prompt
stringclasses
1 value
completions
listlengths
1
63.8k
labels
listlengths
1
63.8k
source
stringclasses
1 value
other_info
stringlengths
2.06k
101k
index
int64
0
6.83k
Determine whether the {function_name} code is vulnerable or not.
[ "# credo:disable-for-this-file Credo.Check.Readability.Specs\ndefmodule Hygeia.MixProject do\n @moduledoc false", " use Mix.Project", " def project do\n [\n app: :hygeia,\n version: \"0.0.0-noversion\",\n build_path: \"../../_build\",\n config_path: \"../../config/config.exs\",\n deps_path: \"../../deps\",\n lockfile: \"../../mix.lock\",\n elixir: \"~> 1.12\",\n elixirc_paths: elixirc_paths(Mix.env()),\n start_permanent: Mix.env() == :prod,\n compilers: [:gettext] ++ Mix.compilers(),\n aliases: aliases(),\n deps: deps(),\n build_embedded: Mix.env() == :prod or System.get_env(\"BUILD_EMBEDDED\") in [\"1\", \"true\"],\n test_coverage: [tool: ExCoveralls],\n preferred_cli_env: [\n coveralls: :test,\n \"coveralls.detail\": :test,\n \"coveralls.html\": :test,\n \"coveralls.json\": :test,\n \"coveralls.post\": :test,\n \"coveralls.xml\": :test\n ],\n # Injected via Config\n xref: [\n exclude: [\n HygeiaWeb.SendCaseClosedEmailUrlGenerator,\n HygeiaWeb.AutoTracingCommunicationUrlGenerator\n ]\n ]\n ]\n end", " # Configuration for the OTP application.\n #\n # Type `mix help compile.app` for more information.\n def application do\n [\n mod: {Hygeia.Application, []},\n extra_applications: [:logger, :runtime_tools]\n ]\n end", " # Specifies which paths to compile per environment.\n defp elixirc_paths(:test), do: [\"lib\", \"test/support\"]\n defp elixirc_paths(_env), do: [\"lib\"]", " # Specifies your project dependencies.\n #\n # Type `mix help deps` for examples and options.\n defp deps do\n [\n {:cadastre, \"~> 0.2.0\"},\n {:crontab, \"~> 1.1\"},", " {:csv, \"~> 2.4\"},", " {:ecto_boot_migration, \"~> 0.2\"},\n {:ecto_enum, \"~> 1.4\"},\n {:ecto, \"~> 3.7\"},\n {:ecto_sql, \"~> 3.4\"},\n {:email_checker, \"~> 0.1\"},\n {:erlsom, \"~> 1.5\"},\n {:excoveralls, \"~> 0.4\", runtime: false, only: [:test]},\n {:ex_phone_number, \"~> 0.2\"},\n {:gen_smtp, \"~> 1.0\"},\n {:gun, \"~> 2.0.0\", hex: :grpc_gun, override: true},\n {:highlander, \"~> 0.2\"},\n {:human_readable_identifier_generator, \"~> 1.0\"},\n {:hygeia_cldr, in_umbrella: true},\n {:hygeia_cluster, in_umbrella: true},\n {:hygeia_gettext, in_umbrella: true},\n {:hygeia_iam, in_umbrella: true},\n {:jason, \"~> 1.0\"},\n {:jsone, \"~> 1.5\", override: true},\n {:mail, \"~> 0.2\"},\n {:mox, \"~> 1.0\", only: :test},\n {:paginator, \"~> 1.0\"},\n {:phoenix, \"~> 1.6\"},\n {:phoenix_pubsub, \"~> 2.0\"},\n {:polymorphic_embed, \"~> 1.7\"},\n {:postgrex, \">= 0.0.0\"},\n {:sedex, \"~> 1.0\"},\n {:sentry, \"~> 8.0\"},\n {:websms, \"~> 1.0.0-alpha\"},\n {:xlsxir, \"~> 1.6.4\"},\n {:zitadel_api, \"~> 1.0-rc\"},\n # TODO: Remove when issue in apps/hygeia_gettext/mix.exs is solved\n {:gettext, \"~> 0.13\", github: \"elixir-gettext/gettext\", branch: \"master\", override: true}\n ]\n end", " # Aliases are shortcuts or tasks specific to the current project.\n #\n # See the documentation for `Mix` for more info on aliases.\n defp aliases do\n [\n setup: [\"ecto.reset\"],\n \"ecto.setup\":\n case Mix.env() do\n :test ->\n [\"ecto.create\", \"ecto.migrate\"]", " _env ->\n [\n \"ecto.create\",\n \"ecto.load --skip-if-loaded --quiet\",\n \"ecto.migrate\",\n \"run priv/repo/seeds.exs\"\n ]\n end,\n \"ecto.reset\": [\"ecto.drop\", \"ecto.setup\"],\n test: [\"ecto.create --quiet\", \"ecto.migrate --quiet\", \"test\"]\n ]\n end\nend" ]
[ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1806, 868, 63, 18], "buggy_code_start_loc": [1119, 637, 62, 17], "filenames": ["apps/hygeia/lib/hygeia/case_context.ex", "apps/hygeia/lib/hygeia/statistics_context.ex", "apps/hygeia/mix.exs", "mix.lock"], "fixing_code_end_loc": [1806, 868, 66, 18], "fixing_code_start_loc": [1119, 637, 62, 17], "message": "Hygeia is an application for collecting and processing personal and case data in connection with communicable diseases. In affected versions all CSV Exports (Statistics & BAG MED) contain a CSV Injection Vulnerability. Users of the system are able to submit formula as exported fields which then get executed upon ingestion of the exported file. There is no validation or sanitization of these formula fields and so malicious may construct malicious code. This vulnerability has been resolved in version 1.30.4. There are no workarounds and all users are advised to upgrade their package.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hygeia_project:hygeia:*:*:*:*:*:*:*:*", "matchCriteriaId": "F7DDCC54-C4E6-4E39-8F2B-AE90486E8AC1", "versionEndExcluding": "1.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.11.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Hygeia is an application for collecting and processing personal and case data in connection with communicable diseases. In affected versions all CSV Exports (Statistics & BAG MED) contain a CSV Injection Vulnerability. Users of the system are able to submit formula as exported fields which then get executed upon ingestion of the exported file. There is no validation or sanitization of these formula fields and so malicious may construct malicious code. This vulnerability has been resolved in version 1.30.4. There are no workarounds and all users are advised to upgrade their package."}, {"lang": "es", "value": "Hygeia es una aplicaci\u00f3n para recoger y procesar datos personales y de casos en relaci\u00f3n con las enfermedades transmisibles. En las versiones afectadas, todas las exportaciones CSV (Statistics & BAG MED) contienen una vulnerabilidad de inyecci\u00f3n CSV. Los usuarios del sistema pueden enviar f\u00f3rmulas como campos exportados que luego se ejecutan al ingerir el archivo exportado. No se presenta comprobaci\u00f3n ni saneo de estos campos de f\u00f3rmulas, por lo que maliciosos pueden construir c\u00f3digo malicioso. Esta vulnerabilidad ha sido resuelta en la versi\u00f3n 1.30.4. No se presentan soluciones y se recomienda a todos los usuarios que actualicen su paquete"}], "evaluatorComment": null, "id": "CVE-2021-41128", "lastModified": "2021-10-14T23:00:49.797", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 6.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 9.1, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.1, "impactScore": 5.3, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2021-10-06T18:15:11.067", "references": [{"source": "security-advisories@github.com", "tags": ["Issue Tracking", "Third Party Advisory"], "url": "https://github.com/beatrichartz/csv/issues/103"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/beatrichartz/csv/pull/104"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jshmrtn/hygeia/commit/d917f27432fe84e1c9751222ae55bae36a4dce60"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jshmrtn/hygeia/security/advisories/GHSA-8pwv-jhj2-2369"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://owasp.org/www-community/attacks/CSV_Injection"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/jshmrtn/hygeia/commit/d917f27432fe84e1c9751222ae55bae36a4dce60"}, "type": "CWE-74"}
349
Determine whether the {function_name} code is vulnerable or not.
[ "# credo:disable-for-this-file Credo.Check.Readability.Specs\ndefmodule Hygeia.MixProject do\n @moduledoc false", " use Mix.Project", " def project do\n [\n app: :hygeia,\n version: \"0.0.0-noversion\",\n build_path: \"../../_build\",\n config_path: \"../../config/config.exs\",\n deps_path: \"../../deps\",\n lockfile: \"../../mix.lock\",\n elixir: \"~> 1.12\",\n elixirc_paths: elixirc_paths(Mix.env()),\n start_permanent: Mix.env() == :prod,\n compilers: [:gettext] ++ Mix.compilers(),\n aliases: aliases(),\n deps: deps(),\n build_embedded: Mix.env() == :prod or System.get_env(\"BUILD_EMBEDDED\") in [\"1\", \"true\"],\n test_coverage: [tool: ExCoveralls],\n preferred_cli_env: [\n coveralls: :test,\n \"coveralls.detail\": :test,\n \"coveralls.html\": :test,\n \"coveralls.json\": :test,\n \"coveralls.post\": :test,\n \"coveralls.xml\": :test\n ],\n # Injected via Config\n xref: [\n exclude: [\n HygeiaWeb.SendCaseClosedEmailUrlGenerator,\n HygeiaWeb.AutoTracingCommunicationUrlGenerator\n ]\n ]\n ]\n end", " # Configuration for the OTP application.\n #\n # Type `mix help compile.app` for more information.\n def application do\n [\n mod: {Hygeia.Application, []},\n extra_applications: [:logger, :runtime_tools]\n ]\n end", " # Specifies which paths to compile per environment.\n defp elixirc_paths(:test), do: [\"lib\", \"test/support\"]\n defp elixirc_paths(_env), do: [\"lib\"]", " # Specifies your project dependencies.\n #\n # Type `mix help deps` for examples and options.\n defp deps do\n [\n {:cadastre, \"~> 0.2.0\"},\n {:crontab, \"~> 1.1\"},", " # TODO: Revert back to the released version when the following PR is\n # merged and released:\n # - https://github.com/beatrichartz/csv/pull/104\n {:csv, \"~> 2.4\", github: \"jshmrtn/csv\", branch: \"formular_escaping\"},", " {:ecto_boot_migration, \"~> 0.2\"},\n {:ecto_enum, \"~> 1.4\"},\n {:ecto, \"~> 3.7\"},\n {:ecto_sql, \"~> 3.4\"},\n {:email_checker, \"~> 0.1\"},\n {:erlsom, \"~> 1.5\"},\n {:excoveralls, \"~> 0.4\", runtime: false, only: [:test]},\n {:ex_phone_number, \"~> 0.2\"},\n {:gen_smtp, \"~> 1.0\"},\n {:gun, \"~> 2.0.0\", hex: :grpc_gun, override: true},\n {:highlander, \"~> 0.2\"},\n {:human_readable_identifier_generator, \"~> 1.0\"},\n {:hygeia_cldr, in_umbrella: true},\n {:hygeia_cluster, in_umbrella: true},\n {:hygeia_gettext, in_umbrella: true},\n {:hygeia_iam, in_umbrella: true},\n {:jason, \"~> 1.0\"},\n {:jsone, \"~> 1.5\", override: true},\n {:mail, \"~> 0.2\"},\n {:mox, \"~> 1.0\", only: :test},\n {:paginator, \"~> 1.0\"},\n {:phoenix, \"~> 1.6\"},\n {:phoenix_pubsub, \"~> 2.0\"},\n {:polymorphic_embed, \"~> 1.7\"},\n {:postgrex, \">= 0.0.0\"},\n {:sedex, \"~> 1.0\"},\n {:sentry, \"~> 8.0\"},\n {:websms, \"~> 1.0.0-alpha\"},\n {:xlsxir, \"~> 1.6.4\"},\n {:zitadel_api, \"~> 1.0-rc\"},\n # TODO: Remove when issue in apps/hygeia_gettext/mix.exs is solved\n {:gettext, \"~> 0.13\", github: \"elixir-gettext/gettext\", branch: \"master\", override: true}\n ]\n end", " # Aliases are shortcuts or tasks specific to the current project.\n #\n # See the documentation for `Mix` for more info on aliases.\n defp aliases do\n [\n setup: [\"ecto.reset\"],\n \"ecto.setup\":\n case Mix.env() do\n :test ->\n [\"ecto.create\", \"ecto.migrate\"]", " _env ->\n [\n \"ecto.create\",\n \"ecto.load --skip-if-loaded --quiet\",\n \"ecto.migrate\",\n \"run priv/repo/seeds.exs\"\n ]\n end,\n \"ecto.reset\": [\"ecto.drop\", \"ecto.setup\"],\n test: [\"ecto.create --quiet\", \"ecto.migrate --quiet\", \"test\"]\n ]\n end\nend" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1806, 868, 63, 18], "buggy_code_start_loc": [1119, 637, 62, 17], "filenames": ["apps/hygeia/lib/hygeia/case_context.ex", "apps/hygeia/lib/hygeia/statistics_context.ex", "apps/hygeia/mix.exs", "mix.lock"], "fixing_code_end_loc": [1806, 868, 66, 18], "fixing_code_start_loc": [1119, 637, 62, 17], "message": "Hygeia is an application for collecting and processing personal and case data in connection with communicable diseases. In affected versions all CSV Exports (Statistics & BAG MED) contain a CSV Injection Vulnerability. Users of the system are able to submit formula as exported fields which then get executed upon ingestion of the exported file. There is no validation or sanitization of these formula fields and so malicious may construct malicious code. This vulnerability has been resolved in version 1.30.4. There are no workarounds and all users are advised to upgrade their package.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hygeia_project:hygeia:*:*:*:*:*:*:*:*", "matchCriteriaId": "F7DDCC54-C4E6-4E39-8F2B-AE90486E8AC1", "versionEndExcluding": "1.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.11.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Hygeia is an application for collecting and processing personal and case data in connection with communicable diseases. In affected versions all CSV Exports (Statistics & BAG MED) contain a CSV Injection Vulnerability. Users of the system are able to submit formula as exported fields which then get executed upon ingestion of the exported file. There is no validation or sanitization of these formula fields and so malicious may construct malicious code. This vulnerability has been resolved in version 1.30.4. There are no workarounds and all users are advised to upgrade their package."}, {"lang": "es", "value": "Hygeia es una aplicaci\u00f3n para recoger y procesar datos personales y de casos en relaci\u00f3n con las enfermedades transmisibles. En las versiones afectadas, todas las exportaciones CSV (Statistics & BAG MED) contienen una vulnerabilidad de inyecci\u00f3n CSV. Los usuarios del sistema pueden enviar f\u00f3rmulas como campos exportados que luego se ejecutan al ingerir el archivo exportado. No se presenta comprobaci\u00f3n ni saneo de estos campos de f\u00f3rmulas, por lo que maliciosos pueden construir c\u00f3digo malicioso. Esta vulnerabilidad ha sido resuelta en la versi\u00f3n 1.30.4. No se presentan soluciones y se recomienda a todos los usuarios que actualicen su paquete"}], "evaluatorComment": null, "id": "CVE-2021-41128", "lastModified": "2021-10-14T23:00:49.797", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 6.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 9.1, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.1, "impactScore": 5.3, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2021-10-06T18:15:11.067", "references": [{"source": "security-advisories@github.com", "tags": ["Issue Tracking", "Third Party Advisory"], "url": "https://github.com/beatrichartz/csv/issues/103"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/beatrichartz/csv/pull/104"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jshmrtn/hygeia/commit/d917f27432fe84e1c9751222ae55bae36a4dce60"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jshmrtn/hygeia/security/advisories/GHSA-8pwv-jhj2-2369"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://owasp.org/www-community/attacks/CSV_Injection"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/jshmrtn/hygeia/commit/d917f27432fe84e1c9751222ae55bae36a4dce60"}, "type": "CWE-74"}
349
Determine whether the {function_name} code is vulnerable or not.
[ "%{\n \"base64url\": {:hex, :base64url, \"1.0.1\", \"f8c7f2da04ca9a5d0f5f50258f055e1d699f0e8bf4cfdb30b750865368403cf6\", [:rebar3], [], \"hexpm\", \"f9b3add4731a02a9b0410398b475b33e7566a695365237a6bdee1bb447719f5c\"},\n \"briefly\": {:hex, :briefly, \"0.3.0\", \"16e6b76d2070ebc9cbd025fa85cf5dbaf52368c4bd896fb482b5a6b95a540c2f\", [:mix], [], \"hexpm\", \"c6ebf8fc3dcd4950dd10c03e953fb4f553a8bcf0ff4c8c40d71542434cd7e046\"},\n \"bunt\": {:hex, :bunt, \"0.2.0\", \"951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38\", [:mix], [], \"hexpm\", \"7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353\"},\n \"cadastre\": {:hex, :cadastre, \"0.2.1\", \"1e31763f495311c176c27e2e5013ade5bcad94b2ab52e36c8838b8d8adb564ae\", [:mix], [], \"hexpm\", \"5f4a6218777ecec4aa9462ee1fd4323dc4520e3343858546967b7c9455c89137\"},\n \"castore\": {:hex, :castore, \"0.1.11\", \"c0665858e0e1c3e8c27178e73dffea699a5b28eb72239a3b2642d208e8594914\", [:mix], [], \"hexpm\", \"91b009ba61973b532b84f7c09ce441cba7aa15cb8b006cf06c6f4bba18220081\"},\n \"certifi\": {:hex, :certifi, \"2.8.0\", \"d4fb0a6bb20b7c9c3643e22507e42f356ac090a1dcea9ab99e27e0376d695eba\", [:rebar3], [], \"hexpm\", \"6ac7efc1c6f8600b08d625292d4bbf584e14847ce1b6b5c44d983d273e1097ea\"},\n \"cldr_utils\": {:hex, :cldr_utils, \"2.16.0\", \"5abd1835151e264f6f9a285ab8c7419954a45eec5ca5a356dea592faa23e80b9\", [:mix], [{:castore, \"~> 0.1\", [hex: :castore, repo: \"hexpm\", optional: true]}, {:certifi, \"~> 2.5\", [hex: :certifi, repo: \"hexpm\", optional: true]}, {:decimal, \"~> 1.9 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: false]}], \"hexpm\", \"3ef5dc0fdfe566a5a4b8bda726cf760ebada69c0600affc4cb02b5e8ae7f7b47\"},\n \"coerce\": {:hex, :coerce, \"1.0.1\", \"211c27386315dc2894ac11bc1f413a0e38505d808153367bd5c6e75a4003d096\", [:mix], [], \"hexpm\", \"b44a691700f7a1a15b4b7e2ff1fa30bebd669929ac8aa43cffe9e2f8bf051cf1\"},\n \"combine\": {:hex, :combine, \"0.10.0\", \"eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f\", [:mix], [], \"hexpm\", \"1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b\"},\n \"connection\": {:hex, :connection, \"1.1.0\", \"ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68\", [:mix], [], \"hexpm\", \"722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c\"},\n \"cowboy\": {:hex, :cowboy, \"2.7.0\", \"91ed100138a764355f43316b1d23d7ff6bdb0de4ea618cb5d8677c93a7a2f115\", [:rebar3], [{:cowlib, \"~> 2.8.0\", [hex: :cowlib, repo: \"hexpm\", optional: false]}, {:ranch, \"~> 1.7.1\", [hex: :ranch, repo: \"hexpm\", optional: false]}], \"hexpm\", \"04fd8c6a39edc6aaa9c26123009200fc61f92a3a94f3178c527b70b767c6e605\"},\n \"cowboy_telemetry\": {:hex, :cowboy_telemetry, \"0.3.1\", \"ebd1a1d7aff97f27c66654e78ece187abdc646992714164380d8a041eda16754\", [:rebar3], [{:cowboy, \"~> 2.7\", [hex: :cowboy, repo: \"hexpm\", optional: false]}, {:telemetry, \"~> 0.4\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"3a6efd3366130eab84ca372cbd4a7d3c3a97bdfcfb4911233b035d117063f0af\"},\n \"cowlib\": {:hex, :cowlib, \"2.8.0\", \"fd0ff1787db84ac415b8211573e9a30a3ebe71b5cbff7f720089972b2319c8a4\", [:rebar3], [], \"hexpm\", \"79f954a7021b302186a950a32869dbc185523d99d3e44ce430cd1f3289f41ed4\"},\n \"credo\": {:hex, :credo, \"1.5.6\", \"e04cc0fdc236fefbb578e0c04bd01a471081616e741d386909e527ac146016c6\", [:mix], [{:bunt, \"~> 0.2.0\", [hex: :bunt, repo: \"hexpm\", optional: false]}, {:file_system, \"~> 0.2.8\", [hex: :file_system, repo: \"hexpm\", optional: false]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: false]}], \"hexpm\", \"4b52a3e558bd64e30de62a648518a5ea2b6e3e5d2b164ef5296244753fc7eb17\"},\n \"crontab\": {:hex, :crontab, \"1.1.10\", \"dc9bb1f4299138d47bce38341f5dcbee0aa6c205e864fba7bc847f3b5cb48241\", [:mix], [{:ecto, \"~> 1.0 or ~> 2.0 or ~> 3.0\", [hex: :ecto, repo: \"hexpm\", optional: true]}], \"hexpm\", \"1347d889d1a0eda997990876b4894359e34bfbbd688acbb0ba28a2795ca40685\"},", " \"csv\": {:hex, :csv, \"2.4.1\", \"50e32749953b6bf9818dbfed81cf1190e38cdf24f95891303108087486c5925e\", [:mix], [{:parallel_stream, \"~> 1.0.4\", [hex: :parallel_stream, repo: \"hexpm\", optional: false]}], \"hexpm\", \"54508938ac67e27966b10ef49606e3ad5995d665d7fc2688efb3eab1307c9079\"},", " \"db_connection\": {:hex, :db_connection, \"2.4.0\", \"d04b1b73795dae60cead94189f1b8a51cc9e1f911c234cc23074017c43c031e5\", [:mix], [{:connection, \"~> 1.0\", [hex: :connection, repo: \"hexpm\", optional: false]}, {:telemetry, \"~> 0.4 or ~> 1.0\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"ad416c21ad9f61b3103d254a71b63696ecadb6a917b36f563921e0de00d7d7c8\"},\n \"decimal\": {:hex, :decimal, \"2.0.0\", \"a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697\", [:mix], [], \"hexpm\", \"34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577\"},\n \"dialyxir\": {:hex, :dialyxir, \"1.1.0\", \"c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488\", [:mix], [{:erlex, \">= 0.2.6\", [hex: :erlex, repo: \"hexpm\", optional: false]}], \"hexpm\", \"07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a\"},\n \"earmark\": {:hex, :earmark, \"1.4.15\", \"2c7f924bf495ec1f65bd144b355d0949a05a254d0ec561740308a54946a67888\", [:mix], [{:earmark_parser, \">= 1.4.13\", [hex: :earmark_parser, repo: \"hexpm\", optional: false]}], \"hexpm\", \"3b1209b85bc9f3586f370f7c363f6533788fb4e51db23aa79565875e7f9999ee\"},\n \"earmark_parser\": {:hex, :earmark_parser, \"1.4.15\", \"b29e8e729f4aa4a00436580dcc2c9c5c51890613457c193cc8525c388ccb2f06\", [:mix], [], \"hexpm\", \"044523d6438ea19c1b8ec877ec221b008661d3c27e3b848f4c879f500421ca5c\"},\n \"ecto\": {:hex, :ecto, \"3.7.1\", \"a20598862351b29f80f285b21ec5297da1181c0442687f9b8329f0445d228892\", [:mix], [{:decimal, \"~> 1.6 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: false]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}, {:telemetry, \"~> 0.4 or ~> 1.0\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"d36e5b39fc479e654cffd4dbe1865d9716e4a9b6311faff799b6f90ab81b8638\"},\n \"ecto_boot_migration\": {:hex, :ecto_boot_migration, \"0.3.0\", \"517ccb8aca5306acf49689a3e3f5beeb3cd8362d426e322d2631442c531595d3\", [:mix], [{:ecto_sql, \"~> 3.0\", [hex: :ecto_sql, repo: \"hexpm\", optional: false]}], \"hexpm\", \"3c7aed8ed08ba6d3df23d4715c1e044fa79cd8387deba8d7ba0bad13518b9ea1\"},\n \"ecto_enum\": {:hex, :ecto_enum, \"1.4.0\", \"d14b00e04b974afc69c251632d1e49594d899067ee2b376277efd8233027aec8\", [:mix], [{:ecto, \">= 3.0.0\", [hex: :ecto, repo: \"hexpm\", optional: false]}, {:ecto_sql, \"> 3.0.0\", [hex: :ecto_sql, repo: \"hexpm\", optional: false]}, {:mariaex, \">= 0.0.0\", [hex: :mariaex, repo: \"hexpm\", optional: true]}, {:postgrex, \">= 0.0.0\", [hex: :postgrex, repo: \"hexpm\", optional: true]}], \"hexpm\", \"8fb55c087181c2b15eee406519dc22578fa60dd82c088be376d0010172764ee4\"},\n \"ecto_psql_extras\": {:hex, :ecto_psql_extras, \"0.7.0\", \"d8aa261062e7acfaa3fcbef41f4d4fd83215a30d9eb5adc0a6e6d14f15ae3944\", [:mix], [{:ecto_sql, \"~> 3.4\", [hex: :ecto_sql, repo: \"hexpm\", optional: false]}, {:postgrex, \">= 0.15.7\", [hex: :postgrex, repo: \"hexpm\", optional: false]}, {:table_rex, \"~> 3.1.1\", [hex: :table_rex, repo: \"hexpm\", optional: false]}], \"hexpm\", \"6ae6d0635d553e7a89b641a1379b49d0b52e4d0cce2cce8cf980f5b7cda6184f\"},\n \"ecto_sql\": {:hex, :ecto_sql, \"3.7.0\", \"2fcaad4ab0c8d76a5afbef078162806adbe709c04160aca58400d5cbbe8eeac6\", [:mix], [{:db_connection, \"~> 2.2\", [hex: :db_connection, repo: \"hexpm\", optional: false]}, {:ecto, \"~> 3.7.0\", [hex: :ecto, repo: \"hexpm\", optional: false]}, {:myxql, \"~> 0.4.0 or ~> 0.5.0\", [hex: :myxql, repo: \"hexpm\", optional: true]}, {:postgrex, \"~> 0.15.0 or ~> 1.0\", [hex: :postgrex, repo: \"hexpm\", optional: true]}, {:tds, \"~> 2.1.1\", [hex: :tds, repo: \"hexpm\", optional: true]}, {:telemetry, \"~> 0.4.0 or ~> 1.0\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"a26135dfa1d99bf87a928c464cfa25bba6535a4fe761eefa56077a4febc60f70\"},\n \"email_checker\": {:hex, :email_checker, \"0.2.1\", \"7fe36fc7cfbbf02b37040fcafbd6a27aca56ab344bcf8138a71a9549a57b4117\", [:mix], [{:socket, \"~> 0.3.1\", [hex: :socket, repo: \"hexpm\", optional: true]}], \"hexpm\", \"4abb60a4bf67782d4cec5d41417e30dc54ff64e2fce356409914e809688403ac\"},\n \"erlex\": {:hex, :erlex, \"0.2.6\", \"c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e\", [:mix], [], \"hexpm\", \"2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75\"},\n \"erljwt\": {:hex, :erljwt, \"2.0.7\", \"15c76e9e17b3db2a1aa105eba0ab384ba09d5c5742376f074dff39a0cc67578c\", [:rebar3], [{:base64url, \"~> 1.0\", [hex: :base64url, repo: \"hexpm\", optional: false]}, {:jsone, \"~> 1.4\", [hex: :jsone, repo: \"hexpm\", optional: false]}], \"hexpm\", \"61266d3d3cb35b3ea341916ce73b0aefe0face260b402729ae7426eb8d5293c3\"},\n \"erlsom\": {:hex, :erlsom, \"1.5.0\", \"c5a5cdd0ee0e8dca62bcc4b13ff08da24fdefc16ccd8b25282a2fda2ba1be24a\", [:rebar3], [], \"hexpm\", \"55a9dbf9cfa77fcfc108bd8e2c4f9f784dea228a8f4b06ea10b684944946955a\"},\n \"ex_aws\": {:hex, :ex_aws, \"2.2.5\", \"013c5c6a1ff4ff09266b3904d3d65d8f9717edbd52f760470469af8b36c860f7\", [:mix], [{:configparser_ex, \"~> 4.0\", [hex: :configparser_ex, repo: \"hexpm\", optional: true]}, {:hackney, \"~> 1.16\", [hex: :hackney, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.1\", [hex: :jason, repo: \"hexpm\", optional: true]}, {:jsx, \"~> 3.0\", [hex: :jsx, repo: \"hexpm\", optional: true]}, {:sweet_xml, \"~> 0.6\", [hex: :sweet_xml, repo: \"hexpm\", optional: true]}, {:telemetry, \"~> 0.4.3\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"e8da4c3470e8e249f406013d2cc42f7f80a71c3f2dad51aba7155d028a13868b\"},\n \"ex_aws_s3\": {:hex, :ex_aws_s3, \"2.3.0\", \"5dfe50116bad048240bae7cd9418bfe23296542ff72a01b9138113a1cd31451c\", [:mix], [{:ex_aws, \"~> 2.0\", [hex: :ex_aws, repo: \"hexpm\", optional: false]}, {:sweet_xml, \">= 0.0.0\", [hex: :sweet_xml, repo: \"hexpm\", optional: true]}], \"hexpm\", \"0b13b11478825d62d2f6e57ae763695331be06f2216468f31bb304316758b096\"},\n \"ex_cldr\": {:hex, :ex_cldr, \"2.23.2\", \"76c51b722cefdcd1a13eb5e7c7f4da5b9acfd64ff054424a977ff6e2d6a78981\", [:mix], [{:castore, \"~> 0.1\", [hex: :castore, repo: \"hexpm\", optional: true]}, {:certifi, \"~> 2.5\", [hex: :certifi, repo: \"hexpm\", optional: true]}, {:cldr_utils, \"~> 2.15\", [hex: :cldr_utils, repo: \"hexpm\", optional: false]}, {:decimal, \"~> 1.6 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: false]}, {:gettext, \"~> 0.13\", [hex: :gettext, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}, {:nimble_parsec, \"~> 0.5 or ~> 1.0\", [hex: :nimble_parsec, repo: \"hexpm\", optional: true]}, {:plug, \"~> 1.9\", [hex: :plug, repo: \"hexpm\", optional: true]}], \"hexpm\", \"d9ce03c8d3fdc7ab751bdb2be742b6972f94adc856d51dfe5bb06a51ac96b8f4\"},\n \"ex_cldr_calendars\": {:hex, :ex_cldr_calendars, \"1.16.0\", \"7f076c85b63b03cf2c5719b75a9c1ca1b177d6d164a94a1eaf4bfb1a5dca152a\", [:mix], [{:calendar_interval, \"~> 0.2\", [hex: :calendar_interval, repo: \"hexpm\", optional: true]}, {:earmark, \"~> 1.0\", [hex: :earmark, repo: \"hexpm\", optional: false]}, {:ex_cldr, \"~> 2.23\", [hex: :ex_cldr, repo: \"hexpm\", optional: false]}, {:ex_cldr_units, \"~> 3.7\", [hex: :ex_cldr_units, repo: \"hexpm\", optional: true]}, {:ex_doc, \"~> 0.21\", [hex: :ex_doc, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: false]}], \"hexpm\", \"483d91a0fb4909efe211ae59a3620a28bf1a72d64dbf922ae940115e64f6138a\"},\n \"ex_cldr_currencies\": {:hex, :ex_cldr_currencies, \"2.11.1\", \"a6e56209d6f98082cd197aa424333e7a0e38e79253fce9589117719728de4fef\", [:mix], [{:ex_cldr, \"~> 2.23\", [hex: :ex_cldr, repo: \"hexpm\", optional: false]}, {:ex_doc, \"~> 0.18\", [hex: :ex_doc, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}], \"hexpm\", \"99e8eb3f48a30127bb11ab70f484c124c9fe5b11bce710c94c53939032b0c58c\"},\n \"ex_cldr_dates_times\": {:hex, :ex_cldr_dates_times, \"2.9.4\", \"9ee780d2226f695fc80e45f61118c3feccc9ec47ef1685300b4c1a22a039111f\", [:mix], [{:calendar_interval, \"~> 0.2\", [hex: :calendar_interval, repo: \"hexpm\", optional: true]}, {:ex_cldr_calendars, \"~> 1.15\", [hex: :ex_cldr_calendars, repo: \"hexpm\", optional: false]}, {:ex_cldr_numbers, \"~> 2.19\", [hex: :ex_cldr_numbers, repo: \"hexpm\", optional: false]}, {:ex_doc, \"~> 0.18\", [hex: :ex_doc, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}], \"hexpm\", \"0597172df5e7bcc7d79b5405adb1ee2b06c607a0879c66c768fba055b5c81434\"},\n \"ex_cldr_languages\": {:hex, :ex_cldr_languages, \"0.2.3\", \"3863f0e9f38c13b8822b5d998a0bc12941386f25fc6f6011313428784de40c44\", [:mix], [{:ex_cldr, \"~> 2.2 and >= 2.2.1\", [hex: :ex_cldr, repo: \"hexpm\", optional: false]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}], \"hexpm\", \"af0b10ff3d405190289b3defa130b07add5b24f8ffa3466ec07bc0575d97587e\"},\n \"ex_cldr_lists\": {:hex, :ex_cldr_lists, \"2.8.0\", \"373d8574d28590fdbc475436cc1590d37200867b4116f69a51e6e57cb0e62ee6\", [:mix], [{:ex_cldr_numbers, \"~> 2.17\", [hex: :ex_cldr_numbers, repo: \"hexpm\", optional: false]}, {:ex_doc, \"~> 0.18\", [hex: :ex_doc, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}], \"hexpm\", \"455406d488452d6eb0b044e23a918e015418787ffc87791d81e7320742269483\"},\n \"ex_cldr_numbers\": {:hex, :ex_cldr_numbers, \"2.22.1\", \"c710abb30a89875a5e2aff5f8a5e073ffad8689c6e84034729f10c51d39c4dcf\", [:mix], [{:decimal, \"~> 1.6 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: false]}, {:ex_cldr, \"~> 2.23\", [hex: :ex_cldr, repo: \"hexpm\", optional: false]}, {:ex_cldr_currencies, \"~> 2.11\", [hex: :ex_cldr_currencies, repo: \"hexpm\", optional: false]}, {:ex_doc, \"~> 0.18\", [hex: :ex_doc, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}], \"hexpm\", \"2015161a54f583eede00f18cdf43ec2b27aecf53e22486f6158d787da1f02bb9\"},\n \"ex_cldr_units\": {:hex, :ex_cldr_units, \"3.7.1\", \"89241de864e4673fe352d15d5727d89c63c10ce9c271b827c07452719f5e2a16\", [:mix], [{:cldr_utils, \"~> 2.16\", [hex: :cldr_utils, repo: \"hexpm\", optional: false]}, {:decimal, \"~> 1.6 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: true]}, {:ex_cldr_lists, \"~> 2.8\", [hex: :ex_cldr_lists, repo: \"hexpm\", optional: false]}, {:ex_cldr_numbers, \"~> 2.19\", [hex: :ex_cldr_numbers, repo: \"hexpm\", optional: false]}, {:ex_doc, \"~> 0.18\", [hex: :ex_doc, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}, {:ratio, \"~> 2.4\", [hex: :ratio, repo: \"hexpm\", optional: false]}], \"hexpm\", \"b9595bea124b6355632784bc8fb4a924c6456f1934a9a80359622e52b9bcdeb6\"},\n \"ex_doc\": {:hex, :ex_doc, \"0.25.3\", \"3edf6a0d70a39d2eafde030b8895501b1c93692effcbd21347296c18e47618ce\", [:mix], [{:earmark_parser, \"~> 1.4.0\", [hex: :earmark_parser, repo: \"hexpm\", optional: false]}, {:makeup_elixir, \"~> 0.14\", [hex: :makeup_elixir, repo: \"hexpm\", optional: false]}, {:makeup_erlang, \"~> 0.1\", [hex: :makeup_erlang, repo: \"hexpm\", optional: false]}], \"hexpm\", \"9ebebc2169ec732a38e9e779fd0418c9189b3ca93f4a676c961be6c1527913f5\"},\n \"ex_phone_number\": {:hex, :ex_phone_number, \"0.2.1\", \"c332d5119b0ffebe3f3e4c1d5264d544b972d5d350230d7b5b1586bbfaf1036e\", [:mix], [{:sweet_xml, \"~> 0.6.5\", [hex: :sweet_xml, repo: \"hexpm\", optional: false]}], \"hexpm\", \"988acbe6ffb70ee33164ad5c185dc6767028369280dcbb4ceda4bc66373b2b10\"},\n \"excoveralls\": {:hex, :excoveralls, \"0.14.3\", \"d17dc249ad32e469afd2bc656b58e810109d4367ec6bd467bed57a84dc4a3e02\", [:mix], [{:hackney, \"~> 1.16\", [hex: :hackney, repo: \"hexpm\", optional: false]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: false]}], \"hexpm\", \"b5aecdfdcf48e9d5e1c210841589b30981a5e7e66055cb8691a6f90b1601c108\"},\n \"file_system\": {:hex, :file_system, \"0.2.10\", \"fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d\", [:mix], [], \"hexpm\", \"41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc\"},\n \"floki\": {:hex, :floki, \"0.31.0\", \"f05ee8a8e6a3ced4e62beeb2c79a63bc8e12ab98fbaaf6e6a3d9b76b1278e23f\", [:mix], [{:html_entities, \"~> 0.5.0\", [hex: :html_entities, repo: \"hexpm\", optional: false]}], \"hexpm\", \"b05afa372f5c345a5bf240ac25ea1f0f3d5fcfd7490ac0beeb4a203f9444891e\"},\n \"gen_smtp\": {:hex, :gen_smtp, \"1.1.1\", \"bf9303c31735100631b1d708d629e4c65944319d1143b5c9952054f4a1311d85\", [:rebar3], [{:hut, \"1.3.0\", [hex: :hut, repo: \"hexpm\", optional: false]}, {:ranch, \">= 1.7.0\", [hex: :ranch, repo: \"hexpm\", optional: false]}], \"hexpm\", \"51bc50cc017efd4a4248cbc39ea30fb60efa7d4a49688986fafad84434ff9ab7\"},\n \"gettext\": {:git, \"https://github.com/elixir-gettext/gettext.git\", \"becf0585b12762bddb6dd04a9f0a307c8768fa1a\", [branch: \"master\"]},\n \"google_protos\": {:hex, :google_protos, \"0.1.0\", \"c6b9e12092d17571b093d4156d004494ca143b65dbbcbfc3ffff463ea03467c0\", [:mix], [{:protobuf, \"~> 0.5\", [hex: :protobuf, repo: \"hexpm\", optional: false]}], \"hexpm\", \"ff5564525f89d2638a4cfa9fb4d31e9ee9d9d7cb937b3e8a95f558440c039e1b\"},\n \"grpc\": {:hex, :grpc, \"0.5.0-beta.1\", \"7d43f52e138fe261f5b4981f1ada515dfc2e1bfa9dc92c7022e8f41e7e49b571\", [:mix], [{:cowboy, \"~> 2.7.0\", [hex: :cowboy, repo: \"hexpm\", optional: false]}, {:gun, \"~> 2.0.0\", [hex: :grpc_gun, repo: \"hexpm\", optional: false]}, {:protobuf, \"~> 0.5\", [hex: :protobuf, repo: \"hexpm\", optional: false]}], \"hexpm\", \"fbbf8872935c295b7575435fe4128372c23c6ded89c2ef8058af3c6167bb3f65\"},\n \"gun\": {:hex, :grpc_gun, \"2.0.0\", \"f99678a2ab975e74372a756c86ec30a8384d3ac8a8b86c7ed6243ef4e61d2729\", [:rebar3], [{:cowlib, \"~> 2.8.0\", [hex: :cowlib, repo: \"hexpm\", optional: false]}], \"hexpm\", \"03dbbca1a9c604a0267a40ea1d69986225091acb822de0b2dbea21d5815e410b\"},\n \"hackney\": {:hex, :hackney, \"1.18.0\", \"c4443d960bb9fba6d01161d01cd81173089686717d9490e5d3606644c48d121f\", [:rebar3], [{:certifi, \"~>2.8.0\", [hex: :certifi, repo: \"hexpm\", optional: false]}, {:idna, \"~>6.1.0\", [hex: :idna, repo: \"hexpm\", optional: false]}, {:metrics, \"~>1.0.0\", [hex: :metrics, repo: \"hexpm\", optional: false]}, {:mimerl, \"~>1.1\", [hex: :mimerl, repo: \"hexpm\", optional: false]}, {:parse_trans, \"3.3.1\", [hex: :parse_trans, repo: \"hexpm\", optional: false]}, {:ssl_verify_fun, \"~>1.1.0\", [hex: :ssl_verify_fun, repo: \"hexpm\", optional: false]}, {:unicode_util_compat, \"~>0.7.0\", [hex: :unicode_util_compat, repo: \"hexpm\", optional: false]}], \"hexpm\", \"9afcda620704d720db8c6a3123e9848d09c87586dc1c10479c42627b905b5c5e\"},\n \"highlander\": {:hex, :highlander, \"0.2.1\", \"e59b459f857e89daf73f2598bf2b2c0479a435481e6101ea389fd3625919b052\", [:mix], [], \"hexpm\", \"5ba19a18358803d82a923511acec8ee85fac30731c5ca056f2f934bc3d3afd9a\"},\n \"html_entities\": {:hex, :html_entities, \"0.5.2\", \"9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c\", [:mix], [], \"hexpm\", \"c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc\"},\n \"human_readable_identifier_generator\": {:hex, :human_readable_identifier_generator, \"1.0.0\", \"0e58c50c60055af05118da93d948b03fbc698425618774a9d1b0532c29b95d73\", [:mix], [], \"hexpm\", \"3669c913a2bdc0342385deb832cc06852af897d80e14db1d50b163fe959e8435\"},\n \"hut\": {:hex, :hut, \"1.3.0\", \"71f2f054e657c03f959cf1acc43f436ea87580696528ca2a55c8afb1b06c85e7\", [:\"erlang.mk\", :rebar, :rebar3], [], \"hexpm\", \"7e15d28555d8a1f2b5a3a931ec120af0753e4853a4c66053db354f35bf9ab563\"},\n \"idna\": {:hex, :idna, \"6.1.1\", \"8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d\", [:rebar3], [{:unicode_util_compat, \"~>0.7.0\", [hex: :unicode_util_compat, repo: \"hexpm\", optional: false]}], \"hexpm\", \"92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea\"},\n \"jason\": {:hex, :jason, \"1.2.2\", \"ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052\", [:mix], [{:decimal, \"~> 1.0 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: true]}], \"hexpm\", \"18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179\"},\n \"jose\": {:hex, :jose, \"1.11.2\", \"f4c018ccf4fdce22c71e44d471f15f723cb3efab5d909ab2ba202b5bf35557b3\", [:mix, :rebar3], [], \"hexpm\", \"98143fbc48d55f3a18daba82d34fe48959d44538e9697c08f34200fa5f0947d2\"},\n \"jsone\": {:hex, :jsone, \"1.6.1\", \"7ea1098fe004c4127320fe0e3cf6a951b01f82039feaa56c322dc7e34dd59762\", [:rebar3], [], \"hexpm\", \"a6c1df6081df742068d2ed747a4fe8a7740c56421b53e02bc9d4907dd3502922\"},\n \"libcluster\": {:hex, :libcluster, \"3.3.0\", \"f7d45ff56d88e9fb4c30aee662480cbab69ebc0e7f7da4ad8d01b1e4f7492da8\", [:mix], [{:jason, \"~> 1.1\", [hex: :jason, repo: \"hexpm\", optional: false]}], \"hexpm\", \"ecdcdc88334ec8eb18b10a13a1d5f22a3319a970b5b1e66cfe71c7719a4ab6cc\"},\n \"mail\": {:hex, :mail, \"0.2.3\", \"2c6bb5f8a5f74845fa50ecd0fb45ea16b164026f285f45104f1c4c078cd616d4\", [:mix], [], \"hexpm\", \"932b398fa9c69fdf290d7ff63175826e0f1e24414d5b0763bb00a2acfc6c6bf5\"},\n \"makeup\": {:hex, :makeup, \"1.0.5\", \"d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c\", [:mix], [{:nimble_parsec, \"~> 0.5 or ~> 1.0\", [hex: :nimble_parsec, repo: \"hexpm\", optional: false]}], \"hexpm\", \"cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9\"},\n \"makeup_elixir\": {:hex, :makeup_elixir, \"0.15.1\", \"b5888c880d17d1cc3e598f05cdb5b5a91b7b17ac4eaf5f297cb697663a1094dd\", [:mix], [{:makeup, \"~> 1.0\", [hex: :makeup, repo: \"hexpm\", optional: false]}, {:nimble_parsec, \"~> 1.1\", [hex: :nimble_parsec, repo: \"hexpm\", optional: false]}], \"hexpm\", \"db68c173234b07ab2a07f645a5acdc117b9f99d69ebf521821d89690ae6c6ec8\"},\n \"makeup_erlang\": {:hex, :makeup_erlang, \"0.1.1\", \"3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f\", [:mix], [{:makeup, \"~> 1.0\", [hex: :makeup, repo: \"hexpm\", optional: false]}], \"hexpm\", \"174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb\"},\n \"metrics\": {:hex, :metrics, \"1.0.1\", \"25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486\", [:rebar3], [], \"hexpm\", \"69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16\"},\n \"mime\": {:hex, :mime, \"1.6.0\", \"dabde576a497cef4bbdd60aceee8160e02a6c89250d6c0b29e56c0dfb00db3d2\", [:mix], [], \"hexpm\", \"31a1a8613f8321143dde1dafc36006a17d28d02bdfecb9e95a880fa7aabd19a7\"},\n \"mimerl\": {:hex, :mimerl, \"1.2.0\", \"67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3\", [:rebar3], [], \"hexpm\", \"f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323\"},\n \"mint\": {:hex, :mint, \"1.4.0\", \"cd7d2451b201fc8e4a8fd86257fb3878d9e3752899eb67b0c5b25b180bde1212\", [:mix], [{:castore, \"~> 0.1.0\", [hex: :castore, repo: \"hexpm\", optional: true]}], \"hexpm\", \"10a99e144b815cbf8522dccbc8199d15802440fc7a64d67b6853adb6fa170217\"},\n \"mox\": {:hex, :mox, \"1.0.0\", \"4b3c7005173f47ff30641ba044eb0fe67287743eec9bd9545e37f3002b0a9f8b\", [:mix], [], \"hexpm\", \"201b0a20b7abdaaab083e9cf97884950f8a30a1350a1da403b3145e213c6f4df\"},\n \"nebulex\": {:hex, :nebulex, \"2.1.1\", \"ae7fe6791b03b00caeaa1a63c80de061903617187c3635cbf016a5b78b0459c5\", [:mix], [{:decorator, \"~> 1.4\", [hex: :decorator, repo: \"hexpm\", optional: true]}, {:shards, \"~> 1.0\", [hex: :shards, repo: \"hexpm\", optional: true]}, {:telemetry, \"~> 0.4\", [hex: :telemetry, repo: \"hexpm\", optional: true]}], \"hexpm\", \"a8f803e8fd0fc653fe10e5ef72c78592b0f8cc17980d02d6dce0b93047569624\"},\n \"nimble_parsec\": {:hex, :nimble_parsec, \"1.1.0\", \"3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89\", [:mix], [], \"hexpm\", \"08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b\"},\n \"numbers\": {:hex, :numbers, \"5.2.4\", \"f123d5bb7f6acc366f8f445e10a32bd403c8469bdbce8ce049e1f0972b607080\", [:mix], [{:coerce, \"~> 1.0\", [hex: :coerce, repo: \"hexpm\", optional: false]}, {:decimal, \"~> 1.9 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: true]}], \"hexpm\", \"eeccf5c61d5f4922198395bf87a465b6f980b8b862dd22d28198c5e6fab38582\"},\n \"oidcc\": {:hex, :oidcc, \"2.0.0-alpha.1\", \"e2847841bc748c1a1f5a8a8c57541effe8dcd4268e91bc0740b241405a2dfd45\", [:rebar3], [{:erljwt, \"~> 2.0.7\", [hex: :erljwt, repo: \"hexpm\", optional: false]}, {:hackney, \"~> 1.18\", [hex: :hackney, repo: \"hexpm\", optional: false]}], \"hexpm\", \"69e1aa464978b658ee0d2b52e5f3d7c74f313aa858caf3c3f3076cf12a6191ce\"},\n \"openapi_compiler\": {:hex, :openapi_compiler, \"1.0.0-beta.13\", \"e2f4af1dd210201202232e0085c8f3b64b5064c06557cc1cdee4784872c71430\", [:mix], [{:jason, \"~> 1.2\", [hex: :jason, repo: \"hexpm\", optional: false]}, {:tesla, \"~> 1.3\", [hex: :tesla, repo: \"hexpm\", optional: false]}, {:uri_template, \"~> 1.2\", [hex: :uri_template, repo: \"hexpm\", optional: false]}, {:yamerl, \"~> 0.7\", [hex: :yamerl, repo: \"hexpm\", optional: false]}], \"hexpm\", \"f67c01168c9842a68a5d4514fe226a294df707bac03fc779cd61f242c3b097d1\"},\n \"paginator\": {:hex, :paginator, \"1.0.4\", \"471e8e59e7a08541c5b7d2ea7166308c8e05ceb412fb444f3bdf320f5d793260\", [:mix], [{:ecto, \"~> 3.0\", [hex: :ecto, repo: \"hexpm\", optional: false]}, {:ecto_sql, \"~> 3.0\", [hex: :ecto_sql, repo: \"hexpm\", optional: false]}, {:plug_crypto, \"~> 1.2.0\", [hex: :plug_crypto, repo: \"hexpm\", optional: false]}, {:postgrex, \"~> 0.13\", [hex: :postgrex, repo: \"hexpm\", optional: true]}], \"hexpm\", \"9d79d21c0192d8d1fc562e5c99b5ebf7e0bb443c671e256b41fd709170730b91\"},\n \"parallel_stream\": {:hex, :parallel_stream, \"1.0.6\", \"b967be2b23f0f6787fab7ed681b4c45a215a81481fb62b01a5b750fa8f30f76c\", [:mix], [], \"hexpm\", \"639b2e8749e11b87b9eb42f2ad325d161c170b39b288ac8d04c4f31f8f0823eb\"},\n \"parse_trans\": {:hex, :parse_trans, \"3.3.1\", \"16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8\", [:rebar3], [], \"hexpm\", \"07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b\"},\n \"pdf_generator\": {:hex, :pdf_generator, \"0.6.2\", \"601f145a0db0dcd7b8c35e1698038f78f18fc42eb3bd2001f826a3a239205f0e\", [:mix], [], \"hexpm\", \"82af2debaae156834b14dc0727cd8c3ded70ed4a2a909107d514bf28f5d1fc35\"},\n \"phoenix\": {:hex, :phoenix, \"1.6.0\", \"7b85023f7ddef9a5c70909a51cc37c8b868b474d853f90f4280efd26b0e7cce5\", [:mix], [{:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}, {:phoenix_pubsub, \"~> 2.0\", [hex: :phoenix_pubsub, repo: \"hexpm\", optional: false]}, {:phoenix_view, \"~> 1.0\", [hex: :phoenix_view, repo: \"hexpm\", optional: false]}, {:plug, \"~> 1.10\", [hex: :plug, repo: \"hexpm\", optional: false]}, {:plug_cowboy, \"~> 2.2\", [hex: :plug_cowboy, repo: \"hexpm\", optional: true]}, {:plug_crypto, \"~> 1.2\", [hex: :plug_crypto, repo: \"hexpm\", optional: false]}, {:telemetry, \"~> 0.4 or ~> 1.0\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"52ffdd31f2daeb399b2e1eb57d468f99a1ad6eee5d8ea19d2353492f06c9fc96\"},\n \"phoenix_active_link\": {:git, \"https://github.com/jshmrtn/phoenix-active-link.git\", \"b76370d61b351b0255ea73bbf4eaee1a1fb8f0b0\", [branch: \"phoenix_html_v3\"]},\n \"phoenix_ecto\": {:hex, :phoenix_ecto, \"4.4.0\", \"0672ed4e4808b3fbed494dded89958e22fb882de47a97634c0b13e7b0b5f7720\", [:mix], [{:ecto, \"~> 3.3\", [hex: :ecto, repo: \"hexpm\", optional: false]}, {:phoenix_html, \"~> 2.14.2 or ~> 3.0\", [hex: :phoenix_html, repo: \"hexpm\", optional: true]}, {:plug, \"~> 1.9\", [hex: :plug, repo: \"hexpm\", optional: false]}], \"hexpm\", \"09864e558ed31ee00bd48fcc1d4fc58ae9678c9e81649075431e69dbabb43cc1\"},\n \"phoenix_html\": {:hex, :phoenix_html, \"3.0.4\", \"232d41884fe6a9c42d09f48397c175cd6f0d443aaa34c7424da47604201df2e1\", [:mix], [{:plug, \"~> 1.5\", [hex: :plug, repo: \"hexpm\", optional: true]}], \"hexpm\", \"ce17fd3cf815b2ed874114073e743507704b1f5288bb03c304a77458485efc8b\"},\n \"phoenix_live_dashboard\": {:hex, :phoenix_live_dashboard, \"0.5.2\", \"b3b863ba9da3c9bd0b18fc32e96e8e5e25faf6a5f62db1dd91029835ea4cc90f\", [:mix], [{:ecto, \"~> 3.6.2 or ~> 3.7\", [hex: :ecto, repo: \"hexpm\", optional: true]}, {:ecto_psql_extras, \"~> 0.7\", [hex: :ecto_psql_extras, repo: \"hexpm\", optional: true]}, {:phoenix_live_view, \"~> 0.16.0\", [hex: :phoenix_live_view, repo: \"hexpm\", optional: false]}, {:telemetry_metrics, \"~> 0.6.0\", [hex: :telemetry_metrics, repo: \"hexpm\", optional: false]}], \"hexpm\", \"6d7124f36ee6c74be334386b8b5a1eb27223c77f86f4167de132b9358036f199\"},\n \"phoenix_live_reload\": {:hex, :phoenix_live_reload, \"1.3.3\", \"3a53772a6118d5679bf50fc1670505a290e32a1d195df9e069d8c53ab040c054\", [:mix], [{:file_system, \"~> 0.2.1 or ~> 0.3\", [hex: :file_system, repo: \"hexpm\", optional: false]}, {:phoenix, \"~> 1.4\", [hex: :phoenix, repo: \"hexpm\", optional: false]}], \"hexpm\", \"766796676e5f558dbae5d1bdb066849673e956005e3730dfd5affd7a6da4abac\"},\n \"phoenix_live_view\": {:hex, :phoenix_live_view, \"0.16.4\", \"5692edd0bac247a9a816eee7394e32e7a764959c7d0cf9190662fc8b0cd24c97\", [:mix], [{:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}, {:phoenix, \"~> 1.5.9 or ~> 1.6.0\", [hex: :phoenix, repo: \"hexpm\", optional: false]}, {:phoenix_html, \"~> 3.0\", [hex: :phoenix_html, repo: \"hexpm\", optional: false]}, {:telemetry, \"~> 0.4.2 or ~> 1.0\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"754ba49aa2e8601afd4f151492c93eb72df69b0b9856bab17711b8397e43bba0\"},\n \"phoenix_pubsub\": {:hex, :phoenix_pubsub, \"2.0.0\", \"a1ae76717bb168cdeb10ec9d92d1480fec99e3080f011402c0a2d68d47395ffb\", [:mix], [], \"hexpm\", \"c52d948c4f261577b9c6fa804be91884b381a7f8f18450c5045975435350f771\"},\n \"phoenix_view\": {:hex, :phoenix_view, \"1.0.0\", \"fea71ecaaed71178b26dd65c401607de5ec22e2e9ef141389c721b3f3d4d8011\", [:mix], [{:phoenix_html, \"~> 2.14.2 or ~> 3.0\", [hex: :phoenix_html, repo: \"hexpm\", optional: true]}], \"hexpm\", \"82be3e2516f5633220246e2e58181282c71640dab7afc04f70ad94253025db0c\"},\n \"plug\": {:hex, :plug, \"1.12.1\", \"645678c800601d8d9f27ad1aebba1fdb9ce5b2623ddb961a074da0b96c35187d\", [:mix], [{:mime, \"~> 1.0 or ~> 2.0\", [hex: :mime, repo: \"hexpm\", optional: false]}, {:plug_crypto, \"~> 1.1.1 or ~> 1.2\", [hex: :plug_crypto, repo: \"hexpm\", optional: false]}, {:telemetry, \"~> 0.4.3 or ~> 1.0\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"d57e799a777bc20494b784966dc5fbda91eb4a09f571f76545b72a634ce0d30b\"},\n \"plug_checkup\": {:git, \"https://github.com/jshmrtn/plug_checkup.git\", \"93d41c4763cf03d135b654be586dc652a0db815d\", [branch: \"check_query_selector\"]},\n \"plug_content_security_policy\": {:hex, :plug_content_security_policy, \"0.2.1\", \"0a19c76307ad000b3757739c14b34b83ecccf7d0a3472e64e14797a20b62939b\", [:mix], [{:plug, \"~> 1.3\", [hex: :plug, repo: \"hexpm\", optional: false]}], \"hexpm\", \"ceea10050671c0387c64526e2cb337ee08e12705c737eaed80439266df5b2e29\"},\n \"plug_cowboy\": {:hex, :plug_cowboy, \"2.5.2\", \"62894ccd601cf9597e2c23911ff12798a8a18d237e9739f58a6b04e4988899fe\", [:mix], [{:cowboy, \"~> 2.7\", [hex: :cowboy, repo: \"hexpm\", optional: false]}, {:cowboy_telemetry, \"~> 0.3\", [hex: :cowboy_telemetry, repo: \"hexpm\", optional: false]}, {:plug, \"~> 1.7\", [hex: :plug, repo: \"hexpm\", optional: false]}], \"hexpm\", \"ea6e87f774c8608d60c8d34022a7d073bd7680a0a013f049fc62bf35efea1044\"},\n \"plug_crypto\": {:hex, :plug_crypto, \"1.2.2\", \"05654514ac717ff3a1843204b424477d9e60c143406aa94daf2274fdd280794d\", [:mix], [], \"hexpm\", \"87631c7ad914a5a445f0a3809f99b079113ae4ed4b867348dd9eec288cecb6db\"},\n \"plug_dynamic\": {:hex, :plug_dynamic, \"1.0.0\", \"aecc1a6c19bb4a4d3ceb35ae85999e9ec77cf50eeead754607bc657d47478b32\", [:mix], [{:plug, \"~> 1.6\", [hex: :plug, repo: \"hexpm\", optional: false]}], \"hexpm\", \"403590330db12255755e0ce6397aaf05b000f255cfe5ea8edf70dc9d4413b99c\"},\n \"polymorphic_embed\": {:hex, :polymorphic_embed, \"1.7.2\", \"1b76c9a88b2d542a4f35a4665e5e123aa9339fb2885b7ef33d7c1126c38e8764\", [:mix], [{:ecto, \"~> 3.6\", [hex: :ecto, repo: \"hexpm\", optional: false]}, {:jason, \"~> 1.2\", [hex: :jason, repo: \"hexpm\", optional: false]}, {:phoenix_html, \"~> 2.14 or ~> 3.0\", [hex: :phoenix_html, repo: \"hexpm\", optional: true]}], \"hexpm\", \"a495da6b55ea8dc86b069e96b640835cf243fe42d38687d317a7334b993a02f5\"},\n \"postgrex\": {:hex, :postgrex, \"0.15.11\", \"50abbb50f33d22d79af402e549b9a566ba4f0451b4f5fd39b72d9bbd49743d24\", [:mix], [{:connection, \"~> 1.0\", [hex: :connection, repo: \"hexpm\", optional: false]}, {:db_connection, \"~> 2.1\", [hex: :db_connection, repo: \"hexpm\", optional: false]}, {:decimal, \"~> 1.5 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: false]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}], \"hexpm\", \"6f0e5c3ea10f97468f5ff852277cb207f068399eb68b0c06c142ef68a4e82952\"},\n \"protobuf\": {:hex, :protobuf, \"0.7.1\", \"7d1b9f7d9ecb32eccd96b0c58572de4d1c09e9e3bc414e4cb15c2dce7013f195\", [:mix], [], \"hexpm\", \"6eff7a5287963719521c82e5d5b4583fd1d7cdd89ad129f0ea7d503a50a4d13f\"},\n \"ranch\": {:hex, :ranch, \"1.7.1\", \"6b1fab51b49196860b733a49c07604465a47bdb78aa10c1c16a3d199f7f8c881\", [:rebar3], [], \"hexpm\", \"451d8527787df716d99dc36162fca05934915db0b6141bbdac2ea8d3c7afc7d7\"},\n \"ratio\": {:hex, :ratio, \"2.4.2\", \"c8518f3536d49b1b00d88dd20d49f8b11abb7819638093314a6348139f14f9f9\", [:mix], [{:decimal, \"~> 1.6 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: true]}, {:numbers, \"~> 5.2.0\", [hex: :numbers, repo: \"hexpm\", optional: false]}], \"hexpm\", \"441ef6f73172a3503de65ccf1769030997b0d533b1039422f1e5e0e0b4cbf89e\"},\n \"remote_ip\": {:hex, :remote_ip, \"1.0.0\", \"3d7fb45204a5704443f480cee9515e464997f52c35e0a60b6ece1f81484067ae\", [:mix], [{:combine, \"~> 0.10\", [hex: :combine, repo: \"hexpm\", optional: false]}, {:plug, \"~> 1.10\", [hex: :plug, repo: \"hexpm\", optional: false]}], \"hexpm\", \"9e9fcad4e50c43b5234bb6a9629ed6ab223f3ed07147bd35470e4ee5c8caf907\"},\n \"sedex\": {:hex, :sedex, \"1.0.3\", \"c310bfe065a141b25b47ee1872acc94b79d3223dcd06dd2f714fb6064424482e\", [:mix], [{:erlsom, \"~> 1.5\", [hex: :erlsom, repo: \"hexpm\", optional: false]}, {:ex_aws, \"~> 2.1\", [hex: :ex_aws, repo: \"hexpm\", optional: false]}, {:ex_aws_s3, \"~> 2.0\", [hex: :ex_aws_s3, repo: \"hexpm\", optional: false]}, {:jose, \"~> 1.11\", [hex: :jose, repo: \"hexpm\", optional: false]}, {:sweet_xml, \"~> 0.6\", [hex: :sweet_xml, repo: \"hexpm\", optional: false]}], \"hexpm\", \"45e9a4fc942f055a6cf8684032e96324d0b45aabab7b4c12371adfdfb5eb54f2\"},\n \"sentry\": {:hex, :sentry, \"8.0.5\", \"5ca922b9238a50c7258b52f47364b2d545beda5e436c7a43965b34577f1ef61f\", [:mix], [{:hackney, \"~> 1.8\", [hex: :hackney, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.1\", [hex: :jason, repo: \"hexpm\", optional: true]}, {:plug, \"~> 1.6\", [hex: :plug, repo: \"hexpm\", optional: true]}, {:plug_cowboy, \"~> 2.3\", [hex: :plug_cowboy, repo: \"hexpm\", optional: true]}], \"hexpm\", \"4972839fdbf52e886d7b3e694c8adf421f764f2fa79036b88fb4742049bd4b7c\"},\n \"shards\": {:hex, :shards, \"1.0.1\", \"1bdbbf047db27f3c3eb800a829d4a47062c84d5543cbfebcfc4c14d038bf9220\", [:make, :rebar3], [], \"hexpm\", \"2c57788afbf053c4024366772892beee89b8b72e884e764fb0a075dfa7442041\"},\n \"ssl_verify_fun\": {:hex, :ssl_verify_fun, \"1.1.6\", \"cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0\", [:make, :mix, :rebar3], [], \"hexpm\", \"bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680\"},\n \"surface\": {:hex, :surface, \"0.5.1\", \"2aa593d8ba5dde584e288f697ec8318352f2ff2037ad6d195788c702f104bff2\", [:mix], [{:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: false]}, {:phoenix_live_view, \"~> 0.15\", [hex: :phoenix_live_view, repo: \"hexpm\", optional: false]}], \"hexpm\", \"a853bfe3479e1f711c84d69d988f85612bd2847dc18ada80be951af40dbe136c\"},\n \"surface_formatter\": {:hex, :surface_formatter, \"0.5.4\", \"ce3332e2516615795d10bcf8fb10c765128ff9ccb0fa0e21aa4f384a58498d52\", [:mix], [{:surface, \"~> 0.5.0\", [hex: :surface, repo: \"hexpm\", optional: false]}], \"hexpm\", \"ea1a5666e4abf1a6c61048fb9a64040ce59865cf33002ca08d2011b6d700feb4\"},\n \"sweet_xml\": {:hex, :sweet_xml, \"0.6.6\", \"fc3e91ec5dd7c787b6195757fbcf0abc670cee1e4172687b45183032221b66b8\", [:mix], [], \"hexpm\", \"2e1ec458f892ffa81f9f8386e3f35a1af6db7a7a37748a64478f13163a1f3573\"},\n \"table_rex\": {:hex, :table_rex, \"3.1.1\", \"0c67164d1714b5e806d5067c1e96ff098ba7ae79413cc075973e17c38a587caa\", [:mix], [], \"hexpm\", \"678a23aba4d670419c23c17790f9dcd635a4a89022040df7d5d772cb21012490\"},\n \"telemetry\": {:hex, :telemetry, \"0.4.3\", \"a06428a514bdbc63293cd9a6263aad00ddeb66f608163bdec7c8995784080818\", [:rebar3], [], \"hexpm\", \"eb72b8365ffda5bed68a620d1da88525e326cb82a75ee61354fc24b844768041\"},\n \"telemetry_metrics\": {:hex, :telemetry_metrics, \"0.6.1\", \"315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f\", [:mix], [{:telemetry, \"~> 0.4 or ~> 1.0\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6\"},\n \"telemetry_metrics_prometheus\": {:hex, :telemetry_metrics_prometheus, \"1.1.0\", \"1cc23e932c1ef9aa3b91db257ead31ea58d53229d407e059b29bb962c1505a13\", [:mix], [{:plug_cowboy, \"~> 2.1\", [hex: :plug_cowboy, repo: \"hexpm\", optional: false]}, {:telemetry_metrics_prometheus_core, \"~> 1.0\", [hex: :telemetry_metrics_prometheus_core, repo: \"hexpm\", optional: false]}], \"hexpm\", \"d43b3659b3244da44fe0275b717701542365d4519b79d9ce895b9719c1ce4d26\"},\n \"telemetry_metrics_prometheus_core\": {:hex, :telemetry_metrics_prometheus_core, \"1.0.1\", \"cebf3c8892f5dc40eb057375e5c1c2077c155ed46654d5af35a2ad48a3f48749\", [:mix], [{:telemetry, \"~> 0.4\", [hex: :telemetry, repo: \"hexpm\", optional: false]}, {:telemetry_metrics, \"~> 0.6\", [hex: :telemetry_metrics, repo: \"hexpm\", optional: false]}], \"hexpm\", \"112a9d5a6facf34fb0dda8426c18432ffb9e8abe38f394f3417cb589ecaeb674\"},\n \"telemetry_poller\": {:hex, :telemetry_poller, \"0.5.1\", \"21071cc2e536810bac5628b935521ff3e28f0303e770951158c73eaaa01e962a\", [:rebar3], [{:telemetry, \"~> 0.4\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"4cab72069210bc6e7a080cec9afffad1b33370149ed5d379b81c7c5f0c663fd4\"},\n \"tesla\": {:hex, :tesla, \"1.4.3\", \"f5a494e08fb1abe4fd9c28abb17f3d9b62b8f6fc492860baa91efb1aab61c8a0\", [:mix], [{:castore, \"~> 0.1\", [hex: :castore, repo: \"hexpm\", optional: true]}, {:exjsx, \">= 3.0.0\", [hex: :exjsx, repo: \"hexpm\", optional: true]}, {:finch, \"~> 0.3\", [hex: :finch, repo: \"hexpm\", optional: true]}, {:fuse, \"~> 2.4\", [hex: :fuse, repo: \"hexpm\", optional: true]}, {:gun, \"~> 1.3\", [hex: :gun, repo: \"hexpm\", optional: true]}, {:hackney, \"~> 1.6\", [hex: :hackney, repo: \"hexpm\", optional: true]}, {:ibrowse, \"4.4.0\", [hex: :ibrowse, repo: \"hexpm\", optional: true]}, {:jason, \">= 1.0.0\", [hex: :jason, repo: \"hexpm\", optional: true]}, {:mime, \"~> 1.0\", [hex: :mime, repo: \"hexpm\", optional: false]}, {:mint, \"~> 1.0\", [hex: :mint, repo: \"hexpm\", optional: true]}, {:poison, \">= 1.0.0\", [hex: :poison, repo: \"hexpm\", optional: true]}, {:telemetry, \"~> 0.4 or ~> 1.0\", [hex: :telemetry, repo: \"hexpm\", optional: true]}], \"hexpm\", \"e0755bb664bf4d664af72931f320c97adbf89da4586670f4864bf259b5750386\"},\n \"tzdata\": {:hex, :tzdata, \"1.1.0\", \"72f5babaa9390d0f131465c8702fa76da0919e37ba32baa90d93c583301a8359\", [:mix], [{:hackney, \"~> 1.17\", [hex: :hackney, repo: \"hexpm\", optional: false]}], \"hexpm\", \"18f453739b48d3dc5bcf0e8906d2dc112bb40baafe2c707596d89f3c8dd14034\"},\n \"unicode_util_compat\": {:hex, :unicode_util_compat, \"0.7.0\", \"bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78\", [:rebar3], [], \"hexpm\", \"25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521\"},\n \"uri_template\": {:hex, :uri_template, \"1.2.1\", \"cc36ef5d18a3a5a23ce35a450ab5b139d5e49ce132b08b7f8797c17efc69d594\", [:mix], [], \"hexpm\", \"fe9a2dfeb4fd289b376df2b84dc2dc2d3244364f0ecf0c21e9832fbb756d524d\"},\n \"websms\": {:hex, :websms, \"1.0.0-alpha.1\", \"b92d86cc86fbbb379585e910402ff032d22cc5bf3025a4d2513dccc483f98a42\", [:mix], [{:castore, \"~> 0.1\", [hex: :castore, repo: \"hexpm\", optional: false]}, {:mint, \"~> 1.0\", [hex: :mint, repo: \"hexpm\", optional: false]}, {:openapi_compiler, \"~> 1.0-beta\", [hex: :openapi_compiler, repo: \"hexpm\", optional: false]}], \"hexpm\", \"19c71783208febfed3f37b050b45b7b4be680b0dc5f3c2bfeedf9dd1db10c997\"},\n \"xlsxir\": {:hex, :xlsxir, \"1.6.4\", \"d1e69439cbd9edc1190950f9f883ac364e1f31641e0395ccdb27761791b169a3\", [:mix], [{:erlsom, \"~> 1.5\", [hex: :erlsom, repo: \"hexpm\", optional: false]}], \"hexpm\", \"38e91f65eb8a4c8dea07d941c8b7e21baf8c8d4938232395c9ffd19d2eb071f2\"},\n \"yamerl\": {:hex, :yamerl, \"0.8.1\", \"07da13ffa1d8e13948943789665c62ccd679dfa7b324a4a2ed3149df17f453a4\", [:rebar3], [], \"hexpm\", \"96cb30f9d64344fed0ef8a92e9f16f207de6c04dfff4f366752ca79f5bceb23f\"},\n \"zitadel_api\": {:hex, :zitadel_api, \"1.0.0-rc.7\", \"88cf9990eeb2c096957d5cf9a2eac7bd840ced097c79fa2b659cd42c1dcac620\", [:mix], [{:google_protos, \"~> 0.1.0\", [hex: :google_protos, repo: \"hexpm\", optional: false]}, {:grpc, \"~> 0.5.0-beta.1\", [hex: :grpc, repo: \"hexpm\", optional: false]}], \"hexpm\", \"131ebdcf1c736ad4ad2ee1e45ff3beab8dda9f1331904d7d7b2e1fc14f61aff6\"},\n}" ]
[ 1, 0, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1806, 868, 63, 18], "buggy_code_start_loc": [1119, 637, 62, 17], "filenames": ["apps/hygeia/lib/hygeia/case_context.ex", "apps/hygeia/lib/hygeia/statistics_context.ex", "apps/hygeia/mix.exs", "mix.lock"], "fixing_code_end_loc": [1806, 868, 66, 18], "fixing_code_start_loc": [1119, 637, 62, 17], "message": "Hygeia is an application for collecting and processing personal and case data in connection with communicable diseases. In affected versions all CSV Exports (Statistics & BAG MED) contain a CSV Injection Vulnerability. Users of the system are able to submit formula as exported fields which then get executed upon ingestion of the exported file. There is no validation or sanitization of these formula fields and so malicious may construct malicious code. This vulnerability has been resolved in version 1.30.4. There are no workarounds and all users are advised to upgrade their package.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hygeia_project:hygeia:*:*:*:*:*:*:*:*", "matchCriteriaId": "F7DDCC54-C4E6-4E39-8F2B-AE90486E8AC1", "versionEndExcluding": "1.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.11.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Hygeia is an application for collecting and processing personal and case data in connection with communicable diseases. In affected versions all CSV Exports (Statistics & BAG MED) contain a CSV Injection Vulnerability. Users of the system are able to submit formula as exported fields which then get executed upon ingestion of the exported file. There is no validation or sanitization of these formula fields and so malicious may construct malicious code. This vulnerability has been resolved in version 1.30.4. There are no workarounds and all users are advised to upgrade their package."}, {"lang": "es", "value": "Hygeia es una aplicaci\u00f3n para recoger y procesar datos personales y de casos en relaci\u00f3n con las enfermedades transmisibles. En las versiones afectadas, todas las exportaciones CSV (Statistics & BAG MED) contienen una vulnerabilidad de inyecci\u00f3n CSV. Los usuarios del sistema pueden enviar f\u00f3rmulas como campos exportados que luego se ejecutan al ingerir el archivo exportado. No se presenta comprobaci\u00f3n ni saneo de estos campos de f\u00f3rmulas, por lo que maliciosos pueden construir c\u00f3digo malicioso. Esta vulnerabilidad ha sido resuelta en la versi\u00f3n 1.30.4. No se presentan soluciones y se recomienda a todos los usuarios que actualicen su paquete"}], "evaluatorComment": null, "id": "CVE-2021-41128", "lastModified": "2021-10-14T23:00:49.797", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 6.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 9.1, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.1, "impactScore": 5.3, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2021-10-06T18:15:11.067", "references": [{"source": "security-advisories@github.com", "tags": ["Issue Tracking", "Third Party Advisory"], "url": "https://github.com/beatrichartz/csv/issues/103"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/beatrichartz/csv/pull/104"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jshmrtn/hygeia/commit/d917f27432fe84e1c9751222ae55bae36a4dce60"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jshmrtn/hygeia/security/advisories/GHSA-8pwv-jhj2-2369"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://owasp.org/www-community/attacks/CSV_Injection"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/jshmrtn/hygeia/commit/d917f27432fe84e1c9751222ae55bae36a4dce60"}, "type": "CWE-74"}
349
Determine whether the {function_name} code is vulnerable or not.
[ "%{\n \"base64url\": {:hex, :base64url, \"1.0.1\", \"f8c7f2da04ca9a5d0f5f50258f055e1d699f0e8bf4cfdb30b750865368403cf6\", [:rebar3], [], \"hexpm\", \"f9b3add4731a02a9b0410398b475b33e7566a695365237a6bdee1bb447719f5c\"},\n \"briefly\": {:hex, :briefly, \"0.3.0\", \"16e6b76d2070ebc9cbd025fa85cf5dbaf52368c4bd896fb482b5a6b95a540c2f\", [:mix], [], \"hexpm\", \"c6ebf8fc3dcd4950dd10c03e953fb4f553a8bcf0ff4c8c40d71542434cd7e046\"},\n \"bunt\": {:hex, :bunt, \"0.2.0\", \"951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38\", [:mix], [], \"hexpm\", \"7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353\"},\n \"cadastre\": {:hex, :cadastre, \"0.2.1\", \"1e31763f495311c176c27e2e5013ade5bcad94b2ab52e36c8838b8d8adb564ae\", [:mix], [], \"hexpm\", \"5f4a6218777ecec4aa9462ee1fd4323dc4520e3343858546967b7c9455c89137\"},\n \"castore\": {:hex, :castore, \"0.1.11\", \"c0665858e0e1c3e8c27178e73dffea699a5b28eb72239a3b2642d208e8594914\", [:mix], [], \"hexpm\", \"91b009ba61973b532b84f7c09ce441cba7aa15cb8b006cf06c6f4bba18220081\"},\n \"certifi\": {:hex, :certifi, \"2.8.0\", \"d4fb0a6bb20b7c9c3643e22507e42f356ac090a1dcea9ab99e27e0376d695eba\", [:rebar3], [], \"hexpm\", \"6ac7efc1c6f8600b08d625292d4bbf584e14847ce1b6b5c44d983d273e1097ea\"},\n \"cldr_utils\": {:hex, :cldr_utils, \"2.16.0\", \"5abd1835151e264f6f9a285ab8c7419954a45eec5ca5a356dea592faa23e80b9\", [:mix], [{:castore, \"~> 0.1\", [hex: :castore, repo: \"hexpm\", optional: true]}, {:certifi, \"~> 2.5\", [hex: :certifi, repo: \"hexpm\", optional: true]}, {:decimal, \"~> 1.9 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: false]}], \"hexpm\", \"3ef5dc0fdfe566a5a4b8bda726cf760ebada69c0600affc4cb02b5e8ae7f7b47\"},\n \"coerce\": {:hex, :coerce, \"1.0.1\", \"211c27386315dc2894ac11bc1f413a0e38505d808153367bd5c6e75a4003d096\", [:mix], [], \"hexpm\", \"b44a691700f7a1a15b4b7e2ff1fa30bebd669929ac8aa43cffe9e2f8bf051cf1\"},\n \"combine\": {:hex, :combine, \"0.10.0\", \"eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f\", [:mix], [], \"hexpm\", \"1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b\"},\n \"connection\": {:hex, :connection, \"1.1.0\", \"ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68\", [:mix], [], \"hexpm\", \"722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c\"},\n \"cowboy\": {:hex, :cowboy, \"2.7.0\", \"91ed100138a764355f43316b1d23d7ff6bdb0de4ea618cb5d8677c93a7a2f115\", [:rebar3], [{:cowlib, \"~> 2.8.0\", [hex: :cowlib, repo: \"hexpm\", optional: false]}, {:ranch, \"~> 1.7.1\", [hex: :ranch, repo: \"hexpm\", optional: false]}], \"hexpm\", \"04fd8c6a39edc6aaa9c26123009200fc61f92a3a94f3178c527b70b767c6e605\"},\n \"cowboy_telemetry\": {:hex, :cowboy_telemetry, \"0.3.1\", \"ebd1a1d7aff97f27c66654e78ece187abdc646992714164380d8a041eda16754\", [:rebar3], [{:cowboy, \"~> 2.7\", [hex: :cowboy, repo: \"hexpm\", optional: false]}, {:telemetry, \"~> 0.4\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"3a6efd3366130eab84ca372cbd4a7d3c3a97bdfcfb4911233b035d117063f0af\"},\n \"cowlib\": {:hex, :cowlib, \"2.8.0\", \"fd0ff1787db84ac415b8211573e9a30a3ebe71b5cbff7f720089972b2319c8a4\", [:rebar3], [], \"hexpm\", \"79f954a7021b302186a950a32869dbc185523d99d3e44ce430cd1f3289f41ed4\"},\n \"credo\": {:hex, :credo, \"1.5.6\", \"e04cc0fdc236fefbb578e0c04bd01a471081616e741d386909e527ac146016c6\", [:mix], [{:bunt, \"~> 0.2.0\", [hex: :bunt, repo: \"hexpm\", optional: false]}, {:file_system, \"~> 0.2.8\", [hex: :file_system, repo: \"hexpm\", optional: false]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: false]}], \"hexpm\", \"4b52a3e558bd64e30de62a648518a5ea2b6e3e5d2b164ef5296244753fc7eb17\"},\n \"crontab\": {:hex, :crontab, \"1.1.10\", \"dc9bb1f4299138d47bce38341f5dcbee0aa6c205e864fba7bc847f3b5cb48241\", [:mix], [{:ecto, \"~> 1.0 or ~> 2.0 or ~> 3.0\", [hex: :ecto, repo: \"hexpm\", optional: true]}], \"hexpm\", \"1347d889d1a0eda997990876b4894359e34bfbbd688acbb0ba28a2795ca40685\"},", " \"csv\": {:git, \"https://github.com/jshmrtn/csv.git\", \"faef83ef956e132911c4b44891ce0d48904577c0\", [branch: \"formular_escaping\"]},", " \"db_connection\": {:hex, :db_connection, \"2.4.0\", \"d04b1b73795dae60cead94189f1b8a51cc9e1f911c234cc23074017c43c031e5\", [:mix], [{:connection, \"~> 1.0\", [hex: :connection, repo: \"hexpm\", optional: false]}, {:telemetry, \"~> 0.4 or ~> 1.0\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"ad416c21ad9f61b3103d254a71b63696ecadb6a917b36f563921e0de00d7d7c8\"},\n \"decimal\": {:hex, :decimal, \"2.0.0\", \"a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697\", [:mix], [], \"hexpm\", \"34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577\"},\n \"dialyxir\": {:hex, :dialyxir, \"1.1.0\", \"c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488\", [:mix], [{:erlex, \">= 0.2.6\", [hex: :erlex, repo: \"hexpm\", optional: false]}], \"hexpm\", \"07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a\"},\n \"earmark\": {:hex, :earmark, \"1.4.15\", \"2c7f924bf495ec1f65bd144b355d0949a05a254d0ec561740308a54946a67888\", [:mix], [{:earmark_parser, \">= 1.4.13\", [hex: :earmark_parser, repo: \"hexpm\", optional: false]}], \"hexpm\", \"3b1209b85bc9f3586f370f7c363f6533788fb4e51db23aa79565875e7f9999ee\"},\n \"earmark_parser\": {:hex, :earmark_parser, \"1.4.15\", \"b29e8e729f4aa4a00436580dcc2c9c5c51890613457c193cc8525c388ccb2f06\", [:mix], [], \"hexpm\", \"044523d6438ea19c1b8ec877ec221b008661d3c27e3b848f4c879f500421ca5c\"},\n \"ecto\": {:hex, :ecto, \"3.7.1\", \"a20598862351b29f80f285b21ec5297da1181c0442687f9b8329f0445d228892\", [:mix], [{:decimal, \"~> 1.6 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: false]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}, {:telemetry, \"~> 0.4 or ~> 1.0\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"d36e5b39fc479e654cffd4dbe1865d9716e4a9b6311faff799b6f90ab81b8638\"},\n \"ecto_boot_migration\": {:hex, :ecto_boot_migration, \"0.3.0\", \"517ccb8aca5306acf49689a3e3f5beeb3cd8362d426e322d2631442c531595d3\", [:mix], [{:ecto_sql, \"~> 3.0\", [hex: :ecto_sql, repo: \"hexpm\", optional: false]}], \"hexpm\", \"3c7aed8ed08ba6d3df23d4715c1e044fa79cd8387deba8d7ba0bad13518b9ea1\"},\n \"ecto_enum\": {:hex, :ecto_enum, \"1.4.0\", \"d14b00e04b974afc69c251632d1e49594d899067ee2b376277efd8233027aec8\", [:mix], [{:ecto, \">= 3.0.0\", [hex: :ecto, repo: \"hexpm\", optional: false]}, {:ecto_sql, \"> 3.0.0\", [hex: :ecto_sql, repo: \"hexpm\", optional: false]}, {:mariaex, \">= 0.0.0\", [hex: :mariaex, repo: \"hexpm\", optional: true]}, {:postgrex, \">= 0.0.0\", [hex: :postgrex, repo: \"hexpm\", optional: true]}], \"hexpm\", \"8fb55c087181c2b15eee406519dc22578fa60dd82c088be376d0010172764ee4\"},\n \"ecto_psql_extras\": {:hex, :ecto_psql_extras, \"0.7.0\", \"d8aa261062e7acfaa3fcbef41f4d4fd83215a30d9eb5adc0a6e6d14f15ae3944\", [:mix], [{:ecto_sql, \"~> 3.4\", [hex: :ecto_sql, repo: \"hexpm\", optional: false]}, {:postgrex, \">= 0.15.7\", [hex: :postgrex, repo: \"hexpm\", optional: false]}, {:table_rex, \"~> 3.1.1\", [hex: :table_rex, repo: \"hexpm\", optional: false]}], \"hexpm\", \"6ae6d0635d553e7a89b641a1379b49d0b52e4d0cce2cce8cf980f5b7cda6184f\"},\n \"ecto_sql\": {:hex, :ecto_sql, \"3.7.0\", \"2fcaad4ab0c8d76a5afbef078162806adbe709c04160aca58400d5cbbe8eeac6\", [:mix], [{:db_connection, \"~> 2.2\", [hex: :db_connection, repo: \"hexpm\", optional: false]}, {:ecto, \"~> 3.7.0\", [hex: :ecto, repo: \"hexpm\", optional: false]}, {:myxql, \"~> 0.4.0 or ~> 0.5.0\", [hex: :myxql, repo: \"hexpm\", optional: true]}, {:postgrex, \"~> 0.15.0 or ~> 1.0\", [hex: :postgrex, repo: \"hexpm\", optional: true]}, {:tds, \"~> 2.1.1\", [hex: :tds, repo: \"hexpm\", optional: true]}, {:telemetry, \"~> 0.4.0 or ~> 1.0\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"a26135dfa1d99bf87a928c464cfa25bba6535a4fe761eefa56077a4febc60f70\"},\n \"email_checker\": {:hex, :email_checker, \"0.2.1\", \"7fe36fc7cfbbf02b37040fcafbd6a27aca56ab344bcf8138a71a9549a57b4117\", [:mix], [{:socket, \"~> 0.3.1\", [hex: :socket, repo: \"hexpm\", optional: true]}], \"hexpm\", \"4abb60a4bf67782d4cec5d41417e30dc54ff64e2fce356409914e809688403ac\"},\n \"erlex\": {:hex, :erlex, \"0.2.6\", \"c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e\", [:mix], [], \"hexpm\", \"2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75\"},\n \"erljwt\": {:hex, :erljwt, \"2.0.7\", \"15c76e9e17b3db2a1aa105eba0ab384ba09d5c5742376f074dff39a0cc67578c\", [:rebar3], [{:base64url, \"~> 1.0\", [hex: :base64url, repo: \"hexpm\", optional: false]}, {:jsone, \"~> 1.4\", [hex: :jsone, repo: \"hexpm\", optional: false]}], \"hexpm\", \"61266d3d3cb35b3ea341916ce73b0aefe0face260b402729ae7426eb8d5293c3\"},\n \"erlsom\": {:hex, :erlsom, \"1.5.0\", \"c5a5cdd0ee0e8dca62bcc4b13ff08da24fdefc16ccd8b25282a2fda2ba1be24a\", [:rebar3], [], \"hexpm\", \"55a9dbf9cfa77fcfc108bd8e2c4f9f784dea228a8f4b06ea10b684944946955a\"},\n \"ex_aws\": {:hex, :ex_aws, \"2.2.5\", \"013c5c6a1ff4ff09266b3904d3d65d8f9717edbd52f760470469af8b36c860f7\", [:mix], [{:configparser_ex, \"~> 4.0\", [hex: :configparser_ex, repo: \"hexpm\", optional: true]}, {:hackney, \"~> 1.16\", [hex: :hackney, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.1\", [hex: :jason, repo: \"hexpm\", optional: true]}, {:jsx, \"~> 3.0\", [hex: :jsx, repo: \"hexpm\", optional: true]}, {:sweet_xml, \"~> 0.6\", [hex: :sweet_xml, repo: \"hexpm\", optional: true]}, {:telemetry, \"~> 0.4.3\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"e8da4c3470e8e249f406013d2cc42f7f80a71c3f2dad51aba7155d028a13868b\"},\n \"ex_aws_s3\": {:hex, :ex_aws_s3, \"2.3.0\", \"5dfe50116bad048240bae7cd9418bfe23296542ff72a01b9138113a1cd31451c\", [:mix], [{:ex_aws, \"~> 2.0\", [hex: :ex_aws, repo: \"hexpm\", optional: false]}, {:sweet_xml, \">= 0.0.0\", [hex: :sweet_xml, repo: \"hexpm\", optional: true]}], \"hexpm\", \"0b13b11478825d62d2f6e57ae763695331be06f2216468f31bb304316758b096\"},\n \"ex_cldr\": {:hex, :ex_cldr, \"2.23.2\", \"76c51b722cefdcd1a13eb5e7c7f4da5b9acfd64ff054424a977ff6e2d6a78981\", [:mix], [{:castore, \"~> 0.1\", [hex: :castore, repo: \"hexpm\", optional: true]}, {:certifi, \"~> 2.5\", [hex: :certifi, repo: \"hexpm\", optional: true]}, {:cldr_utils, \"~> 2.15\", [hex: :cldr_utils, repo: \"hexpm\", optional: false]}, {:decimal, \"~> 1.6 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: false]}, {:gettext, \"~> 0.13\", [hex: :gettext, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}, {:nimble_parsec, \"~> 0.5 or ~> 1.0\", [hex: :nimble_parsec, repo: \"hexpm\", optional: true]}, {:plug, \"~> 1.9\", [hex: :plug, repo: \"hexpm\", optional: true]}], \"hexpm\", \"d9ce03c8d3fdc7ab751bdb2be742b6972f94adc856d51dfe5bb06a51ac96b8f4\"},\n \"ex_cldr_calendars\": {:hex, :ex_cldr_calendars, \"1.16.0\", \"7f076c85b63b03cf2c5719b75a9c1ca1b177d6d164a94a1eaf4bfb1a5dca152a\", [:mix], [{:calendar_interval, \"~> 0.2\", [hex: :calendar_interval, repo: \"hexpm\", optional: true]}, {:earmark, \"~> 1.0\", [hex: :earmark, repo: \"hexpm\", optional: false]}, {:ex_cldr, \"~> 2.23\", [hex: :ex_cldr, repo: \"hexpm\", optional: false]}, {:ex_cldr_units, \"~> 3.7\", [hex: :ex_cldr_units, repo: \"hexpm\", optional: true]}, {:ex_doc, \"~> 0.21\", [hex: :ex_doc, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: false]}], \"hexpm\", \"483d91a0fb4909efe211ae59a3620a28bf1a72d64dbf922ae940115e64f6138a\"},\n \"ex_cldr_currencies\": {:hex, :ex_cldr_currencies, \"2.11.1\", \"a6e56209d6f98082cd197aa424333e7a0e38e79253fce9589117719728de4fef\", [:mix], [{:ex_cldr, \"~> 2.23\", [hex: :ex_cldr, repo: \"hexpm\", optional: false]}, {:ex_doc, \"~> 0.18\", [hex: :ex_doc, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}], \"hexpm\", \"99e8eb3f48a30127bb11ab70f484c124c9fe5b11bce710c94c53939032b0c58c\"},\n \"ex_cldr_dates_times\": {:hex, :ex_cldr_dates_times, \"2.9.4\", \"9ee780d2226f695fc80e45f61118c3feccc9ec47ef1685300b4c1a22a039111f\", [:mix], [{:calendar_interval, \"~> 0.2\", [hex: :calendar_interval, repo: \"hexpm\", optional: true]}, {:ex_cldr_calendars, \"~> 1.15\", [hex: :ex_cldr_calendars, repo: \"hexpm\", optional: false]}, {:ex_cldr_numbers, \"~> 2.19\", [hex: :ex_cldr_numbers, repo: \"hexpm\", optional: false]}, {:ex_doc, \"~> 0.18\", [hex: :ex_doc, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}], \"hexpm\", \"0597172df5e7bcc7d79b5405adb1ee2b06c607a0879c66c768fba055b5c81434\"},\n \"ex_cldr_languages\": {:hex, :ex_cldr_languages, \"0.2.3\", \"3863f0e9f38c13b8822b5d998a0bc12941386f25fc6f6011313428784de40c44\", [:mix], [{:ex_cldr, \"~> 2.2 and >= 2.2.1\", [hex: :ex_cldr, repo: \"hexpm\", optional: false]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}], \"hexpm\", \"af0b10ff3d405190289b3defa130b07add5b24f8ffa3466ec07bc0575d97587e\"},\n \"ex_cldr_lists\": {:hex, :ex_cldr_lists, \"2.8.0\", \"373d8574d28590fdbc475436cc1590d37200867b4116f69a51e6e57cb0e62ee6\", [:mix], [{:ex_cldr_numbers, \"~> 2.17\", [hex: :ex_cldr_numbers, repo: \"hexpm\", optional: false]}, {:ex_doc, \"~> 0.18\", [hex: :ex_doc, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}], \"hexpm\", \"455406d488452d6eb0b044e23a918e015418787ffc87791d81e7320742269483\"},\n \"ex_cldr_numbers\": {:hex, :ex_cldr_numbers, \"2.22.1\", \"c710abb30a89875a5e2aff5f8a5e073ffad8689c6e84034729f10c51d39c4dcf\", [:mix], [{:decimal, \"~> 1.6 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: false]}, {:ex_cldr, \"~> 2.23\", [hex: :ex_cldr, repo: \"hexpm\", optional: false]}, {:ex_cldr_currencies, \"~> 2.11\", [hex: :ex_cldr_currencies, repo: \"hexpm\", optional: false]}, {:ex_doc, \"~> 0.18\", [hex: :ex_doc, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}], \"hexpm\", \"2015161a54f583eede00f18cdf43ec2b27aecf53e22486f6158d787da1f02bb9\"},\n \"ex_cldr_units\": {:hex, :ex_cldr_units, \"3.7.1\", \"89241de864e4673fe352d15d5727d89c63c10ce9c271b827c07452719f5e2a16\", [:mix], [{:cldr_utils, \"~> 2.16\", [hex: :cldr_utils, repo: \"hexpm\", optional: false]}, {:decimal, \"~> 1.6 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: true]}, {:ex_cldr_lists, \"~> 2.8\", [hex: :ex_cldr_lists, repo: \"hexpm\", optional: false]}, {:ex_cldr_numbers, \"~> 2.19\", [hex: :ex_cldr_numbers, repo: \"hexpm\", optional: false]}, {:ex_doc, \"~> 0.18\", [hex: :ex_doc, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}, {:ratio, \"~> 2.4\", [hex: :ratio, repo: \"hexpm\", optional: false]}], \"hexpm\", \"b9595bea124b6355632784bc8fb4a924c6456f1934a9a80359622e52b9bcdeb6\"},\n \"ex_doc\": {:hex, :ex_doc, \"0.25.3\", \"3edf6a0d70a39d2eafde030b8895501b1c93692effcbd21347296c18e47618ce\", [:mix], [{:earmark_parser, \"~> 1.4.0\", [hex: :earmark_parser, repo: \"hexpm\", optional: false]}, {:makeup_elixir, \"~> 0.14\", [hex: :makeup_elixir, repo: \"hexpm\", optional: false]}, {:makeup_erlang, \"~> 0.1\", [hex: :makeup_erlang, repo: \"hexpm\", optional: false]}], \"hexpm\", \"9ebebc2169ec732a38e9e779fd0418c9189b3ca93f4a676c961be6c1527913f5\"},\n \"ex_phone_number\": {:hex, :ex_phone_number, \"0.2.1\", \"c332d5119b0ffebe3f3e4c1d5264d544b972d5d350230d7b5b1586bbfaf1036e\", [:mix], [{:sweet_xml, \"~> 0.6.5\", [hex: :sweet_xml, repo: \"hexpm\", optional: false]}], \"hexpm\", \"988acbe6ffb70ee33164ad5c185dc6767028369280dcbb4ceda4bc66373b2b10\"},\n \"excoveralls\": {:hex, :excoveralls, \"0.14.3\", \"d17dc249ad32e469afd2bc656b58e810109d4367ec6bd467bed57a84dc4a3e02\", [:mix], [{:hackney, \"~> 1.16\", [hex: :hackney, repo: \"hexpm\", optional: false]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: false]}], \"hexpm\", \"b5aecdfdcf48e9d5e1c210841589b30981a5e7e66055cb8691a6f90b1601c108\"},\n \"file_system\": {:hex, :file_system, \"0.2.10\", \"fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d\", [:mix], [], \"hexpm\", \"41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc\"},\n \"floki\": {:hex, :floki, \"0.31.0\", \"f05ee8a8e6a3ced4e62beeb2c79a63bc8e12ab98fbaaf6e6a3d9b76b1278e23f\", [:mix], [{:html_entities, \"~> 0.5.0\", [hex: :html_entities, repo: \"hexpm\", optional: false]}], \"hexpm\", \"b05afa372f5c345a5bf240ac25ea1f0f3d5fcfd7490ac0beeb4a203f9444891e\"},\n \"gen_smtp\": {:hex, :gen_smtp, \"1.1.1\", \"bf9303c31735100631b1d708d629e4c65944319d1143b5c9952054f4a1311d85\", [:rebar3], [{:hut, \"1.3.0\", [hex: :hut, repo: \"hexpm\", optional: false]}, {:ranch, \">= 1.7.0\", [hex: :ranch, repo: \"hexpm\", optional: false]}], \"hexpm\", \"51bc50cc017efd4a4248cbc39ea30fb60efa7d4a49688986fafad84434ff9ab7\"},\n \"gettext\": {:git, \"https://github.com/elixir-gettext/gettext.git\", \"becf0585b12762bddb6dd04a9f0a307c8768fa1a\", [branch: \"master\"]},\n \"google_protos\": {:hex, :google_protos, \"0.1.0\", \"c6b9e12092d17571b093d4156d004494ca143b65dbbcbfc3ffff463ea03467c0\", [:mix], [{:protobuf, \"~> 0.5\", [hex: :protobuf, repo: \"hexpm\", optional: false]}], \"hexpm\", \"ff5564525f89d2638a4cfa9fb4d31e9ee9d9d7cb937b3e8a95f558440c039e1b\"},\n \"grpc\": {:hex, :grpc, \"0.5.0-beta.1\", \"7d43f52e138fe261f5b4981f1ada515dfc2e1bfa9dc92c7022e8f41e7e49b571\", [:mix], [{:cowboy, \"~> 2.7.0\", [hex: :cowboy, repo: \"hexpm\", optional: false]}, {:gun, \"~> 2.0.0\", [hex: :grpc_gun, repo: \"hexpm\", optional: false]}, {:protobuf, \"~> 0.5\", [hex: :protobuf, repo: \"hexpm\", optional: false]}], \"hexpm\", \"fbbf8872935c295b7575435fe4128372c23c6ded89c2ef8058af3c6167bb3f65\"},\n \"gun\": {:hex, :grpc_gun, \"2.0.0\", \"f99678a2ab975e74372a756c86ec30a8384d3ac8a8b86c7ed6243ef4e61d2729\", [:rebar3], [{:cowlib, \"~> 2.8.0\", [hex: :cowlib, repo: \"hexpm\", optional: false]}], \"hexpm\", \"03dbbca1a9c604a0267a40ea1d69986225091acb822de0b2dbea21d5815e410b\"},\n \"hackney\": {:hex, :hackney, \"1.18.0\", \"c4443d960bb9fba6d01161d01cd81173089686717d9490e5d3606644c48d121f\", [:rebar3], [{:certifi, \"~>2.8.0\", [hex: :certifi, repo: \"hexpm\", optional: false]}, {:idna, \"~>6.1.0\", [hex: :idna, repo: \"hexpm\", optional: false]}, {:metrics, \"~>1.0.0\", [hex: :metrics, repo: \"hexpm\", optional: false]}, {:mimerl, \"~>1.1\", [hex: :mimerl, repo: \"hexpm\", optional: false]}, {:parse_trans, \"3.3.1\", [hex: :parse_trans, repo: \"hexpm\", optional: false]}, {:ssl_verify_fun, \"~>1.1.0\", [hex: :ssl_verify_fun, repo: \"hexpm\", optional: false]}, {:unicode_util_compat, \"~>0.7.0\", [hex: :unicode_util_compat, repo: \"hexpm\", optional: false]}], \"hexpm\", \"9afcda620704d720db8c6a3123e9848d09c87586dc1c10479c42627b905b5c5e\"},\n \"highlander\": {:hex, :highlander, \"0.2.1\", \"e59b459f857e89daf73f2598bf2b2c0479a435481e6101ea389fd3625919b052\", [:mix], [], \"hexpm\", \"5ba19a18358803d82a923511acec8ee85fac30731c5ca056f2f934bc3d3afd9a\"},\n \"html_entities\": {:hex, :html_entities, \"0.5.2\", \"9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c\", [:mix], [], \"hexpm\", \"c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc\"},\n \"human_readable_identifier_generator\": {:hex, :human_readable_identifier_generator, \"1.0.0\", \"0e58c50c60055af05118da93d948b03fbc698425618774a9d1b0532c29b95d73\", [:mix], [], \"hexpm\", \"3669c913a2bdc0342385deb832cc06852af897d80e14db1d50b163fe959e8435\"},\n \"hut\": {:hex, :hut, \"1.3.0\", \"71f2f054e657c03f959cf1acc43f436ea87580696528ca2a55c8afb1b06c85e7\", [:\"erlang.mk\", :rebar, :rebar3], [], \"hexpm\", \"7e15d28555d8a1f2b5a3a931ec120af0753e4853a4c66053db354f35bf9ab563\"},\n \"idna\": {:hex, :idna, \"6.1.1\", \"8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d\", [:rebar3], [{:unicode_util_compat, \"~>0.7.0\", [hex: :unicode_util_compat, repo: \"hexpm\", optional: false]}], \"hexpm\", \"92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea\"},\n \"jason\": {:hex, :jason, \"1.2.2\", \"ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052\", [:mix], [{:decimal, \"~> 1.0 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: true]}], \"hexpm\", \"18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179\"},\n \"jose\": {:hex, :jose, \"1.11.2\", \"f4c018ccf4fdce22c71e44d471f15f723cb3efab5d909ab2ba202b5bf35557b3\", [:mix, :rebar3], [], \"hexpm\", \"98143fbc48d55f3a18daba82d34fe48959d44538e9697c08f34200fa5f0947d2\"},\n \"jsone\": {:hex, :jsone, \"1.6.1\", \"7ea1098fe004c4127320fe0e3cf6a951b01f82039feaa56c322dc7e34dd59762\", [:rebar3], [], \"hexpm\", \"a6c1df6081df742068d2ed747a4fe8a7740c56421b53e02bc9d4907dd3502922\"},\n \"libcluster\": {:hex, :libcluster, \"3.3.0\", \"f7d45ff56d88e9fb4c30aee662480cbab69ebc0e7f7da4ad8d01b1e4f7492da8\", [:mix], [{:jason, \"~> 1.1\", [hex: :jason, repo: \"hexpm\", optional: false]}], \"hexpm\", \"ecdcdc88334ec8eb18b10a13a1d5f22a3319a970b5b1e66cfe71c7719a4ab6cc\"},\n \"mail\": {:hex, :mail, \"0.2.3\", \"2c6bb5f8a5f74845fa50ecd0fb45ea16b164026f285f45104f1c4c078cd616d4\", [:mix], [], \"hexpm\", \"932b398fa9c69fdf290d7ff63175826e0f1e24414d5b0763bb00a2acfc6c6bf5\"},\n \"makeup\": {:hex, :makeup, \"1.0.5\", \"d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c\", [:mix], [{:nimble_parsec, \"~> 0.5 or ~> 1.0\", [hex: :nimble_parsec, repo: \"hexpm\", optional: false]}], \"hexpm\", \"cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9\"},\n \"makeup_elixir\": {:hex, :makeup_elixir, \"0.15.1\", \"b5888c880d17d1cc3e598f05cdb5b5a91b7b17ac4eaf5f297cb697663a1094dd\", [:mix], [{:makeup, \"~> 1.0\", [hex: :makeup, repo: \"hexpm\", optional: false]}, {:nimble_parsec, \"~> 1.1\", [hex: :nimble_parsec, repo: \"hexpm\", optional: false]}], \"hexpm\", \"db68c173234b07ab2a07f645a5acdc117b9f99d69ebf521821d89690ae6c6ec8\"},\n \"makeup_erlang\": {:hex, :makeup_erlang, \"0.1.1\", \"3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f\", [:mix], [{:makeup, \"~> 1.0\", [hex: :makeup, repo: \"hexpm\", optional: false]}], \"hexpm\", \"174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb\"},\n \"metrics\": {:hex, :metrics, \"1.0.1\", \"25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486\", [:rebar3], [], \"hexpm\", \"69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16\"},\n \"mime\": {:hex, :mime, \"1.6.0\", \"dabde576a497cef4bbdd60aceee8160e02a6c89250d6c0b29e56c0dfb00db3d2\", [:mix], [], \"hexpm\", \"31a1a8613f8321143dde1dafc36006a17d28d02bdfecb9e95a880fa7aabd19a7\"},\n \"mimerl\": {:hex, :mimerl, \"1.2.0\", \"67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3\", [:rebar3], [], \"hexpm\", \"f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323\"},\n \"mint\": {:hex, :mint, \"1.4.0\", \"cd7d2451b201fc8e4a8fd86257fb3878d9e3752899eb67b0c5b25b180bde1212\", [:mix], [{:castore, \"~> 0.1.0\", [hex: :castore, repo: \"hexpm\", optional: true]}], \"hexpm\", \"10a99e144b815cbf8522dccbc8199d15802440fc7a64d67b6853adb6fa170217\"},\n \"mox\": {:hex, :mox, \"1.0.0\", \"4b3c7005173f47ff30641ba044eb0fe67287743eec9bd9545e37f3002b0a9f8b\", [:mix], [], \"hexpm\", \"201b0a20b7abdaaab083e9cf97884950f8a30a1350a1da403b3145e213c6f4df\"},\n \"nebulex\": {:hex, :nebulex, \"2.1.1\", \"ae7fe6791b03b00caeaa1a63c80de061903617187c3635cbf016a5b78b0459c5\", [:mix], [{:decorator, \"~> 1.4\", [hex: :decorator, repo: \"hexpm\", optional: true]}, {:shards, \"~> 1.0\", [hex: :shards, repo: \"hexpm\", optional: true]}, {:telemetry, \"~> 0.4\", [hex: :telemetry, repo: \"hexpm\", optional: true]}], \"hexpm\", \"a8f803e8fd0fc653fe10e5ef72c78592b0f8cc17980d02d6dce0b93047569624\"},\n \"nimble_parsec\": {:hex, :nimble_parsec, \"1.1.0\", \"3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89\", [:mix], [], \"hexpm\", \"08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b\"},\n \"numbers\": {:hex, :numbers, \"5.2.4\", \"f123d5bb7f6acc366f8f445e10a32bd403c8469bdbce8ce049e1f0972b607080\", [:mix], [{:coerce, \"~> 1.0\", [hex: :coerce, repo: \"hexpm\", optional: false]}, {:decimal, \"~> 1.9 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: true]}], \"hexpm\", \"eeccf5c61d5f4922198395bf87a465b6f980b8b862dd22d28198c5e6fab38582\"},\n \"oidcc\": {:hex, :oidcc, \"2.0.0-alpha.1\", \"e2847841bc748c1a1f5a8a8c57541effe8dcd4268e91bc0740b241405a2dfd45\", [:rebar3], [{:erljwt, \"~> 2.0.7\", [hex: :erljwt, repo: \"hexpm\", optional: false]}, {:hackney, \"~> 1.18\", [hex: :hackney, repo: \"hexpm\", optional: false]}], \"hexpm\", \"69e1aa464978b658ee0d2b52e5f3d7c74f313aa858caf3c3f3076cf12a6191ce\"},\n \"openapi_compiler\": {:hex, :openapi_compiler, \"1.0.0-beta.13\", \"e2f4af1dd210201202232e0085c8f3b64b5064c06557cc1cdee4784872c71430\", [:mix], [{:jason, \"~> 1.2\", [hex: :jason, repo: \"hexpm\", optional: false]}, {:tesla, \"~> 1.3\", [hex: :tesla, repo: \"hexpm\", optional: false]}, {:uri_template, \"~> 1.2\", [hex: :uri_template, repo: \"hexpm\", optional: false]}, {:yamerl, \"~> 0.7\", [hex: :yamerl, repo: \"hexpm\", optional: false]}], \"hexpm\", \"f67c01168c9842a68a5d4514fe226a294df707bac03fc779cd61f242c3b097d1\"},\n \"paginator\": {:hex, :paginator, \"1.0.4\", \"471e8e59e7a08541c5b7d2ea7166308c8e05ceb412fb444f3bdf320f5d793260\", [:mix], [{:ecto, \"~> 3.0\", [hex: :ecto, repo: \"hexpm\", optional: false]}, {:ecto_sql, \"~> 3.0\", [hex: :ecto_sql, repo: \"hexpm\", optional: false]}, {:plug_crypto, \"~> 1.2.0\", [hex: :plug_crypto, repo: \"hexpm\", optional: false]}, {:postgrex, \"~> 0.13\", [hex: :postgrex, repo: \"hexpm\", optional: true]}], \"hexpm\", \"9d79d21c0192d8d1fc562e5c99b5ebf7e0bb443c671e256b41fd709170730b91\"},\n \"parallel_stream\": {:hex, :parallel_stream, \"1.0.6\", \"b967be2b23f0f6787fab7ed681b4c45a215a81481fb62b01a5b750fa8f30f76c\", [:mix], [], \"hexpm\", \"639b2e8749e11b87b9eb42f2ad325d161c170b39b288ac8d04c4f31f8f0823eb\"},\n \"parse_trans\": {:hex, :parse_trans, \"3.3.1\", \"16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8\", [:rebar3], [], \"hexpm\", \"07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b\"},\n \"pdf_generator\": {:hex, :pdf_generator, \"0.6.2\", \"601f145a0db0dcd7b8c35e1698038f78f18fc42eb3bd2001f826a3a239205f0e\", [:mix], [], \"hexpm\", \"82af2debaae156834b14dc0727cd8c3ded70ed4a2a909107d514bf28f5d1fc35\"},\n \"phoenix\": {:hex, :phoenix, \"1.6.0\", \"7b85023f7ddef9a5c70909a51cc37c8b868b474d853f90f4280efd26b0e7cce5\", [:mix], [{:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}, {:phoenix_pubsub, \"~> 2.0\", [hex: :phoenix_pubsub, repo: \"hexpm\", optional: false]}, {:phoenix_view, \"~> 1.0\", [hex: :phoenix_view, repo: \"hexpm\", optional: false]}, {:plug, \"~> 1.10\", [hex: :plug, repo: \"hexpm\", optional: false]}, {:plug_cowboy, \"~> 2.2\", [hex: :plug_cowboy, repo: \"hexpm\", optional: true]}, {:plug_crypto, \"~> 1.2\", [hex: :plug_crypto, repo: \"hexpm\", optional: false]}, {:telemetry, \"~> 0.4 or ~> 1.0\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"52ffdd31f2daeb399b2e1eb57d468f99a1ad6eee5d8ea19d2353492f06c9fc96\"},\n \"phoenix_active_link\": {:git, \"https://github.com/jshmrtn/phoenix-active-link.git\", \"b76370d61b351b0255ea73bbf4eaee1a1fb8f0b0\", [branch: \"phoenix_html_v3\"]},\n \"phoenix_ecto\": {:hex, :phoenix_ecto, \"4.4.0\", \"0672ed4e4808b3fbed494dded89958e22fb882de47a97634c0b13e7b0b5f7720\", [:mix], [{:ecto, \"~> 3.3\", [hex: :ecto, repo: \"hexpm\", optional: false]}, {:phoenix_html, \"~> 2.14.2 or ~> 3.0\", [hex: :phoenix_html, repo: \"hexpm\", optional: true]}, {:plug, \"~> 1.9\", [hex: :plug, repo: \"hexpm\", optional: false]}], \"hexpm\", \"09864e558ed31ee00bd48fcc1d4fc58ae9678c9e81649075431e69dbabb43cc1\"},\n \"phoenix_html\": {:hex, :phoenix_html, \"3.0.4\", \"232d41884fe6a9c42d09f48397c175cd6f0d443aaa34c7424da47604201df2e1\", [:mix], [{:plug, \"~> 1.5\", [hex: :plug, repo: \"hexpm\", optional: true]}], \"hexpm\", \"ce17fd3cf815b2ed874114073e743507704b1f5288bb03c304a77458485efc8b\"},\n \"phoenix_live_dashboard\": {:hex, :phoenix_live_dashboard, \"0.5.2\", \"b3b863ba9da3c9bd0b18fc32e96e8e5e25faf6a5f62db1dd91029835ea4cc90f\", [:mix], [{:ecto, \"~> 3.6.2 or ~> 3.7\", [hex: :ecto, repo: \"hexpm\", optional: true]}, {:ecto_psql_extras, \"~> 0.7\", [hex: :ecto_psql_extras, repo: \"hexpm\", optional: true]}, {:phoenix_live_view, \"~> 0.16.0\", [hex: :phoenix_live_view, repo: \"hexpm\", optional: false]}, {:telemetry_metrics, \"~> 0.6.0\", [hex: :telemetry_metrics, repo: \"hexpm\", optional: false]}], \"hexpm\", \"6d7124f36ee6c74be334386b8b5a1eb27223c77f86f4167de132b9358036f199\"},\n \"phoenix_live_reload\": {:hex, :phoenix_live_reload, \"1.3.3\", \"3a53772a6118d5679bf50fc1670505a290e32a1d195df9e069d8c53ab040c054\", [:mix], [{:file_system, \"~> 0.2.1 or ~> 0.3\", [hex: :file_system, repo: \"hexpm\", optional: false]}, {:phoenix, \"~> 1.4\", [hex: :phoenix, repo: \"hexpm\", optional: false]}], \"hexpm\", \"766796676e5f558dbae5d1bdb066849673e956005e3730dfd5affd7a6da4abac\"},\n \"phoenix_live_view\": {:hex, :phoenix_live_view, \"0.16.4\", \"5692edd0bac247a9a816eee7394e32e7a764959c7d0cf9190662fc8b0cd24c97\", [:mix], [{:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}, {:phoenix, \"~> 1.5.9 or ~> 1.6.0\", [hex: :phoenix, repo: \"hexpm\", optional: false]}, {:phoenix_html, \"~> 3.0\", [hex: :phoenix_html, repo: \"hexpm\", optional: false]}, {:telemetry, \"~> 0.4.2 or ~> 1.0\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"754ba49aa2e8601afd4f151492c93eb72df69b0b9856bab17711b8397e43bba0\"},\n \"phoenix_pubsub\": {:hex, :phoenix_pubsub, \"2.0.0\", \"a1ae76717bb168cdeb10ec9d92d1480fec99e3080f011402c0a2d68d47395ffb\", [:mix], [], \"hexpm\", \"c52d948c4f261577b9c6fa804be91884b381a7f8f18450c5045975435350f771\"},\n \"phoenix_view\": {:hex, :phoenix_view, \"1.0.0\", \"fea71ecaaed71178b26dd65c401607de5ec22e2e9ef141389c721b3f3d4d8011\", [:mix], [{:phoenix_html, \"~> 2.14.2 or ~> 3.0\", [hex: :phoenix_html, repo: \"hexpm\", optional: true]}], \"hexpm\", \"82be3e2516f5633220246e2e58181282c71640dab7afc04f70ad94253025db0c\"},\n \"plug\": {:hex, :plug, \"1.12.1\", \"645678c800601d8d9f27ad1aebba1fdb9ce5b2623ddb961a074da0b96c35187d\", [:mix], [{:mime, \"~> 1.0 or ~> 2.0\", [hex: :mime, repo: \"hexpm\", optional: false]}, {:plug_crypto, \"~> 1.1.1 or ~> 1.2\", [hex: :plug_crypto, repo: \"hexpm\", optional: false]}, {:telemetry, \"~> 0.4.3 or ~> 1.0\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"d57e799a777bc20494b784966dc5fbda91eb4a09f571f76545b72a634ce0d30b\"},\n \"plug_checkup\": {:git, \"https://github.com/jshmrtn/plug_checkup.git\", \"93d41c4763cf03d135b654be586dc652a0db815d\", [branch: \"check_query_selector\"]},\n \"plug_content_security_policy\": {:hex, :plug_content_security_policy, \"0.2.1\", \"0a19c76307ad000b3757739c14b34b83ecccf7d0a3472e64e14797a20b62939b\", [:mix], [{:plug, \"~> 1.3\", [hex: :plug, repo: \"hexpm\", optional: false]}], \"hexpm\", \"ceea10050671c0387c64526e2cb337ee08e12705c737eaed80439266df5b2e29\"},\n \"plug_cowboy\": {:hex, :plug_cowboy, \"2.5.2\", \"62894ccd601cf9597e2c23911ff12798a8a18d237e9739f58a6b04e4988899fe\", [:mix], [{:cowboy, \"~> 2.7\", [hex: :cowboy, repo: \"hexpm\", optional: false]}, {:cowboy_telemetry, \"~> 0.3\", [hex: :cowboy_telemetry, repo: \"hexpm\", optional: false]}, {:plug, \"~> 1.7\", [hex: :plug, repo: \"hexpm\", optional: false]}], \"hexpm\", \"ea6e87f774c8608d60c8d34022a7d073bd7680a0a013f049fc62bf35efea1044\"},\n \"plug_crypto\": {:hex, :plug_crypto, \"1.2.2\", \"05654514ac717ff3a1843204b424477d9e60c143406aa94daf2274fdd280794d\", [:mix], [], \"hexpm\", \"87631c7ad914a5a445f0a3809f99b079113ae4ed4b867348dd9eec288cecb6db\"},\n \"plug_dynamic\": {:hex, :plug_dynamic, \"1.0.0\", \"aecc1a6c19bb4a4d3ceb35ae85999e9ec77cf50eeead754607bc657d47478b32\", [:mix], [{:plug, \"~> 1.6\", [hex: :plug, repo: \"hexpm\", optional: false]}], \"hexpm\", \"403590330db12255755e0ce6397aaf05b000f255cfe5ea8edf70dc9d4413b99c\"},\n \"polymorphic_embed\": {:hex, :polymorphic_embed, \"1.7.2\", \"1b76c9a88b2d542a4f35a4665e5e123aa9339fb2885b7ef33d7c1126c38e8764\", [:mix], [{:ecto, \"~> 3.6\", [hex: :ecto, repo: \"hexpm\", optional: false]}, {:jason, \"~> 1.2\", [hex: :jason, repo: \"hexpm\", optional: false]}, {:phoenix_html, \"~> 2.14 or ~> 3.0\", [hex: :phoenix_html, repo: \"hexpm\", optional: true]}], \"hexpm\", \"a495da6b55ea8dc86b069e96b640835cf243fe42d38687d317a7334b993a02f5\"},\n \"postgrex\": {:hex, :postgrex, \"0.15.11\", \"50abbb50f33d22d79af402e549b9a566ba4f0451b4f5fd39b72d9bbd49743d24\", [:mix], [{:connection, \"~> 1.0\", [hex: :connection, repo: \"hexpm\", optional: false]}, {:db_connection, \"~> 2.1\", [hex: :db_connection, repo: \"hexpm\", optional: false]}, {:decimal, \"~> 1.5 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: false]}, {:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: true]}], \"hexpm\", \"6f0e5c3ea10f97468f5ff852277cb207f068399eb68b0c06c142ef68a4e82952\"},\n \"protobuf\": {:hex, :protobuf, \"0.7.1\", \"7d1b9f7d9ecb32eccd96b0c58572de4d1c09e9e3bc414e4cb15c2dce7013f195\", [:mix], [], \"hexpm\", \"6eff7a5287963719521c82e5d5b4583fd1d7cdd89ad129f0ea7d503a50a4d13f\"},\n \"ranch\": {:hex, :ranch, \"1.7.1\", \"6b1fab51b49196860b733a49c07604465a47bdb78aa10c1c16a3d199f7f8c881\", [:rebar3], [], \"hexpm\", \"451d8527787df716d99dc36162fca05934915db0b6141bbdac2ea8d3c7afc7d7\"},\n \"ratio\": {:hex, :ratio, \"2.4.2\", \"c8518f3536d49b1b00d88dd20d49f8b11abb7819638093314a6348139f14f9f9\", [:mix], [{:decimal, \"~> 1.6 or ~> 2.0\", [hex: :decimal, repo: \"hexpm\", optional: true]}, {:numbers, \"~> 5.2.0\", [hex: :numbers, repo: \"hexpm\", optional: false]}], \"hexpm\", \"441ef6f73172a3503de65ccf1769030997b0d533b1039422f1e5e0e0b4cbf89e\"},\n \"remote_ip\": {:hex, :remote_ip, \"1.0.0\", \"3d7fb45204a5704443f480cee9515e464997f52c35e0a60b6ece1f81484067ae\", [:mix], [{:combine, \"~> 0.10\", [hex: :combine, repo: \"hexpm\", optional: false]}, {:plug, \"~> 1.10\", [hex: :plug, repo: \"hexpm\", optional: false]}], \"hexpm\", \"9e9fcad4e50c43b5234bb6a9629ed6ab223f3ed07147bd35470e4ee5c8caf907\"},\n \"sedex\": {:hex, :sedex, \"1.0.3\", \"c310bfe065a141b25b47ee1872acc94b79d3223dcd06dd2f714fb6064424482e\", [:mix], [{:erlsom, \"~> 1.5\", [hex: :erlsom, repo: \"hexpm\", optional: false]}, {:ex_aws, \"~> 2.1\", [hex: :ex_aws, repo: \"hexpm\", optional: false]}, {:ex_aws_s3, \"~> 2.0\", [hex: :ex_aws_s3, repo: \"hexpm\", optional: false]}, {:jose, \"~> 1.11\", [hex: :jose, repo: \"hexpm\", optional: false]}, {:sweet_xml, \"~> 0.6\", [hex: :sweet_xml, repo: \"hexpm\", optional: false]}], \"hexpm\", \"45e9a4fc942f055a6cf8684032e96324d0b45aabab7b4c12371adfdfb5eb54f2\"},\n \"sentry\": {:hex, :sentry, \"8.0.5\", \"5ca922b9238a50c7258b52f47364b2d545beda5e436c7a43965b34577f1ef61f\", [:mix], [{:hackney, \"~> 1.8\", [hex: :hackney, repo: \"hexpm\", optional: true]}, {:jason, \"~> 1.1\", [hex: :jason, repo: \"hexpm\", optional: true]}, {:plug, \"~> 1.6\", [hex: :plug, repo: \"hexpm\", optional: true]}, {:plug_cowboy, \"~> 2.3\", [hex: :plug_cowboy, repo: \"hexpm\", optional: true]}], \"hexpm\", \"4972839fdbf52e886d7b3e694c8adf421f764f2fa79036b88fb4742049bd4b7c\"},\n \"shards\": {:hex, :shards, \"1.0.1\", \"1bdbbf047db27f3c3eb800a829d4a47062c84d5543cbfebcfc4c14d038bf9220\", [:make, :rebar3], [], \"hexpm\", \"2c57788afbf053c4024366772892beee89b8b72e884e764fb0a075dfa7442041\"},\n \"ssl_verify_fun\": {:hex, :ssl_verify_fun, \"1.1.6\", \"cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0\", [:make, :mix, :rebar3], [], \"hexpm\", \"bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680\"},\n \"surface\": {:hex, :surface, \"0.5.1\", \"2aa593d8ba5dde584e288f697ec8318352f2ff2037ad6d195788c702f104bff2\", [:mix], [{:jason, \"~> 1.0\", [hex: :jason, repo: \"hexpm\", optional: false]}, {:phoenix_live_view, \"~> 0.15\", [hex: :phoenix_live_view, repo: \"hexpm\", optional: false]}], \"hexpm\", \"a853bfe3479e1f711c84d69d988f85612bd2847dc18ada80be951af40dbe136c\"},\n \"surface_formatter\": {:hex, :surface_formatter, \"0.5.4\", \"ce3332e2516615795d10bcf8fb10c765128ff9ccb0fa0e21aa4f384a58498d52\", [:mix], [{:surface, \"~> 0.5.0\", [hex: :surface, repo: \"hexpm\", optional: false]}], \"hexpm\", \"ea1a5666e4abf1a6c61048fb9a64040ce59865cf33002ca08d2011b6d700feb4\"},\n \"sweet_xml\": {:hex, :sweet_xml, \"0.6.6\", \"fc3e91ec5dd7c787b6195757fbcf0abc670cee1e4172687b45183032221b66b8\", [:mix], [], \"hexpm\", \"2e1ec458f892ffa81f9f8386e3f35a1af6db7a7a37748a64478f13163a1f3573\"},\n \"table_rex\": {:hex, :table_rex, \"3.1.1\", \"0c67164d1714b5e806d5067c1e96ff098ba7ae79413cc075973e17c38a587caa\", [:mix], [], \"hexpm\", \"678a23aba4d670419c23c17790f9dcd635a4a89022040df7d5d772cb21012490\"},\n \"telemetry\": {:hex, :telemetry, \"0.4.3\", \"a06428a514bdbc63293cd9a6263aad00ddeb66f608163bdec7c8995784080818\", [:rebar3], [], \"hexpm\", \"eb72b8365ffda5bed68a620d1da88525e326cb82a75ee61354fc24b844768041\"},\n \"telemetry_metrics\": {:hex, :telemetry_metrics, \"0.6.1\", \"315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f\", [:mix], [{:telemetry, \"~> 0.4 or ~> 1.0\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6\"},\n \"telemetry_metrics_prometheus\": {:hex, :telemetry_metrics_prometheus, \"1.1.0\", \"1cc23e932c1ef9aa3b91db257ead31ea58d53229d407e059b29bb962c1505a13\", [:mix], [{:plug_cowboy, \"~> 2.1\", [hex: :plug_cowboy, repo: \"hexpm\", optional: false]}, {:telemetry_metrics_prometheus_core, \"~> 1.0\", [hex: :telemetry_metrics_prometheus_core, repo: \"hexpm\", optional: false]}], \"hexpm\", \"d43b3659b3244da44fe0275b717701542365d4519b79d9ce895b9719c1ce4d26\"},\n \"telemetry_metrics_prometheus_core\": {:hex, :telemetry_metrics_prometheus_core, \"1.0.1\", \"cebf3c8892f5dc40eb057375e5c1c2077c155ed46654d5af35a2ad48a3f48749\", [:mix], [{:telemetry, \"~> 0.4\", [hex: :telemetry, repo: \"hexpm\", optional: false]}, {:telemetry_metrics, \"~> 0.6\", [hex: :telemetry_metrics, repo: \"hexpm\", optional: false]}], \"hexpm\", \"112a9d5a6facf34fb0dda8426c18432ffb9e8abe38f394f3417cb589ecaeb674\"},\n \"telemetry_poller\": {:hex, :telemetry_poller, \"0.5.1\", \"21071cc2e536810bac5628b935521ff3e28f0303e770951158c73eaaa01e962a\", [:rebar3], [{:telemetry, \"~> 0.4\", [hex: :telemetry, repo: \"hexpm\", optional: false]}], \"hexpm\", \"4cab72069210bc6e7a080cec9afffad1b33370149ed5d379b81c7c5f0c663fd4\"},\n \"tesla\": {:hex, :tesla, \"1.4.3\", \"f5a494e08fb1abe4fd9c28abb17f3d9b62b8f6fc492860baa91efb1aab61c8a0\", [:mix], [{:castore, \"~> 0.1\", [hex: :castore, repo: \"hexpm\", optional: true]}, {:exjsx, \">= 3.0.0\", [hex: :exjsx, repo: \"hexpm\", optional: true]}, {:finch, \"~> 0.3\", [hex: :finch, repo: \"hexpm\", optional: true]}, {:fuse, \"~> 2.4\", [hex: :fuse, repo: \"hexpm\", optional: true]}, {:gun, \"~> 1.3\", [hex: :gun, repo: \"hexpm\", optional: true]}, {:hackney, \"~> 1.6\", [hex: :hackney, repo: \"hexpm\", optional: true]}, {:ibrowse, \"4.4.0\", [hex: :ibrowse, repo: \"hexpm\", optional: true]}, {:jason, \">= 1.0.0\", [hex: :jason, repo: \"hexpm\", optional: true]}, {:mime, \"~> 1.0\", [hex: :mime, repo: \"hexpm\", optional: false]}, {:mint, \"~> 1.0\", [hex: :mint, repo: \"hexpm\", optional: true]}, {:poison, \">= 1.0.0\", [hex: :poison, repo: \"hexpm\", optional: true]}, {:telemetry, \"~> 0.4 or ~> 1.0\", [hex: :telemetry, repo: \"hexpm\", optional: true]}], \"hexpm\", \"e0755bb664bf4d664af72931f320c97adbf89da4586670f4864bf259b5750386\"},\n \"tzdata\": {:hex, :tzdata, \"1.1.0\", \"72f5babaa9390d0f131465c8702fa76da0919e37ba32baa90d93c583301a8359\", [:mix], [{:hackney, \"~> 1.17\", [hex: :hackney, repo: \"hexpm\", optional: false]}], \"hexpm\", \"18f453739b48d3dc5bcf0e8906d2dc112bb40baafe2c707596d89f3c8dd14034\"},\n \"unicode_util_compat\": {:hex, :unicode_util_compat, \"0.7.0\", \"bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78\", [:rebar3], [], \"hexpm\", \"25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521\"},\n \"uri_template\": {:hex, :uri_template, \"1.2.1\", \"cc36ef5d18a3a5a23ce35a450ab5b139d5e49ce132b08b7f8797c17efc69d594\", [:mix], [], \"hexpm\", \"fe9a2dfeb4fd289b376df2b84dc2dc2d3244364f0ecf0c21e9832fbb756d524d\"},\n \"websms\": {:hex, :websms, \"1.0.0-alpha.1\", \"b92d86cc86fbbb379585e910402ff032d22cc5bf3025a4d2513dccc483f98a42\", [:mix], [{:castore, \"~> 0.1\", [hex: :castore, repo: \"hexpm\", optional: false]}, {:mint, \"~> 1.0\", [hex: :mint, repo: \"hexpm\", optional: false]}, {:openapi_compiler, \"~> 1.0-beta\", [hex: :openapi_compiler, repo: \"hexpm\", optional: false]}], \"hexpm\", \"19c71783208febfed3f37b050b45b7b4be680b0dc5f3c2bfeedf9dd1db10c997\"},\n \"xlsxir\": {:hex, :xlsxir, \"1.6.4\", \"d1e69439cbd9edc1190950f9f883ac364e1f31641e0395ccdb27761791b169a3\", [:mix], [{:erlsom, \"~> 1.5\", [hex: :erlsom, repo: \"hexpm\", optional: false]}], \"hexpm\", \"38e91f65eb8a4c8dea07d941c8b7e21baf8c8d4938232395c9ffd19d2eb071f2\"},\n \"yamerl\": {:hex, :yamerl, \"0.8.1\", \"07da13ffa1d8e13948943789665c62ccd679dfa7b324a4a2ed3149df17f453a4\", [:rebar3], [], \"hexpm\", \"96cb30f9d64344fed0ef8a92e9f16f207de6c04dfff4f366752ca79f5bceb23f\"},\n \"zitadel_api\": {:hex, :zitadel_api, \"1.0.0-rc.7\", \"88cf9990eeb2c096957d5cf9a2eac7bd840ced097c79fa2b659cd42c1dcac620\", [:mix], [{:google_protos, \"~> 0.1.0\", [hex: :google_protos, repo: \"hexpm\", optional: false]}, {:grpc, \"~> 0.5.0-beta.1\", [hex: :grpc, repo: \"hexpm\", optional: false]}], \"hexpm\", \"131ebdcf1c736ad4ad2ee1e45ff3beab8dda9f1331904d7d7b2e1fc14f61aff6\"},\n}" ]
[ 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1806, 868, 63, 18], "buggy_code_start_loc": [1119, 637, 62, 17], "filenames": ["apps/hygeia/lib/hygeia/case_context.ex", "apps/hygeia/lib/hygeia/statistics_context.ex", "apps/hygeia/mix.exs", "mix.lock"], "fixing_code_end_loc": [1806, 868, 66, 18], "fixing_code_start_loc": [1119, 637, 62, 17], "message": "Hygeia is an application for collecting and processing personal and case data in connection with communicable diseases. In affected versions all CSV Exports (Statistics & BAG MED) contain a CSV Injection Vulnerability. Users of the system are able to submit formula as exported fields which then get executed upon ingestion of the exported file. There is no validation or sanitization of these formula fields and so malicious may construct malicious code. This vulnerability has been resolved in version 1.30.4. There are no workarounds and all users are advised to upgrade their package.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hygeia_project:hygeia:*:*:*:*:*:*:*:*", "matchCriteriaId": "F7DDCC54-C4E6-4E39-8F2B-AE90486E8AC1", "versionEndExcluding": "1.30.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "1.11.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Hygeia is an application for collecting and processing personal and case data in connection with communicable diseases. In affected versions all CSV Exports (Statistics & BAG MED) contain a CSV Injection Vulnerability. Users of the system are able to submit formula as exported fields which then get executed upon ingestion of the exported file. There is no validation or sanitization of these formula fields and so malicious may construct malicious code. This vulnerability has been resolved in version 1.30.4. There are no workarounds and all users are advised to upgrade their package."}, {"lang": "es", "value": "Hygeia es una aplicaci\u00f3n para recoger y procesar datos personales y de casos en relaci\u00f3n con las enfermedades transmisibles. En las versiones afectadas, todas las exportaciones CSV (Statistics & BAG MED) contienen una vulnerabilidad de inyecci\u00f3n CSV. Los usuarios del sistema pueden enviar f\u00f3rmulas como campos exportados que luego se ejecutan al ingerir el archivo exportado. No se presenta comprobaci\u00f3n ni saneo de estos campos de f\u00f3rmulas, por lo que maliciosos pueden construir c\u00f3digo malicioso. Esta vulnerabilidad ha sido resuelta en la versi\u00f3n 1.30.4. No se presentan soluciones y se recomienda a todos los usuarios que actualicen su paquete"}], "evaluatorComment": null, "id": "CVE-2021-41128", "lastModified": "2021-10-14T23:00:49.797", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 6.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:S/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 9.1, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.1, "impactScore": 5.3, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2021-10-06T18:15:11.067", "references": [{"source": "security-advisories@github.com", "tags": ["Issue Tracking", "Third Party Advisory"], "url": "https://github.com/beatrichartz/csv/issues/103"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/beatrichartz/csv/pull/104"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jshmrtn/hygeia/commit/d917f27432fe84e1c9751222ae55bae36a4dce60"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jshmrtn/hygeia/security/advisories/GHSA-8pwv-jhj2-2369"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://owasp.org/www-community/attacks/CSV_Injection"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/jshmrtn/hygeia/commit/d917f27432fe84e1c9751222ae55bae36a4dce60"}, "type": "CWE-74"}
349
Determine whether the {function_name} code is vulnerable or not.
[ "# Copyright 2012, Piston Cloud Computing, Inc.\n# Copyright 2012, OpenStack LLC.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.", "\nimport netaddr", "from nova.compute import api as compute\nfrom nova.scheduler import filters", "\nclass AffinityFilter(filters.BaseHostFilter):\n def __init__(self):\n self.compute_api = compute.API()\n", " def _affinity_host(self, context, instance_id):\n return self.compute_api.get(context, instance_id)['host']", "", "class DifferentHostFilter(AffinityFilter):\n '''Schedule the instance on a different host from a set of instances.'''", " def host_passes(self, host_state, filter_properties):\n context = filter_properties['context']\n scheduler_hints = filter_properties.get('scheduler_hints') or {}\n me = host_state.host", " affinity_uuids = scheduler_hints.get('different_host', [])\n if isinstance(affinity_uuids, basestring):\n affinity_uuids = [affinity_uuids]\n if affinity_uuids:", "", " return not any([i for i in affinity_uuids", " if self._affinity_host(context, i) == me])", " # With no different_host key\n return True", "\nclass SameHostFilter(AffinityFilter):\n '''Schedule the instance on the same host as another instance in a set of\n of instances.\n '''", " def host_passes(self, host_state, filter_properties):\n context = filter_properties['context']\n scheduler_hints = filter_properties.get('scheduler_hints') or {}\n me = host_state.host", " affinity_uuids = scheduler_hints.get('same_host', [])\n if isinstance(affinity_uuids, basestring):\n affinity_uuids = [affinity_uuids]\n if affinity_uuids:", "", " return any([i for i\n in affinity_uuids", " if self._affinity_host(context, i) == me])", " # With no same_host key\n return True", "\nclass SimpleCIDRAffinityFilter(AffinityFilter):\n def host_passes(self, host_state, filter_properties):\n scheduler_hints = filter_properties.get('scheduler_hints') or {}", " affinity_cidr = scheduler_hints.get('cidr', '/24')\n affinity_host_addr = scheduler_hints.get('build_near_host_ip')\n host_ip = host_state.capabilities.get('host_ip')\n if affinity_host_addr:\n affinity_net = netaddr.IPNetwork(str.join('', (affinity_host_addr,\n affinity_cidr)))", " return netaddr.IPAddress(host_ip) in affinity_net", " # We don't have an affinity host address.\n return True" ]
[ 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [67], "buggy_code_start_loc": [28], "filenames": ["nova/scheduler/filters/affinity_filter.py"], "fixing_code_end_loc": [72], "fixing_code_start_loc": [28], "message": "The Nova scheduler in OpenStack Compute (Nova) Folsom (2012.2) and Essex (2012.1), when DifferentHostFilter or SameHostFilter is enabled, allows remote authenticated users to cause a denial of service (excessive database lookup calls and server hang) via a request with many repeated IDs in the os:scheduler_hints section.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:openstack:compute:2012.2:*:*:*:*:*:*:*", "matchCriteriaId": "0E9D8029-F7DD-435D-B4F4-D3DABDB7333B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:openstack:essex:2012.1:*:*:*:*:*:*:*", "matchCriteriaId": "E5FDB43F-B315-4F68-9D86-B644F2D4DF9A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:openstack:folsom:2012.2:*:*:*:*:*:*:*", "matchCriteriaId": "E76B76AB-D744-4163-8615-7BA18ABB1347", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The Nova scheduler in OpenStack Compute (Nova) Folsom (2012.2) and Essex (2012.1), when DifferentHostFilter or SameHostFilter is enabled, allows remote authenticated users to cause a denial of service (excessive database lookup calls and server hang) via a request with many repeated IDs in the os:scheduler_hints section."}, {"lang": "es", "value": "El planificador Nova en OpenStack Compute (Nova) Folsom (2012.2) y Essex (2012.1), cuando DifferentHostFilter o SameHostFilter est\u00e1n activados, permite a usuarios remotos autenticados provocar una denegaci\u00f3n de servicio (exceso de llamadas de b\u00fasqueda de base de datos y el servidor se bloquea) a trav\u00e9s de una solicitud con muchos identificadores repetidos en el sistema operativo: Secci\u00f3n scheduler_hints."}], "evaluatorComment": null, "id": "CVE-2012-3371", "lastModified": "2012-08-24T04:00:00.000", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 3.5, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:S/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": null}, "published": "2012-07-17T21:55:02.350", "references": [{"source": "secalert@redhat.com", "tags": null, "url": "http://www.openwall.com/lists/oss-security/2012/07/11/13"}, {"source": "secalert@redhat.com", "tags": null, "url": "http://www.securityfocus.com/bid/54388"}, {"source": "secalert@redhat.com", "tags": null, "url": "http://www.ubuntu.com/usn/USN-1501-1"}, {"source": "secalert@redhat.com", "tags": ["Exploit"], "url": "https://bugs.launchpad.net/nova/+bug/1017795"}, {"source": "secalert@redhat.com", "tags": ["Exploit", "Patch"], "url": "https://github.com/openstack/nova/commit/034762e8060dcf0a11cb039b9d426b0d0bb1801d"}, {"source": "secalert@redhat.com", "tags": null, "url": "https://lists.launchpad.net/openstack/msg14452.html"}], "sourceIdentifier": "secalert@redhat.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-20"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/openstack/nova/commit/034762e8060dcf0a11cb039b9d426b0d0bb1801d"}, "type": "CWE-20"}
350
Determine whether the {function_name} code is vulnerable or not.
[ "# Copyright 2012, Piston Cloud Computing, Inc.\n# Copyright 2012, OpenStack LLC.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.", "\nimport netaddr", "from nova.compute import api as compute\nfrom nova.scheduler import filters", "\nclass AffinityFilter(filters.BaseHostFilter):\n def __init__(self):\n self.compute_api = compute.API()\n", " def _all_hosts(self, context):\n all_hosts = {}\n for instance in self.compute_api.get_all(context):\n all_hosts[instance['uuid']] = instance['host']\n return all_hosts", "", "class DifferentHostFilter(AffinityFilter):\n '''Schedule the instance on a different host from a set of instances.'''", " def host_passes(self, host_state, filter_properties):\n context = filter_properties['context']\n scheduler_hints = filter_properties.get('scheduler_hints') or {}\n me = host_state.host", " affinity_uuids = scheduler_hints.get('different_host', [])\n if isinstance(affinity_uuids, basestring):\n affinity_uuids = [affinity_uuids]\n if affinity_uuids:", " all_hosts = self._all_hosts(context)", " return not any([i for i in affinity_uuids", " if all_hosts.get(i) == me])", " # With no different_host key\n return True", "\nclass SameHostFilter(AffinityFilter):\n '''Schedule the instance on the same host as another instance in a set of\n of instances.\n '''", " def host_passes(self, host_state, filter_properties):\n context = filter_properties['context']\n scheduler_hints = filter_properties.get('scheduler_hints') or {}\n me = host_state.host", " affinity_uuids = scheduler_hints.get('same_host', [])\n if isinstance(affinity_uuids, basestring):\n affinity_uuids = [affinity_uuids]\n if affinity_uuids:", " all_hosts = self._all_hosts(context)", " return any([i for i\n in affinity_uuids", " if all_hosts.get(i) == me])", " # With no same_host key\n return True", "\nclass SimpleCIDRAffinityFilter(AffinityFilter):\n def host_passes(self, host_state, filter_properties):\n scheduler_hints = filter_properties.get('scheduler_hints') or {}", " affinity_cidr = scheduler_hints.get('cidr', '/24')\n affinity_host_addr = scheduler_hints.get('build_near_host_ip')\n host_ip = host_state.capabilities.get('host_ip')\n if affinity_host_addr:\n affinity_net = netaddr.IPNetwork(str.join('', (affinity_host_addr,\n affinity_cidr)))", " return netaddr.IPAddress(host_ip) in affinity_net", " # We don't have an affinity host address.\n return True" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [67], "buggy_code_start_loc": [28], "filenames": ["nova/scheduler/filters/affinity_filter.py"], "fixing_code_end_loc": [72], "fixing_code_start_loc": [28], "message": "The Nova scheduler in OpenStack Compute (Nova) Folsom (2012.2) and Essex (2012.1), when DifferentHostFilter or SameHostFilter is enabled, allows remote authenticated users to cause a denial of service (excessive database lookup calls and server hang) via a request with many repeated IDs in the os:scheduler_hints section.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:openstack:compute:2012.2:*:*:*:*:*:*:*", "matchCriteriaId": "0E9D8029-F7DD-435D-B4F4-D3DABDB7333B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:openstack:essex:2012.1:*:*:*:*:*:*:*", "matchCriteriaId": "E5FDB43F-B315-4F68-9D86-B644F2D4DF9A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:openstack:folsom:2012.2:*:*:*:*:*:*:*", "matchCriteriaId": "E76B76AB-D744-4163-8615-7BA18ABB1347", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The Nova scheduler in OpenStack Compute (Nova) Folsom (2012.2) and Essex (2012.1), when DifferentHostFilter or SameHostFilter is enabled, allows remote authenticated users to cause a denial of service (excessive database lookup calls and server hang) via a request with many repeated IDs in the os:scheduler_hints section."}, {"lang": "es", "value": "El planificador Nova en OpenStack Compute (Nova) Folsom (2012.2) y Essex (2012.1), cuando DifferentHostFilter o SameHostFilter est\u00e1n activados, permite a usuarios remotos autenticados provocar una denegaci\u00f3n de servicio (exceso de llamadas de b\u00fasqueda de base de datos y el servidor se bloquea) a trav\u00e9s de una solicitud con muchos identificadores repetidos en el sistema operativo: Secci\u00f3n scheduler_hints."}], "evaluatorComment": null, "id": "CVE-2012-3371", "lastModified": "2012-08-24T04:00:00.000", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 3.5, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:S/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": null}, "published": "2012-07-17T21:55:02.350", "references": [{"source": "secalert@redhat.com", "tags": null, "url": "http://www.openwall.com/lists/oss-security/2012/07/11/13"}, {"source": "secalert@redhat.com", "tags": null, "url": "http://www.securityfocus.com/bid/54388"}, {"source": "secalert@redhat.com", "tags": null, "url": "http://www.ubuntu.com/usn/USN-1501-1"}, {"source": "secalert@redhat.com", "tags": ["Exploit"], "url": "https://bugs.launchpad.net/nova/+bug/1017795"}, {"source": "secalert@redhat.com", "tags": ["Exploit", "Patch"], "url": "https://github.com/openstack/nova/commit/034762e8060dcf0a11cb039b9d426b0d0bb1801d"}, {"source": "secalert@redhat.com", "tags": null, "url": "https://lists.launchpad.net/openstack/msg14452.html"}], "sourceIdentifier": "secalert@redhat.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-20"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/openstack/nova/commit/034762e8060dcf0a11cb039b9d426b0d0bb1801d"}, "type": "CWE-20"}
350
Determine whether the {function_name} code is vulnerable or not.
[ "mbed TLS ChangeLog (Sorted per branch, date)", "= mbed TLS 2.y.z released YYYY-MM-DD", "Changes\n * Certificate verification functions now set flags to -1 in case the full\n chain was not verified due to an internal error (including in the verify\n callback) or chain length limitations.", "", "\n= mbed TLS 2.5.1 released 2017-06-21", "Security\n * Fixed unlimited overread of heap-based buffer in mbedtls_ssl_read().\n The issue could only happen client-side with renegotiation enabled.\n Could result in DoS (application crash) or information leak\n (if the application layer sent data read from mbedtls_ssl_read()\n back to the server or to a third party). Can be triggered remotely.\n * Removed SHA-1 and RIPEMD-160 from the default hash algorithms for\n certificate verification. SHA-1 can be turned back on with a compile-time\n option if needed.\n * Fixed offset in FALLBACK_SCSV parsing that caused TLS server to fail to\n detect it sometimes. Reported by Hugo Leisink. #810\n * Tighten parsing of RSA PKCS#1 v1.5 signatures, to avoid a\n potential Bleichenbacher/BERserk-style attack.", "Bugfix\n * Remove size zero arrays from ECJPAKE test suite. Size zero arrays are not\n valid C and they prevented the test from compiling in Visual Studio 2015\n and with GCC using the -Wpedantic compilation option.\n * Fix insufficient support for signature-hash-algorithm extension,\n resulting in compatibility problems with Chrome. Found by hfloyrd. #823\n * Fix behaviour that hid the original cause of fatal alerts in some cases\n when sending the alert failed. The fix makes sure not to hide the error\n that triggered the alert.\n * Fix SSLv3 renegotiation behaviour and stop processing data received from\n peer after sending a fatal alert to refuse a renegotiation attempt.\n Previous behaviour was to keep processing data even after the alert has\n been sent.\n * Accept empty trusted CA chain in authentication mode\n MBEDTLS_SSL_VERIFY_OPTIONAL.\n Found by jethrogb. #864\n * Fix implementation of mbedtls_ssl_parse_certificate() to not annihilate\n fatal errors in authentication mode MBEDTLS_SSL_VERIFY_OPTIONAL and to\n reflect bad EC curves within verification result.\n * Fix bug that caused the modular inversion function to accept the invalid\n modulus 1 and therefore to hang. Found by blaufish. #641.\n * Fix incorrect sign computation in modular exponentiation when the base is\n a negative MPI. Previously the result was always negative. Found by Guido\n Vranken.\n * Fix a numerical underflow leading to stack overflow in mpi_read_file()\n that was triggered uppon reading an empty line. Found by Guido Vranken.", "Changes\n * Send fatal alerts in more cases. The previous behaviour was to skip\n sending the fatal alert and just drop the connection.\n * Clarify ECDSA documentation and improve the sample code to avoid\n misunderstanding and potentially dangerous use of the API. Pointed out\n by Jean-Philippe Aumasson.", "= mbed TLS 2.5.0 branch released 2017-05-17", "Security\n * Wipe stack buffers in RSA private key operations\n (rsa_rsaes_pkcs1_v15_decrypt(), rsa_rsaes_oaep_decrypt). Found by Laurent\n Simon.\n * Add exponent blinding to RSA private operations as a countermeasure\n against side-channel attacks like the cache attack described in\n https://arxiv.org/abs/1702.08719v2.\n Found and fix proposed by Michael Schwarz, Samuel Weiser, Daniel Gruss,\n Clémentine Maurice and Stefan Mangard.", "Features\n * Add hardware acceleration support for the Elliptic Curve Point module.\n This involved exposing parts of the internal interface to enable\n replacing the core functions and adding and alternative, module level\n replacement support for enabling the extension of the interface.\n * Add a new configuration option to 'mbedtls_ssl_config' to enable\n suppressing the CA list in Certificate Request messages. The default\n behaviour has not changed, namely every configured CAs name is included.", "API Changes\n * The following functions in the AES module have been deprecated and replaced\n by the functions shown below. The new functions change the return type from\n void to int to allow returning error codes when using MBEDTLS_AES_ALT,\n MBEDTLS_AES_DECRYPT_ALT or MBEDTLS_AES_ENCRYPT_ALT.\n mbedtls_aes_decrypt() -> mbedtls_internal_aes_decrypt()\n mbedtls_aes_encrypt() -> mbedtls_internal_aes_encrypt()", "Bugfix\n * Remove macros from compat-1.3.h that correspond to deleted items from most\n recent versions of the library. Found by Kyle Keen.\n * Fixed issue in the Threading module that prevented mutexes from\n initialising. Found by sznaider. #667 #843\n * Add checks in the PK module for the RSA functions on 64-bit systems.\n The PK and RSA modules use different types for passing hash length and\n without these checks the type cast could lead to data loss. Found by Guido\n Vranken.", "= mbed TLS 2.4.2 branch released 2017-03-08", "Security\n * Add checks to prevent signature forgeries for very large messages while\n using RSA through the PK module in 64-bit systems. The issue was caused by\n some data loss when casting a size_t to an unsigned int value in the\n functions rsa_verify_wrap(), rsa_sign_wrap(), rsa_alt_sign_wrap() and\n mbedtls_pk_sign(). Found by Jean-Philippe Aumasson.\n * Fixed potential livelock during the parsing of a CRL in PEM format in\n mbedtls_x509_crl_parse(). A string containing a CRL followed by trailing\n characters after the footer could result in the execution of an infinite\n loop. The issue can be triggered remotely. Found by Greg Zaverucha,\n Microsoft.\n * Removed MD5 from the allowed hash algorithms for CertificateRequest and\n CertificateVerify messages, to prevent SLOTH attacks against TLS 1.2.\n Introduced by interoperability fix for #513.\n * Fixed a bug that caused freeing a buffer that was allocated on the stack,\n when verifying the validity of a key on secp224k1. This could be\n triggered remotely for example with a maliciously constructed certificate\n and potentially could lead to remote code execution on some platforms.\n Reported independently by rongsaws and Aleksandar Nikolic, Cisco Talos\n team. #569 CVE-2017-2784", "Bugfix\n * Fix output certificate verification flags set by x509_crt_verify_top() when\n traversing a chain of trusted CA. The issue would cause both flags,\n MBEDTLS_X509_BADCERT_NOT_TRUSTED and MBEDTLS_X509_BADCERT_EXPIRED, to be\n set when the verification conditions are not met regardless of the cause.\n Found by Harm Verhagen and inestlerode. #665 #561\n * Fix the redefinition of macro ssl_set_bio to an undefined symbol\n mbedtls_ssl_set_bio_timeout in compat-1.3.h, by removing it.\n Found by omlib-lin. #673\n * Fix unused variable/function compilation warnings in pem.c, x509_crt.c and\n x509_csr.c that are reported when building mbed TLS with a config.h that\n does not define MBEDTLS_PEM_PARSE_C. Found by omnium21. #562\n * Fix incorrect renegotiation condition in ssl_check_ctr_renegotiate() that\n would compare 64 bits of the record counter instead of 48 bits as indicated\n in RFC 6347 Section 4.3.1. This could cause the execution of the\n renegotiation routines at unexpected times when the protocol is DTLS. Found\n by wariua. #687\n * Fixed multiple buffer overreads in mbedtls_pem_read_buffer() when parsing\n the input string in PEM format to extract the different components. Found\n by Eyal Itkin.\n * Fixed potential arithmetic overflow in mbedtls_ctr_drbg_reseed() that could\n cause buffer bound checks to be bypassed. Found by Eyal Itkin.\n * Fixed potential arithmetic overflows in mbedtls_cipher_update() that could\n cause buffer bound checks to be bypassed. Found by Eyal Itkin.\n * Fixed potential arithmetic overflow in mbedtls_md2_update() that could\n cause buffer bound checks to be bypassed. Found by Eyal Itkin.\n * Fixed potential arithmetic overflow in mbedtls_base64_decode() that could\n cause buffer bound checks to be bypassed. Found by Eyal Itkin.\n * Fixed heap overreads in mbedtls_x509_get_time(). Found by Peng\n Li/Yueh-Hsun Lin, KNOX Security, Samsung Research America.\n * Fix potential memory leak in mbedtls_x509_crl_parse(). The leak was caused\n by missing calls to mbedtls_pem_free() in cases when a\n MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT error was encountered. Found and\n fix proposed by Guido Vranken. #722\n * Fixed the templates used to generate project and solution files for Visual\n Studio 2015 as well as the files themselves, to remove a build warning\n generated in Visual Studio 2015. Reported by Steve Valliere. #742\n * Fix a resource leak in ssl_cookie, when using MBEDTLS_THREADING_C.\n Raised and fix suggested by Alan Gillingham in the mbed TLS forum. #771\n * Fix 1 byte buffer overflow in mbedtls_mpi_write_string() when the MPI\n number to write in hexadecimal is negative and requires an odd number of\n digits. Found and fixed by Guido Vranken.\n * Fix unlisted DES configuration dependency in some pkparse test cases. Found\n by inestlerode. #555", "= mbed TLS 2.4.1 branch released 2016-12-13", "Changes\n * Update to CMAC test data, taken from - NIST Special Publication 800-38B -\n Recommendation for Block Cipher Modes of Operation: The CMAC Mode for\n Authentication – October 2016", "= mbed TLS 2.4.0 branch released 2016-10-17", "Security\n * Removed the MBEDTLS_SSL_AEAD_RANDOM_IV option, because it was not compliant\n with RFC-5116 and could lead to session key recovery in very long TLS\n sessions. \"Nonce-Disrespecting Adversaries Practical Forgery Attacks on GCM in\n TLS\" - H. Bock, A. Zauner, S. Devlin, J. Somorovsky, P. Jovanovic.\n https://eprint.iacr.org/2016/475.pdf\n * Fixed potential stack corruption in mbedtls_x509write_crt_der() and\n mbedtls_x509write_csr_der() when the signature is copied to the buffer\n without checking whether there is enough space in the destination. The\n issue cannot be triggered remotely. Found by Jethro Beekman.", "Features\n * Added support for CMAC for AES and 3DES and AES-CMAC-PRF-128, as defined by\n NIST SP 800-38B, RFC-4493 and RFC-4615.\n * Added hardware entropy selftest to verify that the hardware entropy source\n is functioning correctly.\n * Added a script to print build environment info for diagnostic use in test\n scripts, which is also now called by all.sh.\n * Added the macro MBEDTLS_X509_MAX_FILE_PATH_LEN that enables the user to\n configure the maximum length of a file path that can be buffered when\n calling mbedtls_x509_crt_parse_path().\n * Added a configuration file config-no-entropy.h that configures the subset of\n library features that do not require an entropy source.\n * Added the macro MBEDTLS_ENTROPY_MIN_HARDWARE in config.h. This allows users\n to configure the minimum number of bytes for entropy sources using the\n mbedtls_hardware_poll() function.", "Bugfix\n * Fix for platform time abstraction to avoid dependency issues where a build\n may need time but not the standard C library abstraction, and added\n configuration consistency checks to check_config.h\n * Fix dependency issue in Makefile to allow parallel builds.\n * Fix incorrect handling of block lengths in crypt_and_hash.c sample program,\n when GCM is used. Found by udf2457. #441\n * Fix for key exchanges based on ECDH-RSA or ECDH-ECDSA which weren't\n enabled unless others were also present. Found by David Fernandez. #428\n * Fix for out-of-tree builds using CMake. Found by jwurzer, and fix based on\n a contribution from Tobias Tangemann. #541\n * Fixed cert_app.c sample program for debug output and for use when no root\n certificates are provided.\n * Fix conditional statement that would cause a 1 byte overread in\n mbedtls_asn1_get_int(). Found and fixed by Guido Vranken. #599\n * Fixed pthread implementation to avoid unintended double initialisations\n and double frees. Found by Niklas Amnebratt.\n * Fixed the sample applications gen_key.c, cert_req.c and cert_write.c for\n builds where the configuration MBEDTLS_PEM_WRITE_C is not defined. Found\n by inestlerode. #559.\n * Fix mbedtls_x509_get_sig() to update the ASN1 type in the mbedtls_x509_buf\n data structure until after error checks are successful. Found by\n subramanyam-c. #622\n * Fix documentation and implementation missmatch for function arguments of\n mbedtls_gcm_finish(). Found by cmiatpaar. #602\n * Guarantee that P>Q at RSA key generation. Found by inestlerode. #558\n * Fix potential byte overread when verifying malformed SERVER_HELLO in\n ssl_parse_hello_verify_request() for DTLS. Found by Guido Vranken.\n * Fix check for validity of date when parsing in mbedtls_x509_get_time().\n Found by subramanyam-c. #626\n * Fix compatibility issue with Internet Explorer client authentication,\n where the limited hash choices prevented the client from sending its\n certificate. Found by teumas. #513\n * Fix compilation without MBEDTLS_SELF_TEST enabled.", "Changes\n * Extended test coverage of special cases, and added new timing test suite.\n * Removed self-tests from the basic-built-test.sh script, and added all\n missing self-tests to the test suites, to ensure self-tests are only\n executed once.\n * Added support for 3 and 4 byte lengths to mbedtls_asn1_write_len().\n * Added support for a Yotta specific configuration file -\n through the symbol YOTTA_CFG_MBEDTLS_TARGET_CONFIG_FILE.\n * Added optimization for code space for X.509/OID based on configured\n features. Contributed by Aviv Palivoda.\n * Renamed source file library/net.c to library/net_sockets.c to avoid\n naming collision in projects which also have files with the common name\n net.c. For consistency, the corresponding header file, net.h, is marked as\n deprecated, and its contents moved to net_sockets.h.\n * Changed the strategy for X.509 certificate parsing and validation, to no\n longer disregard certificates with unrecognised fields.", "= mbed TLS 2.3.0 branch released 2016-06-28", "Security\n * Fix missing padding length check in mbedtls_rsa_rsaes_pkcs1_v15_decrypt\n required by PKCS1 v2.2\n * Fix potential integer overflow to buffer overflow in\n mbedtls_rsa_rsaes_pkcs1_v15_encrypt and mbedtls_rsa_rsaes_oaep_encrypt\n (not triggerable remotely in (D)TLS).\n * Fix a potential integer underflow to buffer overread in \n mbedtls_rsa_rsaes_oaep_decrypt. It is not triggerable remotely in\n SSL/TLS.", "Features\n * Support for platform abstraction of the standard C library time()\n function.", "Bugfix\n * Fix bug in mbedtls_mpi_add_mpi() that caused wrong results when the three\n arguments where the same (in-place doubling). Found and fixed by Janos\n Follath. #309\n * Fix potential build failures related to the 'apidoc' target, introduced\n in the previous patch release. Found by Robert Scheck. #390 #391\n * Fix issue in Makefile that prevented building using armar. #386\n * Fix memory leak that occured only when ECJPAKE was enabled and ECDHE and\n ECDSA was disabled in config.h . The leak didn't occur by default.\n * Fix an issue that caused valid certificates to be rejected whenever an\n expired or not yet valid certificate was parsed before a valid certificate\n in the trusted certificate list.\n * Fix bug in mbedtls_x509_crt_parse that caused trailing extra data in the \n buffer after DER certificates to be included in the raw representation.\n * Fix issue that caused a hang when generating RSA keys of odd bitlength\n * Fix bug in mbedtls_rsa_rsaes_pkcs1_v15_encrypt that made null pointer\n dereference possible.\n * Fix issue that caused a crash if invalid curves were passed to\n mbedtls_ssl_conf_curves. #373\n * Fix issue in ssl_fork_server which was preventing it from functioning. #429\n * Fix memory leaks in test framework\n * Fix test in ssl-opt.sh that does not run properly with valgrind\n * Fix unchecked calls to mmbedtls_md_setup(). Fix by Brian Murray. #502", "Changes\n * On ARM platforms, when compiling with -O0 with GCC, Clang or armcc5,\n don't use the optimized assembly for bignum multiplication. This removes\n the need to pass -fomit-frame-pointer to avoid a build error with -O0.\n * Disabled SSLv3 in the default configuration.\n * Optimized mbedtls_mpi_zeroize() for MPI integer size. (Fix by Alexey\n Skalozub).\n * Fix non-compliance server extension handling. Extensions for SSLv3 are now\n ignored, as required by RFC6101.", "= mbed TLS 2.2.1 released 2016-01-05", "Security\n * Fix potential double free when mbedtls_asn1_store_named_data() fails to\n allocate memory. Only used for certificate generation, not triggerable\n remotely in SSL/TLS. Found by Rafał Przywara. #367\n * Disable MD5 handshake signatures in TLS 1.2 by default to prevent the\n SLOTH attack on TLS 1.2 server authentication (other attacks from the\n SLOTH paper do not apply to any version of mbed TLS or PolarSSL).\n https://www.mitls.org/pages/attacks/SLOTH", "Bugfix\n * Fix over-restrictive length limit in GCM. Found by Andreas-N. #362\n * Fix bug in certificate validation that caused valid chains to be rejected\n when the first intermediate certificate has pathLenConstraint=0. Found by\n Nicholas Wilson. Introduced in mbed TLS 2.2.0. #280\n * Removed potential leak in mbedtls_rsa_rsassa_pkcs1_v15_sign(), found by\n JayaraghavendranK. #372\n * Fix suboptimal handling of unexpected records that caused interop issues\n with some peers over unreliable links. Avoid dropping an entire DTLS\n datagram if a single record in a datagram is unexpected, instead only\n drop the record and look at subsequent records (if any are present) in\n the same datagram. Found by jeannotlapin. #345", "= mbed TLS 2.2.0 released 2015-11-04", "Security\n * Fix potential double free if mbedtls_ssl_conf_psk() is called more than\n once and some allocation fails. Cannot be forced remotely. Found by Guido\n Vranken, Intelworks.\n * Fix potential heap corruption on Windows when\n mbedtls_x509_crt_parse_path() is passed a path longer than 2GB. Cannot be\n triggered remotely. Found by Guido Vranken, Intelworks.\n * Fix potential buffer overflow in some asn1_write_xxx() functions.\n Cannot be triggered remotely unless you create X.509 certificates based\n on untrusted input or write keys of untrusted origin. Found by Guido\n Vranken, Intelworks.\n * The X509 max_pathlen constraint was not enforced on intermediate\n certificates. Found by Nicholas Wilson, fix and tests provided by\n Janos Follath. #280 and #319", "Features\n * Experimental support for EC J-PAKE as defined in Thread 1.0.0.\n Disabled by default as the specification might still change.\n * Added a key extraction callback to accees the master secret and key\n block. (Potential uses include EAP-TLS and Thread.)", "Bugfix\n * Self-signed certificates were not excluded from pathlen counting,\n resulting in some valid X.509 being incorrectly rejected. Found and fix\n provided by Janos Follath. #319\n * Fix build error with configurations where ECDHE-PSK is the only key\n exchange. Found and fix provided by Chris Hammond. #270\n * Fix build error with configurations where RSA, RSA-PSK, ECDH-RSA or\n ECHD-ECDSA if the only key exchange. Multiple reports. #310\n * Fixed a bug causing some handshakes to fail due to some non-fatal alerts\n not being properly ignored. Found by mancha and Kasom Koht-arsa, #308\n * mbedtls_x509_crt_verify(_with_profile)() now also checks the key type and\n size/curve against the profile. Before that, there was no way to set a\n minimum key size for end-entity certificates with RSA keys. Found by\n Matthew Page of Scannex Electronics Ltd.\n * Fix failures in MPI on Sparc(64) due to use of bad assembly code.\n Found by Kurt Danielson. #292\n * Fix typo in name of the extKeyUsage OID. Found by inestlerode, #314\n * Fix bug in ASN.1 encoding of booleans that caused generated CA\n certificates to be rejected by some applications, including OS X\n Keychain. Found and fixed by Jonathan Leroy, Inikup.", "Changes\n * Improved performance of mbedtls_ecp_muladd() when one of the scalars is 1\n or -1.", "= mbed TLS 2.1.2 released 2015-10-06", "Security\n * Added fix for CVE-2015-5291 to prevent heap corruption due to buffer\n overflow of the hostname or session ticket. Found by Guido Vranken,\n Intelworks.\n * Fix potential double-free if mbedtls_ssl_set_hs_psk() is called more than\n once in the same handhake and mbedtls_ssl_conf_psk() was used.\n Found and patch provided by Guido Vranken, Intelworks. Cannot be forced\n remotely.\n * Fix stack buffer overflow in pkcs12 decryption (used by\n mbedtls_pk_parse_key(file)() when the password is > 129 bytes.\n Found by Guido Vranken, Intelworks. Not triggerable remotely.\n * Fix potential buffer overflow in mbedtls_mpi_read_string().\n Found by Guido Vranken, Intelworks. Not exploitable remotely in the context\n of TLS, but might be in other uses. On 32 bit machines, requires reading a\n string of close to or larger than 1GB to exploit; on 64 bit machines, would\n require reading a string of close to or larger than 2^62 bytes.\n * Fix potential random memory allocation in mbedtls_pem_read_buffer()\n on crafted PEM input data. Found and fix provided by Guido Vranken,\n Intelworks. Not triggerable remotely in TLS. Triggerable remotely if you\n accept PEM data from an untrusted source.\n * Fix possible heap buffer overflow in base64_encoded() when the input\n buffer is 512MB or larger on 32-bit platforms. Found by Guido Vranken,\n Intelworks. Not trigerrable remotely in TLS.\n * Fix potential double-free if mbedtls_conf_psk() is called repeatedly on\n the same mbedtls_ssl_config object and memory allocation fails. Found by\n Guido Vranken, Intelworks. Cannot be forced remotely.\n * Fix potential heap buffer overflow in servers that perform client\n authentication against a crafted CA cert. Cannot be triggered remotely\n unless you allow third parties to pick trust CAs for client auth.\n Found by Guido Vranken, Intelworks.", "Bugfix\n * Fix compile error in net.c with musl libc. Found and patch provided by\n zhasha (#278).\n * Fix macroization of 'inline' keyword when building as C++. (#279)", "Changes\n * Added checking of hostname length in mbedtls_ssl_set_hostname() to ensure\n domain names are compliant with RFC 1035.\n * Fixed paths for check_config.h in example config files. (Found by bachp)\n (#291)", "= mbed TLS 2.1.1 released 2015-09-17", "Security\n * Add countermeasure against Lenstra's RSA-CRT attack for PKCS#1 v1.5\n signatures. (Found by Florian Weimer, Red Hat.)\n https://securityblog.redhat.com/2015/09/02/factoring-rsa-keys-with-tls-perfect-forward-secrecy/\n * Fix possible client-side NULL pointer dereference (read) when the client\n tries to continue the handshake after it failed (a misuse of the API).\n (Found and patch provided by Fabian Foerg, Gotham Digital Science using\n afl-fuzz.)", "Bugfix\n * Fix warning when using a 64bit platform. (found by embedthis) (#275)\n * Fix off-by-one error in parsing Supported Point Format extension that\n caused some handshakes to fail.", "Changes\n * Made X509 profile pointer const in mbedtls_ssl_conf_cert_profile() to allow\n use of mbedtls_x509_crt_profile_next. (found by NWilson)\n * When a client initiates a reconnect from the same port as a live\n connection, if cookie verification is available\n (MBEDTLS_SSL_DTLS_HELLO_VERIFY defined in config.h, and usable cookie\n callbacks set with mbedtls_ssl_conf_dtls_cookies()), this will be\n detected and mbedtls_ssl_read() will return\n MBEDTLS_ERR_SSL_CLIENT_RECONNECT - it is then possible to start a new\n handshake with the same context. (See RFC 6347 section 4.2.8.)", "= mbed TLS 2.1.0 released 2015-09-04", "Features\n * Added support for yotta as a build system.\n * Primary open source license changed to Apache 2.0 license.", "Bugfix\n * Fix segfault in the benchmark program when benchmarking DHM.\n * Fix build error with CMake and pre-4.5 versions of GCC (found by Hugo\n Leisink).\n * Fix bug when parsing a ServerHello without extensions (found by David\n Sears).\n * Fix bug in CMake lists that caused libmbedcrypto.a not to be installed\n (found by Benoit Lecocq).\n * Fix bug in Makefile that caused libmbedcrypto and libmbedx509 not to be\n installed (found by Rawi666).\n * Fix compile error with armcc 5 with --gnu option.\n * Fix bug in Makefile that caused programs not to be installed correctly\n (found by robotanarchy) (#232).\n * Fix bug in Makefile that prevented from installing without building the\n tests (found by robotanarchy) (#232).\n * Fix missing -static-libgcc when building shared libraries for Windows\n with make.\n * Fix link error when building shared libraries for Windows with make.\n * Fix error when loading libmbedtls.so.\n * Fix bug in mbedtls_ssl_conf_default() that caused the default preset to\n be always used (found by dcb314) (#235)\n * Fix bug in mbedtls_rsa_public() and mbedtls_rsa_private() that could\n result trying to unlock an unlocked mutex on invalid input (found by\n Fredrik Axelsson) (#257)\n * Fix -Wshadow warnings (found by hnrkp) (#240)\n * Fix memory corruption on client with overlong PSK identity, around\n SSL_MAX_CONTENT_LEN or higher - not triggerrable remotely (found by\n Aleksandrs Saveljevs) (#238)\n * Fix unused function warning when using MBEDTLS_MDx_ALT or\n MBEDTLS_SHAxxx_ALT (found by Henrik) (#239)\n * Fix memory corruption in pkey programs (found by yankuncheng) (#210)", "Changes\n * The PEM parser now accepts a trailing space at end of lines (#226).\n * It is now possible to #include a user-provided configuration file at the\n end of the default config.h by defining MBEDTLS_USER_CONFIG_FILE on the\n compiler's command line.\n * When verifying a certificate chain, if an intermediate certificate is\n trusted, no later cert is checked. (suggested by hannes-landeholm)\n (#220).\n * Prepend a \"thread identifier\" to debug messages (issue pointed out by\n Hugo Leisink) (#210).\n * Add mbedtls_ssl_get_max_frag_len() to query the current maximum fragment\n length.", "= mbed TLS 2.0.0 released 2015-07-13", "Features\n * Support for DTLS 1.0 and 1.2 (RFC 6347).\n * Ability to override core functions from MDx, SHAx, AES and DES modules\n with custom implementation (eg hardware accelerated), complementing the\n ability to override the whole module.\n * New server-side implementation of session tickets that rotate keys to\n preserve forward secrecy, and allows sharing across multiple contexts.\n * Added a concept of X.509 cerificate verification profile that controls\n which algorithms and key sizes (curves for ECDSA) are acceptable.\n * Expanded configurability of security parameters in the SSL module with\n mbedtls_ssl_conf_dhm_min_bitlen() and mbedtls_ssl_conf_sig_hashes().\n * Introduced a concept of presets for SSL security-relevant configuration\n parameters.", "API Changes\n * The library has been split into libmbedcrypto, libmbedx509, libmbedtls.\n You now need to link to all of them if you use TLS for example.\n * All public identifiers moved to the mbedtls_* or MBEDTLS_* namespace.\n Some names have been further changed to make them more consistent.\n Migration helpers scripts/rename.pl and include/mbedlts/compat-1.3.h are\n provided. Full list of renamings in scripts/data_files/rename-1.3-2.0.txt\n * Renamings of fields inside structures, not covered by the previous list:\n mbedtls_cipher_info_t.key_length -> key_bitlen\n mbedtls_cipher_context_t.key_length -> key_bitlen\n mbedtls_ecp_curve_info.size -> bit_size\n * Headers are now found in the 'mbedtls' directory (previously 'polarssl').\n * The following _init() functions that could return errors have\n been split into an _init() that returns void and another function that\n should generally be the first function called on this context after init:\n mbedtls_ssl_init() -> mbedtls_ssl_setup()\n mbedtls_ccm_init() -> mbedtls_ccm_setkey()\n mbedtls_gcm_init() -> mbedtls_gcm_setkey()\n mbedtls_hmac_drbg_init() -> mbedtls_hmac_drbg_seed(_buf)()\n mbedtls_ctr_drbg_init() -> mbedtls_ctr_drbg_seed()\n Note that for mbedtls_ssl_setup(), you need to be done setting up the\n ssl_config structure before calling it.\n * Most ssl_set_xxx() functions (all except ssl_set_bio(), ssl_set_hostname(),\n ssl_set_session() and ssl_set_client_transport_id(), plus\n ssl_legacy_renegotiation()) have been renamed to mbedtls_ssl_conf_xxx()\n (see rename.pl and compat-1.3.h above) and their first argument's type\n changed from ssl_context to ssl_config.\n * ssl_set_bio() changed signature (contexts merged, order switched, one\n additional callback for read-with-timeout).\n * The following functions have been introduced and must be used in callback\n implementations (SNI, PSK) instead of their *conf counterparts:\n mbedtls_ssl_set_hs_own_cert()\n mbedtls_ssl_set_hs_ca_chain()\n mbedtls_ssl_set_hs_psk()\n * mbedtls_ssl_conf_ca_chain() lost its last argument (peer_cn), now set\n using mbedtls_ssl_set_hostname().\n * mbedtls_ssl_conf_session_cache() changed prototype (only one context\n pointer, parameters reordered).\n * On server, mbedtls_ssl_conf_session_tickets_cb() must now be used in\n place of mbedtls_ssl_conf_session_tickets() to enable session tickets.\n * The SSL debug callback gained two new arguments (file name, line number).\n * Debug modes were removed.\n * mbedtls_ssl_conf_truncated_hmac() now returns void.\n * mbedtls_memory_buffer_alloc_init() now returns void.\n * X.509 verification flags are now an uint32_t. Affect the signature of:\n mbedtls_ssl_get_verify_result()\n mbedtls_x509_ctr_verify_info()\n mbedtls_x509_crt_verify() (flags, f_vrfy -> needs to be updated)\n mbedtls_ssl_conf_verify() (f_vrfy -> needs to be updated)\n * The following functions changed prototype to avoid an in-out length\n parameter:\n mbedtls_base64_encode()\n mbedtls_base64_decode()\n mbedtls_mpi_write_string()\n mbedtls_dhm_calc_secret()\n * In the NET module, all \"int\" and \"int *\" arguments for file descriptors\n changed type to \"mbedtls_net_context *\".\n * net_accept() gained new arguments for the size of the client_ip buffer.\n * In the threading layer, mbedtls_mutex_init() and mbedtls_mutex_free() now\n return void.\n * ecdsa_write_signature() gained an addtional md_alg argument and\n ecdsa_write_signature_det() was deprecated.\n * pk_sign() no longer accepts md_alg == POLARSSL_MD_NONE with ECDSA.\n * Last argument of x509_crt_check_key_usage() and\n mbedtls_x509write_crt_set_key_usage() changed from int to unsigned.\n * test_ca_list (from certs.h) is renamed to test_cas_pem and is only\n available if POLARSSL_PEM_PARSE_C is defined (it never worked without).\n * Test certificates in certs.c are no longer guaranteed to be nul-terminated\n strings; use the new *_len variables instead of strlen().\n * Functions mbedtls_x509_xxx_parse(), mbedtls_pk_parse_key(),\n mbedtls_pk_parse_public_key() and mbedtls_dhm_parse_dhm() now expect the\n length parameter to include the terminating null byte for PEM input.\n * Signature of mpi_mul_mpi() changed to make the last argument unsigned\n * calloc() is now used instead of malloc() everywhere. API of platform\n layer and the memory_buffer_alloc module changed accordingly.\n (Thanks to Mansour Moufid for helping with the replacement.)\n * Change SSL_DISABLE_RENEGOTIATION config.h flag to SSL_RENEGOTIATION\n (support for renegotiation now needs explicit enabling in config.h).\n * Split MBEDTLS_HAVE_TIME into MBEDTLS_HAVE_TIME and MBEDTLS_HAVE_TIME_DATE\n in config.h\n * net_connect() and net_bind() have a new 'proto' argument to choose\n between TCP and UDP, using the macros NET_PROTO_TCP or NET_PROTO_UDP.\n Their 'port' argument type is changed to a string.\n * Some constness fixes", "Removals\n * Removed mbedtls_ecp_group_read_string(). Only named groups are supported.\n * Removed mbedtls_ecp_sub() and mbedtls_ecp_add(), use\n mbedtls_ecp_muladd().\n * Removed individual mdX_hmac, shaX_hmac, mdX_file and shaX_file functions\n (use generic functions from md.h)\n * Removed mbedtls_timing_msleep(). Use mbedtls_net_usleep() or a custom\n waiting function.\n * Removed test DHM parameters from the test certs module.\n * Removed the PBKDF2 module (use PKCS5).\n * Removed POLARSSL_ERROR_STRERROR_BC (use mbedtls_strerror()).\n * Removed compat-1.2.h (helper for migrating from 1.2 to 1.3).\n * Removed openssl.h (very partial OpenSSL compatibility layer).\n * Configuration options POLARSSL_HAVE_LONGLONG was removed (now always on).\n * Configuration options POLARSSL_HAVE_INT8 and POLARSSL_HAVE_INT16 have\n been removed (compiler is required to support 32-bit operations).\n * Configuration option POLARSSL_HAVE_IPV6 was removed (always enabled).\n * Removed test program o_p_test, the script compat.sh does more.\n * Removed test program ssl_test, superseded by ssl-opt.sh.\n * Removed helper script active-config.pl", "New deprecations\n * md_init_ctx() is deprecated in favour of md_setup(), that adds a third\n argument (allowing memory savings if HMAC is not used)", "Semi-API changes (technically public, morally private)\n * Renamed a few headers to include _internal in the name. Those headers are\n not supposed to be included by users.\n * Changed md_info_t into an opaque structure (use md_get_xxx() accessors).\n * Changed pk_info_t into an opaque structure.\n * Changed cipher_base_t into an opaque structure.\n * Removed sig_oid2 and rename sig_oid1 to sig_oid in x509_crt and x509_crl.\n * x509_crt.key_usage changed from unsigned char to unsigned int.\n * Removed r and s from ecdsa_context\n * Removed mode from des_context and des3_context", "Default behavior changes\n * The default minimum TLS version is now TLS 1.0.\n * RC4 is now blacklisted by default in the SSL/TLS layer, and excluded from the\n default ciphersuite list returned by ssl_list_ciphersuites()\n * Support for receiving SSLv2 ClientHello is now disabled by default at\n compile time.\n * The default authmode for SSL/TLS clients is now REQUIRED.\n * Support for RSA_ALT contexts in the PK layer is now optional. Since is is\n enabled in the default configuration, this is only noticeable if using a\n custom config.h\n * Default DHM parameters server-side upgraded from 1024 to 2048 bits.\n * A minimum RSA key size of 2048 bits is now enforced during ceritificate\n chain verification.\n * Negotiation of truncated HMAC is now disabled by default on server too.\n * The following functions are now case-sensitive:\n mbedtls_cipher_info_from_string()\n mbedtls_ecp_curve_info_from_name()\n mbedtls_md_info_from_string()\n mbedtls_ssl_ciphersuite_from_string()\n mbedtls_version_check_feature()", "Requirement changes\n * The minimum MSVC version required is now 2010 (better C99 support).\n * The NET layer now unconditionnaly relies on getaddrinfo() and select().\n * Compiler is required to support C99 types such as long long and uint32_t.", "API changes from the 1.4 preview branch\n * ssl_set_bio_timeout() was removed, split into mbedtls_ssl_set_bio() with\n new prototype, and mbedtls_ssl_set_read_timeout().\n * The following functions now return void:\n mbedtls_ssl_conf_transport()\n mbedtls_ssl_conf_max_version()\n mbedtls_ssl_conf_min_version()\n * DTLS no longer hard-depends on TIMING_C, but uses a callback interface\n instead, see mbedtls_ssl_set_timer_cb(), with the Timing module providing\n an example implementation, see mbedtls_timing_delay_context and\n mbedtls_timing_set/get_delay().\n * With UDP sockets, it is no longer necessary to call net_bind() again\n after a successful net_accept().", "Changes\n * mbedtls_ctr_drbg_random() and mbedtls_hmac_drbg_random() are now\n thread-safe if MBEDTLS_THREADING_C is enabled.\n * Reduced ROM fooprint of SHA-256 and added an option to reduce it even\n more (at the expense of performance) MBEDTLS_SHA256_SMALLER.", "= mbed TLS 1.3 branch", "Security\n * With authmode set to SSL_VERIFY_OPTIONAL, verification of keyUsage and\n extendedKeyUsage on the leaf certificate was lost (results not accessible\n via ssl_get_verify_results()).\n * Add countermeasure against \"Lucky 13 strikes back\" cache-based attack,\n https://dl.acm.org/citation.cfm?id=2714625", "Features\n * Improve ECC performance by using more efficient doubling formulas\n (contributed by Peter Dettman).\n * Add x509_crt_verify_info() to display certificate verification results.\n * Add support for reading DH parameters with privateValueLength included\n (contributed by Daniel Kahn Gillmor).\n * Add support for bit strings in X.509 names (request by Fredrik Axelsson).\n * Add support for id-at-uniqueIdentifier in X.509 names.\n * Add support for overriding snprintf() (except on Windows) and exit() in\n the platform layer.\n * Add an option to use macros instead of function pointers in the platform\n layer (helps get rid of unwanted references).\n * Improved Makefiles for Windows targets by fixing library targets and making\n cross-compilation easier (thanks to Alon Bar-Lev).\n * The benchmark program also prints heap usage for public-key primitives\n if POLARSSL_MEMORY_BUFFER_ALLOC_C and POLARSSL_MEMORY_DEBUG are defined.\n * New script ecc-heap.sh helps measuring the impact of ECC parameters on\n speed and RAM (heap only for now) usage.\n * New script memory.sh helps measuring the ROM and RAM requirements of two\n reduced configurations (PSK-CCM and NSA suite B).\n * Add config flag POLARSSL_DEPRECATED_WARNING (off by default) to produce\n warnings on use of deprecated functions (with GCC and Clang only).\n * Add config flag POLARSSL_DEPRECATED_REMOVED (off by default) to produce\n errors on use of deprecated functions.", "Bugfix\n * Fix compile errors with PLATFORM_NO_STD_FUNCTIONS.\n * Fix compile error with PLATFORM_EXIT_ALT (thanks to Rafał Przywara).\n * Fix bug in entropy.c when THREADING_C is also enabled that caused\n entropy_free() to crash (thanks to Rafał Przywara).\n * Fix memory leak when gcm_setkey() and ccm_setkey() are used more than\n once on the same context.\n * Fix bug in ssl_mail_client when password is longer that username (found\n by Bruno Pape).\n * Fix undefined behaviour (memcmp( NULL, NULL, 0 );) in X.509 modules\n (detected by Clang's 3.6 UBSan).\n * mpi_size() and mpi_msb() would segfault when called on an mpi that is\n initialized but not set (found by pravic).\n * Fix detection of support for getrandom() on Linux (reported by syzzer) by\n doing it at runtime (using uname) rather that compile time.\n * Fix handling of symlinks by \"make install\" (found by Gaël PORTAY).\n * Fix potential NULL pointer dereference (not trigerrable remotely) when\n ssl_write() is called before the handshake is finished (introduced in\n 1.3.10) (first reported by Martin Blumenstingl).\n * Fix bug in pk_parse_key() that caused some valid private EC keys to be\n rejected.\n * Fix bug in Via Padlock support (found by Nikos Mavrogiannopoulos).\n * Fix thread safety bug in RSA operations (found by Fredrik Axelsson).\n * Fix hardclock() (only used in the benchmarking program) with some\n versions of mingw64 (found by kxjhlele).\n * Fix warnings from mingw64 in timing.c (found by kxjklele).\n * Fix potential unintended sign extension in asn1_get_len() on 64-bit\n platforms.\n * Fix potential memory leak in ssl_set_psk() (found by Mansour Moufid).\n * Fix compile error when POLARSSL_SSL_DISABLE_RENEGOTATION and\n POLARSSL_SSL_SSESSION_TICKETS where both enabled in config.h (introduced\n in 1.3.10).\n * Add missing extern \"C\" guard in aesni.h (reported by amir zamani).\n * Add missing dependency on SHA-256 in some x509 programs (reported by\n Gergely Budai).\n * Fix bug related to ssl_set_curves(): the client didn't check that the\n curve picked by the server was actually allowed.", "Changes\n * Remove bias in mpi_gen_prime (contributed by Pascal Junod).\n * Remove potential sources of timing variations (some contributed by Pascal\n Junod).\n * Options POLARSSL_HAVE_INT8 and POLARSSL_HAVE_INT16 are deprecated.\n * Enabling POLARSSL_NET_C without POLARSSL_HAVE_IPV6 is deprecated.\n * compat-1.2.h and openssl.h are deprecated.\n * Adjusting/overriding CFLAGS and LDFLAGS with the make build system is now\n more flexible (warning: OFLAGS is not used any more) (see the README)\n (contributed by Alon Bar-Lev).\n * ssl_set_own_cert() no longer calls pk_check_pair() since the\n performance impact was bad for some users (this was introduced in 1.3.10).\n * Move from SHA-1 to SHA-256 in example programs using signatures\n (suggested by Thorsten Mühlfelder).\n * Remove some unneeded inclusions of header files from the standard library\n \"minimize\" others (eg use stddef.h if only size_t is needed).\n * Change #include lines in test files to use double quotes instead of angle\n brackets for uniformity with the rest of the code.\n * Remove dependency on sscanf() in X.509 parsing modules.", "= mbed TLS 1.3.10 released 2015-02-09\nSecurity\n * NULL pointer dereference in the buffer-based allocator when the buffer is\n full and polarssl_free() is called (found by Mark Hasemeyer)\n (only possible if POLARSSL_MEMORY_BUFFER_ALLOC_C is enabled, which it is\n not by default).\n * Fix remotely-triggerable uninitialised pointer dereference caused by\n crafted X.509 certificate (TLS server is not affected if it doesn't ask for a\n client certificate) (found using Codenomicon Defensics).\n * Fix remotely-triggerable memory leak caused by crafted X.509 certificates\n (TLS server is not affected if it doesn't ask for a client certificate)\n (found using Codenomicon Defensics).\n * Fix potential stack overflow while parsing crafted X.509 certificates\n (TLS server is not affected if it doesn't ask for a client certificate)\n (found using Codenomicon Defensics).\n * Fix timing difference that could theoretically lead to a\n Bleichenbacher-style attack in the RSA and RSA-PSK key exchanges\n (reported by Sebastian Schinzel).", "Features\n * Add support for FALLBACK_SCSV (draft-ietf-tls-downgrade-scsv).\n * Add support for Extended Master Secret (draft-ietf-tls-session-hash).\n * Add support for Encrypt-then-MAC (RFC 7366).\n * Add function pk_check_pair() to test if public and private keys match.\n * Add x509_crl_parse_der().\n * Add compile-time option POLARSSL_X509_MAX_INTERMEDIATE_CA to limit the\n length of an X.509 verification chain.\n * Support for renegotiation can now be disabled at compile-time\n * Support for 1/n-1 record splitting, a countermeasure against BEAST.\n * Certificate selection based on signature hash, preferring SHA-1 over SHA-2\n for pre-1.2 clients when multiple certificates are available.\n * Add support for getrandom() syscall on recent Linux kernels with Glibc or\n a compatible enough libc (eg uClibc).\n * Add ssl_set_arc4_support() to make it easier to disable RC4 at runtime\n while using the default ciphersuite list.\n * Added new error codes and debug messages about selection of\n ciphersuite/certificate.", "Bugfix\n * Stack buffer overflow if ctr_drbg_update() is called with too large\n add_len (found by Jean-Philippe Aumasson) (not triggerable remotely).\n * Possible buffer overflow of length at most POLARSSL_MEMORY_ALIGN_MULTIPLE\n if memory_buffer_alloc_init() was called with buf not aligned and len not\n a multiple of POLARSSL_MEMORY_ALIGN_MULTIPLE (not triggerable remotely).\n * User set CFLAGS were ignored by Cmake with gcc (introduced in 1.3.9, found\n by Julian Ospald).\n * Fix potential undefined behaviour in Camellia.\n * Fix potential failure in ECDSA signatures when POLARSSL_ECP_MAX_BITS is a\n multiple of 8 (found by Gergely Budai).\n * Fix unchecked return code in x509_crt_parse_path() on Windows (found by\n Peter Vaskovic).\n * Fix assembly selection for MIPS64 (thanks to James Cowgill).\n * ssl_get_verify_result() now works even if the handshake was aborted due\n to a failed verification (found by Fredrik Axelsson).\n * Skip writing and parsing signature_algorithm extension if none of the\n key exchanges enabled needs certificates. This fixes a possible interop\n issue with some servers when a zero-length extension was sent. (Reported\n by Peter Dettman.)\n * On a 0-length input, base64_encode() did not correctly set output length\n (found by Hendrik van den Boogaard).", "Changes\n * Use deterministic nonces for AEAD ciphers in TLS by default (possible to\n switch back to random with POLARSSL_SSL_AEAD_RANDOM_IV in config.h).\n * Blind RSA private operations even when POLARSSL_RSA_NO_CRT is defined.\n * ssl_set_own_cert() now returns an error on key-certificate mismatch.\n * Forbid repeated extensions in X.509 certificates.\n * debug_print_buf() now prints a text view in addition to hexadecimal.\n * A specific error is now returned when there are ciphersuites in common\n but none of them is usable due to external factors such as no certificate\n with a suitable (extended)KeyUsage or curve or no PSK set.\n * It is now possible to disable negotiation of truncated HMAC server-side\n at runtime with ssl_set_truncated_hmac().\n * Example programs for SSL client and server now disable SSLv3 by default.\n * Example programs for SSL client and server now disable RC4 by default.\n * Use platform.h in all test suites and programs.", "= PolarSSL 1.3.9 released 2014-10-20\nSecurity\n * Lowest common hash was selected from signature_algorithms extension in\n TLS 1.2 (found by Darren Bane) (introduced in 1.3.8).\n * Remotely-triggerable memory leak when parsing some X.509 certificates\n (server is not affected if it doesn't ask for a client certificate)\n (found using Codenomicon Defensics).\n * Remotely-triggerable memory leak when parsing crafted ClientHello\n (not affected if ECC support was compiled out) (found using Codenomicon\n Defensics).", "Bugfix\n * Support escaping of commas in x509_string_to_names()\n * Fix compile error in ssl_pthread_server (found by Julian Ospald).\n * Fix net_accept() regarding non-blocking sockets (found by Luca Pesce).\n * Don't print uninitialised buffer in ssl_mail_client (found by Marc Abel).\n * Fix warnings from Clang's scan-build (contributed by Alfred Klomp).\n * Fix compile error in timing.c when POLARSSL_NET_C and POLARSSL_SELFTEST\n are defined but not POLARSSL_HAVE_TIME (found by Stephane Di Vito).\n * Remove non-existent file from VS projects (found by Peter Vaskovic).\n * ssl_read() could return non-application data records on server while\n renegotation was pending, and on client when a HelloRequest was received.\n * Server-initiated renegotiation would fail with non-blocking I/O if the\n write callback returned WANT_WRITE when requesting renegotiation.\n * ssl_close_notify() could send more than one message in some circumstances\n with non-blocking I/O.\n * Fix compiler warnings on iOS (found by Sander Niemeijer).\n * x509_crt_parse() did not increase total_failed on PEM error\n * Fix compile error with armcc in mpi_is_prime()\n * Fix potential bad read in parsing ServerHello (found by Adrien\n Vialletelle).", "Changes\n * Ciphersuites using SHA-256 or SHA-384 now require TLS 1.x (there is no\n standard defining how to use SHA-2 with SSL 3.0).\n * Ciphersuites using RSA-PSK key exchange new require TLS 1.x (the spec is\n ambiguous on how to encode some packets with SSL 3.0).\n * Made buffer size in pk_write_(pub)key_pem() more dynamic, eg smaller if\n RSA is disabled, larger if POLARSSL_MPI_MAX_SIZE is larger.\n * ssl_read() now returns POLARSSL_ERR_NET_WANT_READ rather than\n POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE on harmless alerts.\n * POLARSSL_MPI_MAX_SIZE now defaults to 1024 in order to allow 8192 bits\n RSA keys.\n * Accept spaces at end of line or end of buffer in base64_decode().\n * X.509 certificates with more than one AttributeTypeAndValue per\n RelativeDistinguishedName are not accepted any more.", "= PolarSSL 1.3.8 released 2014-07-11\nSecurity\n * Fix length checking for AEAD ciphersuites (found by Codenomicon).\n It was possible to crash the server (and client) using crafted messages\n when a GCM suite was chosen.", "Features\n * Add CCM module and cipher mode to Cipher Layer\n * Support for CCM and CCM_8 ciphersuites\n * Support for parsing and verifying RSASSA-PSS signatures in the X.509\n modules (certificates, CRLs and CSRs).\n * Blowfish in the cipher layer now supports variable length keys.\n * Add example config.h for PSK with CCM, optimized for low RAM usage.\n * Optimize for RAM usage in example config.h for NSA Suite B profile.\n * Add POLARSSL_REMOVE_ARC4_CIPHERSUITES to allow removing RC4 ciphersuites\n from the default list (inactive by default).\n * Add server-side enforcement of sent renegotiation requests\n (ssl_set_renegotiation_enforced())\n * Add SSL_CIPHERSUITES config.h flag to allow specifying a list of\n ciphersuites to use and save some memory if the list is small.", "Changes\n * Add LINK_WITH_PTHREAD option in CMake for explicit linking that is\n required on some platforms (e.g. OpenBSD)\n * Migrate zeroizing of data to polarssl_zeroize() instead of memset()\n against unwanted compiler optimizations\n * md_list() now returns hashes strongest first\n * Selection of hash for signing ServerKeyExchange in TLS 1.2 now picks\n strongest offered by client.\n * All public contexts have _init() and _free() functions now for simpler\n usage pattern", "Bugfix\n * Fix in debug_print_msg()\n * Enforce alignment in the buffer allocator even if buffer is not aligned\n * Remove less-than-zero checks on unsigned numbers\n * Stricter check on SSL ClientHello internal sizes compared to actual packet\n size (found by TrustInSoft)\n * Fix WSAStartup() return value check (found by Peter Vaskovic)\n * Other minor issues (found by Peter Vaskovic)\n * Fix symlink command for cross compiling with CMake (found by Andre\n Heinecke)\n * Fix DER output of gen_key app (found by Gergely Budai)\n * Very small records were incorrectly rejected when truncated HMAC was in\n use with some ciphersuites and versions (RC4 in all versions, CBC with\n versions < TLS 1.1).\n * Very large records using more than 224 bytes of padding were incorrectly\n rejected with CBC-based ciphersuites and TLS >= 1.1\n * Very large records using less padding could cause a buffer overread of up\n to 32 bytes with CBC-based ciphersuites and TLS >= 1.1\n * Restore ability to use a v1 cert as a CA if trusted locally. (This had\n been removed in 1.3.6.)\n * Restore ability to locally trust a self-signed cert that is not a proper\n CA for use as an end entity certificate. (This had been removed in\n 1.3.6.)\n * Fix preprocessor checks for bn_mul PPC asm (found by Barry K. Nathan).\n * Use \\n\\t rather than semicolons for bn_mul asm, since some assemblers\n interpret semicolons as comment delimiters (found by Barry K. Nathan).\n * Fix off-by-one error in parsing Supported Point Format extension that\n caused some handshakes to fail.\n * Fix possible miscomputation of the premaster secret with DHE-PSK key\n exchange that caused some handshakes to fail with other implementations.\n (Failure rate <= 1/255 with common DHM moduli.)\n * Disable broken Sparc64 bn_mul assembly (found by Florian Obser).\n * Fix base64_decode() to return and check length correctly (in case of\n tight buffers)\n * Fix mpi_write_string() to write \"00\" as hex output for empty MPI (found\n by Hui Dong)", "= PolarSSL 1.3.7 released on 2014-05-02\nFeatures\n * debug_set_log_mode() added to determine raw or full logging\n * debug_set_threshold() added to ignore messages over threshold level\n * version_check_feature() added to check for compile-time options at\n run-time", "Changes\n * POLARSSL_CONFIG_OPTIONS has been removed. All values are individually\n checked and filled in the relevant module headers\n * Debug module only outputs full lines instead of parts\n * Better support for the different Attribute Types from IETF PKIX (RFC 5280)\n * AES-NI now compiles with \"old\" assemblers too\n * Ciphersuites based on RC4 now have the lowest priority by default", "Bugfix\n * Only iterate over actual certificates in ssl_write_certificate_request()\n (found by Matthew Page)\n * Typos in platform.c and pkcs11.c (found by Daniel Phillips and Steffan\n Karger)\n * cert_write app should use subject of issuer certificate as issuer of cert\n * Fix false reject in padding check in ssl_decrypt_buf() for CBC\n ciphersuites, for full SSL frames of data.\n * Improve interoperability by not writing extension length in ClientHello /\n ServerHello when no extensions are present (found by Matthew Page)\n * rsa_check_pubkey() now allows an E up to N\n * On OpenBSD, use arc4random_buf() instead of rand() to prevent warnings\n * mpi_fill_random() was creating numbers larger than requested on\n big-endian platform when size was not an integer number of limbs\n * Fix dependencies issues in X.509 test suite.\n * Some parts of ssl_tls.c were compiled even when the module was disabled.\n * Fix detection of DragonflyBSD in net.c (found by Markus Pfeiffer)\n * Fix detection of Clang on some Apple platforms with CMake\n (found by Barry K. Nathan)", "= PolarSSL 1.3.6 released on 2014-04-11", "Features\n * Support for the ALPN SSL extension\n * Add option 'use_dev_random' to gen_key application\n * Enable verification of the keyUsage extension for CA and leaf\n certificates (POLARSSL_X509_CHECK_KEY_USAGE)\n * Enable verification of the extendedKeyUsage extension\n (POLARSSL_X509_CHECK_EXTENDED_KEY_USAGE)", "Changes\n * x509_crt_info() now prints information about parsed extensions as well\n * pk_verify() now returns a specific error code when the signature is valid\n but shorter than the supplied length.\n * Use UTC time to check certificate validity.\n * Reject certificates with times not in UTC, per RFC 5280.", "Security\n * Avoid potential timing leak in ecdsa_sign() by blinding modular division.\n (Found by Watson Ladd.)\n * The notAfter date of some certificates was no longer checked since 1.3.5.\n This affects certificates in the user-supplied chain except the top\n certificate. If the user-supplied chain contains only one certificates,\n it is not affected (ie, its notAfter date is properly checked).\n * Prevent potential NULL pointer dereference in ssl_read_record() (found by\n TrustInSoft)", "Bugfix\n * The length of various ClientKeyExchange messages was not properly checked.\n * Some example server programs were not sending the close_notify alert.\n * Potential memory leak in mpi_exp_mod() when error occurs during\n calculation of RR.\n * Fixed malloc/free default #define in platform.c (found by Gergely Budai).\n * Fixed type which made POLARSSL_ENTROPY_FORCE_SHA256 uneffective (found by\n Gergely Budai).\n * Fix #include path in ecdsa.h which wasn't accepted by some compilers.\n (found by Gergely Budai)\n * Fix compile errors when POLARSSL_ERROR_STRERROR_BC is undefined (found by\n Shuo Chen).\n * oid_get_numeric_string() used to truncate the output without returning an\n error if the output buffer was just 1 byte too small.\n * dhm_parse_dhm() (hence dhm_parse_dhmfile()) did not set dhm->len.\n * Calling pk_debug() on an RSA-alt key would segfault.\n * pk_get_size() and pk_get_len() were off by a factor 8 for RSA-alt keys.\n * Potential buffer overwrite in pem_write_buffer() because of low length\n indication (found by Thijs Alkemade)\n * EC curves constants, which should be only in ROM since 1.3.3, were also\n stored in RAM due to missing 'const's (found by Gergely Budai).", "= PolarSSL 1.3.5 released on 2014-03-26\nFeatures\n * HMAC-DRBG as a separate module\n * Option to set the Curve preference order (disabled by default)\n * Single Platform compatilibity layer (for memory / printf / fprintf)\n * Ability to provide alternate timing implementation\n * Ability to force the entropy module to use SHA-256 as its basis\n (POLARSSL_ENTROPY_FORCE_SHA256)\n * Testing script ssl-opt.sh added for testing 'live' ssl option\n interoperability against OpenSSL and PolarSSL\n * Support for reading EC keys that use SpecifiedECDomain in some cases.\n * Entropy module now supports seed writing and reading", "Changes\n * Deprecated the Memory layer\n * entropy_add_source(), entropy_update_manual() and entropy_gather()\n now thread-safe if POLARSSL_THREADING_C defined\n * Improvements to the CMake build system, contributed by Julian Ospald.\n * Work around a bug of the version of Clang shipped by Apple with Mavericks\n that prevented bignum.c from compiling. (Reported by Rafael Baptista.)\n * Revamped the compat.sh interoperatibility script to include support for\n testing against GnuTLS\n * Deprecated ssl_set_own_cert_rsa() and ssl_set_own_cert_rsa_alt()\n * Improvements to tests/Makefile, contributed by Oden Eriksson.", "Security\n * Forbid change of server certificate during renegotiation to prevent\n \"triple handshake\" attack when authentication mode is 'optional' (the\n attack was already impossible when authentication is required).\n * Check notBefore timestamp of certificates and CRLs from the future.\n * Forbid sequence number wrapping\n * Fixed possible buffer overflow with overlong PSK\n * Possible remotely-triggered out-of-bounds memory access fixed (found by\n TrustInSoft)", "Bugfix\n * ecp_gen_keypair() does more tries to prevent failure because of\n statistics\n * Fixed bug in RSA PKCS#1 v1.5 \"reversed\" operations\n * Fixed testing with out-of-source builds using cmake\n * Fixed version-major intolerance in server\n * Fixed CMake symlinking on out-of-source builds\n * Fixed dependency issues in test suite\n * Programs rsa_sign_pss and rsa_verify_pss were not using PSS since 1.3.0\n * Bignum's MIPS-32 assembly was used on MIPS-64, causing chaos. (Found by\n Alex Wilson.)\n * ssl_cache was creating entries when max_entries=0 if TIMING_C was enabled.\n * m_sleep() was sleeping twice too long on most Unix platforms.\n * Fixed bug with session tickets and non-blocking I/O in the unlikely case\n send() would return an EAGAIN error when sending the ticket.\n * ssl_cache was leaking memory when reusing a timed out entry containing a\n client certificate.\n * ssl_srv was leaking memory when client presented a timed out ticket\n containing a client certificate\n * ssl_init() was leaving a dirty pointer in ssl_context if malloc of\n out_ctr failed\n * ssl_handshake_init() was leaving dirty pointers in subcontexts if malloc\n of one of them failed\n * Fix typo in rsa_copy() that impacted PKCS#1 v2 contexts\n * x509_get_current_time() uses localtime_r() to prevent thread issues", "= PolarSSL 1.3.4 released on 2014-01-27\nFeatures\n * Support for the Koblitz curves: secp192k1, secp224k1, secp256k1\n * Support for RIPEMD-160\n * Support for AES CFB8 mode\n * Support for deterministic ECDSA (RFC 6979)", "Bugfix\n * Potential memory leak in bignum_selftest()\n * Replaced expired test certificate\n * ssl_mail_client now terminates lines with CRLF, instead of LF\n * net module handles timeouts on blocking sockets better (found by Tilman\n Sauerbeck)\n * Assembly format fixes in bn_mul.h", "Security\n * Missing MPI_CHK calls added around unguarded mpi calls (found by\n TrustInSoft)", "= PolarSSL 1.3.3 released on 2013-12-31\nFeatures\n * EC key generation support in gen_key app\n * Support for adhering to client ciphersuite order preference\n (POLARSSL_SSL_SRV_RESPECT_CLIENT_PREFERENCE)\n * Support for Curve25519\n * Support for ECDH-RSA and ECDH-ECDSA key exchanges and ciphersuites\n * Support for IPv6 in the NET module\n * AES-NI support for AES, AES-GCM and AES key scheduling\n * SSL Pthread-based server example added (ssl_pthread_server)", "Changes\n * gen_prime() speedup\n * Speedup of ECP multiplication operation\n * Relaxed some SHA2 ciphersuite's version requirements\n * Dropped use of readdir_r() instead of readdir() with threading support\n * More constant-time checks in the RSA module\n * Split off curves from ecp.c into ecp_curves.c\n * Curves are now stored fully in ROM\n * Memory usage optimizations in ECP module\n * Removed POLARSSL_THREADING_DUMMY", "Bugfix\n * Fixed bug in mpi_set_bit() on platforms where t_uint is wider than int\n * Fixed X.509 hostname comparison (with non-regular characters)\n * SSL now gracefully handles missing RNG\n * Missing defines / cases for RSA_PSK key exchange\n * crypt_and_hash app checks MAC before final decryption\n * Potential memory leak in ssl_ticket_keys_init()\n * Memory leak in benchmark application\n * Fixed x509_crt_parse_path() bug on Windows platforms\n * Added missing MPI_CHK() around some statements in mpi_div_mpi() (found by\n TrustInSoft)\n * Fixed potential overflow in certificate size verification in\n ssl_write_certificate() (found by TrustInSoft)", "Security\n * Possible remotely-triggered out-of-bounds memory access fixed (found by\n TrustInSoft)", "= PolarSSL 1.3.2 released on 2013-11-04\nFeatures\n * PK tests added to test framework\n * Added optional optimization for NIST MODP curves (POLARSSL_ECP_NIST_OPTIM)\n * Support for Camellia-GCM mode and ciphersuites", "Changes\n * Padding checks in cipher layer are now constant-time\n * Value comparisons in SSL layer are now constant-time\n * Support for serialNumber, postalAddress and postalCode in X509 names\n * SSL Renegotiation was refactored", "Bugfix\n * More stringent checks in cipher layer\n * Server does not send out extensions not advertised by client\n * Prevent possible alignment warnings on casting from char * to 'aligned *'\n * Misc fixes and additions to dependency checks\n * Const correctness\n * cert_write with selfsign should use issuer_name as subject_name\n * Fix ECDSA corner case: missing reduction mod N (found by DualTachyon)\n * Defines to handle UEFI environment under MSVC\n * Server-side initiated renegotiations send HelloRequest", "= PolarSSL 1.3.1 released on 2013-10-15\nFeatures\n * Support for Brainpool curves and TLS ciphersuites (RFC 7027)\n * Support for ECDHE-PSK key-exchange and ciphersuites\n * Support for RSA-PSK key-exchange and ciphersuites", "Changes\n * RSA blinding locks for a smaller amount of time\n * TLS compression only allocates working buffer once\n * Introduced POLARSSL_HAVE_READDIR_R for systems without it\n * config.h is more script-friendly", "Bugfix\n * Missing MSVC defines added\n * Compile errors with POLARSSL_RSA_NO_CRT\n * Header files with 'polarssl/'\n * Const correctness\n * Possible naming collision in dhm_context\n * Better support for MSVC\n * threading_set_alt() name\n * Added missing x509write_crt_set_version()", "= PolarSSL 1.3.0 released on 2013-10-01\nFeatures\n * Elliptic Curve Cryptography module added\n * Elliptic Curve Diffie Hellman module added\n * Ephemeral Elliptic Curve Diffie Hellman support for SSL/TLS\n (ECDHE-based ciphersuites)\n * Ephemeral Elliptic Curve Digital Signature Algorithm support for SSL/TLS\n (ECDSA-based ciphersuites)\n * Ability to specify allowed ciphersuites based on the protocol version.\n * PSK and DHE-PSK based ciphersuites added\n * Memory allocation abstraction layer added\n * Buffer-based memory allocator added (no malloc() / free() / HEAP usage)\n * Threading abstraction layer added (dummy / pthread / alternate)\n * Public Key abstraction layer added\n * Parsing Elliptic Curve keys\n * Parsing Elliptic Curve certificates\n * Support for max_fragment_length extension (RFC 6066)\n * Support for truncated_hmac extension (RFC 6066)\n * Support for zeros-and-length (ANSI X.923) padding, one-and-zeros\n (ISO/IEC 7816-4) padding and zero padding in the cipher layer\n * Support for session tickets (RFC 5077)\n * Certificate Request (CSR) generation with extensions (key_usage,\n ns_cert_type)\n * X509 Certificate writing with extensions (basic_constraints,\n issuer_key_identifier, etc)\n * Optional blinding for RSA, DHM and EC\n * Support for multiple active certificate / key pairs in SSL servers for\n \t the same host (Not to be confused with SNI!)", "Changes\n * Ability to enable / disable SSL v3 / TLS 1.0 / TLS 1.1 / TLS 1.2\n individually\n * Introduced separate SSL Ciphersuites module that is based on\n Cipher and MD information\n * Internals for SSL module adapted to have separate IV pointer that is\n dynamically set (Better support for hardware acceleration)\n * Moved all OID functionality to a separate module. RSA function\n prototypes for the RSA sign and verify functions changed as a result\n * Split up the GCM module into a starts/update/finish cycle\n * Client and server now filter sent and accepted ciphersuites on minimum\n and maximum protocol version\n * Ability to disable server_name extension (RFC 6066)\n * Renamed error_strerror() to the less conflicting polarssl_strerror()\n (Ability to keep old as well with POLARSSL_ERROR_STRERROR_BC)\n * SHA2 renamed to SHA256, SHA4 renamed to SHA512 and functions accordingly\n * All RSA operations require a random generator for blinding purposes\n * X509 core refactored\n * x509_crt_verify() now case insensitive for cn (RFC 6125 6.4)\n * Also compiles / runs without time-based functions (!POLARSSL_HAVE_TIME)\n * Support faulty X509 v1 certificates with extensions\n (POLARSSL_X509_ALLOW_EXTENSIONS_NON_V3)", "Bugfix\n * Fixed parse error in ssl_parse_certificate_request()\n * zlib compression/decompression skipped on empty blocks\n * Support for AIX header locations in net.c module\n * Fixed file descriptor leaks", "Security\n * RSA blinding on CRT operations to counter timing attacks\n (found by Cyril Arnaud and Pierre-Alain Fouque)", "\n= Version 1.2.14 released 2015-05-??", "Security\n * Fix potential invalid memory read in the server, that allows a client to\n crash it remotely (found by Caj Larsson).\n * Fix potential invalid memory read in certificate parsing, that allows a\n client to crash the server remotely if client authentication is enabled\n (found using Codenomicon Defensics).\n * Add countermeasure against \"Lucky 13 strikes back\" cache-based attack,\n https://dl.acm.org/citation.cfm?id=2714625", "Bugfix\n * Fix bug in Via Padlock support (found by Nikos Mavrogiannopoulos).\n * Fix hardclock() (only used in the benchmarking program) with some\n versions of mingw64 (found by kxjhlele).\n * Fix warnings from mingw64 in timing.c (found by kxjklele).\n * Fix potential unintended sign extension in asn1_get_len() on 64-bit\n platforms (found with Coverity Scan).", "= Version 1.2.13 released 2015-02-16\nNote: Although PolarSSL has been renamed to mbed TLS, no changes reflecting\n this will be made in the 1.2 branch at this point.", "Security\n * Fix remotely-triggerable uninitialised pointer dereference caused by\n crafted X.509 certificate (TLS server is not affected if it doesn't ask\n for a client certificate) (found using Codenomicon Defensics).\n * Fix remotely-triggerable memory leak caused by crafted X.509 certificates\n (TLS server is not affected if it doesn't ask for a client certificate)\n (found using Codenomicon Defensics).\n * Fix potential stack overflow while parsing crafted X.509 certificates\n (TLS server is not affected if it doesn't ask for a client certificate)\n found using Codenomicon Defensics).\n * Fix buffer overread of size 1 when parsing crafted X.509 certificates\n (TLS server is not affected if it doesn't ask for a client certificate).", "Bugfix\n * Fix potential undefined behaviour in Camellia.\n * Fix memory leaks in PKCS#5 and PKCS#12.\n * Stack buffer overflow if ctr_drbg_update() is called with too large\n add_len (found by Jean-Philippe Aumasson) (not triggerable remotely).\n * Fix bug in MPI/bignum on s390/s390x (reported by Dan Horák) (introduced\n in 1.2.12).\n * Fix unchecked return code in x509_crt_parse_path() on Windows (found by\n Peter Vaskovic).\n * Fix assembly selection for MIPS64 (thanks to James Cowgill).\n * ssl_get_verify_result() now works even if the handshake was aborted due\n to a failed verification (found by Fredrik Axelsson).\n * Skip writing and parsing signature_algorithm extension if none of the\n key exchanges enabled needs certificates. This fixes a possible interop\n issue with some servers when a zero-length extension was sent. (Reported\n by Peter Dettman.)\n * On a 0-length input, base64_encode() did not correctly set output length\n (found by Hendrik van den Boogaard).", "Changes\n * Blind RSA private operations even when POLARSSL_RSA_NO_CRT is defined.\n * Forbid repeated extensions in X.509 certificates.\n * Add compile-time option POLARSSL_X509_MAX_INTERMEDIATE_CA to limit the\n length of an X.509 verification chain (default = 8).\n= Version 1.2.12 released 2014-10-24", "Security\n * Remotely-triggerable memory leak when parsing some X.509 certificates\n (server is not affected if it doesn't ask for a client certificate).\n (Found using Codenomicon Defensics.)", "Bugfix\n * Fix potential bad read in parsing ServerHello (found by Adrien\n Vialletelle).\n * ssl_close_notify() could send more than one message in some circumstances\n with non-blocking I/O.\n * x509_crt_parse() did not increase total_failed on PEM error\n * Fix compiler warnings on iOS (found by Sander Niemeijer).\n * Don't print uninitialised buffer in ssl_mail_client (found by Marc Abel).\n * Fix net_accept() regarding non-blocking sockets (found by Luca Pesce).\n * ssl_read() could return non-application data records on server while\n renegotation was pending, and on client when a HelloRequest was received.\n * Fix warnings from Clang's scan-build (contributed by Alfred Klomp).", "Changes\n * X.509 certificates with more than one AttributeTypeAndValue per\n RelativeDistinguishedName are not accepted any more.\n * ssl_read() now returns POLARSSL_ERR_NET_WANT_READ rather than\n POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE on harmless alerts.\n * Accept spaces at end of line or end of buffer in base64_decode().", "= Version 1.2.11 released 2014-07-11\nFeatures\n * Entropy module now supports seed writing and reading", "Changes\n * Introduced POLARSSL_HAVE_READDIR_R for systems without it\n * Improvements to the CMake build system, contributed by Julian Ospald.\n * Work around a bug of the version of Clang shipped by Apple with Mavericks\n that prevented bignum.c from compiling. (Reported by Rafael Baptista.)\n * Improvements to tests/Makefile, contributed by Oden Eriksson.\n * Use UTC time to check certificate validity.\n * Reject certificates with times not in UTC, per RFC 5280.\n * Migrate zeroizing of data to polarssl_zeroize() instead of memset()\n against unwanted compiler optimizations", "Security\n * Forbid change of server certificate during renegotiation to prevent\n \"triple handshake\" attack when authentication mode is optional (the\n attack was already impossible when authentication is required).\n * Check notBefore timestamp of certificates and CRLs from the future.\n * Forbid sequence number wrapping\n * Prevent potential NULL pointer dereference in ssl_read_record() (found by\n TrustInSoft)\n * Fix length checking for AEAD ciphersuites (found by Codenomicon).\n It was possible to crash the server (and client) using crafted messages\n when a GCM suite was chosen.", "Bugfix\n * Fixed X.509 hostname comparison (with non-regular characters)\n * SSL now gracefully handles missing RNG\n * crypt_and_hash app checks MAC before final decryption\n * Fixed x509_crt_parse_path() bug on Windows platforms\n * Added missing MPI_CHK() around some statements in mpi_div_mpi() (found by\n TrustInSoft)\n * Fixed potential overflow in certificate size verification in\n ssl_write_certificate() (found by TrustInSoft)\n * Fix ASM format in bn_mul.h\n * Potential memory leak in bignum_selftest()\n * Replaced expired test certificate\n * ssl_mail_client now terminates lines with CRLF, instead of LF\n * Fix bug in RSA PKCS#1 v1.5 \"reversed\" operations\n * Fixed testing with out-of-source builds using cmake\n * Fixed version-major intolerance in server\n * Fixed CMake symlinking on out-of-source builds\n * Bignum's MIPS-32 assembly was used on MIPS-64, causing chaos. (Found by\n Alex Wilson.)\n * ssl_init() was leaving a dirty pointer in ssl_context if malloc of\n out_ctr failed\n * ssl_handshake_init() was leaving dirty pointers in subcontexts if malloc\n of one of them failed\n * x509_get_current_time() uses localtime_r() to prevent thread issues\n * Some example server programs were not sending the close_notify alert.\n * Potential memory leak in mpi_exp_mod() when error occurs during\n calculation of RR.\n * Improve interoperability by not writing extension length in ClientHello\n when no extensions are present (found by Matthew Page)\n * rsa_check_pubkey() now allows an E up to N\n * On OpenBSD, use arc4random_buf() instead of rand() to prevent warnings\n * mpi_fill_random() was creating numbers larger than requested on\n big-endian platform when size was not an integer number of limbs\n * Fix detection of DragonflyBSD in net.c (found by Markus Pfeiffer)\n * Stricter check on SSL ClientHello internal sizes compared to actual packet\n size (found by TrustInSoft)\n * Fix preprocessor checks for bn_mul PPC asm (found by Barry K. Nathan).\n * Use \\n\\t rather than semicolons for bn_mul asm, since some assemblers\n interpret semicolons as comment delimiters (found by Barry K. Nathan).\n * Disable broken Sparc64 bn_mul assembly (found by Florian Obser).\n * Fix base64_decode() to return and check length correctly (in case of\n tight buffers)", "= Version 1.2.10 released 2013-10-07\nChanges\n * Changed RSA blinding to a slower but thread-safe version", "Bugfix\n * Fixed memory leak in RSA as a result of introduction of blinding\n * Fixed ssl_pkcs11_decrypt() prototype\n * Fixed MSVC project files", "= Version 1.2.9 released 2013-10-01\nChanges\n * x509_verify() now case insensitive for cn (RFC 6125 6.4)", "Bugfix\n * Fixed potential memory leak when failing to resume a session\n * Fixed potential file descriptor leaks (found by Remi Gacogne)\n * Minor fixes", "Security\n * Fixed potential heap buffer overflow on large hostname setting\n * Fixed potential negative value misinterpretation in load_file()\n * RSA blinding on CRT operations to counter timing attacks\n (found by Cyril Arnaud and Pierre-Alain Fouque)", "= Version 1.2.8 released 2013-06-19\nFeatures\n * Parsing of PKCS#8 encrypted private key files\n * PKCS#12 PBE and derivation functions\n * Centralized module option values in config.h to allow user-defined\n settings without editing header files by using POLARSSL_CONFIG_OPTIONS", "Changes\n * HAVEGE random generator disabled by default\n * Internally split up x509parse_key() into a (PEM) handler function\n and specific DER parser functions for the PKCS#1 and unencrypted\n PKCS#8 private key formats\n * Added mechanism to provide alternative implementations for all\n symmetric cipher and hash algorithms (e.g. POLARSSL_AES_ALT in\n\t config.h)\n * PKCS#5 module added. Moved PBKDF2 functionality inside and deprecated\n old PBKDF2 module", "Bugfix\n * Secure renegotiation extension should only be sent in case client\n supports secure renegotiation\n * Fixed offset for cert_type list in ssl_parse_certificate_request()\n * Fixed const correctness issues that have no impact on the ABI\n * x509parse_crt() now better handles PEM error situations\n * ssl_parse_certificate() now calls x509parse_crt_der() directly\n instead of the x509parse_crt() wrapper that can also parse PEM\n\t certificates\n * x509parse_crtpath() is now reentrant and uses more portable stat()\n * Fixed bignum.c and bn_mul.h to support Thumb2 and LLVM compiler\n * Fixed values for 2-key Triple DES in cipher layer\n * ssl_write_certificate_request() can handle empty ca_chain", "Security\n * A possible DoS during the SSL Handshake, due to faulty parsing of\n PEM-encoded certificates has been fixed (found by Jack Lloyd)", "= Version 1.2.7 released 2013-04-13\nFeatures\n * Ability to specify allowed ciphersuites based on the protocol version.", "Changes\n * Default Blowfish keysize is now 128-bits\n * Test suites made smaller to accommodate Raspberry Pi", "Bugfix\n * Fix for MPI assembly for ARM\n * GCM adapted to support sizes > 2^29", "= Version 1.2.6 released 2013-03-11\nBugfix\n * Fixed memory leak in ssl_free() and ssl_reset() for active session\n * Corrected GCM counter incrementation to use only 32-bits instead of\n 128-bits (found by Yawning Angel)\n * Fixes for 64-bit compilation with MS Visual Studio\n * Fixed net_bind() for specified IP addresses on little endian systems\n * Fixed assembly code for ARM (Thumb and regular) for some compilers", "Changes\n * Internally split up rsa_pkcs1_encrypt(), rsa_pkcs1_decrypt(),\n rsa_pkcs1_sign() and rsa_pkcs1_verify() to separate PKCS#1 v1.5 and\n PKCS#1 v2.1 functions\n * Added support for custom labels when using rsa_rsaes_oaep_encrypt()\n or rsa_rsaes_oaep_decrypt()\n * Re-added handling for SSLv2 Client Hello when the define\n POLARSSL_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO is set\n * The SSL session cache module (ssl_cache) now also retains peer_cert\n information (not the entire chain)", "Security\n * Removed further timing differences during SSL message decryption in\n ssl_decrypt_buf()\n * Removed timing differences due to bad padding from\n rsa_rsaes_pkcs1_v15_decrypt() and rsa_pkcs1_decrypt() for PKCS#1 v1.5\n operations", "= Version 1.2.5 released 2013-02-02\nChanges\n * Allow enabling of dummy error_strerror() to support some use-cases\n * Debug messages about padding errors during SSL message decryption are\n disabled by default and can be enabled with POLARSSL_SSL_DEBUG_ALL \n * Sending of security-relevant alert messages that do not break\n interoperability can be switched on/off with the flag\n POLARSSL_SSL_ALL_ALERT_MESSAGES", "Security\n * Removed timing differences during SSL message decryption in\n ssl_decrypt_buf() due to badly formatted padding", "= Version 1.2.4 released 2013-01-25\nChanges\n * More advanced SSL ciphersuite representation and moved to more dynamic\n SSL core\n * Added ssl_handshake_step() to allow single stepping the handshake process", "Bugfix\n * Memory leak when using RSA_PKCS_V21 operations fixed\n * Handle future version properly in ssl_write_certificate_request()\n * Correctly handle CertificateRequest message in client for <= TLS 1.1\n without DN list", "= Version 1.2.3 released 2012-11-26\nBugfix\n * Server not always sending correct CertificateRequest message", "= Version 1.2.2 released 2012-11-24\nChanges\n * Added p_hw_data to ssl_context for context specific hardware acceleration\n data\n * During verify trust-CA is only checked for expiration and CRL presence ", "Bugfixes\n * Fixed client authentication compatibility\n * Fixed dependency on POLARSSL_SHA4_C in SSL modules", "= Version 1.2.1 released 2012-11-20\nChanges\n * Depth that the certificate verify callback receives is now numbered\n bottom-up (Peer cert depth is 0)", "Bugfixes\n * Fixes for MSVC6\n * Moved mpi_inv_mod() outside POLARSSL_GENPRIME\n * Allow R and A to point to same mpi in mpi_div_mpi (found by Manuel\n Pégourié-Gonnard)\n * Fixed possible segfault in mpi_shift_r() (found by Manuel\n Pégourié-Gonnard)\n * Added max length check for rsa_pkcs1_sign with PKCS#1 v2.1", "= Version 1.2.0 released 2012-10-31\nFeatures\n * Added support for NULL cipher (POLARSSL_CIPHER_NULL_CIPHER) and weak\n ciphersuites (POLARSSL_ENABLE_WEAK_CIPHERSUITES). They are disabled by\n default!\n * Added support for wildcard certificates\n * Added support for multi-domain certificates through the X509 Subject\n Alternative Name extension\n * Added preliminary ASN.1 buffer writing support\n * Added preliminary X509 Certificate Request writing support\n * Added key_app_writer example application\n * Added cert_req example application\n * Added base Galois Counter Mode (GCM) for AES\n * Added TLS 1.2 support (RFC 5246)\n * Added GCM suites to TLS 1.2 (RFC 5288)\n * Added commandline error code convertor (util/strerror)\n * Added support for Hardware Acceleration hooking in SSL/TLS\n * Added OpenSSL / PolarSSL compatibility script (tests/compat.sh) and\n example application (programs/ssl/o_p_test) (requires OpenSSL)\n * Added X509 CA Path support\n * Added Thumb assembly optimizations\n * Added DEFLATE compression support as per RFC3749 (requires zlib)\n * Added blowfish algorithm (Generic and cipher layer)\n * Added PKCS#5 PBKDF2 key derivation function\n * Added Secure Renegotiation (RFC 5746)\n * Added predefined DHM groups from RFC 5114\n * Added simple SSL session cache implementation\n * Added ServerName extension parsing (SNI) at server side\n * Added option to add minimum accepted SSL/TLS protocol version", "Changes\n * Removed redundant POLARSSL_DEBUG_MSG define\n * AES code only check for Padlock once\n * Fixed const-correctness mpi_get_bit()\n * Documentation for mpi_lsb() and mpi_msb()\n * Moved out_msg to out_hdr + 32 to support hardware acceleration\n * Changed certificate verify behaviour to comply with RFC 6125 section 6.3\n to not match CN if subjectAltName extension is present (Closes ticket #56)\n * Cipher layer cipher_mode_t POLARSSL_MODE_CFB128 is renamed to\n POLARSSL_MODE_CFB, to also handle different block size CFB modes.\n * Removed handling for SSLv2 Client Hello (as per RFC 5246 recommendation)\n * Revamped session resumption handling\n * Generalized external private key implementation handling (like PKCS#11)\n in SSL/TLS\n * Revamped x509_verify() and the SSL f_vrfy callback implementations\n * Moved from unsigned long to fixed width uint32_t types throughout code\n * Renamed ciphersuites naming scheme to IANA reserved names", "Bugfix\n * Fixed handling error in mpi_cmp_mpi() on longer B values (found by\n Hui Dong)\n * Fixed potential heap corruption in x509_name allocation\n * Fixed single RSA test that failed on Big Endian systems (Closes ticket #54)\n * mpi_exp_mod() now correctly handles negative base numbers (Closes ticket\n #52)\n * Handle encryption with private key and decryption with public key as per\n \t RFC 2313\n * Handle empty certificate subject names\n * Prevent reading over buffer boundaries on X509 certificate parsing\n * mpi_add_abs() now correctly handles adding short numbers to long numbers\n with carry rollover (found by Ruslan Yushchenko)\n * Handle existence of OpenSSL Trust Extensions at end of X.509 DER blob\n * Fixed MPI assembly for SPARC64 platform", "Security\n * Fixed potential memory zeroization on miscrafted RSA key (found by Eloi\n Vanderbeken)", "= Version 1.1.8 released on 2013-10-01\nBugfix\n * Fixed potential memory leak when failing to resume a session\n * Fixed potential file descriptor leaks", "Security\n * Potential buffer-overflow for ssl_read_record() (independently found by\n both TrustInSoft and Paul Brodeur of Leviathan Security Group)\n * Potential negative value misinterpretation in load_file()\n * Potential heap buffer overflow on large hostname setting", "= Version 1.1.7 released on 2013-06-19\nChanges\n * HAVEGE random generator disabled by default", "Bugfix\n * x509parse_crt() now better handles PEM error situations\n * ssl_parse_certificate() now calls x509parse_crt_der() directly\n instead of the x509parse_crt() wrapper that can also parse PEM\n\t certificates\n * Fixed values for 2-key Triple DES in cipher layer\n * ssl_write_certificate_request() can handle empty ca_chain", "Security\n * A possible DoS during the SSL Handshake, due to faulty parsing of\n PEM-encoded certificates has been fixed (found by Jack Lloyd)", "= Version 1.1.6 released on 2013-03-11\nBugfix\n * Fixed net_bind() for specified IP addresses on little endian systems", "Changes\n * Allow enabling of dummy error_strerror() to support some use-cases\n * Debug messages about padding errors during SSL message decryption are\n disabled by default and can be enabled with POLARSSL_SSL_DEBUG_ALL", "Security\n * Removed timing differences during SSL message decryption in\n ssl_decrypt_buf()\n * Removed timing differences due to bad padding from\n rsa_rsaes_pkcs1_v15_decrypt() and rsa_pkcs1_decrypt() for PKCS#1 v1.5\n operations", "= Version 1.1.5 released on 2013-01-16\nBugfix\n * Fixed MPI assembly for SPARC64 platform\n * Handle existence of OpenSSL Trust Extensions at end of X.509 DER blob\n * mpi_add_abs() now correctly handles adding short numbers to long numbers\n with carry rollover\n * Moved mpi_inv_mod() outside POLARSSL_GENPRIME\n * Prevent reading over buffer boundaries on X509 certificate parsing\n * mpi_exp_mod() now correctly handles negative base numbers (Closes ticket\n #52)\n * Fixed possible segfault in mpi_shift_r() (found by Manuel\n Pégourié-Gonnard)\n * Allow R and A to point to same mpi in mpi_div_mpi (found by Manuel\n Pégourié-Gonnard)\n * Added max length check for rsa_pkcs1_sign with PKCS#1 v2.1\n * Memory leak when using RSA_PKCS_V21 operations fixed\n * Handle encryption with private key and decryption with public key as per\n RFC 2313\n * Fixes for MSVC6", "Security\n * Fixed potential memory zeroization on miscrafted RSA key (found by Eloi\n Vanderbeken)", "= Version 1.1.4 released on 2012-05-31\nBugfix\n * Correctly handle empty SSL/TLS packets (Found by James Yonan)\n * Fixed potential heap corruption in x509_name allocation\n * Fixed single RSA test that failed on Big Endian systems (Closes ticket #54)", "= Version 1.1.3 released on 2012-04-29\nBugfix\n * Fixed random MPI generation to not generate more size than requested.", "= Version 1.1.2 released on 2012-04-26\nBugfix\n * Fixed handling error in mpi_cmp_mpi() on longer B values (found by\n Hui Dong)", "Security\n * Fixed potential memory corruption on miscrafted client messages (found by\n Frama-C team at CEA LIST)\n * Fixed generation of DHM parameters to correct length (found by Ruslan\n Yushchenko)", "= Version 1.1.1 released on 2012-01-23\nBugfix\n * Check for failed malloc() in ssl_set_hostname() and x509_get_entries()\n (Closes ticket #47, found by Hugo Leisink)\n * Fixed issues with Intel compiler on 64-bit systems (Closes ticket #50)\n * Fixed multiple compiler warnings for VS6 and armcc\n * Fixed bug in CTR_CRBG selftest", "= Version 1.1.0 released on 2011-12-22\nFeatures\n * Added ssl_session_reset() to allow better multi-connection pools of\n SSL contexts without needing to set all non-connection-specific\n\t data and pointers again. Adapted ssl_server to use this functionality.\n * Added ssl_set_max_version() to allow clients to offer a lower maximum\n supported version to a server to help buggy server implementations.\n\t (Closes ticket #36)\n * Added cipher_get_cipher_mode() and cipher_get_cipher_operation()\n introspection functions (Closes ticket #40)\n * Added CTR_DRBG based on AES-256-CTR (NIST SP 800-90) random generator\n * Added a generic entropy accumulator that provides support for adding\n custom entropy sources and added some generic and platform dependent\n\t entropy sources", "Changes\n * Documentation for AES and Camellia in modes CTR and CFB128 clarified.\n * Fixed rsa_encrypt and rsa_decrypt examples to use public key for\n encryption and private key for decryption. (Closes ticket #34)\n * Inceased maximum size of ASN1 length reads to 32-bits.\n * Added an EXPLICIT tag number parameter to x509_get_ext()\n * Added a separate CRL entry extension parsing function\n * Separated the ASN.1 parsing code from the X.509 specific parsing code.\n So now there is a module that is controlled with POLARSSL_ASN1_PARSE_C.\n * Changed the defined key-length of DES ciphers in cipher.h to include the\n parity bits, to prevent mistakes in copying data. (Closes ticket #33)\n * Loads of minimal changes to better support WINCE as a build target\n (Credits go to Marco Lizza)\n * Added POLARSSL_MPI_WINDOW_SIZE definition to allow easier time to memory\n trade-off\n * Introduced POLARSSL_MPI_MAX_SIZE and POLARSSL_MPI_MAX_BITS for MPI size\n management (Closes ticket #44)\n * Changed the used random function pointer to more flexible format. Renamed\n havege_rand() to havege_random() to prevent mistakes. Lots of changes as\n a consequence in library code and programs\n * Moved all examples programs to use the new entropy and CTR_DRBG\n * Added permissive certificate parsing to x509parse_crt() and\n x509parse_crtfile(). With permissive parsing the parsing does not stop on\n encountering a parse-error. Beware that the meaning of return values has\n changed!\n * All error codes are now negative. Even on mermory failures and IO errors.", "Bugfix\n * Fixed faulty HMAC-MD2 implementation. Found by dibac. (Closes\n ticket #37)\n * Fixed a bug where the CRL parser expected an EXPLICIT ASN.1 tag\n before version numbers\n * Allowed X509 key usage parsing to accept 4 byte values instead of the\n standard 1 byte version sometimes used by Microsoft. (Closes ticket #38)\n * Fixed incorrect behaviour in case of RSASSA-PSS with a salt length\n smaller than the hash length. (Closes ticket #41)\n * If certificate serial is longer than 32 octets, serial number is now\n appended with '....' after first 28 octets\n * Improved build support for s390x and sparc64 in bignum.h\n * Fixed MS Visual C++ name clash with int64 in sha4.h\n * Corrected removal of leading \"00:\" in printing serial numbers in\n certificates and CRLs", "= Version 1.0.0 released on 2011-07-27\nFeatures\n * Expanded cipher layer with support for CFB128 and CTR mode\n * Added rsa_encrypt and rsa_decrypt simple example programs.", "Changes\n * The generic cipher and message digest layer now have normal error\n codes instead of integers", "Bugfix\n * Undid faulty bug fix in ssl_write() when flushing old data (Ticket\n #18)", "= Version 0.99-pre5 released on 2011-05-26\nFeatures\n * Added additional Cipher Block Modes to symmetric ciphers\n (AES CTR, Camellia CTR, XTEA CBC) including the option to\n enable and disable individual modes when needed\n * Functions requiring File System functions can now be disabled\n by undefining POLARSSL_FS_IO\n * A error_strerror function() has been added to translate between\n error codes and their description.\n * Added mpi_get_bit() and mpi_set_bit() individual bit setter/getter\n functions.\n * Added ssl_mail_client and ssl_fork_server as example programs.", "Changes\n * Major argument / variable rewrite. Introduced use of size_t\n instead of int for buffer lengths and loop variables for\n better unsigned / signed use. Renamed internal bigint types\n t_int and t_dbl to t_uint and t_udbl in the process\n * mpi_init() and mpi_free() now only accept a single MPI\n argument and do not accept variable argument lists anymore.\n * The error codes have been remapped and combining error codes\n is now done with a PLUS instead of an OR as error codes\n used are negative.\n * Changed behaviour of net_read(), ssl_fetch_input() and ssl_recv().\n net_recv() now returns 0 on EOF instead of\n POLARSSL_ERR_NET_CONN_RESET. ssl_fetch_input() returns\n POLARSSL_ERR_SSL_CONN_EOF on an EOF from its f_recv() function.\n ssl_read() returns 0 if a POLARSSL_ERR_SSL_CONN_EOF is received\n after the handshake.\n * Network functions now return POLARSSL_ERR_NET_WANT_READ or\n POLARSSL_ERR_NET_WANT_WRITE instead of the ambiguous\n POLARSSL_ERR_NET_TRY_AGAIN", "= Version 0.99-pre4 released on 2011-04-01\nFeatures\n * Added support for PKCS#1 v2.1 encoding and thus support\n for the RSAES-OAEP and RSASSA-PSS operations.\n * Reading of Public Key files incorporated into default x509\n functionality as well.\n * Added mpi_fill_random() for centralized filling of big numbers\n with random data (Fixed ticket #10)", "Changes\n * Debug print of MPI now removes leading zero octets and \n displays actual bit size of the value.\n * x509parse_key() (and as a consequence x509parse_keyfile()) \n does not zeroize memory in advance anymore. Use rsa_init()\n before parsing a key or keyfile!", "Bugfix\n * Debug output of MPI's now the same independent of underlying\n platform (32-bit / 64-bit) (Fixes ticket #19, found by Mads\n Kiilerich and Mihai Militaru)\n * Fixed bug in ssl_write() when flushing old data (Fixed ticket\n #18, found by Nikolay Epifanov)\n * Fixed proper handling of RSASSA-PSS verification with variable\n length salt lengths", "= Version 0.99-pre3 released on 2011-02-28\nThis release replaces version 0.99-pre2 which had possible copyright issues.\nFeatures\n * Parsing PEM private keys encrypted with DES and AES\n are now supported as well (Fixes ticket #5)\n * Added crl_app program to allow easy reading and\n printing of X509 CRLs from file", "Changes\n * Parsing of PEM files moved to separate module (Fixes \n ticket #13). Also possible to remove PEM support for\n systems only using DER encoding", "Bugfixes\n * Corrected parsing of UTCTime dates before 1990 and\n after 1950\n * Support more exotic OID's when parsing certificates\n \t (found by Mads Kiilerich)\n * Support more exotic name representations when parsing\n certificates (found by Mads Kiilerich)\n * Replaced the expired test certificates\n * Do not bail out if no client certificate specified. Try\n to negotiate anonymous connection (Fixes ticket #12,\n found by Boris Krasnovskiy)", "Security fixes\n * Fixed a possible Man-in-the-Middle attack on the\n Diffie Hellman key exchange (thanks to Larry Highsmith,\n Subreption LLC)", "= Version 0.99-pre1 released on 2011-01-30\nFeatures\nNote: Most of these features have been donated by Fox-IT\n * Added Doxygen source code documentation parts\n * Added reading of DHM context from memory and file\n * Improved X509 certificate parsing to include extended\n certificate fields, including Key Usage\n * Improved certificate verification and verification\n against the available CRLs\n * Detection for DES weak keys and parity bits added\n * Improvements to support integration in other\n applications:\n + Added generic message digest and cipher wrapper\n + Improved information about current capabilities,\n status, objects and configuration\n + Added verification callback on certificate chain\n verification to allow external blacklisting\n\t + Additional example programs to show usage\n * Added support for PKCS#11 through the use of the\n libpkcs11-helper library", "Changes\n * x509parse_time_expired() checks time in addition to\n the existing date check\n * The ciphers member of ssl_context and the cipher member\n of ssl_session have been renamed to ciphersuites and\n ciphersuite respectively. This clarifies the difference\n with the generic cipher layer and is better naming\n altogether", "= Version 0.14.0 released on 2010-08-16\nFeatures\n * Added support for SSL_EDH_RSA_AES_128_SHA and\n SSL_EDH_RSA_CAMELLIA_128_SHA ciphersuites\n * Added compile-time and run-time version information\n * Expanded ssl_client2 arguments for more flexibility\n * Added support for TLS v1.1", "Changes\n * Made Makefile cleaner\n * Removed dependency on rand() in rsa_pkcs1_encrypt().\n Now using random fuction provided to function and\n changed the prototype of rsa_pkcs1_encrypt(),\n rsa_init() and rsa_gen_key().\n * Some SSL defines were renamed in order to avoid\n future confusion", "Bug fixes\n * Fixed CMake out of source build for tests (found by\n kkert)\n * rsa_check_private() now supports PKCS1v2 keys as well\n * Fixed deadlock in rsa_pkcs1_encrypt() on failing random\n generator", "= Version 0.13.1 released on 2010-03-24\nBug fixes\n * Fixed Makefile in library that was mistakenly merged\n * Added missing const string fixes", "= Version 0.13.0 released on 2010-03-21\nFeatures\n * Added option parsing for host and port selection to\n ssl_client2\n * Added support for GeneralizedTime in X509 parsing\n * Added cert_app program to allow easy reading and\n printing of X509 certificates from file or SSL\n connection.", "Changes\n * Added const correctness for main code base\n * X509 signature algorithm determination is now\n in a function to allow easy future expansion\n * Changed symmetric cipher functions to\n identical interface (returning int result values)\n * Changed ARC4 to use separate input/output buffer\n * Added reset function for HMAC context as speed-up\n for specific use-cases", "Bug fixes\n * Fixed bug resulting in failure to send the last\n certificate in the chain in ssl_write_certificate() and\n ssl_write_certificate_request() (found by fatbob)\n * Added small fixes for compiler warnings on a Mac\n (found by Frank de Brabander)\n * Fixed algorithmic bug in mpi_is_prime() (found by\n Smbat Tonoyan)", "= Version 0.12.1 released on 2009-10-04\nChanges\n * Coverage test definitions now support 'depends_on'\n tagging system.\n * Tests requiring specific hashing algorithms now honor\n the defines.", "Bug fixes\n * Changed typo in #ifdef in x509parse.c (found\n by Eduardo)", "= Version 0.12.0 released on 2009-07-28\nFeatures\n * Added CMake makefiles as alternative to regular Makefiles.\n * Added preliminary Code Coverage tests for AES, ARC4,\n Base64, MPI, SHA-family, MD-family, HMAC-SHA-family,\n Camellia, DES, 3-DES, RSA PKCS#1, XTEA, Diffie-Hellman\n and X509parse.", "Changes\n * Error codes are not (necessarily) negative. Keep\n this is mind when checking for errors.\n * RSA_RAW renamed to SIG_RSA_RAW for consistency.\n * Fixed typo in name of POLARSSL_ERR_RSA_OUTPUT_TOO_LARGE.\n * Changed interface for AES and Camellia setkey functions\n to indicate invalid key lengths.", "Bug fixes\n * Fixed include location of endian.h on FreeBSD (found by\n Gabriel)\n * Fixed include location of endian.h and name clash on\n Apples (found by Martin van Hensbergen)\n * Fixed HMAC-MD2 by modifying md2_starts(), so that the\n required HMAC ipad and opad variables are not cleared.\n (found by code coverage tests)\n * Prevented use of long long in bignum if \n POLARSSL_HAVE_LONGLONG not defined (found by Giles\n Bathgate).\n * Fixed incorrect handling of negative strings in\n mpi_read_string() (found by code coverage tests).\n * Fixed segfault on handling empty rsa_context in\n rsa_check_pubkey() and rsa_check_privkey() (found by\n code coverage tests).\n * Fixed incorrect handling of one single negative input\n value in mpi_add_abs() (found by code coverage tests).\n * Fixed incorrect handling of negative first input\n value in mpi_sub_abs() (found by code coverage tests).\n * Fixed incorrect handling of negative first input\n value in mpi_mod_mpi() and mpi_mod_int(). Resulting\n change also affects mpi_write_string() (found by code\n coverage tests).\n * Corrected is_prime() results for 0, 1 and 2 (found by\n code coverage tests).\n * Fixed Camellia and XTEA for 64-bit Windows systems.", "= Version 0.11.1 released on 2009-05-17\n * Fixed missing functionality for SHA-224, SHA-256, SHA384,\n SHA-512 in rsa_pkcs1_sign()", "= Version 0.11.0 released on 2009-05-03\n * Fixed a bug in mpi_gcd() so that it also works when both\n input numbers are even and added testcases to check\n (found by Pierre Habouzit).\n * Added support for SHA-224, SHA-256, SHA-384 and SHA-512\n one way hash functions with the PKCS#1 v1.5 signing and\n verification.\n * Fixed minor bug regarding mpi_gcd located within the\n POLARSSL_GENPRIME block.\n * Fixed minor memory leak in x509parse_crt() and added better\n handling of 'full' certificate chains (found by Mathias\n Olsson).\n * Centralized file opening and reading for x509 files into\n load_file()\n * Made definition of net_htons() endian-clean for big endian\n systems (Found by Gernot).\n * Undefining POLARSSL_HAVE_ASM now also handles prevents asm in\n padlock and timing code. \n * Fixed an off-by-one buffer allocation in ssl_set_hostname()\n responsible for crashes and unwanted behaviour.\n * Added support for Certificate Revocation List (CRL) parsing.\n * Added support for CRL revocation to x509parse_verify() and\n SSL/TLS code.\n * Fixed compatibility of XTEA and Camellia on a 64-bit system\n (found by Felix von Leitner).", "= Version 0.10.0 released on 2009-01-12\n * Migrated XySSL to PolarSSL\n * Added XTEA symmetric cipher\n * Added Camellia symmetric cipher\n * Added support for ciphersuites: SSL_RSA_CAMELLIA_128_SHA,\n SSL_RSA_CAMELLIA_256_SHA and SSL_EDH_RSA_CAMELLIA_256_SHA\n * Fixed dangerous bug that can cause a heap overflow in\n rsa_pkcs1_decrypt (found by Christophe Devine)", "================================================================\nXySSL ChangeLog", "= Version 0.9 released on 2008-03-16", " * Added support for ciphersuite: SSL_RSA_AES_128_SHA\n * Enabled support for large files by default in aescrypt2.c\n * Preliminary openssl wrapper contributed by David Barrett\n * Fixed a bug in ssl_write() that caused the same payload to\n be sent twice in non-blocking mode when send returns EAGAIN\n * Fixed ssl_parse_client_hello(): session id and challenge must\n not be swapped in the SSLv2 ClientHello (found by Greg Robson)\n * Added user-defined callback debug function (Krystian Kolodziej)\n * Before freeing a certificate, properly zero out all cert. data\n * Fixed the \"mode\" parameter so that encryption/decryption are\n not swapped on PadLock; also fixed compilation on older versions\n of gcc (bug reported by David Barrett)\n * Correctly handle the case in padlock_xcryptcbc() when input or\n ouput data is non-aligned by falling back to the software\n implementation, as VIA Nehemiah cannot handle non-aligned buffers\n * Fixed a memory leak in x509parse_crt() which was reported by Greg\n Robson-Garth; some x509write.c fixes by Pascal Vizeli, thanks to\n Matthew Page who reported several bugs\n * Fixed x509_get_ext() to accept some rare certificates which have\n an INTEGER instead of a BOOLEAN for BasicConstraints::cA.\n * Added support on the client side for the TLS \"hostname\" extension\n (patch contributed by David Patino)\n * Make x509parse_verify() return BADCERT_CN_MISMATCH when an empty\n string is passed as the CN (bug reported by spoofy)\n * Added an option to enable/disable the BN assembly code\n * Updated rsa_check_privkey() to verify that (D*E) = 1 % (P-1)*(Q-1)\n * Disabled obsolete hash functions by default (MD2, MD4); updated\n selftest and benchmark to not test ciphers that have been disabled\n * Updated x509parse_cert_info() to correctly display byte 0 of the\n serial number, setup correct server port in the ssl client example\n * Fixed a critical denial-of-service with X.509 cert. verification:\n peer may cause xyssl to loop indefinitely by sending a certificate\n for which the RSA signature check fails (bug reported by Benoit)\n * Added test vectors for: AES-CBC, AES-CFB, DES-CBC and 3DES-CBC,\n HMAC-MD5, HMAC-SHA1, HMAC-SHA-256, HMAC-SHA-384, and HMAC-SHA-512\n * Fixed HMAC-SHA-384 and HMAC-SHA-512 (thanks to Josh Sinykin)\n * Modified ssl_parse_client_key_exchange() to protect against\n Daniel Bleichenbacher attack on PKCS#1 v1.5 padding, as well\n as the Klima-Pokorny-Rosa extension of Bleichenbacher's attack\n * Updated rsa_gen_key() so that ctx->N is always nbits in size\n * Fixed assembly PPC compilation errors on Mac OS X, thanks to\n David Barrett and Dusan Semen", "= Version 0.8 released on 2007-10-20", " * Modified the HMAC functions to handle keys larger\n than 64 bytes, thanks to Stephane Desneux and gary ng\n * Fixed ssl_read_record() to properly update the handshake\n message digests, which fixes IE6/IE7 client authentication\n * Cleaned up the XYSSL* #defines, suggested by Azriel Fasten\n * Fixed net_recv(), thanks to Lorenz Schori and Egon Kocjan\n * Added user-defined callbacks for handling I/O and sessions\n * Added lots of debugging output in the SSL/TLS functions\n * Added preliminary X.509 cert. writing by Pascal Vizeli\n * Added preliminary support for the VIA PadLock routines\n * Added AES-CFB mode of operation, contributed by chmike\n * Added an SSL/TLS stress testing program (ssl_test.c)\n * Updated the RSA PKCS#1 code to allow choosing between\n RSA_PUBLIC and RSA_PRIVATE, as suggested by David Barrett\n * Updated ssl_read() to skip 0-length records from OpenSSL\n * Fixed the make install target to comply with *BSD make\n * Fixed a bug in mpi_read_binary() on 64-bit platforms\n * mpi_is_prime() speedups, thanks to Kevin McLaughlin\n * Fixed a long standing memory leak in mpi_is_prime()\n * Replaced realloc with malloc in mpi_grow(), and set\n the sign of zero as positive in mpi_init() (reported\n by Jonathan M. McCune)", "= Version 0.7 released on 2007-07-07", " * Added support for the MicroBlaze soft-core processor\n * Fixed a bug in ssl_tls.c which sometimes prevented SSL\n connections from being established with non-blocking I/O\n * Fixed a couple bugs in the VS6 and UNIX Makefiles\n * Fixed the \"PIC register ebx clobbered in asm\" bug\n * Added HMAC starts/update/finish support functions\n * Added the SHA-224, SHA-384 and SHA-512 hash functions\n * Fixed the net_set_*block routines, thanks to Andreas\n * Added a few demonstration programs: md5sum, sha1sum,\n dh_client, dh_server, rsa_genkey, rsa_sign, rsa_verify\n * Added new bignum import and export helper functions\n * Rewrote README.txt in program/ssl/ca to better explain\n how to create a test PKI", "= Version 0.6 released on 2007-04-01", " * Ciphers used in SSL/TLS can now be disabled at compile\n time, to reduce the memory footprint on embedded systems\n * Added multiply assembly code for the TriCore and modified\n havege_struct for this processor, thanks to David Patiño\n * Added multiply assembly code for 64-bit PowerPCs,\n thanks to Peking University and the OSU Open Source Lab\n * Added experimental support of Quantum Cryptography\n * Added support for autoconf, contributed by Arnaud Cornet\n * Fixed \"long long\" compilation issues on IA-64 and PPC64\n * Fixed a bug introduced in xyssl-0.5/timing.c: hardclock\n was not being correctly defined on ARM and MIPS", "= Version 0.5 released on 2007-03-01", " * Added multiply assembly code for SPARC and Alpha\n * Added (beta) support for non-blocking I/O operations\n * Implemented session resuming and client authentication\n * Fixed some portability issues on WinCE, MINIX 3, Plan9\n (thanks to Benjamin Newman), HP-UX, FreeBSD and Solaris\n * Improved the performance of the EDH key exchange\n * Fixed a bug that caused valid packets with a payload\n size of 16384 bytes to be rejected", "= Version 0.4 released on 2007-02-01", " * Added support for Ephemeral Diffie-Hellman key exchange\n * Added multiply asm code for SSE2, ARM, PPC, MIPS and M68K\n * Various improvement to the modular exponentiation code\n * Rewrote the headers to generate the API docs with doxygen\n * Fixed a bug in ssl_encrypt_buf (incorrect padding was\n generated) and in ssl_parse_client_hello (max. client\n version was not properly set), thanks to Didier Rebeix\n * Fixed another bug in ssl_parse_client_hello: clients with\n cipherlists larger than 96 bytes were incorrectly rejected\n * Fixed a couple memory leak in x509_read.c", "= Version 0.3 released on 2007-01-01", " * Added server-side SSLv3 and TLSv1.0 support\n * Multiple fixes to enhance the compatibility with g++,\n thanks to Xosé Antón Otero Ferreira\n * Fixed a bug in the CBC code, thanks to dowst; also,\n the bignum code is no longer dependent on long long\n * Updated rsa_pkcs1_sign to handle arbitrary large inputs\n * Updated timing.c for improved compatibility with i386\n and 486 processors, thanks to Arnaud Cornet", "= Version 0.2 released on 2006-12-01", " * Updated timing.c to support ARM and MIPS arch\n * Updated the MPI code to support 8086 on MSVC 1.5\n * Added the copyright notice at the top of havege.h\n * Fixed a bug in sha2_hmac, thanks to newsoft/Wenfang Zhang\n * Fixed a bug reported by Adrian Rüegsegger in x509_read_key\n * Fixed a bug reported by Torsten Lauter in ssl_read_record\n * Fixed a bug in rsa_check_privkey that would wrongly cause\n valid RSA keys to be dismissed (thanks to oldwolf)\n * Fixed a bug in mpi_is_prime that caused some primes to fail\n the Miller-Rabin primality test", " I'd also like to thank Younès Hafri for the CRUX linux port,\n Khalil Petit who added XySSL into pkgsrc and Arnaud Cornet\n who maintains the Debian package :-)", "= Version 0.1 released on 2006-11-01" ]
[ 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [8, 75, 1056, 78, 271, 482, 2312, 1208], "buggy_code_start_loc": [8, 74, 1055, 78, 270, 482, 2060, 1207], "filenames": ["ChangeLog", "include/mbedtls/error.h", "include/mbedtls/ssl.h", "include/mbedtls/x509.h", "include/mbedtls/x509_crt.h", "library/error.c", "library/x509_crt.c", "tests/suites/test_suite_x509parse.data"], "fixing_code_end_loc": [12, 75, 1056, 80, 277, 485, 2317, 1208], "fixing_code_start_loc": [9, 74, 1055, 79, 270, 483, 2060, 1207], "message": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.10:*:*:*:*:*:*:*", "matchCriteriaId": "28621156-2430-447B-8816-47B0FB58245B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.11:*:*:*:*:*:*:*", "matchCriteriaId": "E11BBB2C-0423-47B1-AE12-EB849E17BAF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.12:*:*:*:*:*:*:*", "matchCriteriaId": "4131CE76-6260-412C-A6A6-20B0E978E569", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.13:*:*:*:*:*:*:*", "matchCriteriaId": "DE92D8F7-5705-47B6-B2C2-9DE6C7880647", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.14:*:*:*:*:*:*:*", "matchCriteriaId": "EA50C256-2054-4661-9C42-D31D7D87BAF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.15:*:*:*:*:*:*:*", "matchCriteriaId": "7791D4E9-3FEE-42DA-B320-CF7188A10294", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.16:*:*:*:*:*:*:*", "matchCriteriaId": "BE415DAA-A89F-4204-AC2C-577FCB447E4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.17:*:*:*:*:*:*:*", "matchCriteriaId": "95F691DB-9552-4EBB-B29D-16658561FA4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.18:*:*:*:*:*:*:*", "matchCriteriaId": "F1547B2A-E0D5-41D1-9449-1CCF35022B0E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.19:*:*:*:*:*:*:*", "matchCriteriaId": "CF762122-64BC-4A1A-A26D-81C1270541A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.20:*:*:*:*:*:*:*", "matchCriteriaId": "59D6B559-5F99-4E38-A861-3AB8A7D2E6BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.21:*:*:*:*:*:*:*", "matchCriteriaId": "4A8956C8-6CF0-4C37-84F9-8A89726806C3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "0B395D81-876F-43FC-8DB9-44377647A37A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F92622F1-82DA-4819-8275-06DC9DBE1BA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5871FDE9-02D0-466C-BDB7-90A14C4F637E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE6B4875-3FC3-499F-A76B-2D04982F743A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "B3B67842-5AFA-459F-9CCF-772B9DC7139F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "AD0500EE-52C0-4896-B3D8-5BE731D66039", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "015739E9-C0E3-4A62-BB9D-FA836BFD4351", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "842B0D15-6A3D-4CEE-AD02-49B0436E78E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "3CF6E05C-E6E5-40B8-AFEA-A5ED937F5439", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "D4133C86-70E0-44FD-BBDB-D61EFB31F027", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "6F9D24F0-3892-417F-9C3A-CACEF00C2293", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "8911513E-968C-403E-9D00-2DC0AA82F99B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "48D98945-82BB-4954-AA6D-7D98E4CE1154", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "6378C1CC-7C8F-47E3-A1A7-CDEC76E4CBE4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "525190A3-2194-4E4E-9D34-0048583B9C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "70407352-624A-40E6-82E4-7B4FAFE0C0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "DD52988E-4B2F-41AF-BC25-F38F87D9B8C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "FD1F7803-31F3-40A9-A878-FDC757FCE83F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected."}, {"lang": "es", "value": "ARM mbed TLS en versiones anteriores a la 1.3.21 y en versiones 2.x anteriores a la 2.1.9, si se configura la autenticaci\u00f3n opcional, permite a los atacantes omitir la autenticaci\u00f3n Peer mediante una cadena de certificados X.509 con muchos intermediarios. NOTA: aunque mbed TLS se conoc\u00eda antes como PolarSSL, las versiones lanzadas con el nombre PolarSSL no est\u00e1n afectadas."}], "evaluatorComment": null, "id": "CVE-2017-14032", "lastModified": "2017-11-08T02:29:02.850", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-08-30T20:29:00.337", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.debian.org/security/2017/dsa-3967"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugs.debian.org/873557"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/d15795acd5074e0b44e71f7ede8bdfe1b48591fc"}, {"source": "cve@mitre.org", "tags": ["Vendor Advisory"], "url": "https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2017-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, "type": "CWE-287"}
351
Determine whether the {function_name} code is vulnerable or not.
[ "mbed TLS ChangeLog (Sorted per branch, date)", "= mbed TLS 2.y.z released YYYY-MM-DD", "Changes\n * Certificate verification functions now set flags to -1 in case the full\n chain was not verified due to an internal error (including in the verify\n callback) or chain length limitations.", " * With authmode set to optional, handshake is now aborted if the\n verification of the peer's certificate failed due to an overlong chain or\n a fatal error in the vrfy callback.", "\n= mbed TLS 2.5.1 released 2017-06-21", "Security\n * Fixed unlimited overread of heap-based buffer in mbedtls_ssl_read().\n The issue could only happen client-side with renegotiation enabled.\n Could result in DoS (application crash) or information leak\n (if the application layer sent data read from mbedtls_ssl_read()\n back to the server or to a third party). Can be triggered remotely.\n * Removed SHA-1 and RIPEMD-160 from the default hash algorithms for\n certificate verification. SHA-1 can be turned back on with a compile-time\n option if needed.\n * Fixed offset in FALLBACK_SCSV parsing that caused TLS server to fail to\n detect it sometimes. Reported by Hugo Leisink. #810\n * Tighten parsing of RSA PKCS#1 v1.5 signatures, to avoid a\n potential Bleichenbacher/BERserk-style attack.", "Bugfix\n * Remove size zero arrays from ECJPAKE test suite. Size zero arrays are not\n valid C and they prevented the test from compiling in Visual Studio 2015\n and with GCC using the -Wpedantic compilation option.\n * Fix insufficient support for signature-hash-algorithm extension,\n resulting in compatibility problems with Chrome. Found by hfloyrd. #823\n * Fix behaviour that hid the original cause of fatal alerts in some cases\n when sending the alert failed. The fix makes sure not to hide the error\n that triggered the alert.\n * Fix SSLv3 renegotiation behaviour and stop processing data received from\n peer after sending a fatal alert to refuse a renegotiation attempt.\n Previous behaviour was to keep processing data even after the alert has\n been sent.\n * Accept empty trusted CA chain in authentication mode\n MBEDTLS_SSL_VERIFY_OPTIONAL.\n Found by jethrogb. #864\n * Fix implementation of mbedtls_ssl_parse_certificate() to not annihilate\n fatal errors in authentication mode MBEDTLS_SSL_VERIFY_OPTIONAL and to\n reflect bad EC curves within verification result.\n * Fix bug that caused the modular inversion function to accept the invalid\n modulus 1 and therefore to hang. Found by blaufish. #641.\n * Fix incorrect sign computation in modular exponentiation when the base is\n a negative MPI. Previously the result was always negative. Found by Guido\n Vranken.\n * Fix a numerical underflow leading to stack overflow in mpi_read_file()\n that was triggered uppon reading an empty line. Found by Guido Vranken.", "Changes\n * Send fatal alerts in more cases. The previous behaviour was to skip\n sending the fatal alert and just drop the connection.\n * Clarify ECDSA documentation and improve the sample code to avoid\n misunderstanding and potentially dangerous use of the API. Pointed out\n by Jean-Philippe Aumasson.", "= mbed TLS 2.5.0 branch released 2017-05-17", "Security\n * Wipe stack buffers in RSA private key operations\n (rsa_rsaes_pkcs1_v15_decrypt(), rsa_rsaes_oaep_decrypt). Found by Laurent\n Simon.\n * Add exponent blinding to RSA private operations as a countermeasure\n against side-channel attacks like the cache attack described in\n https://arxiv.org/abs/1702.08719v2.\n Found and fix proposed by Michael Schwarz, Samuel Weiser, Daniel Gruss,\n Clémentine Maurice and Stefan Mangard.", "Features\n * Add hardware acceleration support for the Elliptic Curve Point module.\n This involved exposing parts of the internal interface to enable\n replacing the core functions and adding and alternative, module level\n replacement support for enabling the extension of the interface.\n * Add a new configuration option to 'mbedtls_ssl_config' to enable\n suppressing the CA list in Certificate Request messages. The default\n behaviour has not changed, namely every configured CAs name is included.", "API Changes\n * The following functions in the AES module have been deprecated and replaced\n by the functions shown below. The new functions change the return type from\n void to int to allow returning error codes when using MBEDTLS_AES_ALT,\n MBEDTLS_AES_DECRYPT_ALT or MBEDTLS_AES_ENCRYPT_ALT.\n mbedtls_aes_decrypt() -> mbedtls_internal_aes_decrypt()\n mbedtls_aes_encrypt() -> mbedtls_internal_aes_encrypt()", "Bugfix\n * Remove macros from compat-1.3.h that correspond to deleted items from most\n recent versions of the library. Found by Kyle Keen.\n * Fixed issue in the Threading module that prevented mutexes from\n initialising. Found by sznaider. #667 #843\n * Add checks in the PK module for the RSA functions on 64-bit systems.\n The PK and RSA modules use different types for passing hash length and\n without these checks the type cast could lead to data loss. Found by Guido\n Vranken.", "= mbed TLS 2.4.2 branch released 2017-03-08", "Security\n * Add checks to prevent signature forgeries for very large messages while\n using RSA through the PK module in 64-bit systems. The issue was caused by\n some data loss when casting a size_t to an unsigned int value in the\n functions rsa_verify_wrap(), rsa_sign_wrap(), rsa_alt_sign_wrap() and\n mbedtls_pk_sign(). Found by Jean-Philippe Aumasson.\n * Fixed potential livelock during the parsing of a CRL in PEM format in\n mbedtls_x509_crl_parse(). A string containing a CRL followed by trailing\n characters after the footer could result in the execution of an infinite\n loop. The issue can be triggered remotely. Found by Greg Zaverucha,\n Microsoft.\n * Removed MD5 from the allowed hash algorithms for CertificateRequest and\n CertificateVerify messages, to prevent SLOTH attacks against TLS 1.2.\n Introduced by interoperability fix for #513.\n * Fixed a bug that caused freeing a buffer that was allocated on the stack,\n when verifying the validity of a key on secp224k1. This could be\n triggered remotely for example with a maliciously constructed certificate\n and potentially could lead to remote code execution on some platforms.\n Reported independently by rongsaws and Aleksandar Nikolic, Cisco Talos\n team. #569 CVE-2017-2784", "Bugfix\n * Fix output certificate verification flags set by x509_crt_verify_top() when\n traversing a chain of trusted CA. The issue would cause both flags,\n MBEDTLS_X509_BADCERT_NOT_TRUSTED and MBEDTLS_X509_BADCERT_EXPIRED, to be\n set when the verification conditions are not met regardless of the cause.\n Found by Harm Verhagen and inestlerode. #665 #561\n * Fix the redefinition of macro ssl_set_bio to an undefined symbol\n mbedtls_ssl_set_bio_timeout in compat-1.3.h, by removing it.\n Found by omlib-lin. #673\n * Fix unused variable/function compilation warnings in pem.c, x509_crt.c and\n x509_csr.c that are reported when building mbed TLS with a config.h that\n does not define MBEDTLS_PEM_PARSE_C. Found by omnium21. #562\n * Fix incorrect renegotiation condition in ssl_check_ctr_renegotiate() that\n would compare 64 bits of the record counter instead of 48 bits as indicated\n in RFC 6347 Section 4.3.1. This could cause the execution of the\n renegotiation routines at unexpected times when the protocol is DTLS. Found\n by wariua. #687\n * Fixed multiple buffer overreads in mbedtls_pem_read_buffer() when parsing\n the input string in PEM format to extract the different components. Found\n by Eyal Itkin.\n * Fixed potential arithmetic overflow in mbedtls_ctr_drbg_reseed() that could\n cause buffer bound checks to be bypassed. Found by Eyal Itkin.\n * Fixed potential arithmetic overflows in mbedtls_cipher_update() that could\n cause buffer bound checks to be bypassed. Found by Eyal Itkin.\n * Fixed potential arithmetic overflow in mbedtls_md2_update() that could\n cause buffer bound checks to be bypassed. Found by Eyal Itkin.\n * Fixed potential arithmetic overflow in mbedtls_base64_decode() that could\n cause buffer bound checks to be bypassed. Found by Eyal Itkin.\n * Fixed heap overreads in mbedtls_x509_get_time(). Found by Peng\n Li/Yueh-Hsun Lin, KNOX Security, Samsung Research America.\n * Fix potential memory leak in mbedtls_x509_crl_parse(). The leak was caused\n by missing calls to mbedtls_pem_free() in cases when a\n MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT error was encountered. Found and\n fix proposed by Guido Vranken. #722\n * Fixed the templates used to generate project and solution files for Visual\n Studio 2015 as well as the files themselves, to remove a build warning\n generated in Visual Studio 2015. Reported by Steve Valliere. #742\n * Fix a resource leak in ssl_cookie, when using MBEDTLS_THREADING_C.\n Raised and fix suggested by Alan Gillingham in the mbed TLS forum. #771\n * Fix 1 byte buffer overflow in mbedtls_mpi_write_string() when the MPI\n number to write in hexadecimal is negative and requires an odd number of\n digits. Found and fixed by Guido Vranken.\n * Fix unlisted DES configuration dependency in some pkparse test cases. Found\n by inestlerode. #555", "= mbed TLS 2.4.1 branch released 2016-12-13", "Changes\n * Update to CMAC test data, taken from - NIST Special Publication 800-38B -\n Recommendation for Block Cipher Modes of Operation: The CMAC Mode for\n Authentication – October 2016", "= mbed TLS 2.4.0 branch released 2016-10-17", "Security\n * Removed the MBEDTLS_SSL_AEAD_RANDOM_IV option, because it was not compliant\n with RFC-5116 and could lead to session key recovery in very long TLS\n sessions. \"Nonce-Disrespecting Adversaries Practical Forgery Attacks on GCM in\n TLS\" - H. Bock, A. Zauner, S. Devlin, J. Somorovsky, P. Jovanovic.\n https://eprint.iacr.org/2016/475.pdf\n * Fixed potential stack corruption in mbedtls_x509write_crt_der() and\n mbedtls_x509write_csr_der() when the signature is copied to the buffer\n without checking whether there is enough space in the destination. The\n issue cannot be triggered remotely. Found by Jethro Beekman.", "Features\n * Added support for CMAC for AES and 3DES and AES-CMAC-PRF-128, as defined by\n NIST SP 800-38B, RFC-4493 and RFC-4615.\n * Added hardware entropy selftest to verify that the hardware entropy source\n is functioning correctly.\n * Added a script to print build environment info for diagnostic use in test\n scripts, which is also now called by all.sh.\n * Added the macro MBEDTLS_X509_MAX_FILE_PATH_LEN that enables the user to\n configure the maximum length of a file path that can be buffered when\n calling mbedtls_x509_crt_parse_path().\n * Added a configuration file config-no-entropy.h that configures the subset of\n library features that do not require an entropy source.\n * Added the macro MBEDTLS_ENTROPY_MIN_HARDWARE in config.h. This allows users\n to configure the minimum number of bytes for entropy sources using the\n mbedtls_hardware_poll() function.", "Bugfix\n * Fix for platform time abstraction to avoid dependency issues where a build\n may need time but not the standard C library abstraction, and added\n configuration consistency checks to check_config.h\n * Fix dependency issue in Makefile to allow parallel builds.\n * Fix incorrect handling of block lengths in crypt_and_hash.c sample program,\n when GCM is used. Found by udf2457. #441\n * Fix for key exchanges based on ECDH-RSA or ECDH-ECDSA which weren't\n enabled unless others were also present. Found by David Fernandez. #428\n * Fix for out-of-tree builds using CMake. Found by jwurzer, and fix based on\n a contribution from Tobias Tangemann. #541\n * Fixed cert_app.c sample program for debug output and for use when no root\n certificates are provided.\n * Fix conditional statement that would cause a 1 byte overread in\n mbedtls_asn1_get_int(). Found and fixed by Guido Vranken. #599\n * Fixed pthread implementation to avoid unintended double initialisations\n and double frees. Found by Niklas Amnebratt.\n * Fixed the sample applications gen_key.c, cert_req.c and cert_write.c for\n builds where the configuration MBEDTLS_PEM_WRITE_C is not defined. Found\n by inestlerode. #559.\n * Fix mbedtls_x509_get_sig() to update the ASN1 type in the mbedtls_x509_buf\n data structure until after error checks are successful. Found by\n subramanyam-c. #622\n * Fix documentation and implementation missmatch for function arguments of\n mbedtls_gcm_finish(). Found by cmiatpaar. #602\n * Guarantee that P>Q at RSA key generation. Found by inestlerode. #558\n * Fix potential byte overread when verifying malformed SERVER_HELLO in\n ssl_parse_hello_verify_request() for DTLS. Found by Guido Vranken.\n * Fix check for validity of date when parsing in mbedtls_x509_get_time().\n Found by subramanyam-c. #626\n * Fix compatibility issue with Internet Explorer client authentication,\n where the limited hash choices prevented the client from sending its\n certificate. Found by teumas. #513\n * Fix compilation without MBEDTLS_SELF_TEST enabled.", "Changes\n * Extended test coverage of special cases, and added new timing test suite.\n * Removed self-tests from the basic-built-test.sh script, and added all\n missing self-tests to the test suites, to ensure self-tests are only\n executed once.\n * Added support for 3 and 4 byte lengths to mbedtls_asn1_write_len().\n * Added support for a Yotta specific configuration file -\n through the symbol YOTTA_CFG_MBEDTLS_TARGET_CONFIG_FILE.\n * Added optimization for code space for X.509/OID based on configured\n features. Contributed by Aviv Palivoda.\n * Renamed source file library/net.c to library/net_sockets.c to avoid\n naming collision in projects which also have files with the common name\n net.c. For consistency, the corresponding header file, net.h, is marked as\n deprecated, and its contents moved to net_sockets.h.\n * Changed the strategy for X.509 certificate parsing and validation, to no\n longer disregard certificates with unrecognised fields.", "= mbed TLS 2.3.0 branch released 2016-06-28", "Security\n * Fix missing padding length check in mbedtls_rsa_rsaes_pkcs1_v15_decrypt\n required by PKCS1 v2.2\n * Fix potential integer overflow to buffer overflow in\n mbedtls_rsa_rsaes_pkcs1_v15_encrypt and mbedtls_rsa_rsaes_oaep_encrypt\n (not triggerable remotely in (D)TLS).\n * Fix a potential integer underflow to buffer overread in \n mbedtls_rsa_rsaes_oaep_decrypt. It is not triggerable remotely in\n SSL/TLS.", "Features\n * Support for platform abstraction of the standard C library time()\n function.", "Bugfix\n * Fix bug in mbedtls_mpi_add_mpi() that caused wrong results when the three\n arguments where the same (in-place doubling). Found and fixed by Janos\n Follath. #309\n * Fix potential build failures related to the 'apidoc' target, introduced\n in the previous patch release. Found by Robert Scheck. #390 #391\n * Fix issue in Makefile that prevented building using armar. #386\n * Fix memory leak that occured only when ECJPAKE was enabled and ECDHE and\n ECDSA was disabled in config.h . The leak didn't occur by default.\n * Fix an issue that caused valid certificates to be rejected whenever an\n expired or not yet valid certificate was parsed before a valid certificate\n in the trusted certificate list.\n * Fix bug in mbedtls_x509_crt_parse that caused trailing extra data in the \n buffer after DER certificates to be included in the raw representation.\n * Fix issue that caused a hang when generating RSA keys of odd bitlength\n * Fix bug in mbedtls_rsa_rsaes_pkcs1_v15_encrypt that made null pointer\n dereference possible.\n * Fix issue that caused a crash if invalid curves were passed to\n mbedtls_ssl_conf_curves. #373\n * Fix issue in ssl_fork_server which was preventing it from functioning. #429\n * Fix memory leaks in test framework\n * Fix test in ssl-opt.sh that does not run properly with valgrind\n * Fix unchecked calls to mmbedtls_md_setup(). Fix by Brian Murray. #502", "Changes\n * On ARM platforms, when compiling with -O0 with GCC, Clang or armcc5,\n don't use the optimized assembly for bignum multiplication. This removes\n the need to pass -fomit-frame-pointer to avoid a build error with -O0.\n * Disabled SSLv3 in the default configuration.\n * Optimized mbedtls_mpi_zeroize() for MPI integer size. (Fix by Alexey\n Skalozub).\n * Fix non-compliance server extension handling. Extensions for SSLv3 are now\n ignored, as required by RFC6101.", "= mbed TLS 2.2.1 released 2016-01-05", "Security\n * Fix potential double free when mbedtls_asn1_store_named_data() fails to\n allocate memory. Only used for certificate generation, not triggerable\n remotely in SSL/TLS. Found by Rafał Przywara. #367\n * Disable MD5 handshake signatures in TLS 1.2 by default to prevent the\n SLOTH attack on TLS 1.2 server authentication (other attacks from the\n SLOTH paper do not apply to any version of mbed TLS or PolarSSL).\n https://www.mitls.org/pages/attacks/SLOTH", "Bugfix\n * Fix over-restrictive length limit in GCM. Found by Andreas-N. #362\n * Fix bug in certificate validation that caused valid chains to be rejected\n when the first intermediate certificate has pathLenConstraint=0. Found by\n Nicholas Wilson. Introduced in mbed TLS 2.2.0. #280\n * Removed potential leak in mbedtls_rsa_rsassa_pkcs1_v15_sign(), found by\n JayaraghavendranK. #372\n * Fix suboptimal handling of unexpected records that caused interop issues\n with some peers over unreliable links. Avoid dropping an entire DTLS\n datagram if a single record in a datagram is unexpected, instead only\n drop the record and look at subsequent records (if any are present) in\n the same datagram. Found by jeannotlapin. #345", "= mbed TLS 2.2.0 released 2015-11-04", "Security\n * Fix potential double free if mbedtls_ssl_conf_psk() is called more than\n once and some allocation fails. Cannot be forced remotely. Found by Guido\n Vranken, Intelworks.\n * Fix potential heap corruption on Windows when\n mbedtls_x509_crt_parse_path() is passed a path longer than 2GB. Cannot be\n triggered remotely. Found by Guido Vranken, Intelworks.\n * Fix potential buffer overflow in some asn1_write_xxx() functions.\n Cannot be triggered remotely unless you create X.509 certificates based\n on untrusted input or write keys of untrusted origin. Found by Guido\n Vranken, Intelworks.\n * The X509 max_pathlen constraint was not enforced on intermediate\n certificates. Found by Nicholas Wilson, fix and tests provided by\n Janos Follath. #280 and #319", "Features\n * Experimental support for EC J-PAKE as defined in Thread 1.0.0.\n Disabled by default as the specification might still change.\n * Added a key extraction callback to accees the master secret and key\n block. (Potential uses include EAP-TLS and Thread.)", "Bugfix\n * Self-signed certificates were not excluded from pathlen counting,\n resulting in some valid X.509 being incorrectly rejected. Found and fix\n provided by Janos Follath. #319\n * Fix build error with configurations where ECDHE-PSK is the only key\n exchange. Found and fix provided by Chris Hammond. #270\n * Fix build error with configurations where RSA, RSA-PSK, ECDH-RSA or\n ECHD-ECDSA if the only key exchange. Multiple reports. #310\n * Fixed a bug causing some handshakes to fail due to some non-fatal alerts\n not being properly ignored. Found by mancha and Kasom Koht-arsa, #308\n * mbedtls_x509_crt_verify(_with_profile)() now also checks the key type and\n size/curve against the profile. Before that, there was no way to set a\n minimum key size for end-entity certificates with RSA keys. Found by\n Matthew Page of Scannex Electronics Ltd.\n * Fix failures in MPI on Sparc(64) due to use of bad assembly code.\n Found by Kurt Danielson. #292\n * Fix typo in name of the extKeyUsage OID. Found by inestlerode, #314\n * Fix bug in ASN.1 encoding of booleans that caused generated CA\n certificates to be rejected by some applications, including OS X\n Keychain. Found and fixed by Jonathan Leroy, Inikup.", "Changes\n * Improved performance of mbedtls_ecp_muladd() when one of the scalars is 1\n or -1.", "= mbed TLS 2.1.2 released 2015-10-06", "Security\n * Added fix for CVE-2015-5291 to prevent heap corruption due to buffer\n overflow of the hostname or session ticket. Found by Guido Vranken,\n Intelworks.\n * Fix potential double-free if mbedtls_ssl_set_hs_psk() is called more than\n once in the same handhake and mbedtls_ssl_conf_psk() was used.\n Found and patch provided by Guido Vranken, Intelworks. Cannot be forced\n remotely.\n * Fix stack buffer overflow in pkcs12 decryption (used by\n mbedtls_pk_parse_key(file)() when the password is > 129 bytes.\n Found by Guido Vranken, Intelworks. Not triggerable remotely.\n * Fix potential buffer overflow in mbedtls_mpi_read_string().\n Found by Guido Vranken, Intelworks. Not exploitable remotely in the context\n of TLS, but might be in other uses. On 32 bit machines, requires reading a\n string of close to or larger than 1GB to exploit; on 64 bit machines, would\n require reading a string of close to or larger than 2^62 bytes.\n * Fix potential random memory allocation in mbedtls_pem_read_buffer()\n on crafted PEM input data. Found and fix provided by Guido Vranken,\n Intelworks. Not triggerable remotely in TLS. Triggerable remotely if you\n accept PEM data from an untrusted source.\n * Fix possible heap buffer overflow in base64_encoded() when the input\n buffer is 512MB or larger on 32-bit platforms. Found by Guido Vranken,\n Intelworks. Not trigerrable remotely in TLS.\n * Fix potential double-free if mbedtls_conf_psk() is called repeatedly on\n the same mbedtls_ssl_config object and memory allocation fails. Found by\n Guido Vranken, Intelworks. Cannot be forced remotely.\n * Fix potential heap buffer overflow in servers that perform client\n authentication against a crafted CA cert. Cannot be triggered remotely\n unless you allow third parties to pick trust CAs for client auth.\n Found by Guido Vranken, Intelworks.", "Bugfix\n * Fix compile error in net.c with musl libc. Found and patch provided by\n zhasha (#278).\n * Fix macroization of 'inline' keyword when building as C++. (#279)", "Changes\n * Added checking of hostname length in mbedtls_ssl_set_hostname() to ensure\n domain names are compliant with RFC 1035.\n * Fixed paths for check_config.h in example config files. (Found by bachp)\n (#291)", "= mbed TLS 2.1.1 released 2015-09-17", "Security\n * Add countermeasure against Lenstra's RSA-CRT attack for PKCS#1 v1.5\n signatures. (Found by Florian Weimer, Red Hat.)\n https://securityblog.redhat.com/2015/09/02/factoring-rsa-keys-with-tls-perfect-forward-secrecy/\n * Fix possible client-side NULL pointer dereference (read) when the client\n tries to continue the handshake after it failed (a misuse of the API).\n (Found and patch provided by Fabian Foerg, Gotham Digital Science using\n afl-fuzz.)", "Bugfix\n * Fix warning when using a 64bit platform. (found by embedthis) (#275)\n * Fix off-by-one error in parsing Supported Point Format extension that\n caused some handshakes to fail.", "Changes\n * Made X509 profile pointer const in mbedtls_ssl_conf_cert_profile() to allow\n use of mbedtls_x509_crt_profile_next. (found by NWilson)\n * When a client initiates a reconnect from the same port as a live\n connection, if cookie verification is available\n (MBEDTLS_SSL_DTLS_HELLO_VERIFY defined in config.h, and usable cookie\n callbacks set with mbedtls_ssl_conf_dtls_cookies()), this will be\n detected and mbedtls_ssl_read() will return\n MBEDTLS_ERR_SSL_CLIENT_RECONNECT - it is then possible to start a new\n handshake with the same context. (See RFC 6347 section 4.2.8.)", "= mbed TLS 2.1.0 released 2015-09-04", "Features\n * Added support for yotta as a build system.\n * Primary open source license changed to Apache 2.0 license.", "Bugfix\n * Fix segfault in the benchmark program when benchmarking DHM.\n * Fix build error with CMake and pre-4.5 versions of GCC (found by Hugo\n Leisink).\n * Fix bug when parsing a ServerHello without extensions (found by David\n Sears).\n * Fix bug in CMake lists that caused libmbedcrypto.a not to be installed\n (found by Benoit Lecocq).\n * Fix bug in Makefile that caused libmbedcrypto and libmbedx509 not to be\n installed (found by Rawi666).\n * Fix compile error with armcc 5 with --gnu option.\n * Fix bug in Makefile that caused programs not to be installed correctly\n (found by robotanarchy) (#232).\n * Fix bug in Makefile that prevented from installing without building the\n tests (found by robotanarchy) (#232).\n * Fix missing -static-libgcc when building shared libraries for Windows\n with make.\n * Fix link error when building shared libraries for Windows with make.\n * Fix error when loading libmbedtls.so.\n * Fix bug in mbedtls_ssl_conf_default() that caused the default preset to\n be always used (found by dcb314) (#235)\n * Fix bug in mbedtls_rsa_public() and mbedtls_rsa_private() that could\n result trying to unlock an unlocked mutex on invalid input (found by\n Fredrik Axelsson) (#257)\n * Fix -Wshadow warnings (found by hnrkp) (#240)\n * Fix memory corruption on client with overlong PSK identity, around\n SSL_MAX_CONTENT_LEN or higher - not triggerrable remotely (found by\n Aleksandrs Saveljevs) (#238)\n * Fix unused function warning when using MBEDTLS_MDx_ALT or\n MBEDTLS_SHAxxx_ALT (found by Henrik) (#239)\n * Fix memory corruption in pkey programs (found by yankuncheng) (#210)", "Changes\n * The PEM parser now accepts a trailing space at end of lines (#226).\n * It is now possible to #include a user-provided configuration file at the\n end of the default config.h by defining MBEDTLS_USER_CONFIG_FILE on the\n compiler's command line.\n * When verifying a certificate chain, if an intermediate certificate is\n trusted, no later cert is checked. (suggested by hannes-landeholm)\n (#220).\n * Prepend a \"thread identifier\" to debug messages (issue pointed out by\n Hugo Leisink) (#210).\n * Add mbedtls_ssl_get_max_frag_len() to query the current maximum fragment\n length.", "= mbed TLS 2.0.0 released 2015-07-13", "Features\n * Support for DTLS 1.0 and 1.2 (RFC 6347).\n * Ability to override core functions from MDx, SHAx, AES and DES modules\n with custom implementation (eg hardware accelerated), complementing the\n ability to override the whole module.\n * New server-side implementation of session tickets that rotate keys to\n preserve forward secrecy, and allows sharing across multiple contexts.\n * Added a concept of X.509 cerificate verification profile that controls\n which algorithms and key sizes (curves for ECDSA) are acceptable.\n * Expanded configurability of security parameters in the SSL module with\n mbedtls_ssl_conf_dhm_min_bitlen() and mbedtls_ssl_conf_sig_hashes().\n * Introduced a concept of presets for SSL security-relevant configuration\n parameters.", "API Changes\n * The library has been split into libmbedcrypto, libmbedx509, libmbedtls.\n You now need to link to all of them if you use TLS for example.\n * All public identifiers moved to the mbedtls_* or MBEDTLS_* namespace.\n Some names have been further changed to make them more consistent.\n Migration helpers scripts/rename.pl and include/mbedlts/compat-1.3.h are\n provided. Full list of renamings in scripts/data_files/rename-1.3-2.0.txt\n * Renamings of fields inside structures, not covered by the previous list:\n mbedtls_cipher_info_t.key_length -> key_bitlen\n mbedtls_cipher_context_t.key_length -> key_bitlen\n mbedtls_ecp_curve_info.size -> bit_size\n * Headers are now found in the 'mbedtls' directory (previously 'polarssl').\n * The following _init() functions that could return errors have\n been split into an _init() that returns void and another function that\n should generally be the first function called on this context after init:\n mbedtls_ssl_init() -> mbedtls_ssl_setup()\n mbedtls_ccm_init() -> mbedtls_ccm_setkey()\n mbedtls_gcm_init() -> mbedtls_gcm_setkey()\n mbedtls_hmac_drbg_init() -> mbedtls_hmac_drbg_seed(_buf)()\n mbedtls_ctr_drbg_init() -> mbedtls_ctr_drbg_seed()\n Note that for mbedtls_ssl_setup(), you need to be done setting up the\n ssl_config structure before calling it.\n * Most ssl_set_xxx() functions (all except ssl_set_bio(), ssl_set_hostname(),\n ssl_set_session() and ssl_set_client_transport_id(), plus\n ssl_legacy_renegotiation()) have been renamed to mbedtls_ssl_conf_xxx()\n (see rename.pl and compat-1.3.h above) and their first argument's type\n changed from ssl_context to ssl_config.\n * ssl_set_bio() changed signature (contexts merged, order switched, one\n additional callback for read-with-timeout).\n * The following functions have been introduced and must be used in callback\n implementations (SNI, PSK) instead of their *conf counterparts:\n mbedtls_ssl_set_hs_own_cert()\n mbedtls_ssl_set_hs_ca_chain()\n mbedtls_ssl_set_hs_psk()\n * mbedtls_ssl_conf_ca_chain() lost its last argument (peer_cn), now set\n using mbedtls_ssl_set_hostname().\n * mbedtls_ssl_conf_session_cache() changed prototype (only one context\n pointer, parameters reordered).\n * On server, mbedtls_ssl_conf_session_tickets_cb() must now be used in\n place of mbedtls_ssl_conf_session_tickets() to enable session tickets.\n * The SSL debug callback gained two new arguments (file name, line number).\n * Debug modes were removed.\n * mbedtls_ssl_conf_truncated_hmac() now returns void.\n * mbedtls_memory_buffer_alloc_init() now returns void.\n * X.509 verification flags are now an uint32_t. Affect the signature of:\n mbedtls_ssl_get_verify_result()\n mbedtls_x509_ctr_verify_info()\n mbedtls_x509_crt_verify() (flags, f_vrfy -> needs to be updated)\n mbedtls_ssl_conf_verify() (f_vrfy -> needs to be updated)\n * The following functions changed prototype to avoid an in-out length\n parameter:\n mbedtls_base64_encode()\n mbedtls_base64_decode()\n mbedtls_mpi_write_string()\n mbedtls_dhm_calc_secret()\n * In the NET module, all \"int\" and \"int *\" arguments for file descriptors\n changed type to \"mbedtls_net_context *\".\n * net_accept() gained new arguments for the size of the client_ip buffer.\n * In the threading layer, mbedtls_mutex_init() and mbedtls_mutex_free() now\n return void.\n * ecdsa_write_signature() gained an addtional md_alg argument and\n ecdsa_write_signature_det() was deprecated.\n * pk_sign() no longer accepts md_alg == POLARSSL_MD_NONE with ECDSA.\n * Last argument of x509_crt_check_key_usage() and\n mbedtls_x509write_crt_set_key_usage() changed from int to unsigned.\n * test_ca_list (from certs.h) is renamed to test_cas_pem and is only\n available if POLARSSL_PEM_PARSE_C is defined (it never worked without).\n * Test certificates in certs.c are no longer guaranteed to be nul-terminated\n strings; use the new *_len variables instead of strlen().\n * Functions mbedtls_x509_xxx_parse(), mbedtls_pk_parse_key(),\n mbedtls_pk_parse_public_key() and mbedtls_dhm_parse_dhm() now expect the\n length parameter to include the terminating null byte for PEM input.\n * Signature of mpi_mul_mpi() changed to make the last argument unsigned\n * calloc() is now used instead of malloc() everywhere. API of platform\n layer and the memory_buffer_alloc module changed accordingly.\n (Thanks to Mansour Moufid for helping with the replacement.)\n * Change SSL_DISABLE_RENEGOTIATION config.h flag to SSL_RENEGOTIATION\n (support for renegotiation now needs explicit enabling in config.h).\n * Split MBEDTLS_HAVE_TIME into MBEDTLS_HAVE_TIME and MBEDTLS_HAVE_TIME_DATE\n in config.h\n * net_connect() and net_bind() have a new 'proto' argument to choose\n between TCP and UDP, using the macros NET_PROTO_TCP or NET_PROTO_UDP.\n Their 'port' argument type is changed to a string.\n * Some constness fixes", "Removals\n * Removed mbedtls_ecp_group_read_string(). Only named groups are supported.\n * Removed mbedtls_ecp_sub() and mbedtls_ecp_add(), use\n mbedtls_ecp_muladd().\n * Removed individual mdX_hmac, shaX_hmac, mdX_file and shaX_file functions\n (use generic functions from md.h)\n * Removed mbedtls_timing_msleep(). Use mbedtls_net_usleep() or a custom\n waiting function.\n * Removed test DHM parameters from the test certs module.\n * Removed the PBKDF2 module (use PKCS5).\n * Removed POLARSSL_ERROR_STRERROR_BC (use mbedtls_strerror()).\n * Removed compat-1.2.h (helper for migrating from 1.2 to 1.3).\n * Removed openssl.h (very partial OpenSSL compatibility layer).\n * Configuration options POLARSSL_HAVE_LONGLONG was removed (now always on).\n * Configuration options POLARSSL_HAVE_INT8 and POLARSSL_HAVE_INT16 have\n been removed (compiler is required to support 32-bit operations).\n * Configuration option POLARSSL_HAVE_IPV6 was removed (always enabled).\n * Removed test program o_p_test, the script compat.sh does more.\n * Removed test program ssl_test, superseded by ssl-opt.sh.\n * Removed helper script active-config.pl", "New deprecations\n * md_init_ctx() is deprecated in favour of md_setup(), that adds a third\n argument (allowing memory savings if HMAC is not used)", "Semi-API changes (technically public, morally private)\n * Renamed a few headers to include _internal in the name. Those headers are\n not supposed to be included by users.\n * Changed md_info_t into an opaque structure (use md_get_xxx() accessors).\n * Changed pk_info_t into an opaque structure.\n * Changed cipher_base_t into an opaque structure.\n * Removed sig_oid2 and rename sig_oid1 to sig_oid in x509_crt and x509_crl.\n * x509_crt.key_usage changed from unsigned char to unsigned int.\n * Removed r and s from ecdsa_context\n * Removed mode from des_context and des3_context", "Default behavior changes\n * The default minimum TLS version is now TLS 1.0.\n * RC4 is now blacklisted by default in the SSL/TLS layer, and excluded from the\n default ciphersuite list returned by ssl_list_ciphersuites()\n * Support for receiving SSLv2 ClientHello is now disabled by default at\n compile time.\n * The default authmode for SSL/TLS clients is now REQUIRED.\n * Support for RSA_ALT contexts in the PK layer is now optional. Since is is\n enabled in the default configuration, this is only noticeable if using a\n custom config.h\n * Default DHM parameters server-side upgraded from 1024 to 2048 bits.\n * A minimum RSA key size of 2048 bits is now enforced during ceritificate\n chain verification.\n * Negotiation of truncated HMAC is now disabled by default on server too.\n * The following functions are now case-sensitive:\n mbedtls_cipher_info_from_string()\n mbedtls_ecp_curve_info_from_name()\n mbedtls_md_info_from_string()\n mbedtls_ssl_ciphersuite_from_string()\n mbedtls_version_check_feature()", "Requirement changes\n * The minimum MSVC version required is now 2010 (better C99 support).\n * The NET layer now unconditionnaly relies on getaddrinfo() and select().\n * Compiler is required to support C99 types such as long long and uint32_t.", "API changes from the 1.4 preview branch\n * ssl_set_bio_timeout() was removed, split into mbedtls_ssl_set_bio() with\n new prototype, and mbedtls_ssl_set_read_timeout().\n * The following functions now return void:\n mbedtls_ssl_conf_transport()\n mbedtls_ssl_conf_max_version()\n mbedtls_ssl_conf_min_version()\n * DTLS no longer hard-depends on TIMING_C, but uses a callback interface\n instead, see mbedtls_ssl_set_timer_cb(), with the Timing module providing\n an example implementation, see mbedtls_timing_delay_context and\n mbedtls_timing_set/get_delay().\n * With UDP sockets, it is no longer necessary to call net_bind() again\n after a successful net_accept().", "Changes\n * mbedtls_ctr_drbg_random() and mbedtls_hmac_drbg_random() are now\n thread-safe if MBEDTLS_THREADING_C is enabled.\n * Reduced ROM fooprint of SHA-256 and added an option to reduce it even\n more (at the expense of performance) MBEDTLS_SHA256_SMALLER.", "= mbed TLS 1.3 branch", "Security\n * With authmode set to SSL_VERIFY_OPTIONAL, verification of keyUsage and\n extendedKeyUsage on the leaf certificate was lost (results not accessible\n via ssl_get_verify_results()).\n * Add countermeasure against \"Lucky 13 strikes back\" cache-based attack,\n https://dl.acm.org/citation.cfm?id=2714625", "Features\n * Improve ECC performance by using more efficient doubling formulas\n (contributed by Peter Dettman).\n * Add x509_crt_verify_info() to display certificate verification results.\n * Add support for reading DH parameters with privateValueLength included\n (contributed by Daniel Kahn Gillmor).\n * Add support for bit strings in X.509 names (request by Fredrik Axelsson).\n * Add support for id-at-uniqueIdentifier in X.509 names.\n * Add support for overriding snprintf() (except on Windows) and exit() in\n the platform layer.\n * Add an option to use macros instead of function pointers in the platform\n layer (helps get rid of unwanted references).\n * Improved Makefiles for Windows targets by fixing library targets and making\n cross-compilation easier (thanks to Alon Bar-Lev).\n * The benchmark program also prints heap usage for public-key primitives\n if POLARSSL_MEMORY_BUFFER_ALLOC_C and POLARSSL_MEMORY_DEBUG are defined.\n * New script ecc-heap.sh helps measuring the impact of ECC parameters on\n speed and RAM (heap only for now) usage.\n * New script memory.sh helps measuring the ROM and RAM requirements of two\n reduced configurations (PSK-CCM and NSA suite B).\n * Add config flag POLARSSL_DEPRECATED_WARNING (off by default) to produce\n warnings on use of deprecated functions (with GCC and Clang only).\n * Add config flag POLARSSL_DEPRECATED_REMOVED (off by default) to produce\n errors on use of deprecated functions.", "Bugfix\n * Fix compile errors with PLATFORM_NO_STD_FUNCTIONS.\n * Fix compile error with PLATFORM_EXIT_ALT (thanks to Rafał Przywara).\n * Fix bug in entropy.c when THREADING_C is also enabled that caused\n entropy_free() to crash (thanks to Rafał Przywara).\n * Fix memory leak when gcm_setkey() and ccm_setkey() are used more than\n once on the same context.\n * Fix bug in ssl_mail_client when password is longer that username (found\n by Bruno Pape).\n * Fix undefined behaviour (memcmp( NULL, NULL, 0 );) in X.509 modules\n (detected by Clang's 3.6 UBSan).\n * mpi_size() and mpi_msb() would segfault when called on an mpi that is\n initialized but not set (found by pravic).\n * Fix detection of support for getrandom() on Linux (reported by syzzer) by\n doing it at runtime (using uname) rather that compile time.\n * Fix handling of symlinks by \"make install\" (found by Gaël PORTAY).\n * Fix potential NULL pointer dereference (not trigerrable remotely) when\n ssl_write() is called before the handshake is finished (introduced in\n 1.3.10) (first reported by Martin Blumenstingl).\n * Fix bug in pk_parse_key() that caused some valid private EC keys to be\n rejected.\n * Fix bug in Via Padlock support (found by Nikos Mavrogiannopoulos).\n * Fix thread safety bug in RSA operations (found by Fredrik Axelsson).\n * Fix hardclock() (only used in the benchmarking program) with some\n versions of mingw64 (found by kxjhlele).\n * Fix warnings from mingw64 in timing.c (found by kxjklele).\n * Fix potential unintended sign extension in asn1_get_len() on 64-bit\n platforms.\n * Fix potential memory leak in ssl_set_psk() (found by Mansour Moufid).\n * Fix compile error when POLARSSL_SSL_DISABLE_RENEGOTATION and\n POLARSSL_SSL_SSESSION_TICKETS where both enabled in config.h (introduced\n in 1.3.10).\n * Add missing extern \"C\" guard in aesni.h (reported by amir zamani).\n * Add missing dependency on SHA-256 in some x509 programs (reported by\n Gergely Budai).\n * Fix bug related to ssl_set_curves(): the client didn't check that the\n curve picked by the server was actually allowed.", "Changes\n * Remove bias in mpi_gen_prime (contributed by Pascal Junod).\n * Remove potential sources of timing variations (some contributed by Pascal\n Junod).\n * Options POLARSSL_HAVE_INT8 and POLARSSL_HAVE_INT16 are deprecated.\n * Enabling POLARSSL_NET_C without POLARSSL_HAVE_IPV6 is deprecated.\n * compat-1.2.h and openssl.h are deprecated.\n * Adjusting/overriding CFLAGS and LDFLAGS with the make build system is now\n more flexible (warning: OFLAGS is not used any more) (see the README)\n (contributed by Alon Bar-Lev).\n * ssl_set_own_cert() no longer calls pk_check_pair() since the\n performance impact was bad for some users (this was introduced in 1.3.10).\n * Move from SHA-1 to SHA-256 in example programs using signatures\n (suggested by Thorsten Mühlfelder).\n * Remove some unneeded inclusions of header files from the standard library\n \"minimize\" others (eg use stddef.h if only size_t is needed).\n * Change #include lines in test files to use double quotes instead of angle\n brackets for uniformity with the rest of the code.\n * Remove dependency on sscanf() in X.509 parsing modules.", "= mbed TLS 1.3.10 released 2015-02-09\nSecurity\n * NULL pointer dereference in the buffer-based allocator when the buffer is\n full and polarssl_free() is called (found by Mark Hasemeyer)\n (only possible if POLARSSL_MEMORY_BUFFER_ALLOC_C is enabled, which it is\n not by default).\n * Fix remotely-triggerable uninitialised pointer dereference caused by\n crafted X.509 certificate (TLS server is not affected if it doesn't ask for a\n client certificate) (found using Codenomicon Defensics).\n * Fix remotely-triggerable memory leak caused by crafted X.509 certificates\n (TLS server is not affected if it doesn't ask for a client certificate)\n (found using Codenomicon Defensics).\n * Fix potential stack overflow while parsing crafted X.509 certificates\n (TLS server is not affected if it doesn't ask for a client certificate)\n (found using Codenomicon Defensics).\n * Fix timing difference that could theoretically lead to a\n Bleichenbacher-style attack in the RSA and RSA-PSK key exchanges\n (reported by Sebastian Schinzel).", "Features\n * Add support for FALLBACK_SCSV (draft-ietf-tls-downgrade-scsv).\n * Add support for Extended Master Secret (draft-ietf-tls-session-hash).\n * Add support for Encrypt-then-MAC (RFC 7366).\n * Add function pk_check_pair() to test if public and private keys match.\n * Add x509_crl_parse_der().\n * Add compile-time option POLARSSL_X509_MAX_INTERMEDIATE_CA to limit the\n length of an X.509 verification chain.\n * Support for renegotiation can now be disabled at compile-time\n * Support for 1/n-1 record splitting, a countermeasure against BEAST.\n * Certificate selection based on signature hash, preferring SHA-1 over SHA-2\n for pre-1.2 clients when multiple certificates are available.\n * Add support for getrandom() syscall on recent Linux kernels with Glibc or\n a compatible enough libc (eg uClibc).\n * Add ssl_set_arc4_support() to make it easier to disable RC4 at runtime\n while using the default ciphersuite list.\n * Added new error codes and debug messages about selection of\n ciphersuite/certificate.", "Bugfix\n * Stack buffer overflow if ctr_drbg_update() is called with too large\n add_len (found by Jean-Philippe Aumasson) (not triggerable remotely).\n * Possible buffer overflow of length at most POLARSSL_MEMORY_ALIGN_MULTIPLE\n if memory_buffer_alloc_init() was called with buf not aligned and len not\n a multiple of POLARSSL_MEMORY_ALIGN_MULTIPLE (not triggerable remotely).\n * User set CFLAGS were ignored by Cmake with gcc (introduced in 1.3.9, found\n by Julian Ospald).\n * Fix potential undefined behaviour in Camellia.\n * Fix potential failure in ECDSA signatures when POLARSSL_ECP_MAX_BITS is a\n multiple of 8 (found by Gergely Budai).\n * Fix unchecked return code in x509_crt_parse_path() on Windows (found by\n Peter Vaskovic).\n * Fix assembly selection for MIPS64 (thanks to James Cowgill).\n * ssl_get_verify_result() now works even if the handshake was aborted due\n to a failed verification (found by Fredrik Axelsson).\n * Skip writing and parsing signature_algorithm extension if none of the\n key exchanges enabled needs certificates. This fixes a possible interop\n issue with some servers when a zero-length extension was sent. (Reported\n by Peter Dettman.)\n * On a 0-length input, base64_encode() did not correctly set output length\n (found by Hendrik van den Boogaard).", "Changes\n * Use deterministic nonces for AEAD ciphers in TLS by default (possible to\n switch back to random with POLARSSL_SSL_AEAD_RANDOM_IV in config.h).\n * Blind RSA private operations even when POLARSSL_RSA_NO_CRT is defined.\n * ssl_set_own_cert() now returns an error on key-certificate mismatch.\n * Forbid repeated extensions in X.509 certificates.\n * debug_print_buf() now prints a text view in addition to hexadecimal.\n * A specific error is now returned when there are ciphersuites in common\n but none of them is usable due to external factors such as no certificate\n with a suitable (extended)KeyUsage or curve or no PSK set.\n * It is now possible to disable negotiation of truncated HMAC server-side\n at runtime with ssl_set_truncated_hmac().\n * Example programs for SSL client and server now disable SSLv3 by default.\n * Example programs for SSL client and server now disable RC4 by default.\n * Use platform.h in all test suites and programs.", "= PolarSSL 1.3.9 released 2014-10-20\nSecurity\n * Lowest common hash was selected from signature_algorithms extension in\n TLS 1.2 (found by Darren Bane) (introduced in 1.3.8).\n * Remotely-triggerable memory leak when parsing some X.509 certificates\n (server is not affected if it doesn't ask for a client certificate)\n (found using Codenomicon Defensics).\n * Remotely-triggerable memory leak when parsing crafted ClientHello\n (not affected if ECC support was compiled out) (found using Codenomicon\n Defensics).", "Bugfix\n * Support escaping of commas in x509_string_to_names()\n * Fix compile error in ssl_pthread_server (found by Julian Ospald).\n * Fix net_accept() regarding non-blocking sockets (found by Luca Pesce).\n * Don't print uninitialised buffer in ssl_mail_client (found by Marc Abel).\n * Fix warnings from Clang's scan-build (contributed by Alfred Klomp).\n * Fix compile error in timing.c when POLARSSL_NET_C and POLARSSL_SELFTEST\n are defined but not POLARSSL_HAVE_TIME (found by Stephane Di Vito).\n * Remove non-existent file from VS projects (found by Peter Vaskovic).\n * ssl_read() could return non-application data records on server while\n renegotation was pending, and on client when a HelloRequest was received.\n * Server-initiated renegotiation would fail with non-blocking I/O if the\n write callback returned WANT_WRITE when requesting renegotiation.\n * ssl_close_notify() could send more than one message in some circumstances\n with non-blocking I/O.\n * Fix compiler warnings on iOS (found by Sander Niemeijer).\n * x509_crt_parse() did not increase total_failed on PEM error\n * Fix compile error with armcc in mpi_is_prime()\n * Fix potential bad read in parsing ServerHello (found by Adrien\n Vialletelle).", "Changes\n * Ciphersuites using SHA-256 or SHA-384 now require TLS 1.x (there is no\n standard defining how to use SHA-2 with SSL 3.0).\n * Ciphersuites using RSA-PSK key exchange new require TLS 1.x (the spec is\n ambiguous on how to encode some packets with SSL 3.0).\n * Made buffer size in pk_write_(pub)key_pem() more dynamic, eg smaller if\n RSA is disabled, larger if POLARSSL_MPI_MAX_SIZE is larger.\n * ssl_read() now returns POLARSSL_ERR_NET_WANT_READ rather than\n POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE on harmless alerts.\n * POLARSSL_MPI_MAX_SIZE now defaults to 1024 in order to allow 8192 bits\n RSA keys.\n * Accept spaces at end of line or end of buffer in base64_decode().\n * X.509 certificates with more than one AttributeTypeAndValue per\n RelativeDistinguishedName are not accepted any more.", "= PolarSSL 1.3.8 released 2014-07-11\nSecurity\n * Fix length checking for AEAD ciphersuites (found by Codenomicon).\n It was possible to crash the server (and client) using crafted messages\n when a GCM suite was chosen.", "Features\n * Add CCM module and cipher mode to Cipher Layer\n * Support for CCM and CCM_8 ciphersuites\n * Support for parsing and verifying RSASSA-PSS signatures in the X.509\n modules (certificates, CRLs and CSRs).\n * Blowfish in the cipher layer now supports variable length keys.\n * Add example config.h for PSK with CCM, optimized for low RAM usage.\n * Optimize for RAM usage in example config.h for NSA Suite B profile.\n * Add POLARSSL_REMOVE_ARC4_CIPHERSUITES to allow removing RC4 ciphersuites\n from the default list (inactive by default).\n * Add server-side enforcement of sent renegotiation requests\n (ssl_set_renegotiation_enforced())\n * Add SSL_CIPHERSUITES config.h flag to allow specifying a list of\n ciphersuites to use and save some memory if the list is small.", "Changes\n * Add LINK_WITH_PTHREAD option in CMake for explicit linking that is\n required on some platforms (e.g. OpenBSD)\n * Migrate zeroizing of data to polarssl_zeroize() instead of memset()\n against unwanted compiler optimizations\n * md_list() now returns hashes strongest first\n * Selection of hash for signing ServerKeyExchange in TLS 1.2 now picks\n strongest offered by client.\n * All public contexts have _init() and _free() functions now for simpler\n usage pattern", "Bugfix\n * Fix in debug_print_msg()\n * Enforce alignment in the buffer allocator even if buffer is not aligned\n * Remove less-than-zero checks on unsigned numbers\n * Stricter check on SSL ClientHello internal sizes compared to actual packet\n size (found by TrustInSoft)\n * Fix WSAStartup() return value check (found by Peter Vaskovic)\n * Other minor issues (found by Peter Vaskovic)\n * Fix symlink command for cross compiling with CMake (found by Andre\n Heinecke)\n * Fix DER output of gen_key app (found by Gergely Budai)\n * Very small records were incorrectly rejected when truncated HMAC was in\n use with some ciphersuites and versions (RC4 in all versions, CBC with\n versions < TLS 1.1).\n * Very large records using more than 224 bytes of padding were incorrectly\n rejected with CBC-based ciphersuites and TLS >= 1.1\n * Very large records using less padding could cause a buffer overread of up\n to 32 bytes with CBC-based ciphersuites and TLS >= 1.1\n * Restore ability to use a v1 cert as a CA if trusted locally. (This had\n been removed in 1.3.6.)\n * Restore ability to locally trust a self-signed cert that is not a proper\n CA for use as an end entity certificate. (This had been removed in\n 1.3.6.)\n * Fix preprocessor checks for bn_mul PPC asm (found by Barry K. Nathan).\n * Use \\n\\t rather than semicolons for bn_mul asm, since some assemblers\n interpret semicolons as comment delimiters (found by Barry K. Nathan).\n * Fix off-by-one error in parsing Supported Point Format extension that\n caused some handshakes to fail.\n * Fix possible miscomputation of the premaster secret with DHE-PSK key\n exchange that caused some handshakes to fail with other implementations.\n (Failure rate <= 1/255 with common DHM moduli.)\n * Disable broken Sparc64 bn_mul assembly (found by Florian Obser).\n * Fix base64_decode() to return and check length correctly (in case of\n tight buffers)\n * Fix mpi_write_string() to write \"00\" as hex output for empty MPI (found\n by Hui Dong)", "= PolarSSL 1.3.7 released on 2014-05-02\nFeatures\n * debug_set_log_mode() added to determine raw or full logging\n * debug_set_threshold() added to ignore messages over threshold level\n * version_check_feature() added to check for compile-time options at\n run-time", "Changes\n * POLARSSL_CONFIG_OPTIONS has been removed. All values are individually\n checked and filled in the relevant module headers\n * Debug module only outputs full lines instead of parts\n * Better support for the different Attribute Types from IETF PKIX (RFC 5280)\n * AES-NI now compiles with \"old\" assemblers too\n * Ciphersuites based on RC4 now have the lowest priority by default", "Bugfix\n * Only iterate over actual certificates in ssl_write_certificate_request()\n (found by Matthew Page)\n * Typos in platform.c and pkcs11.c (found by Daniel Phillips and Steffan\n Karger)\n * cert_write app should use subject of issuer certificate as issuer of cert\n * Fix false reject in padding check in ssl_decrypt_buf() for CBC\n ciphersuites, for full SSL frames of data.\n * Improve interoperability by not writing extension length in ClientHello /\n ServerHello when no extensions are present (found by Matthew Page)\n * rsa_check_pubkey() now allows an E up to N\n * On OpenBSD, use arc4random_buf() instead of rand() to prevent warnings\n * mpi_fill_random() was creating numbers larger than requested on\n big-endian platform when size was not an integer number of limbs\n * Fix dependencies issues in X.509 test suite.\n * Some parts of ssl_tls.c were compiled even when the module was disabled.\n * Fix detection of DragonflyBSD in net.c (found by Markus Pfeiffer)\n * Fix detection of Clang on some Apple platforms with CMake\n (found by Barry K. Nathan)", "= PolarSSL 1.3.6 released on 2014-04-11", "Features\n * Support for the ALPN SSL extension\n * Add option 'use_dev_random' to gen_key application\n * Enable verification of the keyUsage extension for CA and leaf\n certificates (POLARSSL_X509_CHECK_KEY_USAGE)\n * Enable verification of the extendedKeyUsage extension\n (POLARSSL_X509_CHECK_EXTENDED_KEY_USAGE)", "Changes\n * x509_crt_info() now prints information about parsed extensions as well\n * pk_verify() now returns a specific error code when the signature is valid\n but shorter than the supplied length.\n * Use UTC time to check certificate validity.\n * Reject certificates with times not in UTC, per RFC 5280.", "Security\n * Avoid potential timing leak in ecdsa_sign() by blinding modular division.\n (Found by Watson Ladd.)\n * The notAfter date of some certificates was no longer checked since 1.3.5.\n This affects certificates in the user-supplied chain except the top\n certificate. If the user-supplied chain contains only one certificates,\n it is not affected (ie, its notAfter date is properly checked).\n * Prevent potential NULL pointer dereference in ssl_read_record() (found by\n TrustInSoft)", "Bugfix\n * The length of various ClientKeyExchange messages was not properly checked.\n * Some example server programs were not sending the close_notify alert.\n * Potential memory leak in mpi_exp_mod() when error occurs during\n calculation of RR.\n * Fixed malloc/free default #define in platform.c (found by Gergely Budai).\n * Fixed type which made POLARSSL_ENTROPY_FORCE_SHA256 uneffective (found by\n Gergely Budai).\n * Fix #include path in ecdsa.h which wasn't accepted by some compilers.\n (found by Gergely Budai)\n * Fix compile errors when POLARSSL_ERROR_STRERROR_BC is undefined (found by\n Shuo Chen).\n * oid_get_numeric_string() used to truncate the output without returning an\n error if the output buffer was just 1 byte too small.\n * dhm_parse_dhm() (hence dhm_parse_dhmfile()) did not set dhm->len.\n * Calling pk_debug() on an RSA-alt key would segfault.\n * pk_get_size() and pk_get_len() were off by a factor 8 for RSA-alt keys.\n * Potential buffer overwrite in pem_write_buffer() because of low length\n indication (found by Thijs Alkemade)\n * EC curves constants, which should be only in ROM since 1.3.3, were also\n stored in RAM due to missing 'const's (found by Gergely Budai).", "= PolarSSL 1.3.5 released on 2014-03-26\nFeatures\n * HMAC-DRBG as a separate module\n * Option to set the Curve preference order (disabled by default)\n * Single Platform compatilibity layer (for memory / printf / fprintf)\n * Ability to provide alternate timing implementation\n * Ability to force the entropy module to use SHA-256 as its basis\n (POLARSSL_ENTROPY_FORCE_SHA256)\n * Testing script ssl-opt.sh added for testing 'live' ssl option\n interoperability against OpenSSL and PolarSSL\n * Support for reading EC keys that use SpecifiedECDomain in some cases.\n * Entropy module now supports seed writing and reading", "Changes\n * Deprecated the Memory layer\n * entropy_add_source(), entropy_update_manual() and entropy_gather()\n now thread-safe if POLARSSL_THREADING_C defined\n * Improvements to the CMake build system, contributed by Julian Ospald.\n * Work around a bug of the version of Clang shipped by Apple with Mavericks\n that prevented bignum.c from compiling. (Reported by Rafael Baptista.)\n * Revamped the compat.sh interoperatibility script to include support for\n testing against GnuTLS\n * Deprecated ssl_set_own_cert_rsa() and ssl_set_own_cert_rsa_alt()\n * Improvements to tests/Makefile, contributed by Oden Eriksson.", "Security\n * Forbid change of server certificate during renegotiation to prevent\n \"triple handshake\" attack when authentication mode is 'optional' (the\n attack was already impossible when authentication is required).\n * Check notBefore timestamp of certificates and CRLs from the future.\n * Forbid sequence number wrapping\n * Fixed possible buffer overflow with overlong PSK\n * Possible remotely-triggered out-of-bounds memory access fixed (found by\n TrustInSoft)", "Bugfix\n * ecp_gen_keypair() does more tries to prevent failure because of\n statistics\n * Fixed bug in RSA PKCS#1 v1.5 \"reversed\" operations\n * Fixed testing with out-of-source builds using cmake\n * Fixed version-major intolerance in server\n * Fixed CMake symlinking on out-of-source builds\n * Fixed dependency issues in test suite\n * Programs rsa_sign_pss and rsa_verify_pss were not using PSS since 1.3.0\n * Bignum's MIPS-32 assembly was used on MIPS-64, causing chaos. (Found by\n Alex Wilson.)\n * ssl_cache was creating entries when max_entries=0 if TIMING_C was enabled.\n * m_sleep() was sleeping twice too long on most Unix platforms.\n * Fixed bug with session tickets and non-blocking I/O in the unlikely case\n send() would return an EAGAIN error when sending the ticket.\n * ssl_cache was leaking memory when reusing a timed out entry containing a\n client certificate.\n * ssl_srv was leaking memory when client presented a timed out ticket\n containing a client certificate\n * ssl_init() was leaving a dirty pointer in ssl_context if malloc of\n out_ctr failed\n * ssl_handshake_init() was leaving dirty pointers in subcontexts if malloc\n of one of them failed\n * Fix typo in rsa_copy() that impacted PKCS#1 v2 contexts\n * x509_get_current_time() uses localtime_r() to prevent thread issues", "= PolarSSL 1.3.4 released on 2014-01-27\nFeatures\n * Support for the Koblitz curves: secp192k1, secp224k1, secp256k1\n * Support for RIPEMD-160\n * Support for AES CFB8 mode\n * Support for deterministic ECDSA (RFC 6979)", "Bugfix\n * Potential memory leak in bignum_selftest()\n * Replaced expired test certificate\n * ssl_mail_client now terminates lines with CRLF, instead of LF\n * net module handles timeouts on blocking sockets better (found by Tilman\n Sauerbeck)\n * Assembly format fixes in bn_mul.h", "Security\n * Missing MPI_CHK calls added around unguarded mpi calls (found by\n TrustInSoft)", "= PolarSSL 1.3.3 released on 2013-12-31\nFeatures\n * EC key generation support in gen_key app\n * Support for adhering to client ciphersuite order preference\n (POLARSSL_SSL_SRV_RESPECT_CLIENT_PREFERENCE)\n * Support for Curve25519\n * Support for ECDH-RSA and ECDH-ECDSA key exchanges and ciphersuites\n * Support for IPv6 in the NET module\n * AES-NI support for AES, AES-GCM and AES key scheduling\n * SSL Pthread-based server example added (ssl_pthread_server)", "Changes\n * gen_prime() speedup\n * Speedup of ECP multiplication operation\n * Relaxed some SHA2 ciphersuite's version requirements\n * Dropped use of readdir_r() instead of readdir() with threading support\n * More constant-time checks in the RSA module\n * Split off curves from ecp.c into ecp_curves.c\n * Curves are now stored fully in ROM\n * Memory usage optimizations in ECP module\n * Removed POLARSSL_THREADING_DUMMY", "Bugfix\n * Fixed bug in mpi_set_bit() on platforms where t_uint is wider than int\n * Fixed X.509 hostname comparison (with non-regular characters)\n * SSL now gracefully handles missing RNG\n * Missing defines / cases for RSA_PSK key exchange\n * crypt_and_hash app checks MAC before final decryption\n * Potential memory leak in ssl_ticket_keys_init()\n * Memory leak in benchmark application\n * Fixed x509_crt_parse_path() bug on Windows platforms\n * Added missing MPI_CHK() around some statements in mpi_div_mpi() (found by\n TrustInSoft)\n * Fixed potential overflow in certificate size verification in\n ssl_write_certificate() (found by TrustInSoft)", "Security\n * Possible remotely-triggered out-of-bounds memory access fixed (found by\n TrustInSoft)", "= PolarSSL 1.3.2 released on 2013-11-04\nFeatures\n * PK tests added to test framework\n * Added optional optimization for NIST MODP curves (POLARSSL_ECP_NIST_OPTIM)\n * Support for Camellia-GCM mode and ciphersuites", "Changes\n * Padding checks in cipher layer are now constant-time\n * Value comparisons in SSL layer are now constant-time\n * Support for serialNumber, postalAddress and postalCode in X509 names\n * SSL Renegotiation was refactored", "Bugfix\n * More stringent checks in cipher layer\n * Server does not send out extensions not advertised by client\n * Prevent possible alignment warnings on casting from char * to 'aligned *'\n * Misc fixes and additions to dependency checks\n * Const correctness\n * cert_write with selfsign should use issuer_name as subject_name\n * Fix ECDSA corner case: missing reduction mod N (found by DualTachyon)\n * Defines to handle UEFI environment under MSVC\n * Server-side initiated renegotiations send HelloRequest", "= PolarSSL 1.3.1 released on 2013-10-15\nFeatures\n * Support for Brainpool curves and TLS ciphersuites (RFC 7027)\n * Support for ECDHE-PSK key-exchange and ciphersuites\n * Support for RSA-PSK key-exchange and ciphersuites", "Changes\n * RSA blinding locks for a smaller amount of time\n * TLS compression only allocates working buffer once\n * Introduced POLARSSL_HAVE_READDIR_R for systems without it\n * config.h is more script-friendly", "Bugfix\n * Missing MSVC defines added\n * Compile errors with POLARSSL_RSA_NO_CRT\n * Header files with 'polarssl/'\n * Const correctness\n * Possible naming collision in dhm_context\n * Better support for MSVC\n * threading_set_alt() name\n * Added missing x509write_crt_set_version()", "= PolarSSL 1.3.0 released on 2013-10-01\nFeatures\n * Elliptic Curve Cryptography module added\n * Elliptic Curve Diffie Hellman module added\n * Ephemeral Elliptic Curve Diffie Hellman support for SSL/TLS\n (ECDHE-based ciphersuites)\n * Ephemeral Elliptic Curve Digital Signature Algorithm support for SSL/TLS\n (ECDSA-based ciphersuites)\n * Ability to specify allowed ciphersuites based on the protocol version.\n * PSK and DHE-PSK based ciphersuites added\n * Memory allocation abstraction layer added\n * Buffer-based memory allocator added (no malloc() / free() / HEAP usage)\n * Threading abstraction layer added (dummy / pthread / alternate)\n * Public Key abstraction layer added\n * Parsing Elliptic Curve keys\n * Parsing Elliptic Curve certificates\n * Support for max_fragment_length extension (RFC 6066)\n * Support for truncated_hmac extension (RFC 6066)\n * Support for zeros-and-length (ANSI X.923) padding, one-and-zeros\n (ISO/IEC 7816-4) padding and zero padding in the cipher layer\n * Support for session tickets (RFC 5077)\n * Certificate Request (CSR) generation with extensions (key_usage,\n ns_cert_type)\n * X509 Certificate writing with extensions (basic_constraints,\n issuer_key_identifier, etc)\n * Optional blinding for RSA, DHM and EC\n * Support for multiple active certificate / key pairs in SSL servers for\n \t the same host (Not to be confused with SNI!)", "Changes\n * Ability to enable / disable SSL v3 / TLS 1.0 / TLS 1.1 / TLS 1.2\n individually\n * Introduced separate SSL Ciphersuites module that is based on\n Cipher and MD information\n * Internals for SSL module adapted to have separate IV pointer that is\n dynamically set (Better support for hardware acceleration)\n * Moved all OID functionality to a separate module. RSA function\n prototypes for the RSA sign and verify functions changed as a result\n * Split up the GCM module into a starts/update/finish cycle\n * Client and server now filter sent and accepted ciphersuites on minimum\n and maximum protocol version\n * Ability to disable server_name extension (RFC 6066)\n * Renamed error_strerror() to the less conflicting polarssl_strerror()\n (Ability to keep old as well with POLARSSL_ERROR_STRERROR_BC)\n * SHA2 renamed to SHA256, SHA4 renamed to SHA512 and functions accordingly\n * All RSA operations require a random generator for blinding purposes\n * X509 core refactored\n * x509_crt_verify() now case insensitive for cn (RFC 6125 6.4)\n * Also compiles / runs without time-based functions (!POLARSSL_HAVE_TIME)\n * Support faulty X509 v1 certificates with extensions\n (POLARSSL_X509_ALLOW_EXTENSIONS_NON_V3)", "Bugfix\n * Fixed parse error in ssl_parse_certificate_request()\n * zlib compression/decompression skipped on empty blocks\n * Support for AIX header locations in net.c module\n * Fixed file descriptor leaks", "Security\n * RSA blinding on CRT operations to counter timing attacks\n (found by Cyril Arnaud and Pierre-Alain Fouque)", "\n= Version 1.2.14 released 2015-05-??", "Security\n * Fix potential invalid memory read in the server, that allows a client to\n crash it remotely (found by Caj Larsson).\n * Fix potential invalid memory read in certificate parsing, that allows a\n client to crash the server remotely if client authentication is enabled\n (found using Codenomicon Defensics).\n * Add countermeasure against \"Lucky 13 strikes back\" cache-based attack,\n https://dl.acm.org/citation.cfm?id=2714625", "Bugfix\n * Fix bug in Via Padlock support (found by Nikos Mavrogiannopoulos).\n * Fix hardclock() (only used in the benchmarking program) with some\n versions of mingw64 (found by kxjhlele).\n * Fix warnings from mingw64 in timing.c (found by kxjklele).\n * Fix potential unintended sign extension in asn1_get_len() on 64-bit\n platforms (found with Coverity Scan).", "= Version 1.2.13 released 2015-02-16\nNote: Although PolarSSL has been renamed to mbed TLS, no changes reflecting\n this will be made in the 1.2 branch at this point.", "Security\n * Fix remotely-triggerable uninitialised pointer dereference caused by\n crafted X.509 certificate (TLS server is not affected if it doesn't ask\n for a client certificate) (found using Codenomicon Defensics).\n * Fix remotely-triggerable memory leak caused by crafted X.509 certificates\n (TLS server is not affected if it doesn't ask for a client certificate)\n (found using Codenomicon Defensics).\n * Fix potential stack overflow while parsing crafted X.509 certificates\n (TLS server is not affected if it doesn't ask for a client certificate)\n found using Codenomicon Defensics).\n * Fix buffer overread of size 1 when parsing crafted X.509 certificates\n (TLS server is not affected if it doesn't ask for a client certificate).", "Bugfix\n * Fix potential undefined behaviour in Camellia.\n * Fix memory leaks in PKCS#5 and PKCS#12.\n * Stack buffer overflow if ctr_drbg_update() is called with too large\n add_len (found by Jean-Philippe Aumasson) (not triggerable remotely).\n * Fix bug in MPI/bignum on s390/s390x (reported by Dan Horák) (introduced\n in 1.2.12).\n * Fix unchecked return code in x509_crt_parse_path() on Windows (found by\n Peter Vaskovic).\n * Fix assembly selection for MIPS64 (thanks to James Cowgill).\n * ssl_get_verify_result() now works even if the handshake was aborted due\n to a failed verification (found by Fredrik Axelsson).\n * Skip writing and parsing signature_algorithm extension if none of the\n key exchanges enabled needs certificates. This fixes a possible interop\n issue with some servers when a zero-length extension was sent. (Reported\n by Peter Dettman.)\n * On a 0-length input, base64_encode() did not correctly set output length\n (found by Hendrik van den Boogaard).", "Changes\n * Blind RSA private operations even when POLARSSL_RSA_NO_CRT is defined.\n * Forbid repeated extensions in X.509 certificates.\n * Add compile-time option POLARSSL_X509_MAX_INTERMEDIATE_CA to limit the\n length of an X.509 verification chain (default = 8).\n= Version 1.2.12 released 2014-10-24", "Security\n * Remotely-triggerable memory leak when parsing some X.509 certificates\n (server is not affected if it doesn't ask for a client certificate).\n (Found using Codenomicon Defensics.)", "Bugfix\n * Fix potential bad read in parsing ServerHello (found by Adrien\n Vialletelle).\n * ssl_close_notify() could send more than one message in some circumstances\n with non-blocking I/O.\n * x509_crt_parse() did not increase total_failed on PEM error\n * Fix compiler warnings on iOS (found by Sander Niemeijer).\n * Don't print uninitialised buffer in ssl_mail_client (found by Marc Abel).\n * Fix net_accept() regarding non-blocking sockets (found by Luca Pesce).\n * ssl_read() could return non-application data records on server while\n renegotation was pending, and on client when a HelloRequest was received.\n * Fix warnings from Clang's scan-build (contributed by Alfred Klomp).", "Changes\n * X.509 certificates with more than one AttributeTypeAndValue per\n RelativeDistinguishedName are not accepted any more.\n * ssl_read() now returns POLARSSL_ERR_NET_WANT_READ rather than\n POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE on harmless alerts.\n * Accept spaces at end of line or end of buffer in base64_decode().", "= Version 1.2.11 released 2014-07-11\nFeatures\n * Entropy module now supports seed writing and reading", "Changes\n * Introduced POLARSSL_HAVE_READDIR_R for systems without it\n * Improvements to the CMake build system, contributed by Julian Ospald.\n * Work around a bug of the version of Clang shipped by Apple with Mavericks\n that prevented bignum.c from compiling. (Reported by Rafael Baptista.)\n * Improvements to tests/Makefile, contributed by Oden Eriksson.\n * Use UTC time to check certificate validity.\n * Reject certificates with times not in UTC, per RFC 5280.\n * Migrate zeroizing of data to polarssl_zeroize() instead of memset()\n against unwanted compiler optimizations", "Security\n * Forbid change of server certificate during renegotiation to prevent\n \"triple handshake\" attack when authentication mode is optional (the\n attack was already impossible when authentication is required).\n * Check notBefore timestamp of certificates and CRLs from the future.\n * Forbid sequence number wrapping\n * Prevent potential NULL pointer dereference in ssl_read_record() (found by\n TrustInSoft)\n * Fix length checking for AEAD ciphersuites (found by Codenomicon).\n It was possible to crash the server (and client) using crafted messages\n when a GCM suite was chosen.", "Bugfix\n * Fixed X.509 hostname comparison (with non-regular characters)\n * SSL now gracefully handles missing RNG\n * crypt_and_hash app checks MAC before final decryption\n * Fixed x509_crt_parse_path() bug on Windows platforms\n * Added missing MPI_CHK() around some statements in mpi_div_mpi() (found by\n TrustInSoft)\n * Fixed potential overflow in certificate size verification in\n ssl_write_certificate() (found by TrustInSoft)\n * Fix ASM format in bn_mul.h\n * Potential memory leak in bignum_selftest()\n * Replaced expired test certificate\n * ssl_mail_client now terminates lines with CRLF, instead of LF\n * Fix bug in RSA PKCS#1 v1.5 \"reversed\" operations\n * Fixed testing with out-of-source builds using cmake\n * Fixed version-major intolerance in server\n * Fixed CMake symlinking on out-of-source builds\n * Bignum's MIPS-32 assembly was used on MIPS-64, causing chaos. (Found by\n Alex Wilson.)\n * ssl_init() was leaving a dirty pointer in ssl_context if malloc of\n out_ctr failed\n * ssl_handshake_init() was leaving dirty pointers in subcontexts if malloc\n of one of them failed\n * x509_get_current_time() uses localtime_r() to prevent thread issues\n * Some example server programs were not sending the close_notify alert.\n * Potential memory leak in mpi_exp_mod() when error occurs during\n calculation of RR.\n * Improve interoperability by not writing extension length in ClientHello\n when no extensions are present (found by Matthew Page)\n * rsa_check_pubkey() now allows an E up to N\n * On OpenBSD, use arc4random_buf() instead of rand() to prevent warnings\n * mpi_fill_random() was creating numbers larger than requested on\n big-endian platform when size was not an integer number of limbs\n * Fix detection of DragonflyBSD in net.c (found by Markus Pfeiffer)\n * Stricter check on SSL ClientHello internal sizes compared to actual packet\n size (found by TrustInSoft)\n * Fix preprocessor checks for bn_mul PPC asm (found by Barry K. Nathan).\n * Use \\n\\t rather than semicolons for bn_mul asm, since some assemblers\n interpret semicolons as comment delimiters (found by Barry K. Nathan).\n * Disable broken Sparc64 bn_mul assembly (found by Florian Obser).\n * Fix base64_decode() to return and check length correctly (in case of\n tight buffers)", "= Version 1.2.10 released 2013-10-07\nChanges\n * Changed RSA blinding to a slower but thread-safe version", "Bugfix\n * Fixed memory leak in RSA as a result of introduction of blinding\n * Fixed ssl_pkcs11_decrypt() prototype\n * Fixed MSVC project files", "= Version 1.2.9 released 2013-10-01\nChanges\n * x509_verify() now case insensitive for cn (RFC 6125 6.4)", "Bugfix\n * Fixed potential memory leak when failing to resume a session\n * Fixed potential file descriptor leaks (found by Remi Gacogne)\n * Minor fixes", "Security\n * Fixed potential heap buffer overflow on large hostname setting\n * Fixed potential negative value misinterpretation in load_file()\n * RSA blinding on CRT operations to counter timing attacks\n (found by Cyril Arnaud and Pierre-Alain Fouque)", "= Version 1.2.8 released 2013-06-19\nFeatures\n * Parsing of PKCS#8 encrypted private key files\n * PKCS#12 PBE and derivation functions\n * Centralized module option values in config.h to allow user-defined\n settings without editing header files by using POLARSSL_CONFIG_OPTIONS", "Changes\n * HAVEGE random generator disabled by default\n * Internally split up x509parse_key() into a (PEM) handler function\n and specific DER parser functions for the PKCS#1 and unencrypted\n PKCS#8 private key formats\n * Added mechanism to provide alternative implementations for all\n symmetric cipher and hash algorithms (e.g. POLARSSL_AES_ALT in\n\t config.h)\n * PKCS#5 module added. Moved PBKDF2 functionality inside and deprecated\n old PBKDF2 module", "Bugfix\n * Secure renegotiation extension should only be sent in case client\n supports secure renegotiation\n * Fixed offset for cert_type list in ssl_parse_certificate_request()\n * Fixed const correctness issues that have no impact on the ABI\n * x509parse_crt() now better handles PEM error situations\n * ssl_parse_certificate() now calls x509parse_crt_der() directly\n instead of the x509parse_crt() wrapper that can also parse PEM\n\t certificates\n * x509parse_crtpath() is now reentrant and uses more portable stat()\n * Fixed bignum.c and bn_mul.h to support Thumb2 and LLVM compiler\n * Fixed values for 2-key Triple DES in cipher layer\n * ssl_write_certificate_request() can handle empty ca_chain", "Security\n * A possible DoS during the SSL Handshake, due to faulty parsing of\n PEM-encoded certificates has been fixed (found by Jack Lloyd)", "= Version 1.2.7 released 2013-04-13\nFeatures\n * Ability to specify allowed ciphersuites based on the protocol version.", "Changes\n * Default Blowfish keysize is now 128-bits\n * Test suites made smaller to accommodate Raspberry Pi", "Bugfix\n * Fix for MPI assembly for ARM\n * GCM adapted to support sizes > 2^29", "= Version 1.2.6 released 2013-03-11\nBugfix\n * Fixed memory leak in ssl_free() and ssl_reset() for active session\n * Corrected GCM counter incrementation to use only 32-bits instead of\n 128-bits (found by Yawning Angel)\n * Fixes for 64-bit compilation with MS Visual Studio\n * Fixed net_bind() for specified IP addresses on little endian systems\n * Fixed assembly code for ARM (Thumb and regular) for some compilers", "Changes\n * Internally split up rsa_pkcs1_encrypt(), rsa_pkcs1_decrypt(),\n rsa_pkcs1_sign() and rsa_pkcs1_verify() to separate PKCS#1 v1.5 and\n PKCS#1 v2.1 functions\n * Added support for custom labels when using rsa_rsaes_oaep_encrypt()\n or rsa_rsaes_oaep_decrypt()\n * Re-added handling for SSLv2 Client Hello when the define\n POLARSSL_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO is set\n * The SSL session cache module (ssl_cache) now also retains peer_cert\n information (not the entire chain)", "Security\n * Removed further timing differences during SSL message decryption in\n ssl_decrypt_buf()\n * Removed timing differences due to bad padding from\n rsa_rsaes_pkcs1_v15_decrypt() and rsa_pkcs1_decrypt() for PKCS#1 v1.5\n operations", "= Version 1.2.5 released 2013-02-02\nChanges\n * Allow enabling of dummy error_strerror() to support some use-cases\n * Debug messages about padding errors during SSL message decryption are\n disabled by default and can be enabled with POLARSSL_SSL_DEBUG_ALL \n * Sending of security-relevant alert messages that do not break\n interoperability can be switched on/off with the flag\n POLARSSL_SSL_ALL_ALERT_MESSAGES", "Security\n * Removed timing differences during SSL message decryption in\n ssl_decrypt_buf() due to badly formatted padding", "= Version 1.2.4 released 2013-01-25\nChanges\n * More advanced SSL ciphersuite representation and moved to more dynamic\n SSL core\n * Added ssl_handshake_step() to allow single stepping the handshake process", "Bugfix\n * Memory leak when using RSA_PKCS_V21 operations fixed\n * Handle future version properly in ssl_write_certificate_request()\n * Correctly handle CertificateRequest message in client for <= TLS 1.1\n without DN list", "= Version 1.2.3 released 2012-11-26\nBugfix\n * Server not always sending correct CertificateRequest message", "= Version 1.2.2 released 2012-11-24\nChanges\n * Added p_hw_data to ssl_context for context specific hardware acceleration\n data\n * During verify trust-CA is only checked for expiration and CRL presence ", "Bugfixes\n * Fixed client authentication compatibility\n * Fixed dependency on POLARSSL_SHA4_C in SSL modules", "= Version 1.2.1 released 2012-11-20\nChanges\n * Depth that the certificate verify callback receives is now numbered\n bottom-up (Peer cert depth is 0)", "Bugfixes\n * Fixes for MSVC6\n * Moved mpi_inv_mod() outside POLARSSL_GENPRIME\n * Allow R and A to point to same mpi in mpi_div_mpi (found by Manuel\n Pégourié-Gonnard)\n * Fixed possible segfault in mpi_shift_r() (found by Manuel\n Pégourié-Gonnard)\n * Added max length check for rsa_pkcs1_sign with PKCS#1 v2.1", "= Version 1.2.0 released 2012-10-31\nFeatures\n * Added support for NULL cipher (POLARSSL_CIPHER_NULL_CIPHER) and weak\n ciphersuites (POLARSSL_ENABLE_WEAK_CIPHERSUITES). They are disabled by\n default!\n * Added support for wildcard certificates\n * Added support for multi-domain certificates through the X509 Subject\n Alternative Name extension\n * Added preliminary ASN.1 buffer writing support\n * Added preliminary X509 Certificate Request writing support\n * Added key_app_writer example application\n * Added cert_req example application\n * Added base Galois Counter Mode (GCM) for AES\n * Added TLS 1.2 support (RFC 5246)\n * Added GCM suites to TLS 1.2 (RFC 5288)\n * Added commandline error code convertor (util/strerror)\n * Added support for Hardware Acceleration hooking in SSL/TLS\n * Added OpenSSL / PolarSSL compatibility script (tests/compat.sh) and\n example application (programs/ssl/o_p_test) (requires OpenSSL)\n * Added X509 CA Path support\n * Added Thumb assembly optimizations\n * Added DEFLATE compression support as per RFC3749 (requires zlib)\n * Added blowfish algorithm (Generic and cipher layer)\n * Added PKCS#5 PBKDF2 key derivation function\n * Added Secure Renegotiation (RFC 5746)\n * Added predefined DHM groups from RFC 5114\n * Added simple SSL session cache implementation\n * Added ServerName extension parsing (SNI) at server side\n * Added option to add minimum accepted SSL/TLS protocol version", "Changes\n * Removed redundant POLARSSL_DEBUG_MSG define\n * AES code only check for Padlock once\n * Fixed const-correctness mpi_get_bit()\n * Documentation for mpi_lsb() and mpi_msb()\n * Moved out_msg to out_hdr + 32 to support hardware acceleration\n * Changed certificate verify behaviour to comply with RFC 6125 section 6.3\n to not match CN if subjectAltName extension is present (Closes ticket #56)\n * Cipher layer cipher_mode_t POLARSSL_MODE_CFB128 is renamed to\n POLARSSL_MODE_CFB, to also handle different block size CFB modes.\n * Removed handling for SSLv2 Client Hello (as per RFC 5246 recommendation)\n * Revamped session resumption handling\n * Generalized external private key implementation handling (like PKCS#11)\n in SSL/TLS\n * Revamped x509_verify() and the SSL f_vrfy callback implementations\n * Moved from unsigned long to fixed width uint32_t types throughout code\n * Renamed ciphersuites naming scheme to IANA reserved names", "Bugfix\n * Fixed handling error in mpi_cmp_mpi() on longer B values (found by\n Hui Dong)\n * Fixed potential heap corruption in x509_name allocation\n * Fixed single RSA test that failed on Big Endian systems (Closes ticket #54)\n * mpi_exp_mod() now correctly handles negative base numbers (Closes ticket\n #52)\n * Handle encryption with private key and decryption with public key as per\n \t RFC 2313\n * Handle empty certificate subject names\n * Prevent reading over buffer boundaries on X509 certificate parsing\n * mpi_add_abs() now correctly handles adding short numbers to long numbers\n with carry rollover (found by Ruslan Yushchenko)\n * Handle existence of OpenSSL Trust Extensions at end of X.509 DER blob\n * Fixed MPI assembly for SPARC64 platform", "Security\n * Fixed potential memory zeroization on miscrafted RSA key (found by Eloi\n Vanderbeken)", "= Version 1.1.8 released on 2013-10-01\nBugfix\n * Fixed potential memory leak when failing to resume a session\n * Fixed potential file descriptor leaks", "Security\n * Potential buffer-overflow for ssl_read_record() (independently found by\n both TrustInSoft and Paul Brodeur of Leviathan Security Group)\n * Potential negative value misinterpretation in load_file()\n * Potential heap buffer overflow on large hostname setting", "= Version 1.1.7 released on 2013-06-19\nChanges\n * HAVEGE random generator disabled by default", "Bugfix\n * x509parse_crt() now better handles PEM error situations\n * ssl_parse_certificate() now calls x509parse_crt_der() directly\n instead of the x509parse_crt() wrapper that can also parse PEM\n\t certificates\n * Fixed values for 2-key Triple DES in cipher layer\n * ssl_write_certificate_request() can handle empty ca_chain", "Security\n * A possible DoS during the SSL Handshake, due to faulty parsing of\n PEM-encoded certificates has been fixed (found by Jack Lloyd)", "= Version 1.1.6 released on 2013-03-11\nBugfix\n * Fixed net_bind() for specified IP addresses on little endian systems", "Changes\n * Allow enabling of dummy error_strerror() to support some use-cases\n * Debug messages about padding errors during SSL message decryption are\n disabled by default and can be enabled with POLARSSL_SSL_DEBUG_ALL", "Security\n * Removed timing differences during SSL message decryption in\n ssl_decrypt_buf()\n * Removed timing differences due to bad padding from\n rsa_rsaes_pkcs1_v15_decrypt() and rsa_pkcs1_decrypt() for PKCS#1 v1.5\n operations", "= Version 1.1.5 released on 2013-01-16\nBugfix\n * Fixed MPI assembly for SPARC64 platform\n * Handle existence of OpenSSL Trust Extensions at end of X.509 DER blob\n * mpi_add_abs() now correctly handles adding short numbers to long numbers\n with carry rollover\n * Moved mpi_inv_mod() outside POLARSSL_GENPRIME\n * Prevent reading over buffer boundaries on X509 certificate parsing\n * mpi_exp_mod() now correctly handles negative base numbers (Closes ticket\n #52)\n * Fixed possible segfault in mpi_shift_r() (found by Manuel\n Pégourié-Gonnard)\n * Allow R and A to point to same mpi in mpi_div_mpi (found by Manuel\n Pégourié-Gonnard)\n * Added max length check for rsa_pkcs1_sign with PKCS#1 v2.1\n * Memory leak when using RSA_PKCS_V21 operations fixed\n * Handle encryption with private key and decryption with public key as per\n RFC 2313\n * Fixes for MSVC6", "Security\n * Fixed potential memory zeroization on miscrafted RSA key (found by Eloi\n Vanderbeken)", "= Version 1.1.4 released on 2012-05-31\nBugfix\n * Correctly handle empty SSL/TLS packets (Found by James Yonan)\n * Fixed potential heap corruption in x509_name allocation\n * Fixed single RSA test that failed on Big Endian systems (Closes ticket #54)", "= Version 1.1.3 released on 2012-04-29\nBugfix\n * Fixed random MPI generation to not generate more size than requested.", "= Version 1.1.2 released on 2012-04-26\nBugfix\n * Fixed handling error in mpi_cmp_mpi() on longer B values (found by\n Hui Dong)", "Security\n * Fixed potential memory corruption on miscrafted client messages (found by\n Frama-C team at CEA LIST)\n * Fixed generation of DHM parameters to correct length (found by Ruslan\n Yushchenko)", "= Version 1.1.1 released on 2012-01-23\nBugfix\n * Check for failed malloc() in ssl_set_hostname() and x509_get_entries()\n (Closes ticket #47, found by Hugo Leisink)\n * Fixed issues with Intel compiler on 64-bit systems (Closes ticket #50)\n * Fixed multiple compiler warnings for VS6 and armcc\n * Fixed bug in CTR_CRBG selftest", "= Version 1.1.0 released on 2011-12-22\nFeatures\n * Added ssl_session_reset() to allow better multi-connection pools of\n SSL contexts without needing to set all non-connection-specific\n\t data and pointers again. Adapted ssl_server to use this functionality.\n * Added ssl_set_max_version() to allow clients to offer a lower maximum\n supported version to a server to help buggy server implementations.\n\t (Closes ticket #36)\n * Added cipher_get_cipher_mode() and cipher_get_cipher_operation()\n introspection functions (Closes ticket #40)\n * Added CTR_DRBG based on AES-256-CTR (NIST SP 800-90) random generator\n * Added a generic entropy accumulator that provides support for adding\n custom entropy sources and added some generic and platform dependent\n\t entropy sources", "Changes\n * Documentation for AES and Camellia in modes CTR and CFB128 clarified.\n * Fixed rsa_encrypt and rsa_decrypt examples to use public key for\n encryption and private key for decryption. (Closes ticket #34)\n * Inceased maximum size of ASN1 length reads to 32-bits.\n * Added an EXPLICIT tag number parameter to x509_get_ext()\n * Added a separate CRL entry extension parsing function\n * Separated the ASN.1 parsing code from the X.509 specific parsing code.\n So now there is a module that is controlled with POLARSSL_ASN1_PARSE_C.\n * Changed the defined key-length of DES ciphers in cipher.h to include the\n parity bits, to prevent mistakes in copying data. (Closes ticket #33)\n * Loads of minimal changes to better support WINCE as a build target\n (Credits go to Marco Lizza)\n * Added POLARSSL_MPI_WINDOW_SIZE definition to allow easier time to memory\n trade-off\n * Introduced POLARSSL_MPI_MAX_SIZE and POLARSSL_MPI_MAX_BITS for MPI size\n management (Closes ticket #44)\n * Changed the used random function pointer to more flexible format. Renamed\n havege_rand() to havege_random() to prevent mistakes. Lots of changes as\n a consequence in library code and programs\n * Moved all examples programs to use the new entropy and CTR_DRBG\n * Added permissive certificate parsing to x509parse_crt() and\n x509parse_crtfile(). With permissive parsing the parsing does not stop on\n encountering a parse-error. Beware that the meaning of return values has\n changed!\n * All error codes are now negative. Even on mermory failures and IO errors.", "Bugfix\n * Fixed faulty HMAC-MD2 implementation. Found by dibac. (Closes\n ticket #37)\n * Fixed a bug where the CRL parser expected an EXPLICIT ASN.1 tag\n before version numbers\n * Allowed X509 key usage parsing to accept 4 byte values instead of the\n standard 1 byte version sometimes used by Microsoft. (Closes ticket #38)\n * Fixed incorrect behaviour in case of RSASSA-PSS with a salt length\n smaller than the hash length. (Closes ticket #41)\n * If certificate serial is longer than 32 octets, serial number is now\n appended with '....' after first 28 octets\n * Improved build support for s390x and sparc64 in bignum.h\n * Fixed MS Visual C++ name clash with int64 in sha4.h\n * Corrected removal of leading \"00:\" in printing serial numbers in\n certificates and CRLs", "= Version 1.0.0 released on 2011-07-27\nFeatures\n * Expanded cipher layer with support for CFB128 and CTR mode\n * Added rsa_encrypt and rsa_decrypt simple example programs.", "Changes\n * The generic cipher and message digest layer now have normal error\n codes instead of integers", "Bugfix\n * Undid faulty bug fix in ssl_write() when flushing old data (Ticket\n #18)", "= Version 0.99-pre5 released on 2011-05-26\nFeatures\n * Added additional Cipher Block Modes to symmetric ciphers\n (AES CTR, Camellia CTR, XTEA CBC) including the option to\n enable and disable individual modes when needed\n * Functions requiring File System functions can now be disabled\n by undefining POLARSSL_FS_IO\n * A error_strerror function() has been added to translate between\n error codes and their description.\n * Added mpi_get_bit() and mpi_set_bit() individual bit setter/getter\n functions.\n * Added ssl_mail_client and ssl_fork_server as example programs.", "Changes\n * Major argument / variable rewrite. Introduced use of size_t\n instead of int for buffer lengths and loop variables for\n better unsigned / signed use. Renamed internal bigint types\n t_int and t_dbl to t_uint and t_udbl in the process\n * mpi_init() and mpi_free() now only accept a single MPI\n argument and do not accept variable argument lists anymore.\n * The error codes have been remapped and combining error codes\n is now done with a PLUS instead of an OR as error codes\n used are negative.\n * Changed behaviour of net_read(), ssl_fetch_input() and ssl_recv().\n net_recv() now returns 0 on EOF instead of\n POLARSSL_ERR_NET_CONN_RESET. ssl_fetch_input() returns\n POLARSSL_ERR_SSL_CONN_EOF on an EOF from its f_recv() function.\n ssl_read() returns 0 if a POLARSSL_ERR_SSL_CONN_EOF is received\n after the handshake.\n * Network functions now return POLARSSL_ERR_NET_WANT_READ or\n POLARSSL_ERR_NET_WANT_WRITE instead of the ambiguous\n POLARSSL_ERR_NET_TRY_AGAIN", "= Version 0.99-pre4 released on 2011-04-01\nFeatures\n * Added support for PKCS#1 v2.1 encoding and thus support\n for the RSAES-OAEP and RSASSA-PSS operations.\n * Reading of Public Key files incorporated into default x509\n functionality as well.\n * Added mpi_fill_random() for centralized filling of big numbers\n with random data (Fixed ticket #10)", "Changes\n * Debug print of MPI now removes leading zero octets and \n displays actual bit size of the value.\n * x509parse_key() (and as a consequence x509parse_keyfile()) \n does not zeroize memory in advance anymore. Use rsa_init()\n before parsing a key or keyfile!", "Bugfix\n * Debug output of MPI's now the same independent of underlying\n platform (32-bit / 64-bit) (Fixes ticket #19, found by Mads\n Kiilerich and Mihai Militaru)\n * Fixed bug in ssl_write() when flushing old data (Fixed ticket\n #18, found by Nikolay Epifanov)\n * Fixed proper handling of RSASSA-PSS verification with variable\n length salt lengths", "= Version 0.99-pre3 released on 2011-02-28\nThis release replaces version 0.99-pre2 which had possible copyright issues.\nFeatures\n * Parsing PEM private keys encrypted with DES and AES\n are now supported as well (Fixes ticket #5)\n * Added crl_app program to allow easy reading and\n printing of X509 CRLs from file", "Changes\n * Parsing of PEM files moved to separate module (Fixes \n ticket #13). Also possible to remove PEM support for\n systems only using DER encoding", "Bugfixes\n * Corrected parsing of UTCTime dates before 1990 and\n after 1950\n * Support more exotic OID's when parsing certificates\n \t (found by Mads Kiilerich)\n * Support more exotic name representations when parsing\n certificates (found by Mads Kiilerich)\n * Replaced the expired test certificates\n * Do not bail out if no client certificate specified. Try\n to negotiate anonymous connection (Fixes ticket #12,\n found by Boris Krasnovskiy)", "Security fixes\n * Fixed a possible Man-in-the-Middle attack on the\n Diffie Hellman key exchange (thanks to Larry Highsmith,\n Subreption LLC)", "= Version 0.99-pre1 released on 2011-01-30\nFeatures\nNote: Most of these features have been donated by Fox-IT\n * Added Doxygen source code documentation parts\n * Added reading of DHM context from memory and file\n * Improved X509 certificate parsing to include extended\n certificate fields, including Key Usage\n * Improved certificate verification and verification\n against the available CRLs\n * Detection for DES weak keys and parity bits added\n * Improvements to support integration in other\n applications:\n + Added generic message digest and cipher wrapper\n + Improved information about current capabilities,\n status, objects and configuration\n + Added verification callback on certificate chain\n verification to allow external blacklisting\n\t + Additional example programs to show usage\n * Added support for PKCS#11 through the use of the\n libpkcs11-helper library", "Changes\n * x509parse_time_expired() checks time in addition to\n the existing date check\n * The ciphers member of ssl_context and the cipher member\n of ssl_session have been renamed to ciphersuites and\n ciphersuite respectively. This clarifies the difference\n with the generic cipher layer and is better naming\n altogether", "= Version 0.14.0 released on 2010-08-16\nFeatures\n * Added support for SSL_EDH_RSA_AES_128_SHA and\n SSL_EDH_RSA_CAMELLIA_128_SHA ciphersuites\n * Added compile-time and run-time version information\n * Expanded ssl_client2 arguments for more flexibility\n * Added support for TLS v1.1", "Changes\n * Made Makefile cleaner\n * Removed dependency on rand() in rsa_pkcs1_encrypt().\n Now using random fuction provided to function and\n changed the prototype of rsa_pkcs1_encrypt(),\n rsa_init() and rsa_gen_key().\n * Some SSL defines were renamed in order to avoid\n future confusion", "Bug fixes\n * Fixed CMake out of source build for tests (found by\n kkert)\n * rsa_check_private() now supports PKCS1v2 keys as well\n * Fixed deadlock in rsa_pkcs1_encrypt() on failing random\n generator", "= Version 0.13.1 released on 2010-03-24\nBug fixes\n * Fixed Makefile in library that was mistakenly merged\n * Added missing const string fixes", "= Version 0.13.0 released on 2010-03-21\nFeatures\n * Added option parsing for host and port selection to\n ssl_client2\n * Added support for GeneralizedTime in X509 parsing\n * Added cert_app program to allow easy reading and\n printing of X509 certificates from file or SSL\n connection.", "Changes\n * Added const correctness for main code base\n * X509 signature algorithm determination is now\n in a function to allow easy future expansion\n * Changed symmetric cipher functions to\n identical interface (returning int result values)\n * Changed ARC4 to use separate input/output buffer\n * Added reset function for HMAC context as speed-up\n for specific use-cases", "Bug fixes\n * Fixed bug resulting in failure to send the last\n certificate in the chain in ssl_write_certificate() and\n ssl_write_certificate_request() (found by fatbob)\n * Added small fixes for compiler warnings on a Mac\n (found by Frank de Brabander)\n * Fixed algorithmic bug in mpi_is_prime() (found by\n Smbat Tonoyan)", "= Version 0.12.1 released on 2009-10-04\nChanges\n * Coverage test definitions now support 'depends_on'\n tagging system.\n * Tests requiring specific hashing algorithms now honor\n the defines.", "Bug fixes\n * Changed typo in #ifdef in x509parse.c (found\n by Eduardo)", "= Version 0.12.0 released on 2009-07-28\nFeatures\n * Added CMake makefiles as alternative to regular Makefiles.\n * Added preliminary Code Coverage tests for AES, ARC4,\n Base64, MPI, SHA-family, MD-family, HMAC-SHA-family,\n Camellia, DES, 3-DES, RSA PKCS#1, XTEA, Diffie-Hellman\n and X509parse.", "Changes\n * Error codes are not (necessarily) negative. Keep\n this is mind when checking for errors.\n * RSA_RAW renamed to SIG_RSA_RAW for consistency.\n * Fixed typo in name of POLARSSL_ERR_RSA_OUTPUT_TOO_LARGE.\n * Changed interface for AES and Camellia setkey functions\n to indicate invalid key lengths.", "Bug fixes\n * Fixed include location of endian.h on FreeBSD (found by\n Gabriel)\n * Fixed include location of endian.h and name clash on\n Apples (found by Martin van Hensbergen)\n * Fixed HMAC-MD2 by modifying md2_starts(), so that the\n required HMAC ipad and opad variables are not cleared.\n (found by code coverage tests)\n * Prevented use of long long in bignum if \n POLARSSL_HAVE_LONGLONG not defined (found by Giles\n Bathgate).\n * Fixed incorrect handling of negative strings in\n mpi_read_string() (found by code coverage tests).\n * Fixed segfault on handling empty rsa_context in\n rsa_check_pubkey() and rsa_check_privkey() (found by\n code coverage tests).\n * Fixed incorrect handling of one single negative input\n value in mpi_add_abs() (found by code coverage tests).\n * Fixed incorrect handling of negative first input\n value in mpi_sub_abs() (found by code coverage tests).\n * Fixed incorrect handling of negative first input\n value in mpi_mod_mpi() and mpi_mod_int(). Resulting\n change also affects mpi_write_string() (found by code\n coverage tests).\n * Corrected is_prime() results for 0, 1 and 2 (found by\n code coverage tests).\n * Fixed Camellia and XTEA for 64-bit Windows systems.", "= Version 0.11.1 released on 2009-05-17\n * Fixed missing functionality for SHA-224, SHA-256, SHA384,\n SHA-512 in rsa_pkcs1_sign()", "= Version 0.11.0 released on 2009-05-03\n * Fixed a bug in mpi_gcd() so that it also works when both\n input numbers are even and added testcases to check\n (found by Pierre Habouzit).\n * Added support for SHA-224, SHA-256, SHA-384 and SHA-512\n one way hash functions with the PKCS#1 v1.5 signing and\n verification.\n * Fixed minor bug regarding mpi_gcd located within the\n POLARSSL_GENPRIME block.\n * Fixed minor memory leak in x509parse_crt() and added better\n handling of 'full' certificate chains (found by Mathias\n Olsson).\n * Centralized file opening and reading for x509 files into\n load_file()\n * Made definition of net_htons() endian-clean for big endian\n systems (Found by Gernot).\n * Undefining POLARSSL_HAVE_ASM now also handles prevents asm in\n padlock and timing code. \n * Fixed an off-by-one buffer allocation in ssl_set_hostname()\n responsible for crashes and unwanted behaviour.\n * Added support for Certificate Revocation List (CRL) parsing.\n * Added support for CRL revocation to x509parse_verify() and\n SSL/TLS code.\n * Fixed compatibility of XTEA and Camellia on a 64-bit system\n (found by Felix von Leitner).", "= Version 0.10.0 released on 2009-01-12\n * Migrated XySSL to PolarSSL\n * Added XTEA symmetric cipher\n * Added Camellia symmetric cipher\n * Added support for ciphersuites: SSL_RSA_CAMELLIA_128_SHA,\n SSL_RSA_CAMELLIA_256_SHA and SSL_EDH_RSA_CAMELLIA_256_SHA\n * Fixed dangerous bug that can cause a heap overflow in\n rsa_pkcs1_decrypt (found by Christophe Devine)", "================================================================\nXySSL ChangeLog", "= Version 0.9 released on 2008-03-16", " * Added support for ciphersuite: SSL_RSA_AES_128_SHA\n * Enabled support for large files by default in aescrypt2.c\n * Preliminary openssl wrapper contributed by David Barrett\n * Fixed a bug in ssl_write() that caused the same payload to\n be sent twice in non-blocking mode when send returns EAGAIN\n * Fixed ssl_parse_client_hello(): session id and challenge must\n not be swapped in the SSLv2 ClientHello (found by Greg Robson)\n * Added user-defined callback debug function (Krystian Kolodziej)\n * Before freeing a certificate, properly zero out all cert. data\n * Fixed the \"mode\" parameter so that encryption/decryption are\n not swapped on PadLock; also fixed compilation on older versions\n of gcc (bug reported by David Barrett)\n * Correctly handle the case in padlock_xcryptcbc() when input or\n ouput data is non-aligned by falling back to the software\n implementation, as VIA Nehemiah cannot handle non-aligned buffers\n * Fixed a memory leak in x509parse_crt() which was reported by Greg\n Robson-Garth; some x509write.c fixes by Pascal Vizeli, thanks to\n Matthew Page who reported several bugs\n * Fixed x509_get_ext() to accept some rare certificates which have\n an INTEGER instead of a BOOLEAN for BasicConstraints::cA.\n * Added support on the client side for the TLS \"hostname\" extension\n (patch contributed by David Patino)\n * Make x509parse_verify() return BADCERT_CN_MISMATCH when an empty\n string is passed as the CN (bug reported by spoofy)\n * Added an option to enable/disable the BN assembly code\n * Updated rsa_check_privkey() to verify that (D*E) = 1 % (P-1)*(Q-1)\n * Disabled obsolete hash functions by default (MD2, MD4); updated\n selftest and benchmark to not test ciphers that have been disabled\n * Updated x509parse_cert_info() to correctly display byte 0 of the\n serial number, setup correct server port in the ssl client example\n * Fixed a critical denial-of-service with X.509 cert. verification:\n peer may cause xyssl to loop indefinitely by sending a certificate\n for which the RSA signature check fails (bug reported by Benoit)\n * Added test vectors for: AES-CBC, AES-CFB, DES-CBC and 3DES-CBC,\n HMAC-MD5, HMAC-SHA1, HMAC-SHA-256, HMAC-SHA-384, and HMAC-SHA-512\n * Fixed HMAC-SHA-384 and HMAC-SHA-512 (thanks to Josh Sinykin)\n * Modified ssl_parse_client_key_exchange() to protect against\n Daniel Bleichenbacher attack on PKCS#1 v1.5 padding, as well\n as the Klima-Pokorny-Rosa extension of Bleichenbacher's attack\n * Updated rsa_gen_key() so that ctx->N is always nbits in size\n * Fixed assembly PPC compilation errors on Mac OS X, thanks to\n David Barrett and Dusan Semen", "= Version 0.8 released on 2007-10-20", " * Modified the HMAC functions to handle keys larger\n than 64 bytes, thanks to Stephane Desneux and gary ng\n * Fixed ssl_read_record() to properly update the handshake\n message digests, which fixes IE6/IE7 client authentication\n * Cleaned up the XYSSL* #defines, suggested by Azriel Fasten\n * Fixed net_recv(), thanks to Lorenz Schori and Egon Kocjan\n * Added user-defined callbacks for handling I/O and sessions\n * Added lots of debugging output in the SSL/TLS functions\n * Added preliminary X.509 cert. writing by Pascal Vizeli\n * Added preliminary support for the VIA PadLock routines\n * Added AES-CFB mode of operation, contributed by chmike\n * Added an SSL/TLS stress testing program (ssl_test.c)\n * Updated the RSA PKCS#1 code to allow choosing between\n RSA_PUBLIC and RSA_PRIVATE, as suggested by David Barrett\n * Updated ssl_read() to skip 0-length records from OpenSSL\n * Fixed the make install target to comply with *BSD make\n * Fixed a bug in mpi_read_binary() on 64-bit platforms\n * mpi_is_prime() speedups, thanks to Kevin McLaughlin\n * Fixed a long standing memory leak in mpi_is_prime()\n * Replaced realloc with malloc in mpi_grow(), and set\n the sign of zero as positive in mpi_init() (reported\n by Jonathan M. McCune)", "= Version 0.7 released on 2007-07-07", " * Added support for the MicroBlaze soft-core processor\n * Fixed a bug in ssl_tls.c which sometimes prevented SSL\n connections from being established with non-blocking I/O\n * Fixed a couple bugs in the VS6 and UNIX Makefiles\n * Fixed the \"PIC register ebx clobbered in asm\" bug\n * Added HMAC starts/update/finish support functions\n * Added the SHA-224, SHA-384 and SHA-512 hash functions\n * Fixed the net_set_*block routines, thanks to Andreas\n * Added a few demonstration programs: md5sum, sha1sum,\n dh_client, dh_server, rsa_genkey, rsa_sign, rsa_verify\n * Added new bignum import and export helper functions\n * Rewrote README.txt in program/ssl/ca to better explain\n how to create a test PKI", "= Version 0.6 released on 2007-04-01", " * Ciphers used in SSL/TLS can now be disabled at compile\n time, to reduce the memory footprint on embedded systems\n * Added multiply assembly code for the TriCore and modified\n havege_struct for this processor, thanks to David Patiño\n * Added multiply assembly code for 64-bit PowerPCs,\n thanks to Peking University and the OSU Open Source Lab\n * Added experimental support of Quantum Cryptography\n * Added support for autoconf, contributed by Arnaud Cornet\n * Fixed \"long long\" compilation issues on IA-64 and PPC64\n * Fixed a bug introduced in xyssl-0.5/timing.c: hardclock\n was not being correctly defined on ARM and MIPS", "= Version 0.5 released on 2007-03-01", " * Added multiply assembly code for SPARC and Alpha\n * Added (beta) support for non-blocking I/O operations\n * Implemented session resuming and client authentication\n * Fixed some portability issues on WinCE, MINIX 3, Plan9\n (thanks to Benjamin Newman), HP-UX, FreeBSD and Solaris\n * Improved the performance of the EDH key exchange\n * Fixed a bug that caused valid packets with a payload\n size of 16384 bytes to be rejected", "= Version 0.4 released on 2007-02-01", " * Added support for Ephemeral Diffie-Hellman key exchange\n * Added multiply asm code for SSE2, ARM, PPC, MIPS and M68K\n * Various improvement to the modular exponentiation code\n * Rewrote the headers to generate the API docs with doxygen\n * Fixed a bug in ssl_encrypt_buf (incorrect padding was\n generated) and in ssl_parse_client_hello (max. client\n version was not properly set), thanks to Didier Rebeix\n * Fixed another bug in ssl_parse_client_hello: clients with\n cipherlists larger than 96 bytes were incorrectly rejected\n * Fixed a couple memory leak in x509_read.c", "= Version 0.3 released on 2007-01-01", " * Added server-side SSLv3 and TLSv1.0 support\n * Multiple fixes to enhance the compatibility with g++,\n thanks to Xosé Antón Otero Ferreira\n * Fixed a bug in the CBC code, thanks to dowst; also,\n the bignum code is no longer dependent on long long\n * Updated rsa_pkcs1_sign to handle arbitrary large inputs\n * Updated timing.c for improved compatibility with i386\n and 486 processors, thanks to Arnaud Cornet", "= Version 0.2 released on 2006-12-01", " * Updated timing.c to support ARM and MIPS arch\n * Updated the MPI code to support 8086 on MSVC 1.5\n * Added the copyright notice at the top of havege.h\n * Fixed a bug in sha2_hmac, thanks to newsoft/Wenfang Zhang\n * Fixed a bug reported by Adrian Rüegsegger in x509_read_key\n * Fixed a bug reported by Torsten Lauter in ssl_read_record\n * Fixed a bug in rsa_check_privkey that would wrongly cause\n valid RSA keys to be dismissed (thanks to oldwolf)\n * Fixed a bug in mpi_is_prime that caused some primes to fail\n the Miller-Rabin primality test", " I'd also like to thank Younès Hafri for the CRUX linux port,\n Khalil Petit who added XySSL into pkgsrc and Arnaud Cornet\n who maintains the Debian package :-)", "= Version 0.1 released on 2006-11-01" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [8, 75, 1056, 78, 271, 482, 2312, 1208], "buggy_code_start_loc": [8, 74, 1055, 78, 270, 482, 2060, 1207], "filenames": ["ChangeLog", "include/mbedtls/error.h", "include/mbedtls/ssl.h", "include/mbedtls/x509.h", "include/mbedtls/x509_crt.h", "library/error.c", "library/x509_crt.c", "tests/suites/test_suite_x509parse.data"], "fixing_code_end_loc": [12, 75, 1056, 80, 277, 485, 2317, 1208], "fixing_code_start_loc": [9, 74, 1055, 79, 270, 483, 2060, 1207], "message": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.10:*:*:*:*:*:*:*", "matchCriteriaId": "28621156-2430-447B-8816-47B0FB58245B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.11:*:*:*:*:*:*:*", "matchCriteriaId": "E11BBB2C-0423-47B1-AE12-EB849E17BAF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.12:*:*:*:*:*:*:*", "matchCriteriaId": "4131CE76-6260-412C-A6A6-20B0E978E569", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.13:*:*:*:*:*:*:*", "matchCriteriaId": "DE92D8F7-5705-47B6-B2C2-9DE6C7880647", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.14:*:*:*:*:*:*:*", "matchCriteriaId": "EA50C256-2054-4661-9C42-D31D7D87BAF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.15:*:*:*:*:*:*:*", "matchCriteriaId": "7791D4E9-3FEE-42DA-B320-CF7188A10294", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.16:*:*:*:*:*:*:*", "matchCriteriaId": "BE415DAA-A89F-4204-AC2C-577FCB447E4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.17:*:*:*:*:*:*:*", "matchCriteriaId": "95F691DB-9552-4EBB-B29D-16658561FA4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.18:*:*:*:*:*:*:*", "matchCriteriaId": "F1547B2A-E0D5-41D1-9449-1CCF35022B0E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.19:*:*:*:*:*:*:*", "matchCriteriaId": "CF762122-64BC-4A1A-A26D-81C1270541A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.20:*:*:*:*:*:*:*", "matchCriteriaId": "59D6B559-5F99-4E38-A861-3AB8A7D2E6BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.21:*:*:*:*:*:*:*", "matchCriteriaId": "4A8956C8-6CF0-4C37-84F9-8A89726806C3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "0B395D81-876F-43FC-8DB9-44377647A37A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F92622F1-82DA-4819-8275-06DC9DBE1BA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5871FDE9-02D0-466C-BDB7-90A14C4F637E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE6B4875-3FC3-499F-A76B-2D04982F743A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "B3B67842-5AFA-459F-9CCF-772B9DC7139F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "AD0500EE-52C0-4896-B3D8-5BE731D66039", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "015739E9-C0E3-4A62-BB9D-FA836BFD4351", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "842B0D15-6A3D-4CEE-AD02-49B0436E78E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "3CF6E05C-E6E5-40B8-AFEA-A5ED937F5439", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "D4133C86-70E0-44FD-BBDB-D61EFB31F027", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "6F9D24F0-3892-417F-9C3A-CACEF00C2293", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "8911513E-968C-403E-9D00-2DC0AA82F99B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "48D98945-82BB-4954-AA6D-7D98E4CE1154", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "6378C1CC-7C8F-47E3-A1A7-CDEC76E4CBE4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "525190A3-2194-4E4E-9D34-0048583B9C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "70407352-624A-40E6-82E4-7B4FAFE0C0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "DD52988E-4B2F-41AF-BC25-F38F87D9B8C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "FD1F7803-31F3-40A9-A878-FDC757FCE83F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected."}, {"lang": "es", "value": "ARM mbed TLS en versiones anteriores a la 1.3.21 y en versiones 2.x anteriores a la 2.1.9, si se configura la autenticaci\u00f3n opcional, permite a los atacantes omitir la autenticaci\u00f3n Peer mediante una cadena de certificados X.509 con muchos intermediarios. NOTA: aunque mbed TLS se conoc\u00eda antes como PolarSSL, las versiones lanzadas con el nombre PolarSSL no est\u00e1n afectadas."}], "evaluatorComment": null, "id": "CVE-2017-14032", "lastModified": "2017-11-08T02:29:02.850", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-08-30T20:29:00.337", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.debian.org/security/2017/dsa-3967"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugs.debian.org/873557"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/d15795acd5074e0b44e71f7ede8bdfe1b48591fc"}, {"source": "cve@mitre.org", "tags": ["Vendor Advisory"], "url": "https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2017-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, "type": "CWE-287"}
351
Determine whether the {function_name} code is vulnerable or not.
[ "/**\n * \\file error.h\n *\n * \\brief Error to string translation\n *\n * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved\n * SPDX-License-Identifier: Apache-2.0\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n * not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is part of mbed TLS (https://tls.mbed.org)\n */\n#ifndef MBEDTLS_ERROR_H\n#define MBEDTLS_ERROR_H", "#include <stddef.h>", "/**\n * Error code layout.\n *\n * Currently we try to keep all error codes within the negative space of 16\n * bits signed integers to support all platforms (-0x0001 - -0x7FFF). In\n * addition we'd like to give two layers of information on the error if\n * possible.\n *\n * For that purpose the error codes are segmented in the following manner:\n *\n * 16 bit error code bit-segmentation\n *\n * 1 bit - Unused (sign bit)\n * 3 bits - High level module ID\n * 5 bits - Module-dependent error code\n * 7 bits - Low level module errors\n *\n * For historical reasons, low-level error codes are divided in even and odd,\n * even codes were assigned first, and -1 is reserved for other errors.\n *\n * Low-level module errors (0x0002-0x007E, 0x0003-0x007F)\n *\n * Module Nr Codes assigned\n * MPI 7 0x0002-0x0010\n * GCM 2 0x0012-0x0014\n * BLOWFISH 2 0x0016-0x0018\n * THREADING 3 0x001A-0x001E\n * AES 2 0x0020-0x0022\n * CAMELLIA 2 0x0024-0x0026\n * XTEA 1 0x0028-0x0028\n * BASE64 2 0x002A-0x002C\n * OID 1 0x002E-0x002E 0x000B-0x000B\n * PADLOCK 1 0x0030-0x0030\n * DES 1 0x0032-0x0032\n * CTR_DBRG 4 0x0034-0x003A\n * ENTROPY 3 0x003C-0x0040 0x003D-0x003F\n * NET 11 0x0042-0x0052 0x0043-0x0045\n * ASN1 7 0x0060-0x006C\n * PBKDF2 1 0x007C-0x007C\n * HMAC_DRBG 4 0x0003-0x0009\n * CCM 2 0x000D-0x000F\n *\n * High-level module nr (3 bits - 0x0...-0x7...)\n * Name ID Nr of Errors\n * PEM 1 9\n * PKCS#12 1 4 (Started from top)", " * X509 2 19", " * PKCS5 2 4 (Started from top)\n * DHM 3 9\n * PK 3 14 (Started from top)\n * RSA 4 9\n * ECP 4 8 (Started from top)\n * MD 5 4\n * CIPHER 6 6\n * SSL 6 17 (Started from top)\n * SSL 7 31\n *\n * Module dependent error code (5 bits 0x.00.-0x.F8.)\n */", "#ifdef __cplusplus\nextern \"C\" {\n#endif", "/**\n * \\brief Translate a mbed TLS error code into a string representation,\n * Result is truncated if necessary and always includes a terminating\n * null byte.\n *\n * \\param errnum error code\n * \\param buffer buffer to place representation in\n * \\param buflen length of the buffer\n */\nvoid mbedtls_strerror( int errnum, char *buffer, size_t buflen );", "#ifdef __cplusplus\n}\n#endif", "#endif /* error.h */" ]
[ 1, 1, 1, 0, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [8, 75, 1056, 78, 271, 482, 2312, 1208], "buggy_code_start_loc": [8, 74, 1055, 78, 270, 482, 2060, 1207], "filenames": ["ChangeLog", "include/mbedtls/error.h", "include/mbedtls/ssl.h", "include/mbedtls/x509.h", "include/mbedtls/x509_crt.h", "library/error.c", "library/x509_crt.c", "tests/suites/test_suite_x509parse.data"], "fixing_code_end_loc": [12, 75, 1056, 80, 277, 485, 2317, 1208], "fixing_code_start_loc": [9, 74, 1055, 79, 270, 483, 2060, 1207], "message": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.10:*:*:*:*:*:*:*", "matchCriteriaId": "28621156-2430-447B-8816-47B0FB58245B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.11:*:*:*:*:*:*:*", "matchCriteriaId": "E11BBB2C-0423-47B1-AE12-EB849E17BAF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.12:*:*:*:*:*:*:*", "matchCriteriaId": "4131CE76-6260-412C-A6A6-20B0E978E569", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.13:*:*:*:*:*:*:*", "matchCriteriaId": "DE92D8F7-5705-47B6-B2C2-9DE6C7880647", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.14:*:*:*:*:*:*:*", "matchCriteriaId": "EA50C256-2054-4661-9C42-D31D7D87BAF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.15:*:*:*:*:*:*:*", "matchCriteriaId": "7791D4E9-3FEE-42DA-B320-CF7188A10294", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.16:*:*:*:*:*:*:*", "matchCriteriaId": "BE415DAA-A89F-4204-AC2C-577FCB447E4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.17:*:*:*:*:*:*:*", "matchCriteriaId": "95F691DB-9552-4EBB-B29D-16658561FA4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.18:*:*:*:*:*:*:*", "matchCriteriaId": "F1547B2A-E0D5-41D1-9449-1CCF35022B0E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.19:*:*:*:*:*:*:*", "matchCriteriaId": "CF762122-64BC-4A1A-A26D-81C1270541A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.20:*:*:*:*:*:*:*", "matchCriteriaId": "59D6B559-5F99-4E38-A861-3AB8A7D2E6BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.21:*:*:*:*:*:*:*", "matchCriteriaId": "4A8956C8-6CF0-4C37-84F9-8A89726806C3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "0B395D81-876F-43FC-8DB9-44377647A37A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F92622F1-82DA-4819-8275-06DC9DBE1BA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5871FDE9-02D0-466C-BDB7-90A14C4F637E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE6B4875-3FC3-499F-A76B-2D04982F743A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "B3B67842-5AFA-459F-9CCF-772B9DC7139F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "AD0500EE-52C0-4896-B3D8-5BE731D66039", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "015739E9-C0E3-4A62-BB9D-FA836BFD4351", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "842B0D15-6A3D-4CEE-AD02-49B0436E78E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "3CF6E05C-E6E5-40B8-AFEA-A5ED937F5439", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "D4133C86-70E0-44FD-BBDB-D61EFB31F027", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "6F9D24F0-3892-417F-9C3A-CACEF00C2293", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "8911513E-968C-403E-9D00-2DC0AA82F99B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "48D98945-82BB-4954-AA6D-7D98E4CE1154", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "6378C1CC-7C8F-47E3-A1A7-CDEC76E4CBE4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "525190A3-2194-4E4E-9D34-0048583B9C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "70407352-624A-40E6-82E4-7B4FAFE0C0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "DD52988E-4B2F-41AF-BC25-F38F87D9B8C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "FD1F7803-31F3-40A9-A878-FDC757FCE83F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected."}, {"lang": "es", "value": "ARM mbed TLS en versiones anteriores a la 1.3.21 y en versiones 2.x anteriores a la 2.1.9, si se configura la autenticaci\u00f3n opcional, permite a los atacantes omitir la autenticaci\u00f3n Peer mediante una cadena de certificados X.509 con muchos intermediarios. NOTA: aunque mbed TLS se conoc\u00eda antes como PolarSSL, las versiones lanzadas con el nombre PolarSSL no est\u00e1n afectadas."}], "evaluatorComment": null, "id": "CVE-2017-14032", "lastModified": "2017-11-08T02:29:02.850", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-08-30T20:29:00.337", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.debian.org/security/2017/dsa-3967"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugs.debian.org/873557"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/d15795acd5074e0b44e71f7ede8bdfe1b48591fc"}, {"source": "cve@mitre.org", "tags": ["Vendor Advisory"], "url": "https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2017-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, "type": "CWE-287"}
351
Determine whether the {function_name} code is vulnerable or not.
[ "/**\n * \\file error.h\n *\n * \\brief Error to string translation\n *\n * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved\n * SPDX-License-Identifier: Apache-2.0\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n * not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is part of mbed TLS (https://tls.mbed.org)\n */\n#ifndef MBEDTLS_ERROR_H\n#define MBEDTLS_ERROR_H", "#include <stddef.h>", "/**\n * Error code layout.\n *\n * Currently we try to keep all error codes within the negative space of 16\n * bits signed integers to support all platforms (-0x0001 - -0x7FFF). In\n * addition we'd like to give two layers of information on the error if\n * possible.\n *\n * For that purpose the error codes are segmented in the following manner:\n *\n * 16 bit error code bit-segmentation\n *\n * 1 bit - Unused (sign bit)\n * 3 bits - High level module ID\n * 5 bits - Module-dependent error code\n * 7 bits - Low level module errors\n *\n * For historical reasons, low-level error codes are divided in even and odd,\n * even codes were assigned first, and -1 is reserved for other errors.\n *\n * Low-level module errors (0x0002-0x007E, 0x0003-0x007F)\n *\n * Module Nr Codes assigned\n * MPI 7 0x0002-0x0010\n * GCM 2 0x0012-0x0014\n * BLOWFISH 2 0x0016-0x0018\n * THREADING 3 0x001A-0x001E\n * AES 2 0x0020-0x0022\n * CAMELLIA 2 0x0024-0x0026\n * XTEA 1 0x0028-0x0028\n * BASE64 2 0x002A-0x002C\n * OID 1 0x002E-0x002E 0x000B-0x000B\n * PADLOCK 1 0x0030-0x0030\n * DES 1 0x0032-0x0032\n * CTR_DBRG 4 0x0034-0x003A\n * ENTROPY 3 0x003C-0x0040 0x003D-0x003F\n * NET 11 0x0042-0x0052 0x0043-0x0045\n * ASN1 7 0x0060-0x006C\n * PBKDF2 1 0x007C-0x007C\n * HMAC_DRBG 4 0x0003-0x0009\n * CCM 2 0x000D-0x000F\n *\n * High-level module nr (3 bits - 0x0...-0x7...)\n * Name ID Nr of Errors\n * PEM 1 9\n * PKCS#12 1 4 (Started from top)", " * X509 2 20", " * PKCS5 2 4 (Started from top)\n * DHM 3 9\n * PK 3 14 (Started from top)\n * RSA 4 9\n * ECP 4 8 (Started from top)\n * MD 5 4\n * CIPHER 6 6\n * SSL 6 17 (Started from top)\n * SSL 7 31\n *\n * Module dependent error code (5 bits 0x.00.-0x.F8.)\n */", "#ifdef __cplusplus\nextern \"C\" {\n#endif", "/**\n * \\brief Translate a mbed TLS error code into a string representation,\n * Result is truncated if necessary and always includes a terminating\n * null byte.\n *\n * \\param errnum error code\n * \\param buffer buffer to place representation in\n * \\param buflen length of the buffer\n */\nvoid mbedtls_strerror( int errnum, char *buffer, size_t buflen );", "#ifdef __cplusplus\n}\n#endif", "#endif /* error.h */" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [8, 75, 1056, 78, 271, 482, 2312, 1208], "buggy_code_start_loc": [8, 74, 1055, 78, 270, 482, 2060, 1207], "filenames": ["ChangeLog", "include/mbedtls/error.h", "include/mbedtls/ssl.h", "include/mbedtls/x509.h", "include/mbedtls/x509_crt.h", "library/error.c", "library/x509_crt.c", "tests/suites/test_suite_x509parse.data"], "fixing_code_end_loc": [12, 75, 1056, 80, 277, 485, 2317, 1208], "fixing_code_start_loc": [9, 74, 1055, 79, 270, 483, 2060, 1207], "message": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.10:*:*:*:*:*:*:*", "matchCriteriaId": "28621156-2430-447B-8816-47B0FB58245B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.11:*:*:*:*:*:*:*", "matchCriteriaId": "E11BBB2C-0423-47B1-AE12-EB849E17BAF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.12:*:*:*:*:*:*:*", "matchCriteriaId": "4131CE76-6260-412C-A6A6-20B0E978E569", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.13:*:*:*:*:*:*:*", "matchCriteriaId": "DE92D8F7-5705-47B6-B2C2-9DE6C7880647", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.14:*:*:*:*:*:*:*", "matchCriteriaId": "EA50C256-2054-4661-9C42-D31D7D87BAF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.15:*:*:*:*:*:*:*", "matchCriteriaId": "7791D4E9-3FEE-42DA-B320-CF7188A10294", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.16:*:*:*:*:*:*:*", "matchCriteriaId": "BE415DAA-A89F-4204-AC2C-577FCB447E4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.17:*:*:*:*:*:*:*", "matchCriteriaId": "95F691DB-9552-4EBB-B29D-16658561FA4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.18:*:*:*:*:*:*:*", "matchCriteriaId": "F1547B2A-E0D5-41D1-9449-1CCF35022B0E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.19:*:*:*:*:*:*:*", "matchCriteriaId": "CF762122-64BC-4A1A-A26D-81C1270541A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.20:*:*:*:*:*:*:*", "matchCriteriaId": "59D6B559-5F99-4E38-A861-3AB8A7D2E6BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.21:*:*:*:*:*:*:*", "matchCriteriaId": "4A8956C8-6CF0-4C37-84F9-8A89726806C3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "0B395D81-876F-43FC-8DB9-44377647A37A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F92622F1-82DA-4819-8275-06DC9DBE1BA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5871FDE9-02D0-466C-BDB7-90A14C4F637E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE6B4875-3FC3-499F-A76B-2D04982F743A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "B3B67842-5AFA-459F-9CCF-772B9DC7139F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "AD0500EE-52C0-4896-B3D8-5BE731D66039", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "015739E9-C0E3-4A62-BB9D-FA836BFD4351", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "842B0D15-6A3D-4CEE-AD02-49B0436E78E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "3CF6E05C-E6E5-40B8-AFEA-A5ED937F5439", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "D4133C86-70E0-44FD-BBDB-D61EFB31F027", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "6F9D24F0-3892-417F-9C3A-CACEF00C2293", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "8911513E-968C-403E-9D00-2DC0AA82F99B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "48D98945-82BB-4954-AA6D-7D98E4CE1154", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "6378C1CC-7C8F-47E3-A1A7-CDEC76E4CBE4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "525190A3-2194-4E4E-9D34-0048583B9C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "70407352-624A-40E6-82E4-7B4FAFE0C0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "DD52988E-4B2F-41AF-BC25-F38F87D9B8C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "FD1F7803-31F3-40A9-A878-FDC757FCE83F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected."}, {"lang": "es", "value": "ARM mbed TLS en versiones anteriores a la 1.3.21 y en versiones 2.x anteriores a la 2.1.9, si se configura la autenticaci\u00f3n opcional, permite a los atacantes omitir la autenticaci\u00f3n Peer mediante una cadena de certificados X.509 con muchos intermediarios. NOTA: aunque mbed TLS se conoc\u00eda antes como PolarSSL, las versiones lanzadas con el nombre PolarSSL no est\u00e1n afectadas."}], "evaluatorComment": null, "id": "CVE-2017-14032", "lastModified": "2017-11-08T02:29:02.850", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-08-30T20:29:00.337", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.debian.org/security/2017/dsa-3967"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugs.debian.org/873557"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/d15795acd5074e0b44e71f7ede8bdfe1b48591fc"}, {"source": "cve@mitre.org", "tags": ["Vendor Advisory"], "url": "https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2017-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, "type": "CWE-287"}
351
Determine whether the {function_name} code is vulnerable or not.
[ "/**\n * \\file ssl.h\n *\n * \\brief SSL/TLS functions.\n *\n * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved\n * SPDX-License-Identifier: Apache-2.0\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n * not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is part of mbed TLS (https://tls.mbed.org)\n */\n#ifndef MBEDTLS_SSL_H\n#define MBEDTLS_SSL_H", "#if !defined(MBEDTLS_CONFIG_FILE)\n#include \"config.h\"\n#else\n#include MBEDTLS_CONFIG_FILE\n#endif", "#include \"bignum.h\"\n#include \"ecp.h\"", "#include \"ssl_ciphersuites.h\"", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n#include \"x509_crt.h\"\n#include \"x509_crl.h\"\n#endif", "#if defined(MBEDTLS_DHM_C)\n#include \"dhm.h\"\n#endif", "#if defined(MBEDTLS_ECDH_C)\n#include \"ecdh.h\"\n#endif", "#if defined(MBEDTLS_ZLIB_SUPPORT)\n#include \"zlib.h\"\n#endif", "#if defined(MBEDTLS_HAVE_TIME)\n#include \"mbedtls/platform_time.h\"\n#endif", "/*\n * SSL Error codes\n */\n#define MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE -0x7080 /**< The requested feature is not available. */\n#define MBEDTLS_ERR_SSL_BAD_INPUT_DATA -0x7100 /**< Bad input parameters to function. */\n#define MBEDTLS_ERR_SSL_INVALID_MAC -0x7180 /**< Verification of the message MAC failed. */\n#define MBEDTLS_ERR_SSL_INVALID_RECORD -0x7200 /**< An invalid SSL record was received. */\n#define MBEDTLS_ERR_SSL_CONN_EOF -0x7280 /**< The connection indicated an EOF. */\n#define MBEDTLS_ERR_SSL_UNKNOWN_CIPHER -0x7300 /**< An unknown cipher was received. */\n#define MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN -0x7380 /**< The server has no ciphersuites in common with the client. */\n#define MBEDTLS_ERR_SSL_NO_RNG -0x7400 /**< No RNG was provided to the SSL module. */\n#define MBEDTLS_ERR_SSL_NO_CLIENT_CERTIFICATE -0x7480 /**< No client certification received from the client, but required by the authentication mode. */\n#define MBEDTLS_ERR_SSL_CERTIFICATE_TOO_LARGE -0x7500 /**< Our own certificate(s) is/are too large to send in an SSL message. */\n#define MBEDTLS_ERR_SSL_CERTIFICATE_REQUIRED -0x7580 /**< The own certificate is not set, but needed by the server. */\n#define MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED -0x7600 /**< The own private key or pre-shared key is not set, but needed. */\n#define MBEDTLS_ERR_SSL_CA_CHAIN_REQUIRED -0x7680 /**< No CA Chain is set, but required to operate. */\n#define MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE -0x7700 /**< An unexpected message was received from our peer. */\n#define MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE -0x7780 /**< A fatal alert message was received from our peer. */\n#define MBEDTLS_ERR_SSL_PEER_VERIFY_FAILED -0x7800 /**< Verification of our peer failed. */\n#define MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY -0x7880 /**< The peer notified us that the connection is going to be closed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_HELLO -0x7900 /**< Processing of the ClientHello handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO -0x7980 /**< Processing of the ServerHello handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE -0x7A00 /**< Processing of the Certificate handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST -0x7A80 /**< Processing of the CertificateRequest handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE -0x7B00 /**< Processing of the ServerKeyExchange handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO_DONE -0x7B80 /**< Processing of the ServerHelloDone handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE -0x7C00 /**< Processing of the ClientKeyExchange handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_RP -0x7C80 /**< Processing of the ClientKeyExchange handshake message failed in DHM / ECDH Read Public. */\n#define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_CS -0x7D00 /**< Processing of the ClientKeyExchange handshake message failed in DHM / ECDH Calculate Secret. */\n#define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY -0x7D80 /**< Processing of the CertificateVerify handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC -0x7E00 /**< Processing of the ChangeCipherSpec handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_FINISHED -0x7E80 /**< Processing of the Finished handshake message failed. */\n#define MBEDTLS_ERR_SSL_ALLOC_FAILED -0x7F00 /**< Memory allocation failed */\n#define MBEDTLS_ERR_SSL_HW_ACCEL_FAILED -0x7F80 /**< Hardware acceleration function returned with error */\n#define MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH -0x6F80 /**< Hardware acceleration function skipped / left alone data */\n#define MBEDTLS_ERR_SSL_COMPRESSION_FAILED -0x6F00 /**< Processing of the compression / decompression failed */\n#define MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION -0x6E80 /**< Handshake protocol not within min/max boundaries */\n#define MBEDTLS_ERR_SSL_BAD_HS_NEW_SESSION_TICKET -0x6E00 /**< Processing of the NewSessionTicket handshake message failed. */\n#define MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED -0x6D80 /**< Session ticket has expired. */\n#define MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH -0x6D00 /**< Public key type mismatch (eg, asked for RSA key exchange and presented EC key) */\n#define MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY -0x6C80 /**< Unknown identity received (eg, PSK identity) */\n#define MBEDTLS_ERR_SSL_INTERNAL_ERROR -0x6C00 /**< Internal error (eg, unexpected failure in lower-level module) */\n#define MBEDTLS_ERR_SSL_COUNTER_WRAPPING -0x6B80 /**< A counter would wrap (eg, too many messages exchanged). */\n#define MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO -0x6B00 /**< Unexpected message at ServerHello in renegotiation. */\n#define MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED -0x6A80 /**< DTLS client must retry for hello verification */\n#define MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL -0x6A00 /**< A buffer is too small to receive or write a message */\n#define MBEDTLS_ERR_SSL_NO_USABLE_CIPHERSUITE -0x6980 /**< None of the common ciphersuites is usable (eg, no suitable certificate, see debug messages). */\n#define MBEDTLS_ERR_SSL_WANT_READ -0x6900 /**< Connection requires a read call. */\n#define MBEDTLS_ERR_SSL_WANT_WRITE -0x6880 /**< Connection requires a write call. */\n#define MBEDTLS_ERR_SSL_TIMEOUT -0x6800 /**< The operation timed out. */\n#define MBEDTLS_ERR_SSL_CLIENT_RECONNECT -0x6780 /**< The client initiated a reconnect from the same port. */\n#define MBEDTLS_ERR_SSL_UNEXPECTED_RECORD -0x6700 /**< Record header looks valid but is not expected. */\n#define MBEDTLS_ERR_SSL_NON_FATAL -0x6680 /**< The alert message received indicates a non-fatal error. */\n#define MBEDTLS_ERR_SSL_INVALID_VERIFY_HASH -0x6600 /**< Couldn't set the hash for verifying CertificateVerify */", "/*\n * Various constants\n */\n#define MBEDTLS_SSL_MAJOR_VERSION_3 3\n#define MBEDTLS_SSL_MINOR_VERSION_0 0 /*!< SSL v3.0 */\n#define MBEDTLS_SSL_MINOR_VERSION_1 1 /*!< TLS v1.0 */\n#define MBEDTLS_SSL_MINOR_VERSION_2 2 /*!< TLS v1.1 */\n#define MBEDTLS_SSL_MINOR_VERSION_3 3 /*!< TLS v1.2 */", "#define MBEDTLS_SSL_TRANSPORT_STREAM 0 /*!< TLS */\n#define MBEDTLS_SSL_TRANSPORT_DATAGRAM 1 /*!< DTLS */", "#define MBEDTLS_SSL_MAX_HOST_NAME_LEN 255 /*!< Maximum host name defined in RFC 1035 */", "/* RFC 6066 section 4, see also mfl_code_to_length in ssl_tls.c\n * NONE must be zero so that memset()ing structure to zero works */\n#define MBEDTLS_SSL_MAX_FRAG_LEN_NONE 0 /*!< don't use this extension */\n#define MBEDTLS_SSL_MAX_FRAG_LEN_512 1 /*!< MaxFragmentLength 2^9 */\n#define MBEDTLS_SSL_MAX_FRAG_LEN_1024 2 /*!< MaxFragmentLength 2^10 */\n#define MBEDTLS_SSL_MAX_FRAG_LEN_2048 3 /*!< MaxFragmentLength 2^11 */\n#define MBEDTLS_SSL_MAX_FRAG_LEN_4096 4 /*!< MaxFragmentLength 2^12 */\n#define MBEDTLS_SSL_MAX_FRAG_LEN_INVALID 5 /*!< first invalid value */", "#define MBEDTLS_SSL_IS_CLIENT 0\n#define MBEDTLS_SSL_IS_SERVER 1", "#define MBEDTLS_SSL_IS_NOT_FALLBACK 0\n#define MBEDTLS_SSL_IS_FALLBACK 1", "#define MBEDTLS_SSL_EXTENDED_MS_DISABLED 0\n#define MBEDTLS_SSL_EXTENDED_MS_ENABLED 1", "#define MBEDTLS_SSL_ETM_DISABLED 0\n#define MBEDTLS_SSL_ETM_ENABLED 1", "#define MBEDTLS_SSL_COMPRESS_NULL 0\n#define MBEDTLS_SSL_COMPRESS_DEFLATE 1", "#define MBEDTLS_SSL_VERIFY_NONE 0\n#define MBEDTLS_SSL_VERIFY_OPTIONAL 1\n#define MBEDTLS_SSL_VERIFY_REQUIRED 2\n#define MBEDTLS_SSL_VERIFY_UNSET 3 /* Used only for sni_authmode */", "#define MBEDTLS_SSL_LEGACY_RENEGOTIATION 0\n#define MBEDTLS_SSL_SECURE_RENEGOTIATION 1", "#define MBEDTLS_SSL_RENEGOTIATION_DISABLED 0\n#define MBEDTLS_SSL_RENEGOTIATION_ENABLED 1", "#define MBEDTLS_SSL_ANTI_REPLAY_DISABLED 0\n#define MBEDTLS_SSL_ANTI_REPLAY_ENABLED 1", "#define MBEDTLS_SSL_RENEGOTIATION_NOT_ENFORCED -1\n#define MBEDTLS_SSL_RENEGO_MAX_RECORDS_DEFAULT 16", "#define MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION 0\n#define MBEDTLS_SSL_LEGACY_ALLOW_RENEGOTIATION 1\n#define MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE 2", "#define MBEDTLS_SSL_TRUNC_HMAC_DISABLED 0\n#define MBEDTLS_SSL_TRUNC_HMAC_ENABLED 1\n#define MBEDTLS_SSL_TRUNCATED_HMAC_LEN 10 /* 80 bits, rfc 6066 section 7 */", "#define MBEDTLS_SSL_SESSION_TICKETS_DISABLED 0\n#define MBEDTLS_SSL_SESSION_TICKETS_ENABLED 1", "#define MBEDTLS_SSL_CBC_RECORD_SPLITTING_DISABLED 0\n#define MBEDTLS_SSL_CBC_RECORD_SPLITTING_ENABLED 1", "#define MBEDTLS_SSL_ARC4_ENABLED 0\n#define MBEDTLS_SSL_ARC4_DISABLED 1", "#define MBEDTLS_SSL_PRESET_DEFAULT 0\n#define MBEDTLS_SSL_PRESET_SUITEB 2", "#define MBEDTLS_SSL_CERT_REQ_CA_LIST_ENABLED 1\n#define MBEDTLS_SSL_CERT_REQ_CA_LIST_DISABLED 0", "/*\n * Default range for DTLS retransmission timer value, in milliseconds.\n * RFC 6347 4.2.4.1 says from 1 second to 60 seconds.\n */\n#define MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MIN 1000\n#define MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MAX 60000", "/**\n * \\name SECTION: Module settings\n *\n * The configuration options you can set for this module are in this section.\n * Either change them in config.h or define them on the compiler command line.\n * \\{\n */", "#if !defined(MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME)\n#define MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME 86400 /**< Lifetime of session tickets (if enabled) */\n#endif", "/*\n * Maxium fragment length in bytes,\n * determines the size of each of the two internal I/O buffers.\n *\n * Note: the RFC defines the default size of SSL / TLS messages. If you\n * change the value here, other clients / servers may not be able to\n * communicate with you anymore. Only change this value if you control\n * both sides of the connection and have it reduced at both sides, or\n * if you're using the Max Fragment Length extension and you know all your\n * peers are using it too!\n */\n#if !defined(MBEDTLS_SSL_MAX_CONTENT_LEN)\n#define MBEDTLS_SSL_MAX_CONTENT_LEN 16384 /**< Size of the input / output buffer */\n#endif", "/* \\} name SECTION: Module settings */", "/*\n * Length of the verify data for secure renegotiation\n */\n#if defined(MBEDTLS_SSL_PROTO_SSL3)\n#define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 36\n#else\n#define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 12\n#endif", "/*\n * Signaling ciphersuite values (SCSV)\n */\n#define MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO 0xFF /**< renegotiation info ext */\n#define MBEDTLS_SSL_FALLBACK_SCSV_VALUE 0x5600 /**< RFC 7507 section 2 */", "/*\n * Supported Signature and Hash algorithms (For TLS 1.2)\n * RFC 5246 section 7.4.1.4.1\n */\n#define MBEDTLS_SSL_HASH_NONE 0\n#define MBEDTLS_SSL_HASH_MD5 1\n#define MBEDTLS_SSL_HASH_SHA1 2\n#define MBEDTLS_SSL_HASH_SHA224 3\n#define MBEDTLS_SSL_HASH_SHA256 4\n#define MBEDTLS_SSL_HASH_SHA384 5\n#define MBEDTLS_SSL_HASH_SHA512 6", "#define MBEDTLS_SSL_SIG_ANON 0\n#define MBEDTLS_SSL_SIG_RSA 1\n#define MBEDTLS_SSL_SIG_ECDSA 3", "/*\n * Client Certificate Types\n * RFC 5246 section 7.4.4 plus RFC 4492 section 5.5\n */\n#define MBEDTLS_SSL_CERT_TYPE_RSA_SIGN 1\n#define MBEDTLS_SSL_CERT_TYPE_ECDSA_SIGN 64", "/*\n * Message, alert and handshake types\n */\n#define MBEDTLS_SSL_MSG_CHANGE_CIPHER_SPEC 20\n#define MBEDTLS_SSL_MSG_ALERT 21\n#define MBEDTLS_SSL_MSG_HANDSHAKE 22\n#define MBEDTLS_SSL_MSG_APPLICATION_DATA 23", "#define MBEDTLS_SSL_ALERT_LEVEL_WARNING 1\n#define MBEDTLS_SSL_ALERT_LEVEL_FATAL 2", "#define MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY 0 /* 0x00 */\n#define MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE 10 /* 0x0A */\n#define MBEDTLS_SSL_ALERT_MSG_BAD_RECORD_MAC 20 /* 0x14 */\n#define MBEDTLS_SSL_ALERT_MSG_DECRYPTION_FAILED 21 /* 0x15 */\n#define MBEDTLS_SSL_ALERT_MSG_RECORD_OVERFLOW 22 /* 0x16 */\n#define MBEDTLS_SSL_ALERT_MSG_DECOMPRESSION_FAILURE 30 /* 0x1E */\n#define MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE 40 /* 0x28 */\n#define MBEDTLS_SSL_ALERT_MSG_NO_CERT 41 /* 0x29 */\n#define MBEDTLS_SSL_ALERT_MSG_BAD_CERT 42 /* 0x2A */\n#define MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_CERT 43 /* 0x2B */\n#define MBEDTLS_SSL_ALERT_MSG_CERT_REVOKED 44 /* 0x2C */\n#define MBEDTLS_SSL_ALERT_MSG_CERT_EXPIRED 45 /* 0x2D */\n#define MBEDTLS_SSL_ALERT_MSG_CERT_UNKNOWN 46 /* 0x2E */\n#define MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER 47 /* 0x2F */\n#define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_CA 48 /* 0x30 */\n#define MBEDTLS_SSL_ALERT_MSG_ACCESS_DENIED 49 /* 0x31 */\n#define MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR 50 /* 0x32 */\n#define MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR 51 /* 0x33 */\n#define MBEDTLS_SSL_ALERT_MSG_EXPORT_RESTRICTION 60 /* 0x3C */\n#define MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION 70 /* 0x46 */\n#define MBEDTLS_SSL_ALERT_MSG_INSUFFICIENT_SECURITY 71 /* 0x47 */\n#define MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR 80 /* 0x50 */\n#define MBEDTLS_SSL_ALERT_MSG_INAPROPRIATE_FALLBACK 86 /* 0x56 */\n#define MBEDTLS_SSL_ALERT_MSG_USER_CANCELED 90 /* 0x5A */\n#define MBEDTLS_SSL_ALERT_MSG_NO_RENEGOTIATION 100 /* 0x64 */\n#define MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_EXT 110 /* 0x6E */\n#define MBEDTLS_SSL_ALERT_MSG_UNRECOGNIZED_NAME 112 /* 0x70 */\n#define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_PSK_IDENTITY 115 /* 0x73 */\n#define MBEDTLS_SSL_ALERT_MSG_NO_APPLICATION_PROTOCOL 120 /* 0x78 */", "#define MBEDTLS_SSL_HS_HELLO_REQUEST 0\n#define MBEDTLS_SSL_HS_CLIENT_HELLO 1\n#define MBEDTLS_SSL_HS_SERVER_HELLO 2\n#define MBEDTLS_SSL_HS_HELLO_VERIFY_REQUEST 3\n#define MBEDTLS_SSL_HS_NEW_SESSION_TICKET 4\n#define MBEDTLS_SSL_HS_CERTIFICATE 11\n#define MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE 12\n#define MBEDTLS_SSL_HS_CERTIFICATE_REQUEST 13\n#define MBEDTLS_SSL_HS_SERVER_HELLO_DONE 14\n#define MBEDTLS_SSL_HS_CERTIFICATE_VERIFY 15\n#define MBEDTLS_SSL_HS_CLIENT_KEY_EXCHANGE 16\n#define MBEDTLS_SSL_HS_FINISHED 20", "/*\n * TLS extensions\n */\n#define MBEDTLS_TLS_EXT_SERVERNAME 0\n#define MBEDTLS_TLS_EXT_SERVERNAME_HOSTNAME 0", "#define MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH 1", "#define MBEDTLS_TLS_EXT_TRUNCATED_HMAC 4", "#define MBEDTLS_TLS_EXT_SUPPORTED_ELLIPTIC_CURVES 10\n#define MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS 11", "#define MBEDTLS_TLS_EXT_SIG_ALG 13", "#define MBEDTLS_TLS_EXT_ALPN 16", "#define MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC 22 /* 0x16 */\n#define MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET 0x0017 /* 23 */", "#define MBEDTLS_TLS_EXT_SESSION_TICKET 35", "#define MBEDTLS_TLS_EXT_ECJPAKE_KKPP 256 /* experimental */", "#define MBEDTLS_TLS_EXT_RENEGOTIATION_INFO 0xFF01", "/*\n * Size defines\n */\n#if !defined(MBEDTLS_PSK_MAX_LEN)\n#define MBEDTLS_PSK_MAX_LEN 32 /* 256 bits */\n#endif", "/* Dummy type used only for its size */\nunion mbedtls_ssl_premaster_secret\n{\n#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)\n unsigned char _pms_rsa[48]; /* RFC 5246 8.1.1 */\n#endif\n#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED)\n unsigned char _pms_dhm[MBEDTLS_MPI_MAX_SIZE]; /* RFC 5246 8.1.2 */\n#endif\n#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)\n unsigned char _pms_ecdh[MBEDTLS_ECP_MAX_BYTES]; /* RFC 4492 5.10 */\n#endif\n#if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED)\n unsigned char _pms_psk[4 + 2 * MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 2 */\n#endif\n#if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)\n unsigned char _pms_dhe_psk[4 + MBEDTLS_MPI_MAX_SIZE\n + MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 3 */\n#endif\n#if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)\n unsigned char _pms_rsa_psk[52 + MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 4 */\n#endif\n#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)\n unsigned char _pms_ecdhe_psk[4 + MBEDTLS_ECP_MAX_BYTES\n + MBEDTLS_PSK_MAX_LEN]; /* RFC 5489 2 */\n#endif\n#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)\n unsigned char _pms_ecjpake[32]; /* Thread spec: SHA-256 output */\n#endif\n};", "#define MBEDTLS_PREMASTER_SIZE sizeof( union mbedtls_ssl_premaster_secret )", "#ifdef __cplusplus\nextern \"C\" {\n#endif", "/*\n * SSL state machine\n */\ntypedef enum\n{\n MBEDTLS_SSL_HELLO_REQUEST,\n MBEDTLS_SSL_CLIENT_HELLO,\n MBEDTLS_SSL_SERVER_HELLO,\n MBEDTLS_SSL_SERVER_CERTIFICATE,\n MBEDTLS_SSL_SERVER_KEY_EXCHANGE,\n MBEDTLS_SSL_CERTIFICATE_REQUEST,\n MBEDTLS_SSL_SERVER_HELLO_DONE,\n MBEDTLS_SSL_CLIENT_CERTIFICATE,\n MBEDTLS_SSL_CLIENT_KEY_EXCHANGE,\n MBEDTLS_SSL_CERTIFICATE_VERIFY,\n MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC,\n MBEDTLS_SSL_CLIENT_FINISHED,\n MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC,\n MBEDTLS_SSL_SERVER_FINISHED,\n MBEDTLS_SSL_FLUSH_BUFFERS,\n MBEDTLS_SSL_HANDSHAKE_WRAPUP,\n MBEDTLS_SSL_HANDSHAKE_OVER,\n MBEDTLS_SSL_SERVER_NEW_SESSION_TICKET,\n MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT,\n}\nmbedtls_ssl_states;", "/**\n * \\brief Callback type: send data on the network.\n *\n * \\note That callback may be either blocking or non-blocking.\n *\n * \\param ctx Context for the send callback (typically a file descriptor)\n * \\param buf Buffer holding the data to send\n * \\param len Length of the data to send\n *\n * \\return The callback must return the number of bytes sent if any,\n * or a non-zero error code.\n * If performing non-blocking I/O, \\c MBEDTLS_ERR_SSL_WANT_WRITE\n * must be returned when the operation would block.\n *\n * \\note The callback is allowed to send fewer bytes than requested.\n * It must always return the number of bytes actually sent.\n */\ntypedef int mbedtls_ssl_send_t( void *ctx,\n const unsigned char *buf,\n size_t len );", "/**\n * \\brief Callback type: receive data from the network.\n *\n * \\note That callback may be either blocking or non-blocking.\n *\n * \\param ctx Context for the receive callback (typically a file\n * descriptor)\n * \\param buf Buffer to write the received data to\n * \\param len Length of the receive buffer\n *\n * \\return The callback must return the number of bytes received,\n * or a non-zero error code.\n * If performing non-blocking I/O, \\c MBEDTLS_ERR_SSL_WANT_READ\n * must be returned when the operation would block.\n *\n * \\note The callback may receive fewer bytes than the length of the\n * buffer. It must always return the number of bytes actually\n * received and written to the buffer.\n */\ntypedef int mbedtls_ssl_recv_t( void *ctx,\n unsigned char *buf,\n size_t len );", "/**\n * \\brief Callback type: receive data from the network, with timeout\n *\n * \\note That callback must block until data is received, or the\n * timeout delay expires, or the operation is interrupted by a\n * signal.\n *\n * \\param ctx Context for the receive callback (typically a file descriptor)\n * \\param buf Buffer to write the received data to\n * \\param len Length of the receive buffer\n * \\param timeout Maximum nomber of millisecondes to wait for data\n * 0 means no timeout (potentially waiting forever)\n *\n * \\return The callback must return the number of bytes received,\n * or a non-zero error code:\n * \\c MBEDTLS_ERR_SSL_TIMEOUT if the operation timed out,\n * \\c MBEDTLS_ERR_SSL_WANT_READ if interrupted by a signal.\n *\n * \\note The callback may receive fewer bytes than the length of the\n * buffer. It must always return the number of bytes actually\n * received and written to the buffer.\n */\ntypedef int mbedtls_ssl_recv_timeout_t( void *ctx,\n unsigned char *buf,\n size_t len,\n uint32_t timeout );\n/**\n * \\brief Callback type: set a pair of timers/delays to watch\n *\n * \\param ctx Context pointer\n * \\param int_ms Intermediate delay in milliseconds\n * \\param fin_ms Final delay in milliseconds\n * 0 cancels the current timer.\n *\n * \\note This callback must at least store the necessary information\n * for the associated \\c mbedtls_ssl_get_timer_t callback to\n * return correct information.\n *\n * \\note If using a event-driven style of programming, an event must\n * be generated when the final delay is passed. The event must\n * cause a call to \\c mbedtls_ssl_handshake() with the proper\n * SSL context to be scheduled. Care must be taken to ensure\n * that at most one such call happens at a time.\n *\n * \\note Only one timer at a time must be running. Calling this\n * function while a timer is running must cancel it. Cancelled\n * timers must not generate any event.\n */\ntypedef void mbedtls_ssl_set_timer_t( void * ctx,\n uint32_t int_ms,\n uint32_t fin_ms );", "/**\n * \\brief Callback type: get status of timers/delays\n *\n * \\param ctx Context pointer\n *\n * \\return This callback must return:\n * -1 if cancelled (fin_ms == 0),\n * 0 if none of the delays have passed,\n * 1 if only the intermediate delay has passed,\n * 2 if the final delay has passed.\n */\ntypedef int mbedtls_ssl_get_timer_t( void * ctx );", "\n/* Defined below */\ntypedef struct mbedtls_ssl_session mbedtls_ssl_session;\ntypedef struct mbedtls_ssl_context mbedtls_ssl_context;\ntypedef struct mbedtls_ssl_config mbedtls_ssl_config;", "/* Defined in ssl_internal.h */\ntypedef struct mbedtls_ssl_transform mbedtls_ssl_transform;\ntypedef struct mbedtls_ssl_handshake_params mbedtls_ssl_handshake_params;\ntypedef struct mbedtls_ssl_sig_hash_set_t mbedtls_ssl_sig_hash_set_t;\n#if defined(MBEDTLS_X509_CRT_PARSE_C)\ntypedef struct mbedtls_ssl_key_cert mbedtls_ssl_key_cert;\n#endif\n#if defined(MBEDTLS_SSL_PROTO_DTLS)\ntypedef struct mbedtls_ssl_flight_item mbedtls_ssl_flight_item;\n#endif", "/*\n * This structure is used for storing current session data.\n */\nstruct mbedtls_ssl_session\n{\n#if defined(MBEDTLS_HAVE_TIME)\n mbedtls_time_t start; /*!< starting time */\n#endif\n int ciphersuite; /*!< chosen ciphersuite */\n int compression; /*!< chosen compression */\n size_t id_len; /*!< session id length */\n unsigned char id[32]; /*!< session identifier */\n unsigned char master[48]; /*!< the master secret */", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n mbedtls_x509_crt *peer_cert; /*!< peer X.509 cert chain */\n#endif /* MBEDTLS_X509_CRT_PARSE_C */\n uint32_t verify_result; /*!< verification result */", "#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)\n unsigned char *ticket; /*!< RFC 5077 session ticket */\n size_t ticket_len; /*!< session ticket length */\n uint32_t ticket_lifetime; /*!< ticket lifetime hint */\n#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_CLI_C */", "#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)\n unsigned char mfl_code; /*!< MaxFragmentLength negotiated by peer */\n#endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */", "#if defined(MBEDTLS_SSL_TRUNCATED_HMAC)\n int trunc_hmac; /*!< flag for truncated hmac activation */\n#endif /* MBEDTLS_SSL_TRUNCATED_HMAC */", "#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)\n int encrypt_then_mac; /*!< flag for EtM activation */\n#endif\n};", "/**\n * SSL/TLS configuration to be shared between mbedtls_ssl_context structures.\n */\nstruct mbedtls_ssl_config\n{\n /* Group items by size (largest first) to minimize padding overhead */", " /*\n * Pointers\n */", " const int *ciphersuite_list[4]; /*!< allowed ciphersuites per version */", " /** Callback for printing debug output */\n void (*f_dbg)(void *, int, const char *, int, const char *);\n void *p_dbg; /*!< context for the debug function */", " /** Callback for getting (pseudo-)random numbers */\n int (*f_rng)(void *, unsigned char *, size_t);\n void *p_rng; /*!< context for the RNG function */", " /** Callback to retrieve a session from the cache */\n int (*f_get_cache)(void *, mbedtls_ssl_session *);\n /** Callback to store a session into the cache */\n int (*f_set_cache)(void *, const mbedtls_ssl_session *);\n void *p_cache; /*!< context for cache callbacks */", "#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)\n /** Callback for setting cert according to SNI extension */\n int (*f_sni)(void *, mbedtls_ssl_context *, const unsigned char *, size_t);\n void *p_sni; /*!< context for SNI callback */\n#endif", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n /** Callback to customize X.509 certificate chain verification */\n int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *);\n void *p_vrfy; /*!< context for X.509 verify calllback */\n#endif", "#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)\n /** Callback to retrieve PSK key from identity */\n int (*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *, size_t);\n void *p_psk; /*!< context for PSK callback */\n#endif", "#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)\n /** Callback to create & write a cookie for ClientHello veirifcation */\n int (*f_cookie_write)( void *, unsigned char **, unsigned char *,\n const unsigned char *, size_t );\n /** Callback to verify validity of a ClientHello cookie */\n int (*f_cookie_check)( void *, const unsigned char *, size_t,\n const unsigned char *, size_t );\n void *p_cookie; /*!< context for the cookie callbacks */\n#endif", "#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C)\n /** Callback to create & write a session ticket */\n int (*f_ticket_write)( void *, const mbedtls_ssl_session *,\n unsigned char *, const unsigned char *, size_t *, uint32_t * );\n /** Callback to parse a session ticket into a session structure */\n int (*f_ticket_parse)( void *, mbedtls_ssl_session *, unsigned char *, size_t);\n void *p_ticket; /*!< context for the ticket callbacks */\n#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_SRV_C */", "#if defined(MBEDTLS_SSL_EXPORT_KEYS)\n /** Callback to export key block and master secret */\n int (*f_export_keys)( void *, const unsigned char *,\n const unsigned char *, size_t, size_t, size_t );\n void *p_export_keys; /*!< context for key export callback */\n#endif", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n const mbedtls_x509_crt_profile *cert_profile; /*!< verification profile */\n mbedtls_ssl_key_cert *key_cert; /*!< own certificate/key pair(s) */\n mbedtls_x509_crt *ca_chain; /*!< trusted CAs */\n mbedtls_x509_crl *ca_crl; /*!< trusted CAs CRLs */\n#endif /* MBEDTLS_X509_CRT_PARSE_C */", "#if defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED)\n const int *sig_hashes; /*!< allowed signature hashes */\n#endif", "#if defined(MBEDTLS_ECP_C)\n const mbedtls_ecp_group_id *curve_list; /*!< allowed curves */\n#endif", "#if defined(MBEDTLS_DHM_C)\n mbedtls_mpi dhm_P; /*!< prime modulus for DHM */\n mbedtls_mpi dhm_G; /*!< generator for DHM */\n#endif", "#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)\n unsigned char *psk; /*!< pre-shared key */\n size_t psk_len; /*!< length of the pre-shared key */\n unsigned char *psk_identity; /*!< identity for PSK negotiation */\n size_t psk_identity_len;/*!< length of identity */\n#endif", "#if defined(MBEDTLS_SSL_ALPN)\n const char **alpn_list; /*!< ordered list of protocols */\n#endif", " /*\n * Numerical settings (int then char)\n */", " uint32_t read_timeout; /*!< timeout for mbedtls_ssl_read (ms) */", "#if defined(MBEDTLS_SSL_PROTO_DTLS)\n uint32_t hs_timeout_min; /*!< initial value of the handshake\n retransmission timeout (ms) */\n uint32_t hs_timeout_max; /*!< maximum value of the handshake\n retransmission timeout (ms) */\n#endif", "#if defined(MBEDTLS_SSL_RENEGOTIATION)\n int renego_max_records; /*!< grace period for renegotiation */\n unsigned char renego_period[8]; /*!< value of the record counters\n that triggers renegotiation */\n#endif", "#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)\n unsigned int badmac_limit; /*!< limit of records with a bad MAC */\n#endif", "#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)\n unsigned int dhm_min_bitlen; /*!< min. bit length of the DHM prime */\n#endif", " unsigned char max_major_ver; /*!< max. major version used */\n unsigned char max_minor_ver; /*!< max. minor version used */\n unsigned char min_major_ver; /*!< min. major version used */\n unsigned char min_minor_ver; /*!< min. minor version used */", " /*\n * Flags (bitfields)\n */", " unsigned int endpoint : 1; /*!< 0: client, 1: server */\n unsigned int transport : 1; /*!< stream (TLS) or datagram (DTLS) */\n unsigned int authmode : 2; /*!< MBEDTLS_SSL_VERIFY_XXX */\n /* needed even with renego disabled for LEGACY_BREAK_HANDSHAKE */\n unsigned int allow_legacy_renegotiation : 2 ; /*!< MBEDTLS_LEGACY_XXX */\n#if defined(MBEDTLS_ARC4_C)\n unsigned int arc4_disabled : 1; /*!< blacklist RC4 ciphersuites? */\n#endif\n#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)\n unsigned int mfl_code : 3; /*!< desired fragment length */\n#endif\n#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)\n unsigned int encrypt_then_mac : 1 ; /*!< negotiate encrypt-then-mac? */\n#endif\n#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)\n unsigned int extended_ms : 1; /*!< negotiate extended master secret? */\n#endif\n#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)\n unsigned int anti_replay : 1; /*!< detect and prevent replay? */\n#endif\n#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)\n unsigned int cbc_record_splitting : 1; /*!< do cbc record splitting */\n#endif\n#if defined(MBEDTLS_SSL_RENEGOTIATION)\n unsigned int disable_renegotiation : 1; /*!< disable renegotiation? */\n#endif\n#if defined(MBEDTLS_SSL_TRUNCATED_HMAC)\n unsigned int trunc_hmac : 1; /*!< negotiate truncated hmac? */\n#endif\n#if defined(MBEDTLS_SSL_SESSION_TICKETS)\n unsigned int session_tickets : 1; /*!< use session tickets? */\n#endif\n#if defined(MBEDTLS_SSL_FALLBACK_SCSV) && defined(MBEDTLS_SSL_CLI_C)\n unsigned int fallback : 1; /*!< is this a fallback? */\n#endif\n#if defined(MBEDTLS_SSL_SRV_C)\n unsigned int cert_req_ca_list : 1; /*!< enable sending CA list in\n Certificate Request messages? */\n#endif\n};", "\nstruct mbedtls_ssl_context\n{\n const mbedtls_ssl_config *conf; /*!< configuration information */", " /*\n * Miscellaneous\n */\n int state; /*!< SSL handshake: current state */\n#if defined(MBEDTLS_SSL_RENEGOTIATION)\n int renego_status; /*!< Initial, in progress, pending? */\n int renego_records_seen; /*!< Records since renego request, or with DTLS,\n number of retransmissions of request if\n renego_max_records is < 0 */\n#endif", " int major_ver; /*!< equal to MBEDTLS_SSL_MAJOR_VERSION_3 */\n int minor_ver; /*!< either 0 (SSL3) or 1 (TLS1.0) */", "#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)\n unsigned badmac_seen; /*!< records with a bad MAC received */\n#endif", " mbedtls_ssl_send_t *f_send; /*!< Callback for network send */\n mbedtls_ssl_recv_t *f_recv; /*!< Callback for network receive */\n mbedtls_ssl_recv_timeout_t *f_recv_timeout;\n /*!< Callback for network receive with timeout */", " void *p_bio; /*!< context for I/O operations */", " /*\n * Session layer\n */\n mbedtls_ssl_session *session_in; /*!< current session data (in) */\n mbedtls_ssl_session *session_out; /*!< current session data (out) */\n mbedtls_ssl_session *session; /*!< negotiated session data */\n mbedtls_ssl_session *session_negotiate; /*!< session data in negotiation */", " mbedtls_ssl_handshake_params *handshake; /*!< params required only during\n the handshake process */", " /*\n * Record layer transformations\n */\n mbedtls_ssl_transform *transform_in; /*!< current transform params (in) */\n mbedtls_ssl_transform *transform_out; /*!< current transform params (in) */\n mbedtls_ssl_transform *transform; /*!< negotiated transform params */\n mbedtls_ssl_transform *transform_negotiate; /*!< transform params in negotiation */", " /*\n * Timers\n */\n void *p_timer; /*!< context for the timer callbacks */", " mbedtls_ssl_set_timer_t *f_set_timer; /*!< set timer callback */\n mbedtls_ssl_get_timer_t *f_get_timer; /*!< get timer callback */", " /*\n * Record layer (incoming data)\n */\n unsigned char *in_buf; /*!< input buffer */\n unsigned char *in_ctr; /*!< 64-bit incoming message counter\n TLS: maintained by us\n DTLS: read from peer */\n unsigned char *in_hdr; /*!< start of record header */\n unsigned char *in_len; /*!< two-bytes message length field */\n unsigned char *in_iv; /*!< ivlen-byte IV */\n unsigned char *in_msg; /*!< message contents (in_iv+ivlen) */\n unsigned char *in_offt; /*!< read offset in application data */", " int in_msgtype; /*!< record header: message type */\n size_t in_msglen; /*!< record header: message length */\n size_t in_left; /*!< amount of data read so far */\n#if defined(MBEDTLS_SSL_PROTO_DTLS)\n uint16_t in_epoch; /*!< DTLS epoch for incoming records */\n size_t next_record_offset; /*!< offset of the next record in datagram\n (equal to in_left if none) */\n#endif\n#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)\n uint64_t in_window_top; /*!< last validated record seq_num */\n uint64_t in_window; /*!< bitmask for replay detection */\n#endif", " size_t in_hslen; /*!< current handshake message length,\n including the handshake header */\n int nb_zero; /*!< # of 0-length encrypted messages */", " int keep_current_message; /*!< drop or reuse current message\n on next call to record layer? */", " /*\n * Record layer (outgoing data)\n */\n unsigned char *out_buf; /*!< output buffer */\n unsigned char *out_ctr; /*!< 64-bit outgoing message counter */\n unsigned char *out_hdr; /*!< start of record header */\n unsigned char *out_len; /*!< two-bytes message length field */\n unsigned char *out_iv; /*!< ivlen-byte IV */\n unsigned char *out_msg; /*!< message contents (out_iv+ivlen) */", " int out_msgtype; /*!< record header: message type */\n size_t out_msglen; /*!< record header: message length */\n size_t out_left; /*!< amount of data not yet written */", "#if defined(MBEDTLS_ZLIB_SUPPORT)\n unsigned char *compress_buf; /*!< zlib data buffer */\n#endif\n#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)\n signed char split_done; /*!< current record already splitted? */\n#endif", " /*\n * PKI layer\n */\n int client_auth; /*!< flag for client auth. */", " /*\n * User settings\n */\n#if defined(MBEDTLS_X509_CRT_PARSE_C)\n char *hostname; /*!< expected peer CN for verification\n (and SNI if available) */\n#endif", "#if defined(MBEDTLS_SSL_ALPN)\n const char *alpn_chosen; /*!< negotiated protocol */\n#endif", " /*\n * Information for DTLS hello verify\n */\n#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)\n unsigned char *cli_id; /*!< transport-level ID of the client */\n size_t cli_id_len; /*!< length of cli_id */\n#endif", " /*\n * Secure renegotiation\n */\n /* needed to know when to send extension on server */\n int secure_renegotiation; /*!< does peer support legacy or\n secure renegotiation */\n#if defined(MBEDTLS_SSL_RENEGOTIATION)\n size_t verify_data_len; /*!< length of verify data stored */\n char own_verify_data[MBEDTLS_SSL_VERIFY_DATA_MAX_LEN]; /*!< previous handshake verify data */\n char peer_verify_data[MBEDTLS_SSL_VERIFY_DATA_MAX_LEN]; /*!< previous handshake verify data */\n#endif\n};", "#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)", "#define MBEDTLS_SSL_CHANNEL_OUTBOUND 0\n#define MBEDTLS_SSL_CHANNEL_INBOUND 1", "extern int (*mbedtls_ssl_hw_record_init)(mbedtls_ssl_context *ssl,\n const unsigned char *key_enc, const unsigned char *key_dec,\n size_t keylen,\n const unsigned char *iv_enc, const unsigned char *iv_dec,\n size_t ivlen,\n const unsigned char *mac_enc, const unsigned char *mac_dec,\n size_t maclen);\nextern int (*mbedtls_ssl_hw_record_activate)(mbedtls_ssl_context *ssl, int direction);\nextern int (*mbedtls_ssl_hw_record_reset)(mbedtls_ssl_context *ssl);\nextern int (*mbedtls_ssl_hw_record_write)(mbedtls_ssl_context *ssl);\nextern int (*mbedtls_ssl_hw_record_read)(mbedtls_ssl_context *ssl);\nextern int (*mbedtls_ssl_hw_record_finish)(mbedtls_ssl_context *ssl);\n#endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */", "/**\n * \\brief Returns the list of ciphersuites supported by the SSL/TLS module.\n *\n * \\return a statically allocated array of ciphersuites, the last\n * entry is 0.\n */\nconst int *mbedtls_ssl_list_ciphersuites( void );", "/**\n * \\brief Return the name of the ciphersuite associated with the\n * given ID\n *\n * \\param ciphersuite_id SSL ciphersuite ID\n *\n * \\return a string containing the ciphersuite name\n */\nconst char *mbedtls_ssl_get_ciphersuite_name( const int ciphersuite_id );", "/**\n * \\brief Return the ID of the ciphersuite associated with the\n * given name\n *\n * \\param ciphersuite_name SSL ciphersuite name\n *\n * \\return the ID with the ciphersuite or 0 if not found\n */\nint mbedtls_ssl_get_ciphersuite_id( const char *ciphersuite_name );", "/**\n * \\brief Initialize an SSL context\n * Just makes the context ready for mbedtls_ssl_setup() or\n * mbedtls_ssl_free()\n *\n * \\param ssl SSL context\n */\nvoid mbedtls_ssl_init( mbedtls_ssl_context *ssl );", "/**\n * \\brief Set up an SSL context for use\n *\n * \\note No copy of the configuration context is made, it can be\n * shared by many mbedtls_ssl_context structures.\n *\n * \\warning Modifying the conf structure after it has been used in this\n * function is unsupported!\n *\n * \\param ssl SSL context\n * \\param conf SSL configuration to use\n *\n * \\return 0 if successful, or MBEDTLS_ERR_SSL_ALLOC_FAILED if\n * memory allocation failed\n */\nint mbedtls_ssl_setup( mbedtls_ssl_context *ssl,\n const mbedtls_ssl_config *conf );", "/**\n * \\brief Reset an already initialized SSL context for re-use\n * while retaining application-set variables, function\n * pointers and data.\n *\n * \\param ssl SSL context\n * \\return 0 if successful, or MBEDTLS_ERR_SSL_ALLOC_FAILED,\n MBEDTLS_ERR_SSL_HW_ACCEL_FAILED or\n * MBEDTLS_ERR_SSL_COMPRESSION_FAILED\n */\nint mbedtls_ssl_session_reset( mbedtls_ssl_context *ssl );", "/**\n * \\brief Set the current endpoint type\n *\n * \\param conf SSL configuration\n * \\param endpoint must be MBEDTLS_SSL_IS_CLIENT or MBEDTLS_SSL_IS_SERVER\n */\nvoid mbedtls_ssl_conf_endpoint( mbedtls_ssl_config *conf, int endpoint );", "/**\n * \\brief Set the transport type (TLS or DTLS).\n * Default: TLS\n *\n * \\note For DTLS, you must either provide a recv callback that\n * doesn't block, or one that handles timeouts, see\n * \\c mbedtls_ssl_set_bio(). You also need to provide timer\n * callbacks with \\c mbedtls_ssl_set_timer_cb().\n *\n * \\param conf SSL configuration\n * \\param transport transport type:\n * MBEDTLS_SSL_TRANSPORT_STREAM for TLS,\n * MBEDTLS_SSL_TRANSPORT_DATAGRAM for DTLS.\n */\nvoid mbedtls_ssl_conf_transport( mbedtls_ssl_config *conf, int transport );", "/**\n * \\brief Set the certificate verification mode\n * Default: NONE on server, REQUIRED on client\n *\n * \\param conf SSL configuration\n * \\param authmode can be:\n *\n * MBEDTLS_SSL_VERIFY_NONE: peer certificate is not checked\n * (default on server)\n * (insecure on client)\n *\n * MBEDTLS_SSL_VERIFY_OPTIONAL: peer certificate is checked, however the\n * handshake continues even if verification failed;\n * mbedtls_ssl_get_verify_result() can be called after the\n * handshake is complete.\n *\n * MBEDTLS_SSL_VERIFY_REQUIRED: peer *must* present a valid certificate,\n * handshake is aborted if verification failed.\n * (default on client)\n *\n * \\note On client, MBEDTLS_SSL_VERIFY_REQUIRED is the recommended mode.\n * With MBEDTLS_SSL_VERIFY_OPTIONAL, the user needs to call mbedtls_ssl_get_verify_result() at\n * the right time(s), which may not be obvious, while REQUIRED always perform\n * the verification as soon as possible. For example, REQUIRED was protecting\n * against the \"triple handshake\" attack even before it was found.\n */\nvoid mbedtls_ssl_conf_authmode( mbedtls_ssl_config *conf, int authmode );", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n/**\n * \\brief Set the verification callback (Optional).\n *\n * If set, the verify callback is called for each\n * certificate in the chain. For implementation", " * information, please see \\c x509parse_verify()", " *\n * \\param conf SSL configuration\n * \\param f_vrfy verification function\n * \\param p_vrfy verification parameter\n */\nvoid mbedtls_ssl_conf_verify( mbedtls_ssl_config *conf,\n int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),\n void *p_vrfy );\n#endif /* MBEDTLS_X509_CRT_PARSE_C */", "/**\n * \\brief Set the random number generator callback\n *\n * \\param conf SSL configuration\n * \\param f_rng RNG function\n * \\param p_rng RNG parameter\n */\nvoid mbedtls_ssl_conf_rng( mbedtls_ssl_config *conf,\n int (*f_rng)(void *, unsigned char *, size_t),\n void *p_rng );", "/**\n * \\brief Set the debug callback\n *\n * The callback has the following argument:\n * void * opaque context for the callback\n * int debug level\n * const char * file name\n * int line number\n * const char * message\n *\n * \\param conf SSL configuration\n * \\param f_dbg debug function\n * \\param p_dbg debug parameter\n */\nvoid mbedtls_ssl_conf_dbg( mbedtls_ssl_config *conf,\n void (*f_dbg)(void *, int, const char *, int, const char *),\n void *p_dbg );", "/**\n * \\brief Set the underlying BIO callbacks for write, read and\n * read-with-timeout.\n *\n * \\param ssl SSL context\n * \\param p_bio parameter (context) shared by BIO callbacks\n * \\param f_send write callback\n * \\param f_recv read callback\n * \\param f_recv_timeout blocking read callback with timeout.\n *\n * \\note One of f_recv or f_recv_timeout can be NULL, in which case\n * the other is used. If both are non-NULL, f_recv_timeout is\n * used and f_recv is ignored (as if it were NULL).\n *\n * \\note The two most common use cases are:\n * - non-blocking I/O, f_recv != NULL, f_recv_timeout == NULL\n * - blocking I/O, f_recv == NULL, f_recv_timout != NULL\n *\n * \\note For DTLS, you need to provide either a non-NULL\n * f_recv_timeout callback, or a f_recv that doesn't block.\n *\n * \\note See the documentations of \\c mbedtls_ssl_sent_t,\n * \\c mbedtls_ssl_recv_t and \\c mbedtls_ssl_recv_timeout_t for\n * the conventions those callbacks must follow.\n *\n * \\note On some platforms, net_sockets.c provides\n * \\c mbedtls_net_send(), \\c mbedtls_net_recv() and\n * \\c mbedtls_net_recv_timeout() that are suitable to be used\n * here.\n */\nvoid mbedtls_ssl_set_bio( mbedtls_ssl_context *ssl,\n void *p_bio,\n mbedtls_ssl_send_t *f_send,\n mbedtls_ssl_recv_t *f_recv,\n mbedtls_ssl_recv_timeout_t *f_recv_timeout );", "/**\n * \\brief Set the timeout period for mbedtls_ssl_read()\n * (Default: no timeout.)\n *\n * \\param conf SSL configuration context\n * \\param timeout Timeout value in milliseconds.\n * Use 0 for no timeout (default).\n *\n * \\note With blocking I/O, this will only work if a non-NULL\n * \\c f_recv_timeout was set with \\c mbedtls_ssl_set_bio().\n * With non-blocking I/O, this will only work if timer\n * callbacks were set with \\c mbedtls_ssl_set_timer_cb().\n *\n * \\note With non-blocking I/O, you may also skip this function\n * altogether and handle timeouts at the application layer.\n */\nvoid mbedtls_ssl_conf_read_timeout( mbedtls_ssl_config *conf, uint32_t timeout );", "/**\n * \\brief Set the timer callbacks (Mandatory for DTLS.)\n *\n * \\param ssl SSL context\n * \\param p_timer parameter (context) shared by timer callbacks\n * \\param f_set_timer set timer callback\n * \\param f_get_timer get timer callback. Must return:\n *\n * \\note See the documentation of \\c mbedtls_ssl_set_timer_t and\n * \\c mbedtls_ssl_get_timer_t for the conventions this pair of\n * callbacks must follow.\n *\n * \\note On some platforms, timing.c provides\n * \\c mbedtls_timing_set_delay() and\n * \\c mbedtls_timing_get_delay() that are suitable for using\n * here, except if using an event-driven style.\n *\n * \\note See also the \"DTLS tutorial\" article in our knowledge base.\n * https://tls.mbed.org/kb/how-to/dtls-tutorial\n */\nvoid mbedtls_ssl_set_timer_cb( mbedtls_ssl_context *ssl,\n void *p_timer,\n mbedtls_ssl_set_timer_t *f_set_timer,\n mbedtls_ssl_get_timer_t *f_get_timer );", "/**\n * \\brief Callback type: generate and write session ticket\n *\n * \\note This describes what a callback implementation should do.\n * This callback should generate an encrypted and\n * authenticated ticket for the session and write it to the\n * output buffer. Here, ticket means the opaque ticket part\n * of the NewSessionTicket structure of RFC 5077.\n *\n * \\param p_ticket Context for the callback\n * \\param session SSL session to be written in the ticket\n * \\param start Start of the output buffer\n * \\param end End of the output buffer\n * \\param tlen On exit, holds the length written\n * \\param lifetime On exit, holds the lifetime of the ticket in seconds\n *\n * \\return 0 if successful, or\n * a specific MBEDTLS_ERR_XXX code.\n */\ntypedef int mbedtls_ssl_ticket_write_t( void *p_ticket,\n const mbedtls_ssl_session *session,\n unsigned char *start,\n const unsigned char *end,\n size_t *tlen,\n uint32_t *lifetime );", "#if defined(MBEDTLS_SSL_EXPORT_KEYS)\n/**\n * \\brief Callback type: Export key block and master secret\n *\n * \\note This is required for certain uses of TLS, e.g. EAP-TLS\n * (RFC 5216) and Thread. The key pointers are ephemeral and\n * therefore must not be stored. The master secret and keys\n * should not be used directly except as an input to a key\n * derivation function.\n *\n * \\param p_expkey Context for the callback\n * \\param ms Pointer to master secret (fixed length: 48 bytes)\n * \\param kb Pointer to key block, see RFC 5246 section 6.3\n * (variable length: 2 * maclen + 2 * keylen + 2 * ivlen).\n * \\param maclen MAC length\n * \\param keylen Key length\n * \\param ivlen IV length\n *\n * \\return 0 if successful, or\n * a specific MBEDTLS_ERR_XXX code.\n */\ntypedef int mbedtls_ssl_export_keys_t( void *p_expkey,\n const unsigned char *ms,\n const unsigned char *kb,\n size_t maclen,\n size_t keylen,\n size_t ivlen );\n#endif /* MBEDTLS_SSL_EXPORT_KEYS */", "/**\n * \\brief Callback type: parse and load session ticket\n *\n * \\note This describes what a callback implementation should do.\n * This callback should parse a session ticket as generated\n * by the corresponding mbedtls_ssl_ticket_write_t function,\n * and, if the ticket is authentic and valid, load the\n * session.\n *\n * \\note The implementation is allowed to modify the first len\n * bytes of the input buffer, eg to use it as a temporary\n * area for the decrypted ticket contents.\n *\n * \\param p_ticket Context for the callback\n * \\param session SSL session to be loaded\n * \\param buf Start of the buffer containing the ticket\n * \\param len Length of the ticket.\n *\n * \\return 0 if successful, or\n * MBEDTLS_ERR_SSL_INVALID_MAC if not authentic, or\n * MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED if expired, or\n * any other non-zero code for other failures.\n */\ntypedef int mbedtls_ssl_ticket_parse_t( void *p_ticket,\n mbedtls_ssl_session *session,\n unsigned char *buf,\n size_t len );", "#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C)\n/**\n * \\brief Configure SSL session ticket callbacks (server only).\n * (Default: none.)\n *\n * \\note On server, session tickets are enabled by providing\n * non-NULL callbacks.\n *\n * \\note On client, use \\c mbedtls_ssl_conf_session_tickets().\n *\n * \\param conf SSL configuration context\n * \\param f_ticket_write Callback for writing a ticket\n * \\param f_ticket_parse Callback for parsing a ticket\n * \\param p_ticket Context shared by the two callbacks\n */\nvoid mbedtls_ssl_conf_session_tickets_cb( mbedtls_ssl_config *conf,\n mbedtls_ssl_ticket_write_t *f_ticket_write,\n mbedtls_ssl_ticket_parse_t *f_ticket_parse,\n void *p_ticket );\n#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_SRV_C */", "#if defined(MBEDTLS_SSL_EXPORT_KEYS)\n/**\n * \\brief Configure key export callback.\n * (Default: none.)\n *\n * \\note See \\c mbedtls_ssl_export_keys_t.\n *\n * \\param conf SSL configuration context\n * \\param f_export_keys Callback for exporting keys\n * \\param p_export_keys Context for the callback\n */\nvoid mbedtls_ssl_conf_export_keys_cb( mbedtls_ssl_config *conf,\n mbedtls_ssl_export_keys_t *f_export_keys,\n void *p_export_keys );\n#endif /* MBEDTLS_SSL_EXPORT_KEYS */", "/**\n * \\brief Callback type: generate a cookie\n *\n * \\param ctx Context for the callback\n * \\param p Buffer to write to,\n * must be updated to point right after the cookie\n * \\param end Pointer to one past the end of the output buffer\n * \\param info Client ID info that was passed to\n * \\c mbedtls_ssl_set_client_transport_id()\n * \\param ilen Length of info in bytes\n *\n * \\return The callback must return 0 on success,\n * or a negative error code.\n */\ntypedef int mbedtls_ssl_cookie_write_t( void *ctx,\n unsigned char **p, unsigned char *end,\n const unsigned char *info, size_t ilen );", "/**\n * \\brief Callback type: verify a cookie\n *\n * \\param ctx Context for the callback\n * \\param cookie Cookie to verify\n * \\param clen Length of cookie\n * \\param info Client ID info that was passed to\n * \\c mbedtls_ssl_set_client_transport_id()\n * \\param ilen Length of info in bytes\n *\n * \\return The callback must return 0 if cookie is valid,\n * or a negative error code.\n */\ntypedef int mbedtls_ssl_cookie_check_t( void *ctx,\n const unsigned char *cookie, size_t clen,\n const unsigned char *info, size_t ilen );", "#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)\n/**\n * \\brief Register callbacks for DTLS cookies\n * (Server only. DTLS only.)\n *\n * Default: dummy callbacks that fail, in order to force you to\n * register working callbacks (and initialize their context).\n *\n * To disable HelloVerifyRequest, register NULL callbacks.\n *\n * \\warning Disabling hello verification allows your server to be used\n * for amplification in DoS attacks against other hosts.\n * Only disable if you known this can't happen in your\n * particular environment.\n *\n * \\note See comments on \\c mbedtls_ssl_handshake() about handling\n * the MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED that is expected\n * on the first handshake attempt when this is enabled.\n *\n * \\note This is also necessary to handle client reconnection from\n * the same port as described in RFC 6347 section 4.2.8 (only\n * the variant with cookies is supported currently). See\n * comments on \\c mbedtls_ssl_read() for details.\n *\n * \\param conf SSL configuration\n * \\param f_cookie_write Cookie write callback\n * \\param f_cookie_check Cookie check callback\n * \\param p_cookie Context for both callbacks\n */\nvoid mbedtls_ssl_conf_dtls_cookies( mbedtls_ssl_config *conf,\n mbedtls_ssl_cookie_write_t *f_cookie_write,\n mbedtls_ssl_cookie_check_t *f_cookie_check,\n void *p_cookie );", "/**\n * \\brief Set client's transport-level identification info.\n * (Server only. DTLS only.)\n *\n * This is usually the IP address (and port), but could be\n * anything identify the client depending on the underlying\n * network stack. Used for HelloVerifyRequest with DTLS.\n * This is *not* used to route the actual packets.\n *\n * \\param ssl SSL context\n * \\param info Transport-level info identifying the client (eg IP + port)\n * \\param ilen Length of info in bytes\n *\n * \\note An internal copy is made, so the info buffer can be reused.\n *\n * \\return 0 on success,\n * MBEDTLS_ERR_SSL_BAD_INPUT_DATA if used on client,\n * MBEDTLS_ERR_SSL_ALLOC_FAILED if out of memory.\n */\nint mbedtls_ssl_set_client_transport_id( mbedtls_ssl_context *ssl,\n const unsigned char *info,\n size_t ilen );", "#endif /* MBEDTLS_SSL_DTLS_HELLO_VERIFY && MBEDTLS_SSL_SRV_C */", "#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)\n/**\n * \\brief Enable or disable anti-replay protection for DTLS.\n * (DTLS only, no effect on TLS.)\n * Default: enabled.\n *\n * \\param conf SSL configuration\n * \\param mode MBEDTLS_SSL_ANTI_REPLAY_ENABLED or MBEDTLS_SSL_ANTI_REPLAY_DISABLED.\n *\n * \\warning Disabling this is a security risk unless the application\n * protocol handles duplicated packets in a safe way. You\n * should not disable this without careful consideration.\n * However, if your application already detects duplicated\n * packets and needs information about them to adjust its\n * transmission strategy, then you'll want to disable this.\n */\nvoid mbedtls_ssl_conf_dtls_anti_replay( mbedtls_ssl_config *conf, char mode );\n#endif /* MBEDTLS_SSL_DTLS_ANTI_REPLAY */", "#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)\n/**\n * \\brief Set a limit on the number of records with a bad MAC\n * before terminating the connection.\n * (DTLS only, no effect on TLS.)\n * Default: 0 (disabled).\n *\n * \\param conf SSL configuration\n * \\param limit Limit, or 0 to disable.\n *\n * \\note If the limit is N, then the connection is terminated when\n * the Nth non-authentic record is seen.\n *\n * \\note Records with an invalid header are not counted, only the\n * ones going through the authentication-decryption phase.\n *\n * \\note This is a security trade-off related to the fact that it's\n * often relatively easy for an active attacker ot inject UDP\n * datagrams. On one hand, setting a low limit here makes it\n * easier for such an attacker to forcibly terminated a\n * connection. On the other hand, a high limit or no limit\n * might make us waste resources checking authentication on\n * many bogus packets.\n */\nvoid mbedtls_ssl_conf_dtls_badmac_limit( mbedtls_ssl_config *conf, unsigned limit );\n#endif /* MBEDTLS_SSL_DTLS_BADMAC_LIMIT */", "#if defined(MBEDTLS_SSL_PROTO_DTLS)\n/**\n * \\brief Set retransmit timeout values for the DTLS handshake.\n * (DTLS only, no effect on TLS.)\n *\n * \\param conf SSL configuration\n * \\param min Initial timeout value in milliseconds.\n * Default: 1000 (1 second).\n * \\param max Maximum timeout value in milliseconds.\n * Default: 60000 (60 seconds).\n *\n * \\note Default values are from RFC 6347 section 4.2.4.1.\n *\n * \\note The 'min' value should typically be slightly above the\n * expected round-trip time to your peer, plus whatever time\n * it takes for the peer to process the message. For example,\n * if your RTT is about 600ms and you peer needs up to 1s to\n * do the cryptographic operations in the handshake, then you\n * should set 'min' slightly above 1600. Lower values of 'min'\n * might cause spurious resends which waste network resources,\n * while larger value of 'min' will increase overall latency\n * on unreliable network links.\n *\n * \\note The more unreliable your network connection is, the larger\n * your max / min ratio needs to be in order to achieve\n * reliable handshakes.\n *\n * \\note Messages are retransmitted up to log2(ceil(max/min)) times.\n * For example, if min = 1s and max = 5s, the retransmit plan\n * goes: send ... 1s -> resend ... 2s -> resend ... 4s ->\n * resend ... 5s -> give up and return a timeout error.\n */\nvoid mbedtls_ssl_conf_handshake_timeout( mbedtls_ssl_config *conf, uint32_t min, uint32_t max );\n#endif /* MBEDTLS_SSL_PROTO_DTLS */", "#if defined(MBEDTLS_SSL_SRV_C)\n/**\n * \\brief Set the session cache callbacks (server-side only)\n * If not set, no session resuming is done (except if session\n * tickets are enabled too).\n *\n * The session cache has the responsibility to check for stale\n * entries based on timeout. See RFC 5246 for recommendations.\n *\n * Warning: session.peer_cert is cleared by the SSL/TLS layer on\n * connection shutdown, so do not cache the pointer! Either set\n * it to NULL or make a full copy of the certificate.\n *\n * The get callback is called once during the initial handshake\n * to enable session resuming. The get function has the\n * following parameters: (void *parameter, mbedtls_ssl_session *session)\n * If a valid entry is found, it should fill the master of\n * the session object with the cached values and return 0,\n * return 1 otherwise. Optionally peer_cert can be set as well\n * if it is properly present in cache entry.\n *\n * The set callback is called once during the initial handshake\n * to enable session resuming after the entire handshake has\n * been finished. The set function has the following parameters:\n * (void *parameter, const mbedtls_ssl_session *session). The function\n * should create a cache entry for future retrieval based on\n * the data in the session structure and should keep in mind\n * that the mbedtls_ssl_session object presented (and all its referenced\n * data) is cleared by the SSL/TLS layer when the connection is\n * terminated. It is recommended to add metadata to determine if\n * an entry is still valid in the future. Return 0 if\n * successfully cached, return 1 otherwise.\n *\n * \\param conf SSL configuration\n * \\param p_cache parmater (context) for both callbacks\n * \\param f_get_cache session get callback\n * \\param f_set_cache session set callback\n */\nvoid mbedtls_ssl_conf_session_cache( mbedtls_ssl_config *conf,\n void *p_cache,\n int (*f_get_cache)(void *, mbedtls_ssl_session *),\n int (*f_set_cache)(void *, const mbedtls_ssl_session *) );\n#endif /* MBEDTLS_SSL_SRV_C */", "#if defined(MBEDTLS_SSL_CLI_C)\n/**\n * \\brief Request resumption of session (client-side only)\n * Session data is copied from presented session structure.\n *\n * \\param ssl SSL context\n * \\param session session context\n *\n * \\return 0 if successful,\n * MBEDTLS_ERR_SSL_ALLOC_FAILED if memory allocation failed,\n * MBEDTLS_ERR_SSL_BAD_INPUT_DATA if used server-side or\n * arguments are otherwise invalid\n *\n * \\sa mbedtls_ssl_get_session()\n */\nint mbedtls_ssl_set_session( mbedtls_ssl_context *ssl, const mbedtls_ssl_session *session );\n#endif /* MBEDTLS_SSL_CLI_C */", "/**\n * \\brief Set the list of allowed ciphersuites and the preference\n * order. First in the list has the highest preference.\n * (Overrides all version-specific lists)\n *\n * The ciphersuites array is not copied, and must remain\n * valid for the lifetime of the ssl_config.\n *\n * Note: The server uses its own preferences\n * over the preference of the client unless\n * MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE is defined!\n *\n * \\param conf SSL configuration\n * \\param ciphersuites 0-terminated list of allowed ciphersuites\n */\nvoid mbedtls_ssl_conf_ciphersuites( mbedtls_ssl_config *conf,\n const int *ciphersuites );", "/**\n * \\brief Set the list of allowed ciphersuites and the\n * preference order for a specific version of the protocol.\n * (Only useful on the server side)\n *\n * The ciphersuites array is not copied, and must remain\n * valid for the lifetime of the ssl_config.\n *\n * \\param conf SSL configuration\n * \\param ciphersuites 0-terminated list of allowed ciphersuites\n * \\param major Major version number (only MBEDTLS_SSL_MAJOR_VERSION_3\n * supported)\n * \\param minor Minor version number (MBEDTLS_SSL_MINOR_VERSION_0,\n * MBEDTLS_SSL_MINOR_VERSION_1 and MBEDTLS_SSL_MINOR_VERSION_2,\n * MBEDTLS_SSL_MINOR_VERSION_3 supported)\n *\n * \\note With DTLS, use MBEDTLS_SSL_MINOR_VERSION_2 for DTLS 1.0\n * and MBEDTLS_SSL_MINOR_VERSION_3 for DTLS 1.2\n */\nvoid mbedtls_ssl_conf_ciphersuites_for_version( mbedtls_ssl_config *conf,\n const int *ciphersuites,\n int major, int minor );", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n/**\n * \\brief Set the X.509 security profile used for verification\n *\n * \\note The restrictions are enforced for all certificates in the\n * chain. However, signatures in the handshake are not covered\n * by this setting but by \\b mbedtls_ssl_conf_sig_hashes().\n *\n * \\param conf SSL configuration\n * \\param profile Profile to use\n */\nvoid mbedtls_ssl_conf_cert_profile( mbedtls_ssl_config *conf,\n const mbedtls_x509_crt_profile *profile );", "/**\n * \\brief Set the data required to verify peer certificate\n *\n * \\param conf SSL configuration\n * \\param ca_chain trusted CA chain (meaning all fully trusted top-level CAs)\n * \\param ca_crl trusted CA CRLs\n */\nvoid mbedtls_ssl_conf_ca_chain( mbedtls_ssl_config *conf,\n mbedtls_x509_crt *ca_chain,\n mbedtls_x509_crl *ca_crl );", "/**\n * \\brief Set own certificate chain and private key\n *\n * \\note own_cert should contain in order from the bottom up your\n * certificate chain. The top certificate (self-signed)\n * can be omitted.\n *\n * \\note On server, this function can be called multiple times to\n * provision more than one cert/key pair (eg one ECDSA, one\n * RSA with SHA-256, one RSA with SHA-1). An adequate\n * certificate will be selected according to the client's\n * advertised capabilities. In case mutliple certificates are\n * adequate, preference is given to the one set by the first\n * call to this function, then second, etc.\n *\n * \\note On client, only the first call has any effect. That is,\n * only one client certificate can be provisioned. The\n * server's preferences in its CertficateRequest message will\n * be ignored and our only cert will be sent regardless of\n * whether it matches those preferences - the server can then\n * decide what it wants to do with it.\n *\n * \\param conf SSL configuration\n * \\param own_cert own public certificate chain\n * \\param pk_key own private key\n *\n * \\return 0 on success or MBEDTLS_ERR_SSL_ALLOC_FAILED\n */\nint mbedtls_ssl_conf_own_cert( mbedtls_ssl_config *conf,\n mbedtls_x509_crt *own_cert,\n mbedtls_pk_context *pk_key );\n#endif /* MBEDTLS_X509_CRT_PARSE_C */", "#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)\n/**\n * \\brief Set the Pre Shared Key (PSK) and the expected identity name\n *\n * \\note This is mainly useful for clients. Servers will usually\n * want to use \\c mbedtls_ssl_conf_psk_cb() instead.\n *\n * \\note Currently clients can only register one pre-shared key.\n * In other words, the servers' identity hint is ignored.\n * Support for setting multiple PSKs on clients and selecting\n * one based on the identity hint is not a planned feature but\n * feedback is welcomed.\n *\n * \\param conf SSL configuration\n * \\param psk pointer to the pre-shared key\n * \\param psk_len pre-shared key length\n * \\param psk_identity pointer to the pre-shared key identity\n * \\param psk_identity_len identity key length\n *\n * \\return 0 if successful or MBEDTLS_ERR_SSL_ALLOC_FAILED\n */\nint mbedtls_ssl_conf_psk( mbedtls_ssl_config *conf,\n const unsigned char *psk, size_t psk_len,\n const unsigned char *psk_identity, size_t psk_identity_len );", "\n/**\n * \\brief Set the Pre Shared Key (PSK) for the current handshake\n *\n * \\note This should only be called inside the PSK callback,\n * ie the function passed to \\c mbedtls_ssl_conf_psk_cb().\n *\n * \\param ssl SSL context\n * \\param psk pointer to the pre-shared key\n * \\param psk_len pre-shared key length\n *\n * \\return 0 if successful or MBEDTLS_ERR_SSL_ALLOC_FAILED\n */\nint mbedtls_ssl_set_hs_psk( mbedtls_ssl_context *ssl,\n const unsigned char *psk, size_t psk_len );", "/**\n * \\brief Set the PSK callback (server-side only).\n *\n * If set, the PSK callback is called for each\n * handshake where a PSK ciphersuite was negotiated.\n * The caller provides the identity received and wants to\n * receive the actual PSK data and length.\n *\n * The callback has the following parameters: (void *parameter,\n * mbedtls_ssl_context *ssl, const unsigned char *psk_identity,\n * size_t identity_len)\n * If a valid PSK identity is found, the callback should use\n * \\c mbedtls_ssl_set_hs_psk() on the ssl context to set the\n * correct PSK and return 0.\n * Any other return value will result in a denied PSK identity.\n *\n * \\note If you set a PSK callback using this function, then you\n * don't need to set a PSK key and identity using\n * \\c mbedtls_ssl_conf_psk().\n *\n * \\param conf SSL configuration\n * \\param f_psk PSK identity function\n * \\param p_psk PSK identity parameter\n */\nvoid mbedtls_ssl_conf_psk_cb( mbedtls_ssl_config *conf,\n int (*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *,\n size_t),\n void *p_psk );\n#endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */", "#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_SRV_C)\n/**\n * \\brief Set the Diffie-Hellman public P and G values,\n * read as hexadecimal strings (server-side only)\n * (Default: MBEDTLS_DHM_RFC5114_MODP_2048_[PG])\n *\n * \\param conf SSL configuration\n * \\param dhm_P Diffie-Hellman-Merkle modulus\n * \\param dhm_G Diffie-Hellman-Merkle generator\n *\n * \\return 0 if successful\n */\nint mbedtls_ssl_conf_dh_param( mbedtls_ssl_config *conf, const char *dhm_P, const char *dhm_G );", "/**\n * \\brief Set the Diffie-Hellman public P and G values,\n * read from existing context (server-side only)\n *\n * \\param conf SSL configuration\n * \\param dhm_ctx Diffie-Hellman-Merkle context\n *\n * \\return 0 if successful\n */\nint mbedtls_ssl_conf_dh_param_ctx( mbedtls_ssl_config *conf, mbedtls_dhm_context *dhm_ctx );\n#endif /* MBEDTLS_DHM_C && defined(MBEDTLS_SSL_SRV_C) */", "#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)\n/**\n * \\brief Set the minimum length for Diffie-Hellman parameters.\n * (Client-side only.)\n * (Default: 1024 bits.)\n *\n * \\param conf SSL configuration\n * \\param bitlen Minimum bit length of the DHM prime\n */\nvoid mbedtls_ssl_conf_dhm_min_bitlen( mbedtls_ssl_config *conf,\n unsigned int bitlen );\n#endif /* MBEDTLS_DHM_C && MBEDTLS_SSL_CLI_C */", "#if defined(MBEDTLS_ECP_C)\n/**\n * \\brief Set the allowed curves in order of preference.\n * (Default: all defined curves.)\n *\n * On server: this only affects selection of the ECDHE curve;\n * the curves used for ECDH and ECDSA are determined by the\n * list of available certificates instead.\n *\n * On client: this affects the list of curves offered for any\n * use. The server can override our preference order.\n *\n * Both sides: limits the set of curves accepted for use in\n * ECDHE and in the peer's end-entity certificate.\n *\n * \\note This has no influence on which curves are allowed inside the\n * certificate chains, see \\c mbedtls_ssl_conf_cert_profile()\n * for that. For the end-entity certificate however, the key\n * will be accepted only if it is allowed both by this list\n * and by the cert profile.\n *\n * \\note This list should be ordered by decreasing preference\n * (preferred curve first).\n *\n * \\param conf SSL configuration\n * \\param curves Ordered list of allowed curves,\n * terminated by MBEDTLS_ECP_DP_NONE.\n */\nvoid mbedtls_ssl_conf_curves( mbedtls_ssl_config *conf,\n const mbedtls_ecp_group_id *curves );\n#endif /* MBEDTLS_ECP_C */", "#if defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED)\n/**\n * \\brief Set the allowed hashes for signatures during the handshake.\n * (Default: all available hashes except MD5.)\n *\n * \\note This only affects which hashes are offered and can be used\n * for signatures during the handshake. Hashes for message\n * authentication and the TLS PRF are controlled by the\n * ciphersuite, see \\c mbedtls_ssl_conf_ciphersuites(). Hashes\n * used for certificate signature are controlled by the\n * verification profile, see \\c mbedtls_ssl_conf_cert_profile().\n *\n * \\note This list should be ordered by decreasing preference\n * (preferred hash first).\n *\n * \\param conf SSL configuration\n * \\param hashes Ordered list of allowed signature hashes,\n * terminated by \\c MBEDTLS_MD_NONE.\n */\nvoid mbedtls_ssl_conf_sig_hashes( mbedtls_ssl_config *conf,\n const int *hashes );\n#endif /* MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED */", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n/**\n * \\brief Set the hostname to check against the received server\n * certificate. It sets the ServerName TLS extension too,\n * if the extension is enabled.\n * (client-side only)\n *\n * \\param ssl SSL context\n * \\param hostname the server hostname\n *\n * \\return 0 if successful or MBEDTLS_ERR_SSL_ALLOC_FAILED\n */\nint mbedtls_ssl_set_hostname( mbedtls_ssl_context *ssl, const char *hostname );\n#endif /* MBEDTLS_X509_CRT_PARSE_C */", "#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)\n/**\n * \\brief Set own certificate and key for the current handshake\n *\n * \\note Same as \\c mbedtls_ssl_conf_own_cert() but for use within\n * the SNI callback.\n *\n * \\param ssl SSL context\n * \\param own_cert own public certificate chain\n * \\param pk_key own private key\n *\n * \\return 0 on success or MBEDTLS_ERR_SSL_ALLOC_FAILED\n */\nint mbedtls_ssl_set_hs_own_cert( mbedtls_ssl_context *ssl,\n mbedtls_x509_crt *own_cert,\n mbedtls_pk_context *pk_key );", "/**\n * \\brief Set the data required to verify peer certificate for the\n * current handshake\n *\n * \\note Same as \\c mbedtls_ssl_conf_ca_chain() but for use within\n * the SNI callback.\n *\n * \\param ssl SSL context\n * \\param ca_chain trusted CA chain (meaning all fully trusted top-level CAs)\n * \\param ca_crl trusted CA CRLs\n */\nvoid mbedtls_ssl_set_hs_ca_chain( mbedtls_ssl_context *ssl,\n mbedtls_x509_crt *ca_chain,\n mbedtls_x509_crl *ca_crl );", "/**\n * \\brief Set authmode for the current handshake.\n *\n * \\note Same as \\c mbedtls_ssl_conf_authmode() but for use within\n * the SNI callback.\n *\n * \\param ssl SSL context\n * \\param authmode MBEDTLS_SSL_VERIFY_NONE, MBEDTLS_SSL_VERIFY_OPTIONAL or\n * MBEDTLS_SSL_VERIFY_REQUIRED\n */\nvoid mbedtls_ssl_set_hs_authmode( mbedtls_ssl_context *ssl,\n int authmode );", "/**\n * \\brief Set server side ServerName TLS extension callback\n * (optional, server-side only).\n *\n * If set, the ServerName callback is called whenever the\n * server receives a ServerName TLS extension from the client\n * during a handshake. The ServerName callback has the\n * following parameters: (void *parameter, mbedtls_ssl_context *ssl,\n * const unsigned char *hostname, size_t len). If a suitable\n * certificate is found, the callback must set the\n * certificate(s) and key(s) to use with \\c\n * mbedtls_ssl_set_hs_own_cert() (can be called repeatedly),\n * and may optionally adjust the CA and associated CRL with \\c\n * mbedtls_ssl_set_hs_ca_chain() as well as the client\n * authentication mode with \\c mbedtls_ssl_set_hs_authmode(),\n * then must return 0. If no matching name is found, the\n * callback must either set a default cert, or\n * return non-zero to abort the handshake at this point.\n *\n * \\param conf SSL configuration\n * \\param f_sni verification function\n * \\param p_sni verification parameter\n */\nvoid mbedtls_ssl_conf_sni( mbedtls_ssl_config *conf,\n int (*f_sni)(void *, mbedtls_ssl_context *, const unsigned char *,\n size_t),\n void *p_sni );\n#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */", "#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)\n/**\n * \\brief Set the EC J-PAKE password for current handshake.\n *\n * \\note An internal copy is made, and destroyed as soon as the\n * handshake is completed, or when the SSL context is reset or\n * freed.\n *\n * \\note The SSL context needs to be already set up. The right place\n * to call this function is between \\c mbedtls_ssl_setup() or\n * \\c mbedtls_ssl_reset() and \\c mbedtls_ssl_handshake().\n *\n * \\param ssl SSL context\n * \\param pw EC J-PAKE password (pre-shared secret)\n * \\param pw_len length of pw in bytes\n *\n * \\return 0 on success, or a negative error code.\n */\nint mbedtls_ssl_set_hs_ecjpake_password( mbedtls_ssl_context *ssl,\n const unsigned char *pw,\n size_t pw_len );\n#endif /*MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */", "#if defined(MBEDTLS_SSL_ALPN)\n/**\n * \\brief Set the supported Application Layer Protocols.\n *\n * \\param conf SSL configuration\n * \\param protos Pointer to a NULL-terminated list of supported protocols,\n * in decreasing preference order. The pointer to the list is\n * recorded by the library for later reference as required, so\n * the lifetime of the table must be atleast as long as the\n * lifetime of the SSL configuration structure.\n *\n * \\return 0 on success, or MBEDTLS_ERR_SSL_BAD_INPUT_DATA.\n */\nint mbedtls_ssl_conf_alpn_protocols( mbedtls_ssl_config *conf, const char **protos );", "/**\n * \\brief Get the name of the negotiated Application Layer Protocol.\n * This function should be called after the handshake is\n * completed.\n *\n * \\param ssl SSL context\n *\n * \\return Protcol name, or NULL if no protocol was negotiated.\n */\nconst char *mbedtls_ssl_get_alpn_protocol( const mbedtls_ssl_context *ssl );\n#endif /* MBEDTLS_SSL_ALPN */", "/**\n * \\brief Set the maximum supported version sent from the client side\n * and/or accepted at the server side\n * (Default: MBEDTLS_SSL_MAX_MAJOR_VERSION, MBEDTLS_SSL_MAX_MINOR_VERSION)\n *\n * \\note This ignores ciphersuites from higher versions.\n *\n * \\note With DTLS, use MBEDTLS_SSL_MINOR_VERSION_2 for DTLS 1.0 and\n * MBEDTLS_SSL_MINOR_VERSION_3 for DTLS 1.2\n *\n * \\param conf SSL configuration\n * \\param major Major version number (only MBEDTLS_SSL_MAJOR_VERSION_3 supported)\n * \\param minor Minor version number (MBEDTLS_SSL_MINOR_VERSION_0,\n * MBEDTLS_SSL_MINOR_VERSION_1 and MBEDTLS_SSL_MINOR_VERSION_2,\n * MBEDTLS_SSL_MINOR_VERSION_3 supported)\n */\nvoid mbedtls_ssl_conf_max_version( mbedtls_ssl_config *conf, int major, int minor );", "/**\n * \\brief Set the minimum accepted SSL/TLS protocol version\n * (Default: TLS 1.0)\n *\n * \\note Input outside of the SSL_MAX_XXXXX_VERSION and\n * SSL_MIN_XXXXX_VERSION range is ignored.\n *\n * \\note MBEDTLS_SSL_MINOR_VERSION_0 (SSL v3) should be avoided.\n *\n * \\note With DTLS, use MBEDTLS_SSL_MINOR_VERSION_2 for DTLS 1.0 and\n * MBEDTLS_SSL_MINOR_VERSION_3 for DTLS 1.2\n *\n * \\param conf SSL configuration\n * \\param major Major version number (only MBEDTLS_SSL_MAJOR_VERSION_3 supported)\n * \\param minor Minor version number (MBEDTLS_SSL_MINOR_VERSION_0,\n * MBEDTLS_SSL_MINOR_VERSION_1 and MBEDTLS_SSL_MINOR_VERSION_2,\n * MBEDTLS_SSL_MINOR_VERSION_3 supported)\n */\nvoid mbedtls_ssl_conf_min_version( mbedtls_ssl_config *conf, int major, int minor );", "#if defined(MBEDTLS_SSL_FALLBACK_SCSV) && defined(MBEDTLS_SSL_CLI_C)\n/**\n * \\brief Set the fallback flag (client-side only).\n * (Default: MBEDTLS_SSL_IS_NOT_FALLBACK).\n *\n * \\note Set to MBEDTLS_SSL_IS_FALLBACK when preparing a fallback\n * connection, that is a connection with max_version set to a\n * lower value than the value you're willing to use. Such\n * fallback connections are not recommended but are sometimes\n * necessary to interoperate with buggy (version-intolerant)\n * servers.\n *\n * \\warning You should NOT set this to MBEDTLS_SSL_IS_FALLBACK for\n * non-fallback connections! This would appear to work for a\n * while, then cause failures when the server is upgraded to\n * support a newer TLS version.\n *\n * \\param conf SSL configuration\n * \\param fallback MBEDTLS_SSL_IS_NOT_FALLBACK or MBEDTLS_SSL_IS_FALLBACK\n */\nvoid mbedtls_ssl_conf_fallback( mbedtls_ssl_config *conf, char fallback );\n#endif /* MBEDTLS_SSL_FALLBACK_SCSV && MBEDTLS_SSL_CLI_C */", "#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)\n/**\n * \\brief Enable or disable Encrypt-then-MAC\n * (Default: MBEDTLS_SSL_ETM_ENABLED)\n *\n * \\note This should always be enabled, it is a security\n * improvement, and should not cause any interoperability\n * issue (used only if the peer supports it too).\n *\n * \\param conf SSL configuration\n * \\param etm MBEDTLS_SSL_ETM_ENABLED or MBEDTLS_SSL_ETM_DISABLED\n */\nvoid mbedtls_ssl_conf_encrypt_then_mac( mbedtls_ssl_config *conf, char etm );\n#endif /* MBEDTLS_SSL_ENCRYPT_THEN_MAC */", "#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)\n/**\n * \\brief Enable or disable Extended Master Secret negotiation.\n * (Default: MBEDTLS_SSL_EXTENDED_MS_ENABLED)\n *\n * \\note This should always be enabled, it is a security fix to the\n * protocol, and should not cause any interoperability issue\n * (used only if the peer supports it too).\n *\n * \\param conf SSL configuration\n * \\param ems MBEDTLS_SSL_EXTENDED_MS_ENABLED or MBEDTLS_SSL_EXTENDED_MS_DISABLED\n */\nvoid mbedtls_ssl_conf_extended_master_secret( mbedtls_ssl_config *conf, char ems );\n#endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */", "#if defined(MBEDTLS_ARC4_C)\n/**\n * \\brief Disable or enable support for RC4\n * (Default: MBEDTLS_SSL_ARC4_DISABLED)\n *\n * \\warning Use of RC4 in DTLS/TLS has been prohibited by RFC 7465\n * for security reasons. Use at your own risk.\n *\n * \\note This function is deprecated and will likely be removed in\n * a future version of the library.\n * RC4 is disabled by default at compile time and needs to be\n * actively enabled for use with legacy systems.\n *\n * \\param conf SSL configuration\n * \\param arc4 MBEDTLS_SSL_ARC4_ENABLED or MBEDTLS_SSL_ARC4_DISABLED\n */\nvoid mbedtls_ssl_conf_arc4_support( mbedtls_ssl_config *conf, char arc4 );\n#endif /* MBEDTLS_ARC4_C */", "#if defined(MBEDTLS_SSL_SRV_C)\n/**\n * \\brief Whether to send a list of acceptable CAs in\n * CertificateRequest messages.\n * (Default: do send)\n *\n * \\param conf SSL configuration\n * \\param cert_req_ca_list MBEDTLS_SSL_CERT_REQ_CA_LIST_ENABLED or\n * MBEDTLS_SSL_CERT_REQ_CA_LIST_DISABLED\n */\nvoid mbedtls_ssl_conf_cert_req_ca_list( mbedtls_ssl_config *conf,\n char cert_req_ca_list );\n#endif /* MBEDTLS_SSL_SRV_C */", "#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)\n/**\n * \\brief Set the maximum fragment length to emit and/or negotiate\n * (Default: MBEDTLS_SSL_MAX_CONTENT_LEN, usually 2^14 bytes)\n * (Server: set maximum fragment length to emit,\n * usually negotiated by the client during handshake\n * (Client: set maximum fragment length to emit *and*\n * negotiate with the server during handshake)\n *\n * \\param conf SSL configuration\n * \\param mfl_code Code for maximum fragment length (allowed values:\n * MBEDTLS_SSL_MAX_FRAG_LEN_512, MBEDTLS_SSL_MAX_FRAG_LEN_1024,\n * MBEDTLS_SSL_MAX_FRAG_LEN_2048, MBEDTLS_SSL_MAX_FRAG_LEN_4096)\n *\n * \\return 0 if successful or MBEDTLS_ERR_SSL_BAD_INPUT_DATA\n */\nint mbedtls_ssl_conf_max_frag_len( mbedtls_ssl_config *conf, unsigned char mfl_code );\n#endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */", "#if defined(MBEDTLS_SSL_TRUNCATED_HMAC)\n/**\n * \\brief Activate negotiation of truncated HMAC\n * (Default: MBEDTLS_SSL_TRUNC_HMAC_DISABLED)\n *\n * \\param conf SSL configuration\n * \\param truncate Enable or disable (MBEDTLS_SSL_TRUNC_HMAC_ENABLED or\n * MBEDTLS_SSL_TRUNC_HMAC_DISABLED)\n */\nvoid mbedtls_ssl_conf_truncated_hmac( mbedtls_ssl_config *conf, int truncate );\n#endif /* MBEDTLS_SSL_TRUNCATED_HMAC */", "#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)\n/**\n * \\brief Enable / Disable 1/n-1 record splitting\n * (Default: MBEDTLS_SSL_CBC_RECORD_SPLITTING_ENABLED)\n *\n * \\note Only affects SSLv3 and TLS 1.0, not higher versions.\n * Does not affect non-CBC ciphersuites in any version.\n *\n * \\param conf SSL configuration\n * \\param split MBEDTLS_SSL_CBC_RECORD_SPLITTING_ENABLED or\n * MBEDTLS_SSL_CBC_RECORD_SPLITTING_DISABLED\n */\nvoid mbedtls_ssl_conf_cbc_record_splitting( mbedtls_ssl_config *conf, char split );\n#endif /* MBEDTLS_SSL_CBC_RECORD_SPLITTING */", "#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)\n/**\n * \\brief Enable / Disable session tickets (client only).\n * (Default: MBEDTLS_SSL_SESSION_TICKETS_ENABLED.)\n *\n * \\note On server, use \\c mbedtls_ssl_conf_session_tickets_cb().\n *\n * \\param conf SSL configuration\n * \\param use_tickets Enable or disable (MBEDTLS_SSL_SESSION_TICKETS_ENABLED or\n * MBEDTLS_SSL_SESSION_TICKETS_DISABLED)\n */\nvoid mbedtls_ssl_conf_session_tickets( mbedtls_ssl_config *conf, int use_tickets );\n#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_CLI_C */", "#if defined(MBEDTLS_SSL_RENEGOTIATION)\n/**\n * \\brief Enable / Disable renegotiation support for connection when\n * initiated by peer\n * (Default: MBEDTLS_SSL_RENEGOTIATION_DISABLED)\n *\n * \\warning It is recommended to always disable renegotation unless you\n * know you need it and you know what you're doing. In the\n * past, there have been several issues associated with\n * renegotiation or a poor understanding of its properties.\n *\n * \\note Server-side, enabling renegotiation also makes the server\n * susceptible to a resource DoS by a malicious client.\n *\n * \\param conf SSL configuration\n * \\param renegotiation Enable or disable (MBEDTLS_SSL_RENEGOTIATION_ENABLED or\n * MBEDTLS_SSL_RENEGOTIATION_DISABLED)\n */\nvoid mbedtls_ssl_conf_renegotiation( mbedtls_ssl_config *conf, int renegotiation );\n#endif /* MBEDTLS_SSL_RENEGOTIATION */", "/**\n * \\brief Prevent or allow legacy renegotiation.\n * (Default: MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION)\n *\n * MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION allows connections to\n * be established even if the peer does not support\n * secure renegotiation, but does not allow renegotiation\n * to take place if not secure.\n * (Interoperable and secure option)\n *\n * MBEDTLS_SSL_LEGACY_ALLOW_RENEGOTIATION allows renegotiations\n * with non-upgraded peers. Allowing legacy renegotiation\n * makes the connection vulnerable to specific man in the\n * middle attacks. (See RFC 5746)\n * (Most interoperable and least secure option)\n *\n * MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE breaks off connections\n * if peer does not support secure renegotiation. Results\n * in interoperability issues with non-upgraded peers\n * that do not support renegotiation altogether.\n * (Most secure option, interoperability issues)\n *\n * \\param conf SSL configuration\n * \\param allow_legacy Prevent or allow (SSL_NO_LEGACY_RENEGOTIATION,\n * SSL_ALLOW_LEGACY_RENEGOTIATION or\n * MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE)\n */\nvoid mbedtls_ssl_conf_legacy_renegotiation( mbedtls_ssl_config *conf, int allow_legacy );", "#if defined(MBEDTLS_SSL_RENEGOTIATION)\n/**\n * \\brief Enforce renegotiation requests.\n * (Default: enforced, max_records = 16)\n *\n * When we request a renegotiation, the peer can comply or\n * ignore the request. This function allows us to decide\n * whether to enforce our renegotiation requests by closing\n * the connection if the peer doesn't comply.\n *\n * However, records could already be in transit from the peer\n * when the request is emitted. In order to increase\n * reliability, we can accept a number of records before the\n * expected handshake records.\n *\n * The optimal value is highly dependent on the specific usage\n * scenario.\n *\n * \\note With DTLS and server-initiated renegotiation, the\n * HelloRequest is retransmited every time mbedtls_ssl_read() times\n * out or receives Application Data, until:\n * - max_records records have beens seen, if it is >= 0, or\n * - the number of retransmits that would happen during an\n * actual handshake has been reached.\n * Please remember the request might be lost a few times\n * if you consider setting max_records to a really low value.\n *\n * \\warning On client, the grace period can only happen during\n * mbedtls_ssl_read(), as opposed to mbedtls_ssl_write() and mbedtls_ssl_renegotiate()\n * which always behave as if max_record was 0. The reason is,\n * if we receive application data from the server, we need a\n * place to write it, which only happens during mbedtls_ssl_read().\n *\n * \\param conf SSL configuration\n * \\param max_records Use MBEDTLS_SSL_RENEGOTIATION_NOT_ENFORCED if you don't want to\n * enforce renegotiation, or a non-negative value to enforce\n * it but allow for a grace period of max_records records.\n */\nvoid mbedtls_ssl_conf_renegotiation_enforced( mbedtls_ssl_config *conf, int max_records );", "/**\n * \\brief Set record counter threshold for periodic renegotiation.\n * (Default: 2^48 - 1)\n *\n * Renegotiation is automatically triggered when a record\n * counter (outgoing or ingoing) crosses the defined\n * threshold. The default value is meant to prevent the\n * connection from being closed when the counter is about to\n * reached its maximal value (it is not allowed to wrap).\n *\n * Lower values can be used to enforce policies such as \"keys\n * must be refreshed every N packets with cipher X\".\n *\n * The renegotiation period can be disabled by setting\n * conf->disable_renegotiation to\n * MBEDTLS_SSL_RENEGOTIATION_DISABLED.\n *\n * \\note When the configured transport is\n * MBEDTLS_SSL_TRANSPORT_DATAGRAM the maximum renegotiation\n * period is 2^48 - 1, and for MBEDTLS_SSL_TRANSPORT_STREAM,\n * the maximum renegotiation period is 2^64 - 1.\n *\n * \\param conf SSL configuration\n * \\param period The threshold value: a big-endian 64-bit number.\n */\nvoid mbedtls_ssl_conf_renegotiation_period( mbedtls_ssl_config *conf,\n const unsigned char period[8] );\n#endif /* MBEDTLS_SSL_RENEGOTIATION */", "/**\n * \\brief Return the number of data bytes available to read\n *\n * \\param ssl SSL context\n *\n * \\return how many bytes are available in the read buffer\n */\nsize_t mbedtls_ssl_get_bytes_avail( const mbedtls_ssl_context *ssl );", "/**\n * \\brief Return the result of the certificate verification\n *\n * \\param ssl SSL context\n *\n * \\return 0 if successful,\n * -1 if result is not available (eg because the handshake was\n * aborted too early), or\n * a combination of BADCERT_xxx and BADCRL_xxx flags, see\n * x509.h\n */\nuint32_t mbedtls_ssl_get_verify_result( const mbedtls_ssl_context *ssl );", "/**\n * \\brief Return the name of the current ciphersuite\n *\n * \\param ssl SSL context\n *\n * \\return a string containing the ciphersuite name\n */\nconst char *mbedtls_ssl_get_ciphersuite( const mbedtls_ssl_context *ssl );", "/**\n * \\brief Return the current SSL version (SSLv3/TLSv1/etc)\n *\n * \\param ssl SSL context\n *\n * \\return a string containing the SSL version\n */\nconst char *mbedtls_ssl_get_version( const mbedtls_ssl_context *ssl );", "/**\n * \\brief Return the (maximum) number of bytes added by the record\n * layer: header + encryption/MAC overhead (inc. padding)\n *\n * \\param ssl SSL context\n *\n * \\return Current maximum record expansion in bytes, or\n * MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE if compression is\n * enabled, which makes expansion much less predictable\n */\nint mbedtls_ssl_get_record_expansion( const mbedtls_ssl_context *ssl );", "#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)\n/**\n * \\brief Return the maximum fragment length (payload, in bytes).\n * This is the value negotiated with peer if any,\n * or the locally configured value.\n *\n * \\note With DTLS, \\c mbedtls_ssl_write() will return an error if\n * called with a larger length value.\n * With TLS, \\c mbedtls_ssl_write() will fragment the input if\n * necessary and return the number of bytes written; it is up\n * to the caller to call \\c mbedtls_ssl_write() again in\n * order to send the remaining bytes if any.\n *\n * \\param ssl SSL context\n *\n * \\return Current maximum fragment length.\n */\nsize_t mbedtls_ssl_get_max_frag_len( const mbedtls_ssl_context *ssl );\n#endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n/**\n * \\brief Return the peer certificate from the current connection\n *\n * Note: Can be NULL in case no certificate was sent during\n * the handshake. Different calls for the same connection can\n * return the same or different pointers for the same\n * certificate and even a different certificate altogether.\n * The peer cert CAN change in a single connection if\n * renegotiation is performed.\n *\n * \\param ssl SSL context\n *\n * \\return the current peer certificate\n */\nconst mbedtls_x509_crt *mbedtls_ssl_get_peer_cert( const mbedtls_ssl_context *ssl );\n#endif /* MBEDTLS_X509_CRT_PARSE_C */", "#if defined(MBEDTLS_SSL_CLI_C)\n/**\n * \\brief Save session in order to resume it later (client-side only)\n * Session data is copied to presented session structure.\n *\n * \\warning Currently, peer certificate is lost in the operation.\n *\n * \\param ssl SSL context\n * \\param session session context\n *\n * \\return 0 if successful,\n * MBEDTLS_ERR_SSL_ALLOC_FAILED if memory allocation failed,\n * MBEDTLS_ERR_SSL_BAD_INPUT_DATA if used server-side or\n * arguments are otherwise invalid\n *\n * \\sa mbedtls_ssl_set_session()\n */\nint mbedtls_ssl_get_session( const mbedtls_ssl_context *ssl, mbedtls_ssl_session *session );\n#endif /* MBEDTLS_SSL_CLI_C */", "/**\n * \\brief Perform the SSL handshake\n *\n * \\param ssl SSL context\n *\n * \\return 0 if successful, or\n * MBEDTLS_ERR_SSL_WANT_READ or MBEDTLS_ERR_SSL_WANT_WRITE, or\n * MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED (see below), or\n * a specific SSL error code.\n *\n * \\note If this function returns something other than 0 or\n * MBEDTLS_ERR_SSL_WANT_READ/WRITE, then the ssl context\n * becomes unusable, and you should either free it or call\n * \\c mbedtls_ssl_session_reset() on it before re-using it for\n * a new connection; the current connection must be closed.\n *\n * \\note If DTLS is in use, then you may choose to handle\n * MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED specially for logging\n * purposes, as it is an expected return value rather than an\n * actual error, but you still need to reset/free the context.\n */\nint mbedtls_ssl_handshake( mbedtls_ssl_context *ssl );", "/**\n * \\brief Perform a single step of the SSL handshake\n *\n * \\note The state of the context (ssl->state) will be at\n * the next state after execution of this function. Do not\n * call this function if state is MBEDTLS_SSL_HANDSHAKE_OVER.\n *\n * \\note If this function returns something other than 0 or\n * MBEDTLS_ERR_SSL_WANT_READ/WRITE, then the ssl context\n * becomes unusable, and you should either free it or call\n * \\c mbedtls_ssl_session_reset() on it before re-using it for\n * a new connection; the current connection must be closed.\n *\n * \\param ssl SSL context\n *\n * \\return 0 if successful, or\n * MBEDTLS_ERR_SSL_WANT_READ or MBEDTLS_ERR_SSL_WANT_WRITE, or\n * a specific SSL error code.\n */\nint mbedtls_ssl_handshake_step( mbedtls_ssl_context *ssl );", "#if defined(MBEDTLS_SSL_RENEGOTIATION)\n/**\n * \\brief Initiate an SSL renegotiation on the running connection.\n * Client: perform the renegotiation right now.\n * Server: request renegotiation, which will be performed\n * during the next call to mbedtls_ssl_read() if honored by\n * client.\n *\n * \\param ssl SSL context\n *\n * \\return 0 if successful, or any mbedtls_ssl_handshake() return\n * value.\n *\n * \\note If this function returns something other than 0 or\n * MBEDTLS_ERR_SSL_WANT_READ/WRITE, then the ssl context\n * becomes unusable, and you should either free it or call\n * \\c mbedtls_ssl_session_reset() on it before re-using it for\n * a new connection; the current connection must be closed.\n */\nint mbedtls_ssl_renegotiate( mbedtls_ssl_context *ssl );\n#endif /* MBEDTLS_SSL_RENEGOTIATION */", "/**\n * \\brief Read at most 'len' application data bytes\n *\n * \\param ssl SSL context\n * \\param buf buffer that will hold the data\n * \\param len maximum number of bytes to read\n *\n * \\return the number of bytes read, or\n * 0 for EOF, or\n * MBEDTLS_ERR_SSL_WANT_READ or MBEDTLS_ERR_SSL_WANT_WRITE, or\n * MBEDTLS_ERR_SSL_CLIENT_RECONNECT (see below), or\n * another negative error code.\n *\n * \\note If this function returns something other than a positive\n * value or MBEDTLS_ERR_SSL_WANT_READ/WRITE or\n * MBEDTLS_ERR_SSL_CLIENT_RECONNECT, then the ssl context\n * becomes unusable, and you should either free it or call\n * \\c mbedtls_ssl_session_reset() on it before re-using it for\n * a new connection; the current connection must be closed.\n *\n * \\note When this function return MBEDTLS_ERR_SSL_CLIENT_RECONNECT\n * (which can only happen server-side), it means that a client\n * is initiating a new connection using the same source port.\n * You can either treat that as a connection close and wait\n * for the client to resend a ClientHello, or directly\n * continue with \\c mbedtls_ssl_handshake() with the same\n * context (as it has beeen reset internally). Either way, you\n * should make sure this is seen by the application as a new\n * connection: application state, if any, should be reset, and\n * most importantly the identity of the client must be checked\n * again. WARNING: not validating the identity of the client\n * again, or not transmitting the new identity to the\n * application layer, would allow authentication bypass!\n */\nint mbedtls_ssl_read( mbedtls_ssl_context *ssl, unsigned char *buf, size_t len );", "/**\n * \\brief Try to write exactly 'len' application data bytes\n *\n * \\warning This function will do partial writes in some cases. If the\n * return value is non-negative but less than length, the\n * function must be called again with updated arguments:\n * buf + ret, len - ret (if ret is the return value) until\n * it returns a value equal to the last 'len' argument.\n *\n * \\param ssl SSL context\n * \\param buf buffer holding the data\n * \\param len how many bytes must be written\n *\n * \\return the number of bytes actually written (may be less than len),\n * or MBEDTLS_ERR_SSL_WANT_WRITE or MBEDTLS_ERR_SSL_WANT_READ,\n * or another negative error code.\n *\n * \\note If this function returns something other than a positive\n * value or MBEDTLS_ERR_SSL_WANT_READ/WRITE, the ssl context\n * becomes unusable, and you should either free it or call\n * \\c mbedtls_ssl_session_reset() on it before re-using it for\n * a new connection; the current connection must be closed.\n *\n * \\note When this function returns MBEDTLS_ERR_SSL_WANT_WRITE/READ,\n * it must be called later with the *same* arguments,\n * until it returns a positive value.\n *\n * \\note If the requested length is greater than the maximum\n * fragment length (either the built-in limit or the one set\n * or negotiated with the peer), then:\n * - with TLS, less bytes than requested are written.\n * - with DTLS, MBEDTLS_ERR_SSL_BAD_INPUT_DATA is returned.\n * \\c mbedtls_ssl_get_max_frag_len() may be used to query the\n * active maximum fragment length.\n */\nint mbedtls_ssl_write( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len );", "/**\n * \\brief Send an alert message\n *\n * \\param ssl SSL context\n * \\param level The alert level of the message\n * (MBEDTLS_SSL_ALERT_LEVEL_WARNING or MBEDTLS_SSL_ALERT_LEVEL_FATAL)\n * \\param message The alert message (SSL_ALERT_MSG_*)\n *\n * \\return 0 if successful, or a specific SSL error code.\n *\n * \\note If this function returns something other than 0 or\n * MBEDTLS_ERR_SSL_WANT_READ/WRITE, then the ssl context\n * becomes unusable, and you should either free it or call\n * \\c mbedtls_ssl_session_reset() on it before re-using it for\n * a new connection; the current connection must be closed.\n */\nint mbedtls_ssl_send_alert_message( mbedtls_ssl_context *ssl,\n unsigned char level,\n unsigned char message );\n/**\n * \\brief Notify the peer that the connection is being closed\n *\n * \\param ssl SSL context\n *\n * \\return 0 if successful, or a specific SSL error code.\n *\n * \\note If this function returns something other than 0 or\n * MBEDTLS_ERR_SSL_WANT_READ/WRITE, then the ssl context\n * becomes unusable, and you should either free it or call\n * \\c mbedtls_ssl_session_reset() on it before re-using it for\n * a new connection; the current connection must be closed.\n */\nint mbedtls_ssl_close_notify( mbedtls_ssl_context *ssl );", "/**\n * \\brief Free referenced items in an SSL context and clear memory\n *\n * \\param ssl SSL context\n */\nvoid mbedtls_ssl_free( mbedtls_ssl_context *ssl );", "/**\n * \\brief Initialize an SSL configuration context\n * Just makes the context ready for\n * mbedtls_ssl_config_defaults() or mbedtls_ssl_config_free().\n *\n * \\note You need to call mbedtls_ssl_config_defaults() unless you\n * manually set all of the relevent fields yourself.\n *\n * \\param conf SSL configuration context\n */\nvoid mbedtls_ssl_config_init( mbedtls_ssl_config *conf );", "/**\n * \\brief Load reasonnable default SSL configuration values.\n * (You need to call mbedtls_ssl_config_init() first.)\n *\n * \\param conf SSL configuration context\n * \\param endpoint MBEDTLS_SSL_IS_CLIENT or MBEDTLS_SSL_IS_SERVER\n * \\param transport MBEDTLS_SSL_TRANSPORT_STREAM for TLS, or\n * MBEDTLS_SSL_TRANSPORT_DATAGRAM for DTLS\n * \\param preset a MBEDTLS_SSL_PRESET_XXX value\n *\n * \\note See \\c mbedtls_ssl_conf_transport() for notes on DTLS.\n *\n * \\return 0 if successful, or\n * MBEDTLS_ERR_XXX_ALLOC_FAILED on memory allocation error.\n */\nint mbedtls_ssl_config_defaults( mbedtls_ssl_config *conf,\n int endpoint, int transport, int preset );", "/**\n * \\brief Free an SSL configuration context\n *\n * \\param conf SSL configuration context\n */\nvoid mbedtls_ssl_config_free( mbedtls_ssl_config *conf );", "/**\n * \\brief Initialize SSL session structure\n *\n * \\param session SSL session\n */\nvoid mbedtls_ssl_session_init( mbedtls_ssl_session *session );", "/**\n * \\brief Free referenced items in an SSL session including the\n * peer certificate and clear memory\n *\n * \\param session SSL session\n */\nvoid mbedtls_ssl_session_free( mbedtls_ssl_session *session );", "#ifdef __cplusplus\n}\n#endif", "#endif /* ssl.h */" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [8, 75, 1056, 78, 271, 482, 2312, 1208], "buggy_code_start_loc": [8, 74, 1055, 78, 270, 482, 2060, 1207], "filenames": ["ChangeLog", "include/mbedtls/error.h", "include/mbedtls/ssl.h", "include/mbedtls/x509.h", "include/mbedtls/x509_crt.h", "library/error.c", "library/x509_crt.c", "tests/suites/test_suite_x509parse.data"], "fixing_code_end_loc": [12, 75, 1056, 80, 277, 485, 2317, 1208], "fixing_code_start_loc": [9, 74, 1055, 79, 270, 483, 2060, 1207], "message": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.10:*:*:*:*:*:*:*", "matchCriteriaId": "28621156-2430-447B-8816-47B0FB58245B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.11:*:*:*:*:*:*:*", "matchCriteriaId": "E11BBB2C-0423-47B1-AE12-EB849E17BAF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.12:*:*:*:*:*:*:*", "matchCriteriaId": "4131CE76-6260-412C-A6A6-20B0E978E569", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.13:*:*:*:*:*:*:*", "matchCriteriaId": "DE92D8F7-5705-47B6-B2C2-9DE6C7880647", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.14:*:*:*:*:*:*:*", "matchCriteriaId": "EA50C256-2054-4661-9C42-D31D7D87BAF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.15:*:*:*:*:*:*:*", "matchCriteriaId": "7791D4E9-3FEE-42DA-B320-CF7188A10294", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.16:*:*:*:*:*:*:*", "matchCriteriaId": "BE415DAA-A89F-4204-AC2C-577FCB447E4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.17:*:*:*:*:*:*:*", "matchCriteriaId": "95F691DB-9552-4EBB-B29D-16658561FA4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.18:*:*:*:*:*:*:*", "matchCriteriaId": "F1547B2A-E0D5-41D1-9449-1CCF35022B0E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.19:*:*:*:*:*:*:*", "matchCriteriaId": "CF762122-64BC-4A1A-A26D-81C1270541A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.20:*:*:*:*:*:*:*", "matchCriteriaId": "59D6B559-5F99-4E38-A861-3AB8A7D2E6BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.21:*:*:*:*:*:*:*", "matchCriteriaId": "4A8956C8-6CF0-4C37-84F9-8A89726806C3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "0B395D81-876F-43FC-8DB9-44377647A37A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F92622F1-82DA-4819-8275-06DC9DBE1BA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5871FDE9-02D0-466C-BDB7-90A14C4F637E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE6B4875-3FC3-499F-A76B-2D04982F743A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "B3B67842-5AFA-459F-9CCF-772B9DC7139F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "AD0500EE-52C0-4896-B3D8-5BE731D66039", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "015739E9-C0E3-4A62-BB9D-FA836BFD4351", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "842B0D15-6A3D-4CEE-AD02-49B0436E78E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "3CF6E05C-E6E5-40B8-AFEA-A5ED937F5439", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "D4133C86-70E0-44FD-BBDB-D61EFB31F027", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "6F9D24F0-3892-417F-9C3A-CACEF00C2293", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "8911513E-968C-403E-9D00-2DC0AA82F99B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "48D98945-82BB-4954-AA6D-7D98E4CE1154", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "6378C1CC-7C8F-47E3-A1A7-CDEC76E4CBE4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "525190A3-2194-4E4E-9D34-0048583B9C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "70407352-624A-40E6-82E4-7B4FAFE0C0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "DD52988E-4B2F-41AF-BC25-F38F87D9B8C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "FD1F7803-31F3-40A9-A878-FDC757FCE83F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected."}, {"lang": "es", "value": "ARM mbed TLS en versiones anteriores a la 1.3.21 y en versiones 2.x anteriores a la 2.1.9, si se configura la autenticaci\u00f3n opcional, permite a los atacantes omitir la autenticaci\u00f3n Peer mediante una cadena de certificados X.509 con muchos intermediarios. NOTA: aunque mbed TLS se conoc\u00eda antes como PolarSSL, las versiones lanzadas con el nombre PolarSSL no est\u00e1n afectadas."}], "evaluatorComment": null, "id": "CVE-2017-14032", "lastModified": "2017-11-08T02:29:02.850", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-08-30T20:29:00.337", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.debian.org/security/2017/dsa-3967"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugs.debian.org/873557"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/d15795acd5074e0b44e71f7ede8bdfe1b48591fc"}, {"source": "cve@mitre.org", "tags": ["Vendor Advisory"], "url": "https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2017-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, "type": "CWE-287"}
351
Determine whether the {function_name} code is vulnerable or not.
[ "/**\n * \\file ssl.h\n *\n * \\brief SSL/TLS functions.\n *\n * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved\n * SPDX-License-Identifier: Apache-2.0\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n * not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is part of mbed TLS (https://tls.mbed.org)\n */\n#ifndef MBEDTLS_SSL_H\n#define MBEDTLS_SSL_H", "#if !defined(MBEDTLS_CONFIG_FILE)\n#include \"config.h\"\n#else\n#include MBEDTLS_CONFIG_FILE\n#endif", "#include \"bignum.h\"\n#include \"ecp.h\"", "#include \"ssl_ciphersuites.h\"", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n#include \"x509_crt.h\"\n#include \"x509_crl.h\"\n#endif", "#if defined(MBEDTLS_DHM_C)\n#include \"dhm.h\"\n#endif", "#if defined(MBEDTLS_ECDH_C)\n#include \"ecdh.h\"\n#endif", "#if defined(MBEDTLS_ZLIB_SUPPORT)\n#include \"zlib.h\"\n#endif", "#if defined(MBEDTLS_HAVE_TIME)\n#include \"mbedtls/platform_time.h\"\n#endif", "/*\n * SSL Error codes\n */\n#define MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE -0x7080 /**< The requested feature is not available. */\n#define MBEDTLS_ERR_SSL_BAD_INPUT_DATA -0x7100 /**< Bad input parameters to function. */\n#define MBEDTLS_ERR_SSL_INVALID_MAC -0x7180 /**< Verification of the message MAC failed. */\n#define MBEDTLS_ERR_SSL_INVALID_RECORD -0x7200 /**< An invalid SSL record was received. */\n#define MBEDTLS_ERR_SSL_CONN_EOF -0x7280 /**< The connection indicated an EOF. */\n#define MBEDTLS_ERR_SSL_UNKNOWN_CIPHER -0x7300 /**< An unknown cipher was received. */\n#define MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN -0x7380 /**< The server has no ciphersuites in common with the client. */\n#define MBEDTLS_ERR_SSL_NO_RNG -0x7400 /**< No RNG was provided to the SSL module. */\n#define MBEDTLS_ERR_SSL_NO_CLIENT_CERTIFICATE -0x7480 /**< No client certification received from the client, but required by the authentication mode. */\n#define MBEDTLS_ERR_SSL_CERTIFICATE_TOO_LARGE -0x7500 /**< Our own certificate(s) is/are too large to send in an SSL message. */\n#define MBEDTLS_ERR_SSL_CERTIFICATE_REQUIRED -0x7580 /**< The own certificate is not set, but needed by the server. */\n#define MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED -0x7600 /**< The own private key or pre-shared key is not set, but needed. */\n#define MBEDTLS_ERR_SSL_CA_CHAIN_REQUIRED -0x7680 /**< No CA Chain is set, but required to operate. */\n#define MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE -0x7700 /**< An unexpected message was received from our peer. */\n#define MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE -0x7780 /**< A fatal alert message was received from our peer. */\n#define MBEDTLS_ERR_SSL_PEER_VERIFY_FAILED -0x7800 /**< Verification of our peer failed. */\n#define MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY -0x7880 /**< The peer notified us that the connection is going to be closed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_HELLO -0x7900 /**< Processing of the ClientHello handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO -0x7980 /**< Processing of the ServerHello handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE -0x7A00 /**< Processing of the Certificate handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST -0x7A80 /**< Processing of the CertificateRequest handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE -0x7B00 /**< Processing of the ServerKeyExchange handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO_DONE -0x7B80 /**< Processing of the ServerHelloDone handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE -0x7C00 /**< Processing of the ClientKeyExchange handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_RP -0x7C80 /**< Processing of the ClientKeyExchange handshake message failed in DHM / ECDH Read Public. */\n#define MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_CS -0x7D00 /**< Processing of the ClientKeyExchange handshake message failed in DHM / ECDH Calculate Secret. */\n#define MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY -0x7D80 /**< Processing of the CertificateVerify handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC -0x7E00 /**< Processing of the ChangeCipherSpec handshake message failed. */\n#define MBEDTLS_ERR_SSL_BAD_HS_FINISHED -0x7E80 /**< Processing of the Finished handshake message failed. */\n#define MBEDTLS_ERR_SSL_ALLOC_FAILED -0x7F00 /**< Memory allocation failed */\n#define MBEDTLS_ERR_SSL_HW_ACCEL_FAILED -0x7F80 /**< Hardware acceleration function returned with error */\n#define MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH -0x6F80 /**< Hardware acceleration function skipped / left alone data */\n#define MBEDTLS_ERR_SSL_COMPRESSION_FAILED -0x6F00 /**< Processing of the compression / decompression failed */\n#define MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION -0x6E80 /**< Handshake protocol not within min/max boundaries */\n#define MBEDTLS_ERR_SSL_BAD_HS_NEW_SESSION_TICKET -0x6E00 /**< Processing of the NewSessionTicket handshake message failed. */\n#define MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED -0x6D80 /**< Session ticket has expired. */\n#define MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH -0x6D00 /**< Public key type mismatch (eg, asked for RSA key exchange and presented EC key) */\n#define MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY -0x6C80 /**< Unknown identity received (eg, PSK identity) */\n#define MBEDTLS_ERR_SSL_INTERNAL_ERROR -0x6C00 /**< Internal error (eg, unexpected failure in lower-level module) */\n#define MBEDTLS_ERR_SSL_COUNTER_WRAPPING -0x6B80 /**< A counter would wrap (eg, too many messages exchanged). */\n#define MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO -0x6B00 /**< Unexpected message at ServerHello in renegotiation. */\n#define MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED -0x6A80 /**< DTLS client must retry for hello verification */\n#define MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL -0x6A00 /**< A buffer is too small to receive or write a message */\n#define MBEDTLS_ERR_SSL_NO_USABLE_CIPHERSUITE -0x6980 /**< None of the common ciphersuites is usable (eg, no suitable certificate, see debug messages). */\n#define MBEDTLS_ERR_SSL_WANT_READ -0x6900 /**< Connection requires a read call. */\n#define MBEDTLS_ERR_SSL_WANT_WRITE -0x6880 /**< Connection requires a write call. */\n#define MBEDTLS_ERR_SSL_TIMEOUT -0x6800 /**< The operation timed out. */\n#define MBEDTLS_ERR_SSL_CLIENT_RECONNECT -0x6780 /**< The client initiated a reconnect from the same port. */\n#define MBEDTLS_ERR_SSL_UNEXPECTED_RECORD -0x6700 /**< Record header looks valid but is not expected. */\n#define MBEDTLS_ERR_SSL_NON_FATAL -0x6680 /**< The alert message received indicates a non-fatal error. */\n#define MBEDTLS_ERR_SSL_INVALID_VERIFY_HASH -0x6600 /**< Couldn't set the hash for verifying CertificateVerify */", "/*\n * Various constants\n */\n#define MBEDTLS_SSL_MAJOR_VERSION_3 3\n#define MBEDTLS_SSL_MINOR_VERSION_0 0 /*!< SSL v3.0 */\n#define MBEDTLS_SSL_MINOR_VERSION_1 1 /*!< TLS v1.0 */\n#define MBEDTLS_SSL_MINOR_VERSION_2 2 /*!< TLS v1.1 */\n#define MBEDTLS_SSL_MINOR_VERSION_3 3 /*!< TLS v1.2 */", "#define MBEDTLS_SSL_TRANSPORT_STREAM 0 /*!< TLS */\n#define MBEDTLS_SSL_TRANSPORT_DATAGRAM 1 /*!< DTLS */", "#define MBEDTLS_SSL_MAX_HOST_NAME_LEN 255 /*!< Maximum host name defined in RFC 1035 */", "/* RFC 6066 section 4, see also mfl_code_to_length in ssl_tls.c\n * NONE must be zero so that memset()ing structure to zero works */\n#define MBEDTLS_SSL_MAX_FRAG_LEN_NONE 0 /*!< don't use this extension */\n#define MBEDTLS_SSL_MAX_FRAG_LEN_512 1 /*!< MaxFragmentLength 2^9 */\n#define MBEDTLS_SSL_MAX_FRAG_LEN_1024 2 /*!< MaxFragmentLength 2^10 */\n#define MBEDTLS_SSL_MAX_FRAG_LEN_2048 3 /*!< MaxFragmentLength 2^11 */\n#define MBEDTLS_SSL_MAX_FRAG_LEN_4096 4 /*!< MaxFragmentLength 2^12 */\n#define MBEDTLS_SSL_MAX_FRAG_LEN_INVALID 5 /*!< first invalid value */", "#define MBEDTLS_SSL_IS_CLIENT 0\n#define MBEDTLS_SSL_IS_SERVER 1", "#define MBEDTLS_SSL_IS_NOT_FALLBACK 0\n#define MBEDTLS_SSL_IS_FALLBACK 1", "#define MBEDTLS_SSL_EXTENDED_MS_DISABLED 0\n#define MBEDTLS_SSL_EXTENDED_MS_ENABLED 1", "#define MBEDTLS_SSL_ETM_DISABLED 0\n#define MBEDTLS_SSL_ETM_ENABLED 1", "#define MBEDTLS_SSL_COMPRESS_NULL 0\n#define MBEDTLS_SSL_COMPRESS_DEFLATE 1", "#define MBEDTLS_SSL_VERIFY_NONE 0\n#define MBEDTLS_SSL_VERIFY_OPTIONAL 1\n#define MBEDTLS_SSL_VERIFY_REQUIRED 2\n#define MBEDTLS_SSL_VERIFY_UNSET 3 /* Used only for sni_authmode */", "#define MBEDTLS_SSL_LEGACY_RENEGOTIATION 0\n#define MBEDTLS_SSL_SECURE_RENEGOTIATION 1", "#define MBEDTLS_SSL_RENEGOTIATION_DISABLED 0\n#define MBEDTLS_SSL_RENEGOTIATION_ENABLED 1", "#define MBEDTLS_SSL_ANTI_REPLAY_DISABLED 0\n#define MBEDTLS_SSL_ANTI_REPLAY_ENABLED 1", "#define MBEDTLS_SSL_RENEGOTIATION_NOT_ENFORCED -1\n#define MBEDTLS_SSL_RENEGO_MAX_RECORDS_DEFAULT 16", "#define MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION 0\n#define MBEDTLS_SSL_LEGACY_ALLOW_RENEGOTIATION 1\n#define MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE 2", "#define MBEDTLS_SSL_TRUNC_HMAC_DISABLED 0\n#define MBEDTLS_SSL_TRUNC_HMAC_ENABLED 1\n#define MBEDTLS_SSL_TRUNCATED_HMAC_LEN 10 /* 80 bits, rfc 6066 section 7 */", "#define MBEDTLS_SSL_SESSION_TICKETS_DISABLED 0\n#define MBEDTLS_SSL_SESSION_TICKETS_ENABLED 1", "#define MBEDTLS_SSL_CBC_RECORD_SPLITTING_DISABLED 0\n#define MBEDTLS_SSL_CBC_RECORD_SPLITTING_ENABLED 1", "#define MBEDTLS_SSL_ARC4_ENABLED 0\n#define MBEDTLS_SSL_ARC4_DISABLED 1", "#define MBEDTLS_SSL_PRESET_DEFAULT 0\n#define MBEDTLS_SSL_PRESET_SUITEB 2", "#define MBEDTLS_SSL_CERT_REQ_CA_LIST_ENABLED 1\n#define MBEDTLS_SSL_CERT_REQ_CA_LIST_DISABLED 0", "/*\n * Default range for DTLS retransmission timer value, in milliseconds.\n * RFC 6347 4.2.4.1 says from 1 second to 60 seconds.\n */\n#define MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MIN 1000\n#define MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MAX 60000", "/**\n * \\name SECTION: Module settings\n *\n * The configuration options you can set for this module are in this section.\n * Either change them in config.h or define them on the compiler command line.\n * \\{\n */", "#if !defined(MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME)\n#define MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME 86400 /**< Lifetime of session tickets (if enabled) */\n#endif", "/*\n * Maxium fragment length in bytes,\n * determines the size of each of the two internal I/O buffers.\n *\n * Note: the RFC defines the default size of SSL / TLS messages. If you\n * change the value here, other clients / servers may not be able to\n * communicate with you anymore. Only change this value if you control\n * both sides of the connection and have it reduced at both sides, or\n * if you're using the Max Fragment Length extension and you know all your\n * peers are using it too!\n */\n#if !defined(MBEDTLS_SSL_MAX_CONTENT_LEN)\n#define MBEDTLS_SSL_MAX_CONTENT_LEN 16384 /**< Size of the input / output buffer */\n#endif", "/* \\} name SECTION: Module settings */", "/*\n * Length of the verify data for secure renegotiation\n */\n#if defined(MBEDTLS_SSL_PROTO_SSL3)\n#define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 36\n#else\n#define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 12\n#endif", "/*\n * Signaling ciphersuite values (SCSV)\n */\n#define MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO 0xFF /**< renegotiation info ext */\n#define MBEDTLS_SSL_FALLBACK_SCSV_VALUE 0x5600 /**< RFC 7507 section 2 */", "/*\n * Supported Signature and Hash algorithms (For TLS 1.2)\n * RFC 5246 section 7.4.1.4.1\n */\n#define MBEDTLS_SSL_HASH_NONE 0\n#define MBEDTLS_SSL_HASH_MD5 1\n#define MBEDTLS_SSL_HASH_SHA1 2\n#define MBEDTLS_SSL_HASH_SHA224 3\n#define MBEDTLS_SSL_HASH_SHA256 4\n#define MBEDTLS_SSL_HASH_SHA384 5\n#define MBEDTLS_SSL_HASH_SHA512 6", "#define MBEDTLS_SSL_SIG_ANON 0\n#define MBEDTLS_SSL_SIG_RSA 1\n#define MBEDTLS_SSL_SIG_ECDSA 3", "/*\n * Client Certificate Types\n * RFC 5246 section 7.4.4 plus RFC 4492 section 5.5\n */\n#define MBEDTLS_SSL_CERT_TYPE_RSA_SIGN 1\n#define MBEDTLS_SSL_CERT_TYPE_ECDSA_SIGN 64", "/*\n * Message, alert and handshake types\n */\n#define MBEDTLS_SSL_MSG_CHANGE_CIPHER_SPEC 20\n#define MBEDTLS_SSL_MSG_ALERT 21\n#define MBEDTLS_SSL_MSG_HANDSHAKE 22\n#define MBEDTLS_SSL_MSG_APPLICATION_DATA 23", "#define MBEDTLS_SSL_ALERT_LEVEL_WARNING 1\n#define MBEDTLS_SSL_ALERT_LEVEL_FATAL 2", "#define MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY 0 /* 0x00 */\n#define MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE 10 /* 0x0A */\n#define MBEDTLS_SSL_ALERT_MSG_BAD_RECORD_MAC 20 /* 0x14 */\n#define MBEDTLS_SSL_ALERT_MSG_DECRYPTION_FAILED 21 /* 0x15 */\n#define MBEDTLS_SSL_ALERT_MSG_RECORD_OVERFLOW 22 /* 0x16 */\n#define MBEDTLS_SSL_ALERT_MSG_DECOMPRESSION_FAILURE 30 /* 0x1E */\n#define MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE 40 /* 0x28 */\n#define MBEDTLS_SSL_ALERT_MSG_NO_CERT 41 /* 0x29 */\n#define MBEDTLS_SSL_ALERT_MSG_BAD_CERT 42 /* 0x2A */\n#define MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_CERT 43 /* 0x2B */\n#define MBEDTLS_SSL_ALERT_MSG_CERT_REVOKED 44 /* 0x2C */\n#define MBEDTLS_SSL_ALERT_MSG_CERT_EXPIRED 45 /* 0x2D */\n#define MBEDTLS_SSL_ALERT_MSG_CERT_UNKNOWN 46 /* 0x2E */\n#define MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER 47 /* 0x2F */\n#define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_CA 48 /* 0x30 */\n#define MBEDTLS_SSL_ALERT_MSG_ACCESS_DENIED 49 /* 0x31 */\n#define MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR 50 /* 0x32 */\n#define MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR 51 /* 0x33 */\n#define MBEDTLS_SSL_ALERT_MSG_EXPORT_RESTRICTION 60 /* 0x3C */\n#define MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION 70 /* 0x46 */\n#define MBEDTLS_SSL_ALERT_MSG_INSUFFICIENT_SECURITY 71 /* 0x47 */\n#define MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR 80 /* 0x50 */\n#define MBEDTLS_SSL_ALERT_MSG_INAPROPRIATE_FALLBACK 86 /* 0x56 */\n#define MBEDTLS_SSL_ALERT_MSG_USER_CANCELED 90 /* 0x5A */\n#define MBEDTLS_SSL_ALERT_MSG_NO_RENEGOTIATION 100 /* 0x64 */\n#define MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_EXT 110 /* 0x6E */\n#define MBEDTLS_SSL_ALERT_MSG_UNRECOGNIZED_NAME 112 /* 0x70 */\n#define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_PSK_IDENTITY 115 /* 0x73 */\n#define MBEDTLS_SSL_ALERT_MSG_NO_APPLICATION_PROTOCOL 120 /* 0x78 */", "#define MBEDTLS_SSL_HS_HELLO_REQUEST 0\n#define MBEDTLS_SSL_HS_CLIENT_HELLO 1\n#define MBEDTLS_SSL_HS_SERVER_HELLO 2\n#define MBEDTLS_SSL_HS_HELLO_VERIFY_REQUEST 3\n#define MBEDTLS_SSL_HS_NEW_SESSION_TICKET 4\n#define MBEDTLS_SSL_HS_CERTIFICATE 11\n#define MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE 12\n#define MBEDTLS_SSL_HS_CERTIFICATE_REQUEST 13\n#define MBEDTLS_SSL_HS_SERVER_HELLO_DONE 14\n#define MBEDTLS_SSL_HS_CERTIFICATE_VERIFY 15\n#define MBEDTLS_SSL_HS_CLIENT_KEY_EXCHANGE 16\n#define MBEDTLS_SSL_HS_FINISHED 20", "/*\n * TLS extensions\n */\n#define MBEDTLS_TLS_EXT_SERVERNAME 0\n#define MBEDTLS_TLS_EXT_SERVERNAME_HOSTNAME 0", "#define MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH 1", "#define MBEDTLS_TLS_EXT_TRUNCATED_HMAC 4", "#define MBEDTLS_TLS_EXT_SUPPORTED_ELLIPTIC_CURVES 10\n#define MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS 11", "#define MBEDTLS_TLS_EXT_SIG_ALG 13", "#define MBEDTLS_TLS_EXT_ALPN 16", "#define MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC 22 /* 0x16 */\n#define MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET 0x0017 /* 23 */", "#define MBEDTLS_TLS_EXT_SESSION_TICKET 35", "#define MBEDTLS_TLS_EXT_ECJPAKE_KKPP 256 /* experimental */", "#define MBEDTLS_TLS_EXT_RENEGOTIATION_INFO 0xFF01", "/*\n * Size defines\n */\n#if !defined(MBEDTLS_PSK_MAX_LEN)\n#define MBEDTLS_PSK_MAX_LEN 32 /* 256 bits */\n#endif", "/* Dummy type used only for its size */\nunion mbedtls_ssl_premaster_secret\n{\n#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)\n unsigned char _pms_rsa[48]; /* RFC 5246 8.1.1 */\n#endif\n#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED)\n unsigned char _pms_dhm[MBEDTLS_MPI_MAX_SIZE]; /* RFC 5246 8.1.2 */\n#endif\n#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)\n unsigned char _pms_ecdh[MBEDTLS_ECP_MAX_BYTES]; /* RFC 4492 5.10 */\n#endif\n#if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED)\n unsigned char _pms_psk[4 + 2 * MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 2 */\n#endif\n#if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)\n unsigned char _pms_dhe_psk[4 + MBEDTLS_MPI_MAX_SIZE\n + MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 3 */\n#endif\n#if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)\n unsigned char _pms_rsa_psk[52 + MBEDTLS_PSK_MAX_LEN]; /* RFC 4279 4 */\n#endif\n#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)\n unsigned char _pms_ecdhe_psk[4 + MBEDTLS_ECP_MAX_BYTES\n + MBEDTLS_PSK_MAX_LEN]; /* RFC 5489 2 */\n#endif\n#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)\n unsigned char _pms_ecjpake[32]; /* Thread spec: SHA-256 output */\n#endif\n};", "#define MBEDTLS_PREMASTER_SIZE sizeof( union mbedtls_ssl_premaster_secret )", "#ifdef __cplusplus\nextern \"C\" {\n#endif", "/*\n * SSL state machine\n */\ntypedef enum\n{\n MBEDTLS_SSL_HELLO_REQUEST,\n MBEDTLS_SSL_CLIENT_HELLO,\n MBEDTLS_SSL_SERVER_HELLO,\n MBEDTLS_SSL_SERVER_CERTIFICATE,\n MBEDTLS_SSL_SERVER_KEY_EXCHANGE,\n MBEDTLS_SSL_CERTIFICATE_REQUEST,\n MBEDTLS_SSL_SERVER_HELLO_DONE,\n MBEDTLS_SSL_CLIENT_CERTIFICATE,\n MBEDTLS_SSL_CLIENT_KEY_EXCHANGE,\n MBEDTLS_SSL_CERTIFICATE_VERIFY,\n MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC,\n MBEDTLS_SSL_CLIENT_FINISHED,\n MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC,\n MBEDTLS_SSL_SERVER_FINISHED,\n MBEDTLS_SSL_FLUSH_BUFFERS,\n MBEDTLS_SSL_HANDSHAKE_WRAPUP,\n MBEDTLS_SSL_HANDSHAKE_OVER,\n MBEDTLS_SSL_SERVER_NEW_SESSION_TICKET,\n MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT,\n}\nmbedtls_ssl_states;", "/**\n * \\brief Callback type: send data on the network.\n *\n * \\note That callback may be either blocking or non-blocking.\n *\n * \\param ctx Context for the send callback (typically a file descriptor)\n * \\param buf Buffer holding the data to send\n * \\param len Length of the data to send\n *\n * \\return The callback must return the number of bytes sent if any,\n * or a non-zero error code.\n * If performing non-blocking I/O, \\c MBEDTLS_ERR_SSL_WANT_WRITE\n * must be returned when the operation would block.\n *\n * \\note The callback is allowed to send fewer bytes than requested.\n * It must always return the number of bytes actually sent.\n */\ntypedef int mbedtls_ssl_send_t( void *ctx,\n const unsigned char *buf,\n size_t len );", "/**\n * \\brief Callback type: receive data from the network.\n *\n * \\note That callback may be either blocking or non-blocking.\n *\n * \\param ctx Context for the receive callback (typically a file\n * descriptor)\n * \\param buf Buffer to write the received data to\n * \\param len Length of the receive buffer\n *\n * \\return The callback must return the number of bytes received,\n * or a non-zero error code.\n * If performing non-blocking I/O, \\c MBEDTLS_ERR_SSL_WANT_READ\n * must be returned when the operation would block.\n *\n * \\note The callback may receive fewer bytes than the length of the\n * buffer. It must always return the number of bytes actually\n * received and written to the buffer.\n */\ntypedef int mbedtls_ssl_recv_t( void *ctx,\n unsigned char *buf,\n size_t len );", "/**\n * \\brief Callback type: receive data from the network, with timeout\n *\n * \\note That callback must block until data is received, or the\n * timeout delay expires, or the operation is interrupted by a\n * signal.\n *\n * \\param ctx Context for the receive callback (typically a file descriptor)\n * \\param buf Buffer to write the received data to\n * \\param len Length of the receive buffer\n * \\param timeout Maximum nomber of millisecondes to wait for data\n * 0 means no timeout (potentially waiting forever)\n *\n * \\return The callback must return the number of bytes received,\n * or a non-zero error code:\n * \\c MBEDTLS_ERR_SSL_TIMEOUT if the operation timed out,\n * \\c MBEDTLS_ERR_SSL_WANT_READ if interrupted by a signal.\n *\n * \\note The callback may receive fewer bytes than the length of the\n * buffer. It must always return the number of bytes actually\n * received and written to the buffer.\n */\ntypedef int mbedtls_ssl_recv_timeout_t( void *ctx,\n unsigned char *buf,\n size_t len,\n uint32_t timeout );\n/**\n * \\brief Callback type: set a pair of timers/delays to watch\n *\n * \\param ctx Context pointer\n * \\param int_ms Intermediate delay in milliseconds\n * \\param fin_ms Final delay in milliseconds\n * 0 cancels the current timer.\n *\n * \\note This callback must at least store the necessary information\n * for the associated \\c mbedtls_ssl_get_timer_t callback to\n * return correct information.\n *\n * \\note If using a event-driven style of programming, an event must\n * be generated when the final delay is passed. The event must\n * cause a call to \\c mbedtls_ssl_handshake() with the proper\n * SSL context to be scheduled. Care must be taken to ensure\n * that at most one such call happens at a time.\n *\n * \\note Only one timer at a time must be running. Calling this\n * function while a timer is running must cancel it. Cancelled\n * timers must not generate any event.\n */\ntypedef void mbedtls_ssl_set_timer_t( void * ctx,\n uint32_t int_ms,\n uint32_t fin_ms );", "/**\n * \\brief Callback type: get status of timers/delays\n *\n * \\param ctx Context pointer\n *\n * \\return This callback must return:\n * -1 if cancelled (fin_ms == 0),\n * 0 if none of the delays have passed,\n * 1 if only the intermediate delay has passed,\n * 2 if the final delay has passed.\n */\ntypedef int mbedtls_ssl_get_timer_t( void * ctx );", "\n/* Defined below */\ntypedef struct mbedtls_ssl_session mbedtls_ssl_session;\ntypedef struct mbedtls_ssl_context mbedtls_ssl_context;\ntypedef struct mbedtls_ssl_config mbedtls_ssl_config;", "/* Defined in ssl_internal.h */\ntypedef struct mbedtls_ssl_transform mbedtls_ssl_transform;\ntypedef struct mbedtls_ssl_handshake_params mbedtls_ssl_handshake_params;\ntypedef struct mbedtls_ssl_sig_hash_set_t mbedtls_ssl_sig_hash_set_t;\n#if defined(MBEDTLS_X509_CRT_PARSE_C)\ntypedef struct mbedtls_ssl_key_cert mbedtls_ssl_key_cert;\n#endif\n#if defined(MBEDTLS_SSL_PROTO_DTLS)\ntypedef struct mbedtls_ssl_flight_item mbedtls_ssl_flight_item;\n#endif", "/*\n * This structure is used for storing current session data.\n */\nstruct mbedtls_ssl_session\n{\n#if defined(MBEDTLS_HAVE_TIME)\n mbedtls_time_t start; /*!< starting time */\n#endif\n int ciphersuite; /*!< chosen ciphersuite */\n int compression; /*!< chosen compression */\n size_t id_len; /*!< session id length */\n unsigned char id[32]; /*!< session identifier */\n unsigned char master[48]; /*!< the master secret */", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n mbedtls_x509_crt *peer_cert; /*!< peer X.509 cert chain */\n#endif /* MBEDTLS_X509_CRT_PARSE_C */\n uint32_t verify_result; /*!< verification result */", "#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)\n unsigned char *ticket; /*!< RFC 5077 session ticket */\n size_t ticket_len; /*!< session ticket length */\n uint32_t ticket_lifetime; /*!< ticket lifetime hint */\n#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_CLI_C */", "#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)\n unsigned char mfl_code; /*!< MaxFragmentLength negotiated by peer */\n#endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */", "#if defined(MBEDTLS_SSL_TRUNCATED_HMAC)\n int trunc_hmac; /*!< flag for truncated hmac activation */\n#endif /* MBEDTLS_SSL_TRUNCATED_HMAC */", "#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)\n int encrypt_then_mac; /*!< flag for EtM activation */\n#endif\n};", "/**\n * SSL/TLS configuration to be shared between mbedtls_ssl_context structures.\n */\nstruct mbedtls_ssl_config\n{\n /* Group items by size (largest first) to minimize padding overhead */", " /*\n * Pointers\n */", " const int *ciphersuite_list[4]; /*!< allowed ciphersuites per version */", " /** Callback for printing debug output */\n void (*f_dbg)(void *, int, const char *, int, const char *);\n void *p_dbg; /*!< context for the debug function */", " /** Callback for getting (pseudo-)random numbers */\n int (*f_rng)(void *, unsigned char *, size_t);\n void *p_rng; /*!< context for the RNG function */", " /** Callback to retrieve a session from the cache */\n int (*f_get_cache)(void *, mbedtls_ssl_session *);\n /** Callback to store a session into the cache */\n int (*f_set_cache)(void *, const mbedtls_ssl_session *);\n void *p_cache; /*!< context for cache callbacks */", "#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)\n /** Callback for setting cert according to SNI extension */\n int (*f_sni)(void *, mbedtls_ssl_context *, const unsigned char *, size_t);\n void *p_sni; /*!< context for SNI callback */\n#endif", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n /** Callback to customize X.509 certificate chain verification */\n int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *);\n void *p_vrfy; /*!< context for X.509 verify calllback */\n#endif", "#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)\n /** Callback to retrieve PSK key from identity */\n int (*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *, size_t);\n void *p_psk; /*!< context for PSK callback */\n#endif", "#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)\n /** Callback to create & write a cookie for ClientHello veirifcation */\n int (*f_cookie_write)( void *, unsigned char **, unsigned char *,\n const unsigned char *, size_t );\n /** Callback to verify validity of a ClientHello cookie */\n int (*f_cookie_check)( void *, const unsigned char *, size_t,\n const unsigned char *, size_t );\n void *p_cookie; /*!< context for the cookie callbacks */\n#endif", "#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C)\n /** Callback to create & write a session ticket */\n int (*f_ticket_write)( void *, const mbedtls_ssl_session *,\n unsigned char *, const unsigned char *, size_t *, uint32_t * );\n /** Callback to parse a session ticket into a session structure */\n int (*f_ticket_parse)( void *, mbedtls_ssl_session *, unsigned char *, size_t);\n void *p_ticket; /*!< context for the ticket callbacks */\n#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_SRV_C */", "#if defined(MBEDTLS_SSL_EXPORT_KEYS)\n /** Callback to export key block and master secret */\n int (*f_export_keys)( void *, const unsigned char *,\n const unsigned char *, size_t, size_t, size_t );\n void *p_export_keys; /*!< context for key export callback */\n#endif", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n const mbedtls_x509_crt_profile *cert_profile; /*!< verification profile */\n mbedtls_ssl_key_cert *key_cert; /*!< own certificate/key pair(s) */\n mbedtls_x509_crt *ca_chain; /*!< trusted CAs */\n mbedtls_x509_crl *ca_crl; /*!< trusted CAs CRLs */\n#endif /* MBEDTLS_X509_CRT_PARSE_C */", "#if defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED)\n const int *sig_hashes; /*!< allowed signature hashes */\n#endif", "#if defined(MBEDTLS_ECP_C)\n const mbedtls_ecp_group_id *curve_list; /*!< allowed curves */\n#endif", "#if defined(MBEDTLS_DHM_C)\n mbedtls_mpi dhm_P; /*!< prime modulus for DHM */\n mbedtls_mpi dhm_G; /*!< generator for DHM */\n#endif", "#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)\n unsigned char *psk; /*!< pre-shared key */\n size_t psk_len; /*!< length of the pre-shared key */\n unsigned char *psk_identity; /*!< identity for PSK negotiation */\n size_t psk_identity_len;/*!< length of identity */\n#endif", "#if defined(MBEDTLS_SSL_ALPN)\n const char **alpn_list; /*!< ordered list of protocols */\n#endif", " /*\n * Numerical settings (int then char)\n */", " uint32_t read_timeout; /*!< timeout for mbedtls_ssl_read (ms) */", "#if defined(MBEDTLS_SSL_PROTO_DTLS)\n uint32_t hs_timeout_min; /*!< initial value of the handshake\n retransmission timeout (ms) */\n uint32_t hs_timeout_max; /*!< maximum value of the handshake\n retransmission timeout (ms) */\n#endif", "#if defined(MBEDTLS_SSL_RENEGOTIATION)\n int renego_max_records; /*!< grace period for renegotiation */\n unsigned char renego_period[8]; /*!< value of the record counters\n that triggers renegotiation */\n#endif", "#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)\n unsigned int badmac_limit; /*!< limit of records with a bad MAC */\n#endif", "#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)\n unsigned int dhm_min_bitlen; /*!< min. bit length of the DHM prime */\n#endif", " unsigned char max_major_ver; /*!< max. major version used */\n unsigned char max_minor_ver; /*!< max. minor version used */\n unsigned char min_major_ver; /*!< min. major version used */\n unsigned char min_minor_ver; /*!< min. minor version used */", " /*\n * Flags (bitfields)\n */", " unsigned int endpoint : 1; /*!< 0: client, 1: server */\n unsigned int transport : 1; /*!< stream (TLS) or datagram (DTLS) */\n unsigned int authmode : 2; /*!< MBEDTLS_SSL_VERIFY_XXX */\n /* needed even with renego disabled for LEGACY_BREAK_HANDSHAKE */\n unsigned int allow_legacy_renegotiation : 2 ; /*!< MBEDTLS_LEGACY_XXX */\n#if defined(MBEDTLS_ARC4_C)\n unsigned int arc4_disabled : 1; /*!< blacklist RC4 ciphersuites? */\n#endif\n#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)\n unsigned int mfl_code : 3; /*!< desired fragment length */\n#endif\n#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)\n unsigned int encrypt_then_mac : 1 ; /*!< negotiate encrypt-then-mac? */\n#endif\n#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)\n unsigned int extended_ms : 1; /*!< negotiate extended master secret? */\n#endif\n#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)\n unsigned int anti_replay : 1; /*!< detect and prevent replay? */\n#endif\n#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)\n unsigned int cbc_record_splitting : 1; /*!< do cbc record splitting */\n#endif\n#if defined(MBEDTLS_SSL_RENEGOTIATION)\n unsigned int disable_renegotiation : 1; /*!< disable renegotiation? */\n#endif\n#if defined(MBEDTLS_SSL_TRUNCATED_HMAC)\n unsigned int trunc_hmac : 1; /*!< negotiate truncated hmac? */\n#endif\n#if defined(MBEDTLS_SSL_SESSION_TICKETS)\n unsigned int session_tickets : 1; /*!< use session tickets? */\n#endif\n#if defined(MBEDTLS_SSL_FALLBACK_SCSV) && defined(MBEDTLS_SSL_CLI_C)\n unsigned int fallback : 1; /*!< is this a fallback? */\n#endif\n#if defined(MBEDTLS_SSL_SRV_C)\n unsigned int cert_req_ca_list : 1; /*!< enable sending CA list in\n Certificate Request messages? */\n#endif\n};", "\nstruct mbedtls_ssl_context\n{\n const mbedtls_ssl_config *conf; /*!< configuration information */", " /*\n * Miscellaneous\n */\n int state; /*!< SSL handshake: current state */\n#if defined(MBEDTLS_SSL_RENEGOTIATION)\n int renego_status; /*!< Initial, in progress, pending? */\n int renego_records_seen; /*!< Records since renego request, or with DTLS,\n number of retransmissions of request if\n renego_max_records is < 0 */\n#endif", " int major_ver; /*!< equal to MBEDTLS_SSL_MAJOR_VERSION_3 */\n int minor_ver; /*!< either 0 (SSL3) or 1 (TLS1.0) */", "#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)\n unsigned badmac_seen; /*!< records with a bad MAC received */\n#endif", " mbedtls_ssl_send_t *f_send; /*!< Callback for network send */\n mbedtls_ssl_recv_t *f_recv; /*!< Callback for network receive */\n mbedtls_ssl_recv_timeout_t *f_recv_timeout;\n /*!< Callback for network receive with timeout */", " void *p_bio; /*!< context for I/O operations */", " /*\n * Session layer\n */\n mbedtls_ssl_session *session_in; /*!< current session data (in) */\n mbedtls_ssl_session *session_out; /*!< current session data (out) */\n mbedtls_ssl_session *session; /*!< negotiated session data */\n mbedtls_ssl_session *session_negotiate; /*!< session data in negotiation */", " mbedtls_ssl_handshake_params *handshake; /*!< params required only during\n the handshake process */", " /*\n * Record layer transformations\n */\n mbedtls_ssl_transform *transform_in; /*!< current transform params (in) */\n mbedtls_ssl_transform *transform_out; /*!< current transform params (in) */\n mbedtls_ssl_transform *transform; /*!< negotiated transform params */\n mbedtls_ssl_transform *transform_negotiate; /*!< transform params in negotiation */", " /*\n * Timers\n */\n void *p_timer; /*!< context for the timer callbacks */", " mbedtls_ssl_set_timer_t *f_set_timer; /*!< set timer callback */\n mbedtls_ssl_get_timer_t *f_get_timer; /*!< get timer callback */", " /*\n * Record layer (incoming data)\n */\n unsigned char *in_buf; /*!< input buffer */\n unsigned char *in_ctr; /*!< 64-bit incoming message counter\n TLS: maintained by us\n DTLS: read from peer */\n unsigned char *in_hdr; /*!< start of record header */\n unsigned char *in_len; /*!< two-bytes message length field */\n unsigned char *in_iv; /*!< ivlen-byte IV */\n unsigned char *in_msg; /*!< message contents (in_iv+ivlen) */\n unsigned char *in_offt; /*!< read offset in application data */", " int in_msgtype; /*!< record header: message type */\n size_t in_msglen; /*!< record header: message length */\n size_t in_left; /*!< amount of data read so far */\n#if defined(MBEDTLS_SSL_PROTO_DTLS)\n uint16_t in_epoch; /*!< DTLS epoch for incoming records */\n size_t next_record_offset; /*!< offset of the next record in datagram\n (equal to in_left if none) */\n#endif\n#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)\n uint64_t in_window_top; /*!< last validated record seq_num */\n uint64_t in_window; /*!< bitmask for replay detection */\n#endif", " size_t in_hslen; /*!< current handshake message length,\n including the handshake header */\n int nb_zero; /*!< # of 0-length encrypted messages */", " int keep_current_message; /*!< drop or reuse current message\n on next call to record layer? */", " /*\n * Record layer (outgoing data)\n */\n unsigned char *out_buf; /*!< output buffer */\n unsigned char *out_ctr; /*!< 64-bit outgoing message counter */\n unsigned char *out_hdr; /*!< start of record header */\n unsigned char *out_len; /*!< two-bytes message length field */\n unsigned char *out_iv; /*!< ivlen-byte IV */\n unsigned char *out_msg; /*!< message contents (out_iv+ivlen) */", " int out_msgtype; /*!< record header: message type */\n size_t out_msglen; /*!< record header: message length */\n size_t out_left; /*!< amount of data not yet written */", "#if defined(MBEDTLS_ZLIB_SUPPORT)\n unsigned char *compress_buf; /*!< zlib data buffer */\n#endif\n#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)\n signed char split_done; /*!< current record already splitted? */\n#endif", " /*\n * PKI layer\n */\n int client_auth; /*!< flag for client auth. */", " /*\n * User settings\n */\n#if defined(MBEDTLS_X509_CRT_PARSE_C)\n char *hostname; /*!< expected peer CN for verification\n (and SNI if available) */\n#endif", "#if defined(MBEDTLS_SSL_ALPN)\n const char *alpn_chosen; /*!< negotiated protocol */\n#endif", " /*\n * Information for DTLS hello verify\n */\n#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)\n unsigned char *cli_id; /*!< transport-level ID of the client */\n size_t cli_id_len; /*!< length of cli_id */\n#endif", " /*\n * Secure renegotiation\n */\n /* needed to know when to send extension on server */\n int secure_renegotiation; /*!< does peer support legacy or\n secure renegotiation */\n#if defined(MBEDTLS_SSL_RENEGOTIATION)\n size_t verify_data_len; /*!< length of verify data stored */\n char own_verify_data[MBEDTLS_SSL_VERIFY_DATA_MAX_LEN]; /*!< previous handshake verify data */\n char peer_verify_data[MBEDTLS_SSL_VERIFY_DATA_MAX_LEN]; /*!< previous handshake verify data */\n#endif\n};", "#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)", "#define MBEDTLS_SSL_CHANNEL_OUTBOUND 0\n#define MBEDTLS_SSL_CHANNEL_INBOUND 1", "extern int (*mbedtls_ssl_hw_record_init)(mbedtls_ssl_context *ssl,\n const unsigned char *key_enc, const unsigned char *key_dec,\n size_t keylen,\n const unsigned char *iv_enc, const unsigned char *iv_dec,\n size_t ivlen,\n const unsigned char *mac_enc, const unsigned char *mac_dec,\n size_t maclen);\nextern int (*mbedtls_ssl_hw_record_activate)(mbedtls_ssl_context *ssl, int direction);\nextern int (*mbedtls_ssl_hw_record_reset)(mbedtls_ssl_context *ssl);\nextern int (*mbedtls_ssl_hw_record_write)(mbedtls_ssl_context *ssl);\nextern int (*mbedtls_ssl_hw_record_read)(mbedtls_ssl_context *ssl);\nextern int (*mbedtls_ssl_hw_record_finish)(mbedtls_ssl_context *ssl);\n#endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */", "/**\n * \\brief Returns the list of ciphersuites supported by the SSL/TLS module.\n *\n * \\return a statically allocated array of ciphersuites, the last\n * entry is 0.\n */\nconst int *mbedtls_ssl_list_ciphersuites( void );", "/**\n * \\brief Return the name of the ciphersuite associated with the\n * given ID\n *\n * \\param ciphersuite_id SSL ciphersuite ID\n *\n * \\return a string containing the ciphersuite name\n */\nconst char *mbedtls_ssl_get_ciphersuite_name( const int ciphersuite_id );", "/**\n * \\brief Return the ID of the ciphersuite associated with the\n * given name\n *\n * \\param ciphersuite_name SSL ciphersuite name\n *\n * \\return the ID with the ciphersuite or 0 if not found\n */\nint mbedtls_ssl_get_ciphersuite_id( const char *ciphersuite_name );", "/**\n * \\brief Initialize an SSL context\n * Just makes the context ready for mbedtls_ssl_setup() or\n * mbedtls_ssl_free()\n *\n * \\param ssl SSL context\n */\nvoid mbedtls_ssl_init( mbedtls_ssl_context *ssl );", "/**\n * \\brief Set up an SSL context for use\n *\n * \\note No copy of the configuration context is made, it can be\n * shared by many mbedtls_ssl_context structures.\n *\n * \\warning Modifying the conf structure after it has been used in this\n * function is unsupported!\n *\n * \\param ssl SSL context\n * \\param conf SSL configuration to use\n *\n * \\return 0 if successful, or MBEDTLS_ERR_SSL_ALLOC_FAILED if\n * memory allocation failed\n */\nint mbedtls_ssl_setup( mbedtls_ssl_context *ssl,\n const mbedtls_ssl_config *conf );", "/**\n * \\brief Reset an already initialized SSL context for re-use\n * while retaining application-set variables, function\n * pointers and data.\n *\n * \\param ssl SSL context\n * \\return 0 if successful, or MBEDTLS_ERR_SSL_ALLOC_FAILED,\n MBEDTLS_ERR_SSL_HW_ACCEL_FAILED or\n * MBEDTLS_ERR_SSL_COMPRESSION_FAILED\n */\nint mbedtls_ssl_session_reset( mbedtls_ssl_context *ssl );", "/**\n * \\brief Set the current endpoint type\n *\n * \\param conf SSL configuration\n * \\param endpoint must be MBEDTLS_SSL_IS_CLIENT or MBEDTLS_SSL_IS_SERVER\n */\nvoid mbedtls_ssl_conf_endpoint( mbedtls_ssl_config *conf, int endpoint );", "/**\n * \\brief Set the transport type (TLS or DTLS).\n * Default: TLS\n *\n * \\note For DTLS, you must either provide a recv callback that\n * doesn't block, or one that handles timeouts, see\n * \\c mbedtls_ssl_set_bio(). You also need to provide timer\n * callbacks with \\c mbedtls_ssl_set_timer_cb().\n *\n * \\param conf SSL configuration\n * \\param transport transport type:\n * MBEDTLS_SSL_TRANSPORT_STREAM for TLS,\n * MBEDTLS_SSL_TRANSPORT_DATAGRAM for DTLS.\n */\nvoid mbedtls_ssl_conf_transport( mbedtls_ssl_config *conf, int transport );", "/**\n * \\brief Set the certificate verification mode\n * Default: NONE on server, REQUIRED on client\n *\n * \\param conf SSL configuration\n * \\param authmode can be:\n *\n * MBEDTLS_SSL_VERIFY_NONE: peer certificate is not checked\n * (default on server)\n * (insecure on client)\n *\n * MBEDTLS_SSL_VERIFY_OPTIONAL: peer certificate is checked, however the\n * handshake continues even if verification failed;\n * mbedtls_ssl_get_verify_result() can be called after the\n * handshake is complete.\n *\n * MBEDTLS_SSL_VERIFY_REQUIRED: peer *must* present a valid certificate,\n * handshake is aborted if verification failed.\n * (default on client)\n *\n * \\note On client, MBEDTLS_SSL_VERIFY_REQUIRED is the recommended mode.\n * With MBEDTLS_SSL_VERIFY_OPTIONAL, the user needs to call mbedtls_ssl_get_verify_result() at\n * the right time(s), which may not be obvious, while REQUIRED always perform\n * the verification as soon as possible. For example, REQUIRED was protecting\n * against the \"triple handshake\" attack even before it was found.\n */\nvoid mbedtls_ssl_conf_authmode( mbedtls_ssl_config *conf, int authmode );", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n/**\n * \\brief Set the verification callback (Optional).\n *\n * If set, the verify callback is called for each\n * certificate in the chain. For implementation", " * information, please see \\c mbedtls_x509_crt_verify()", " *\n * \\param conf SSL configuration\n * \\param f_vrfy verification function\n * \\param p_vrfy verification parameter\n */\nvoid mbedtls_ssl_conf_verify( mbedtls_ssl_config *conf,\n int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),\n void *p_vrfy );\n#endif /* MBEDTLS_X509_CRT_PARSE_C */", "/**\n * \\brief Set the random number generator callback\n *\n * \\param conf SSL configuration\n * \\param f_rng RNG function\n * \\param p_rng RNG parameter\n */\nvoid mbedtls_ssl_conf_rng( mbedtls_ssl_config *conf,\n int (*f_rng)(void *, unsigned char *, size_t),\n void *p_rng );", "/**\n * \\brief Set the debug callback\n *\n * The callback has the following argument:\n * void * opaque context for the callback\n * int debug level\n * const char * file name\n * int line number\n * const char * message\n *\n * \\param conf SSL configuration\n * \\param f_dbg debug function\n * \\param p_dbg debug parameter\n */\nvoid mbedtls_ssl_conf_dbg( mbedtls_ssl_config *conf,\n void (*f_dbg)(void *, int, const char *, int, const char *),\n void *p_dbg );", "/**\n * \\brief Set the underlying BIO callbacks for write, read and\n * read-with-timeout.\n *\n * \\param ssl SSL context\n * \\param p_bio parameter (context) shared by BIO callbacks\n * \\param f_send write callback\n * \\param f_recv read callback\n * \\param f_recv_timeout blocking read callback with timeout.\n *\n * \\note One of f_recv or f_recv_timeout can be NULL, in which case\n * the other is used. If both are non-NULL, f_recv_timeout is\n * used and f_recv is ignored (as if it were NULL).\n *\n * \\note The two most common use cases are:\n * - non-blocking I/O, f_recv != NULL, f_recv_timeout == NULL\n * - blocking I/O, f_recv == NULL, f_recv_timout != NULL\n *\n * \\note For DTLS, you need to provide either a non-NULL\n * f_recv_timeout callback, or a f_recv that doesn't block.\n *\n * \\note See the documentations of \\c mbedtls_ssl_sent_t,\n * \\c mbedtls_ssl_recv_t and \\c mbedtls_ssl_recv_timeout_t for\n * the conventions those callbacks must follow.\n *\n * \\note On some platforms, net_sockets.c provides\n * \\c mbedtls_net_send(), \\c mbedtls_net_recv() and\n * \\c mbedtls_net_recv_timeout() that are suitable to be used\n * here.\n */\nvoid mbedtls_ssl_set_bio( mbedtls_ssl_context *ssl,\n void *p_bio,\n mbedtls_ssl_send_t *f_send,\n mbedtls_ssl_recv_t *f_recv,\n mbedtls_ssl_recv_timeout_t *f_recv_timeout );", "/**\n * \\brief Set the timeout period for mbedtls_ssl_read()\n * (Default: no timeout.)\n *\n * \\param conf SSL configuration context\n * \\param timeout Timeout value in milliseconds.\n * Use 0 for no timeout (default).\n *\n * \\note With blocking I/O, this will only work if a non-NULL\n * \\c f_recv_timeout was set with \\c mbedtls_ssl_set_bio().\n * With non-blocking I/O, this will only work if timer\n * callbacks were set with \\c mbedtls_ssl_set_timer_cb().\n *\n * \\note With non-blocking I/O, you may also skip this function\n * altogether and handle timeouts at the application layer.\n */\nvoid mbedtls_ssl_conf_read_timeout( mbedtls_ssl_config *conf, uint32_t timeout );", "/**\n * \\brief Set the timer callbacks (Mandatory for DTLS.)\n *\n * \\param ssl SSL context\n * \\param p_timer parameter (context) shared by timer callbacks\n * \\param f_set_timer set timer callback\n * \\param f_get_timer get timer callback. Must return:\n *\n * \\note See the documentation of \\c mbedtls_ssl_set_timer_t and\n * \\c mbedtls_ssl_get_timer_t for the conventions this pair of\n * callbacks must follow.\n *\n * \\note On some platforms, timing.c provides\n * \\c mbedtls_timing_set_delay() and\n * \\c mbedtls_timing_get_delay() that are suitable for using\n * here, except if using an event-driven style.\n *\n * \\note See also the \"DTLS tutorial\" article in our knowledge base.\n * https://tls.mbed.org/kb/how-to/dtls-tutorial\n */\nvoid mbedtls_ssl_set_timer_cb( mbedtls_ssl_context *ssl,\n void *p_timer,\n mbedtls_ssl_set_timer_t *f_set_timer,\n mbedtls_ssl_get_timer_t *f_get_timer );", "/**\n * \\brief Callback type: generate and write session ticket\n *\n * \\note This describes what a callback implementation should do.\n * This callback should generate an encrypted and\n * authenticated ticket for the session and write it to the\n * output buffer. Here, ticket means the opaque ticket part\n * of the NewSessionTicket structure of RFC 5077.\n *\n * \\param p_ticket Context for the callback\n * \\param session SSL session to be written in the ticket\n * \\param start Start of the output buffer\n * \\param end End of the output buffer\n * \\param tlen On exit, holds the length written\n * \\param lifetime On exit, holds the lifetime of the ticket in seconds\n *\n * \\return 0 if successful, or\n * a specific MBEDTLS_ERR_XXX code.\n */\ntypedef int mbedtls_ssl_ticket_write_t( void *p_ticket,\n const mbedtls_ssl_session *session,\n unsigned char *start,\n const unsigned char *end,\n size_t *tlen,\n uint32_t *lifetime );", "#if defined(MBEDTLS_SSL_EXPORT_KEYS)\n/**\n * \\brief Callback type: Export key block and master secret\n *\n * \\note This is required for certain uses of TLS, e.g. EAP-TLS\n * (RFC 5216) and Thread. The key pointers are ephemeral and\n * therefore must not be stored. The master secret and keys\n * should not be used directly except as an input to a key\n * derivation function.\n *\n * \\param p_expkey Context for the callback\n * \\param ms Pointer to master secret (fixed length: 48 bytes)\n * \\param kb Pointer to key block, see RFC 5246 section 6.3\n * (variable length: 2 * maclen + 2 * keylen + 2 * ivlen).\n * \\param maclen MAC length\n * \\param keylen Key length\n * \\param ivlen IV length\n *\n * \\return 0 if successful, or\n * a specific MBEDTLS_ERR_XXX code.\n */\ntypedef int mbedtls_ssl_export_keys_t( void *p_expkey,\n const unsigned char *ms,\n const unsigned char *kb,\n size_t maclen,\n size_t keylen,\n size_t ivlen );\n#endif /* MBEDTLS_SSL_EXPORT_KEYS */", "/**\n * \\brief Callback type: parse and load session ticket\n *\n * \\note This describes what a callback implementation should do.\n * This callback should parse a session ticket as generated\n * by the corresponding mbedtls_ssl_ticket_write_t function,\n * and, if the ticket is authentic and valid, load the\n * session.\n *\n * \\note The implementation is allowed to modify the first len\n * bytes of the input buffer, eg to use it as a temporary\n * area for the decrypted ticket contents.\n *\n * \\param p_ticket Context for the callback\n * \\param session SSL session to be loaded\n * \\param buf Start of the buffer containing the ticket\n * \\param len Length of the ticket.\n *\n * \\return 0 if successful, or\n * MBEDTLS_ERR_SSL_INVALID_MAC if not authentic, or\n * MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED if expired, or\n * any other non-zero code for other failures.\n */\ntypedef int mbedtls_ssl_ticket_parse_t( void *p_ticket,\n mbedtls_ssl_session *session,\n unsigned char *buf,\n size_t len );", "#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_SRV_C)\n/**\n * \\brief Configure SSL session ticket callbacks (server only).\n * (Default: none.)\n *\n * \\note On server, session tickets are enabled by providing\n * non-NULL callbacks.\n *\n * \\note On client, use \\c mbedtls_ssl_conf_session_tickets().\n *\n * \\param conf SSL configuration context\n * \\param f_ticket_write Callback for writing a ticket\n * \\param f_ticket_parse Callback for parsing a ticket\n * \\param p_ticket Context shared by the two callbacks\n */\nvoid mbedtls_ssl_conf_session_tickets_cb( mbedtls_ssl_config *conf,\n mbedtls_ssl_ticket_write_t *f_ticket_write,\n mbedtls_ssl_ticket_parse_t *f_ticket_parse,\n void *p_ticket );\n#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_SRV_C */", "#if defined(MBEDTLS_SSL_EXPORT_KEYS)\n/**\n * \\brief Configure key export callback.\n * (Default: none.)\n *\n * \\note See \\c mbedtls_ssl_export_keys_t.\n *\n * \\param conf SSL configuration context\n * \\param f_export_keys Callback for exporting keys\n * \\param p_export_keys Context for the callback\n */\nvoid mbedtls_ssl_conf_export_keys_cb( mbedtls_ssl_config *conf,\n mbedtls_ssl_export_keys_t *f_export_keys,\n void *p_export_keys );\n#endif /* MBEDTLS_SSL_EXPORT_KEYS */", "/**\n * \\brief Callback type: generate a cookie\n *\n * \\param ctx Context for the callback\n * \\param p Buffer to write to,\n * must be updated to point right after the cookie\n * \\param end Pointer to one past the end of the output buffer\n * \\param info Client ID info that was passed to\n * \\c mbedtls_ssl_set_client_transport_id()\n * \\param ilen Length of info in bytes\n *\n * \\return The callback must return 0 on success,\n * or a negative error code.\n */\ntypedef int mbedtls_ssl_cookie_write_t( void *ctx,\n unsigned char **p, unsigned char *end,\n const unsigned char *info, size_t ilen );", "/**\n * \\brief Callback type: verify a cookie\n *\n * \\param ctx Context for the callback\n * \\param cookie Cookie to verify\n * \\param clen Length of cookie\n * \\param info Client ID info that was passed to\n * \\c mbedtls_ssl_set_client_transport_id()\n * \\param ilen Length of info in bytes\n *\n * \\return The callback must return 0 if cookie is valid,\n * or a negative error code.\n */\ntypedef int mbedtls_ssl_cookie_check_t( void *ctx,\n const unsigned char *cookie, size_t clen,\n const unsigned char *info, size_t ilen );", "#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)\n/**\n * \\brief Register callbacks for DTLS cookies\n * (Server only. DTLS only.)\n *\n * Default: dummy callbacks that fail, in order to force you to\n * register working callbacks (and initialize their context).\n *\n * To disable HelloVerifyRequest, register NULL callbacks.\n *\n * \\warning Disabling hello verification allows your server to be used\n * for amplification in DoS attacks against other hosts.\n * Only disable if you known this can't happen in your\n * particular environment.\n *\n * \\note See comments on \\c mbedtls_ssl_handshake() about handling\n * the MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED that is expected\n * on the first handshake attempt when this is enabled.\n *\n * \\note This is also necessary to handle client reconnection from\n * the same port as described in RFC 6347 section 4.2.8 (only\n * the variant with cookies is supported currently). See\n * comments on \\c mbedtls_ssl_read() for details.\n *\n * \\param conf SSL configuration\n * \\param f_cookie_write Cookie write callback\n * \\param f_cookie_check Cookie check callback\n * \\param p_cookie Context for both callbacks\n */\nvoid mbedtls_ssl_conf_dtls_cookies( mbedtls_ssl_config *conf,\n mbedtls_ssl_cookie_write_t *f_cookie_write,\n mbedtls_ssl_cookie_check_t *f_cookie_check,\n void *p_cookie );", "/**\n * \\brief Set client's transport-level identification info.\n * (Server only. DTLS only.)\n *\n * This is usually the IP address (and port), but could be\n * anything identify the client depending on the underlying\n * network stack. Used for HelloVerifyRequest with DTLS.\n * This is *not* used to route the actual packets.\n *\n * \\param ssl SSL context\n * \\param info Transport-level info identifying the client (eg IP + port)\n * \\param ilen Length of info in bytes\n *\n * \\note An internal copy is made, so the info buffer can be reused.\n *\n * \\return 0 on success,\n * MBEDTLS_ERR_SSL_BAD_INPUT_DATA if used on client,\n * MBEDTLS_ERR_SSL_ALLOC_FAILED if out of memory.\n */\nint mbedtls_ssl_set_client_transport_id( mbedtls_ssl_context *ssl,\n const unsigned char *info,\n size_t ilen );", "#endif /* MBEDTLS_SSL_DTLS_HELLO_VERIFY && MBEDTLS_SSL_SRV_C */", "#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)\n/**\n * \\brief Enable or disable anti-replay protection for DTLS.\n * (DTLS only, no effect on TLS.)\n * Default: enabled.\n *\n * \\param conf SSL configuration\n * \\param mode MBEDTLS_SSL_ANTI_REPLAY_ENABLED or MBEDTLS_SSL_ANTI_REPLAY_DISABLED.\n *\n * \\warning Disabling this is a security risk unless the application\n * protocol handles duplicated packets in a safe way. You\n * should not disable this without careful consideration.\n * However, if your application already detects duplicated\n * packets and needs information about them to adjust its\n * transmission strategy, then you'll want to disable this.\n */\nvoid mbedtls_ssl_conf_dtls_anti_replay( mbedtls_ssl_config *conf, char mode );\n#endif /* MBEDTLS_SSL_DTLS_ANTI_REPLAY */", "#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)\n/**\n * \\brief Set a limit on the number of records with a bad MAC\n * before terminating the connection.\n * (DTLS only, no effect on TLS.)\n * Default: 0 (disabled).\n *\n * \\param conf SSL configuration\n * \\param limit Limit, or 0 to disable.\n *\n * \\note If the limit is N, then the connection is terminated when\n * the Nth non-authentic record is seen.\n *\n * \\note Records with an invalid header are not counted, only the\n * ones going through the authentication-decryption phase.\n *\n * \\note This is a security trade-off related to the fact that it's\n * often relatively easy for an active attacker ot inject UDP\n * datagrams. On one hand, setting a low limit here makes it\n * easier for such an attacker to forcibly terminated a\n * connection. On the other hand, a high limit or no limit\n * might make us waste resources checking authentication on\n * many bogus packets.\n */\nvoid mbedtls_ssl_conf_dtls_badmac_limit( mbedtls_ssl_config *conf, unsigned limit );\n#endif /* MBEDTLS_SSL_DTLS_BADMAC_LIMIT */", "#if defined(MBEDTLS_SSL_PROTO_DTLS)\n/**\n * \\brief Set retransmit timeout values for the DTLS handshake.\n * (DTLS only, no effect on TLS.)\n *\n * \\param conf SSL configuration\n * \\param min Initial timeout value in milliseconds.\n * Default: 1000 (1 second).\n * \\param max Maximum timeout value in milliseconds.\n * Default: 60000 (60 seconds).\n *\n * \\note Default values are from RFC 6347 section 4.2.4.1.\n *\n * \\note The 'min' value should typically be slightly above the\n * expected round-trip time to your peer, plus whatever time\n * it takes for the peer to process the message. For example,\n * if your RTT is about 600ms and you peer needs up to 1s to\n * do the cryptographic operations in the handshake, then you\n * should set 'min' slightly above 1600. Lower values of 'min'\n * might cause spurious resends which waste network resources,\n * while larger value of 'min' will increase overall latency\n * on unreliable network links.\n *\n * \\note The more unreliable your network connection is, the larger\n * your max / min ratio needs to be in order to achieve\n * reliable handshakes.\n *\n * \\note Messages are retransmitted up to log2(ceil(max/min)) times.\n * For example, if min = 1s and max = 5s, the retransmit plan\n * goes: send ... 1s -> resend ... 2s -> resend ... 4s ->\n * resend ... 5s -> give up and return a timeout error.\n */\nvoid mbedtls_ssl_conf_handshake_timeout( mbedtls_ssl_config *conf, uint32_t min, uint32_t max );\n#endif /* MBEDTLS_SSL_PROTO_DTLS */", "#if defined(MBEDTLS_SSL_SRV_C)\n/**\n * \\brief Set the session cache callbacks (server-side only)\n * If not set, no session resuming is done (except if session\n * tickets are enabled too).\n *\n * The session cache has the responsibility to check for stale\n * entries based on timeout. See RFC 5246 for recommendations.\n *\n * Warning: session.peer_cert is cleared by the SSL/TLS layer on\n * connection shutdown, so do not cache the pointer! Either set\n * it to NULL or make a full copy of the certificate.\n *\n * The get callback is called once during the initial handshake\n * to enable session resuming. The get function has the\n * following parameters: (void *parameter, mbedtls_ssl_session *session)\n * If a valid entry is found, it should fill the master of\n * the session object with the cached values and return 0,\n * return 1 otherwise. Optionally peer_cert can be set as well\n * if it is properly present in cache entry.\n *\n * The set callback is called once during the initial handshake\n * to enable session resuming after the entire handshake has\n * been finished. The set function has the following parameters:\n * (void *parameter, const mbedtls_ssl_session *session). The function\n * should create a cache entry for future retrieval based on\n * the data in the session structure and should keep in mind\n * that the mbedtls_ssl_session object presented (and all its referenced\n * data) is cleared by the SSL/TLS layer when the connection is\n * terminated. It is recommended to add metadata to determine if\n * an entry is still valid in the future. Return 0 if\n * successfully cached, return 1 otherwise.\n *\n * \\param conf SSL configuration\n * \\param p_cache parmater (context) for both callbacks\n * \\param f_get_cache session get callback\n * \\param f_set_cache session set callback\n */\nvoid mbedtls_ssl_conf_session_cache( mbedtls_ssl_config *conf,\n void *p_cache,\n int (*f_get_cache)(void *, mbedtls_ssl_session *),\n int (*f_set_cache)(void *, const mbedtls_ssl_session *) );\n#endif /* MBEDTLS_SSL_SRV_C */", "#if defined(MBEDTLS_SSL_CLI_C)\n/**\n * \\brief Request resumption of session (client-side only)\n * Session data is copied from presented session structure.\n *\n * \\param ssl SSL context\n * \\param session session context\n *\n * \\return 0 if successful,\n * MBEDTLS_ERR_SSL_ALLOC_FAILED if memory allocation failed,\n * MBEDTLS_ERR_SSL_BAD_INPUT_DATA if used server-side or\n * arguments are otherwise invalid\n *\n * \\sa mbedtls_ssl_get_session()\n */\nint mbedtls_ssl_set_session( mbedtls_ssl_context *ssl, const mbedtls_ssl_session *session );\n#endif /* MBEDTLS_SSL_CLI_C */", "/**\n * \\brief Set the list of allowed ciphersuites and the preference\n * order. First in the list has the highest preference.\n * (Overrides all version-specific lists)\n *\n * The ciphersuites array is not copied, and must remain\n * valid for the lifetime of the ssl_config.\n *\n * Note: The server uses its own preferences\n * over the preference of the client unless\n * MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE is defined!\n *\n * \\param conf SSL configuration\n * \\param ciphersuites 0-terminated list of allowed ciphersuites\n */\nvoid mbedtls_ssl_conf_ciphersuites( mbedtls_ssl_config *conf,\n const int *ciphersuites );", "/**\n * \\brief Set the list of allowed ciphersuites and the\n * preference order for a specific version of the protocol.\n * (Only useful on the server side)\n *\n * The ciphersuites array is not copied, and must remain\n * valid for the lifetime of the ssl_config.\n *\n * \\param conf SSL configuration\n * \\param ciphersuites 0-terminated list of allowed ciphersuites\n * \\param major Major version number (only MBEDTLS_SSL_MAJOR_VERSION_3\n * supported)\n * \\param minor Minor version number (MBEDTLS_SSL_MINOR_VERSION_0,\n * MBEDTLS_SSL_MINOR_VERSION_1 and MBEDTLS_SSL_MINOR_VERSION_2,\n * MBEDTLS_SSL_MINOR_VERSION_3 supported)\n *\n * \\note With DTLS, use MBEDTLS_SSL_MINOR_VERSION_2 for DTLS 1.0\n * and MBEDTLS_SSL_MINOR_VERSION_3 for DTLS 1.2\n */\nvoid mbedtls_ssl_conf_ciphersuites_for_version( mbedtls_ssl_config *conf,\n const int *ciphersuites,\n int major, int minor );", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n/**\n * \\brief Set the X.509 security profile used for verification\n *\n * \\note The restrictions are enforced for all certificates in the\n * chain. However, signatures in the handshake are not covered\n * by this setting but by \\b mbedtls_ssl_conf_sig_hashes().\n *\n * \\param conf SSL configuration\n * \\param profile Profile to use\n */\nvoid mbedtls_ssl_conf_cert_profile( mbedtls_ssl_config *conf,\n const mbedtls_x509_crt_profile *profile );", "/**\n * \\brief Set the data required to verify peer certificate\n *\n * \\param conf SSL configuration\n * \\param ca_chain trusted CA chain (meaning all fully trusted top-level CAs)\n * \\param ca_crl trusted CA CRLs\n */\nvoid mbedtls_ssl_conf_ca_chain( mbedtls_ssl_config *conf,\n mbedtls_x509_crt *ca_chain,\n mbedtls_x509_crl *ca_crl );", "/**\n * \\brief Set own certificate chain and private key\n *\n * \\note own_cert should contain in order from the bottom up your\n * certificate chain. The top certificate (self-signed)\n * can be omitted.\n *\n * \\note On server, this function can be called multiple times to\n * provision more than one cert/key pair (eg one ECDSA, one\n * RSA with SHA-256, one RSA with SHA-1). An adequate\n * certificate will be selected according to the client's\n * advertised capabilities. In case mutliple certificates are\n * adequate, preference is given to the one set by the first\n * call to this function, then second, etc.\n *\n * \\note On client, only the first call has any effect. That is,\n * only one client certificate can be provisioned. The\n * server's preferences in its CertficateRequest message will\n * be ignored and our only cert will be sent regardless of\n * whether it matches those preferences - the server can then\n * decide what it wants to do with it.\n *\n * \\param conf SSL configuration\n * \\param own_cert own public certificate chain\n * \\param pk_key own private key\n *\n * \\return 0 on success or MBEDTLS_ERR_SSL_ALLOC_FAILED\n */\nint mbedtls_ssl_conf_own_cert( mbedtls_ssl_config *conf,\n mbedtls_x509_crt *own_cert,\n mbedtls_pk_context *pk_key );\n#endif /* MBEDTLS_X509_CRT_PARSE_C */", "#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)\n/**\n * \\brief Set the Pre Shared Key (PSK) and the expected identity name\n *\n * \\note This is mainly useful for clients. Servers will usually\n * want to use \\c mbedtls_ssl_conf_psk_cb() instead.\n *\n * \\note Currently clients can only register one pre-shared key.\n * In other words, the servers' identity hint is ignored.\n * Support for setting multiple PSKs on clients and selecting\n * one based on the identity hint is not a planned feature but\n * feedback is welcomed.\n *\n * \\param conf SSL configuration\n * \\param psk pointer to the pre-shared key\n * \\param psk_len pre-shared key length\n * \\param psk_identity pointer to the pre-shared key identity\n * \\param psk_identity_len identity key length\n *\n * \\return 0 if successful or MBEDTLS_ERR_SSL_ALLOC_FAILED\n */\nint mbedtls_ssl_conf_psk( mbedtls_ssl_config *conf,\n const unsigned char *psk, size_t psk_len,\n const unsigned char *psk_identity, size_t psk_identity_len );", "\n/**\n * \\brief Set the Pre Shared Key (PSK) for the current handshake\n *\n * \\note This should only be called inside the PSK callback,\n * ie the function passed to \\c mbedtls_ssl_conf_psk_cb().\n *\n * \\param ssl SSL context\n * \\param psk pointer to the pre-shared key\n * \\param psk_len pre-shared key length\n *\n * \\return 0 if successful or MBEDTLS_ERR_SSL_ALLOC_FAILED\n */\nint mbedtls_ssl_set_hs_psk( mbedtls_ssl_context *ssl,\n const unsigned char *psk, size_t psk_len );", "/**\n * \\brief Set the PSK callback (server-side only).\n *\n * If set, the PSK callback is called for each\n * handshake where a PSK ciphersuite was negotiated.\n * The caller provides the identity received and wants to\n * receive the actual PSK data and length.\n *\n * The callback has the following parameters: (void *parameter,\n * mbedtls_ssl_context *ssl, const unsigned char *psk_identity,\n * size_t identity_len)\n * If a valid PSK identity is found, the callback should use\n * \\c mbedtls_ssl_set_hs_psk() on the ssl context to set the\n * correct PSK and return 0.\n * Any other return value will result in a denied PSK identity.\n *\n * \\note If you set a PSK callback using this function, then you\n * don't need to set a PSK key and identity using\n * \\c mbedtls_ssl_conf_psk().\n *\n * \\param conf SSL configuration\n * \\param f_psk PSK identity function\n * \\param p_psk PSK identity parameter\n */\nvoid mbedtls_ssl_conf_psk_cb( mbedtls_ssl_config *conf,\n int (*f_psk)(void *, mbedtls_ssl_context *, const unsigned char *,\n size_t),\n void *p_psk );\n#endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */", "#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_SRV_C)\n/**\n * \\brief Set the Diffie-Hellman public P and G values,\n * read as hexadecimal strings (server-side only)\n * (Default: MBEDTLS_DHM_RFC5114_MODP_2048_[PG])\n *\n * \\param conf SSL configuration\n * \\param dhm_P Diffie-Hellman-Merkle modulus\n * \\param dhm_G Diffie-Hellman-Merkle generator\n *\n * \\return 0 if successful\n */\nint mbedtls_ssl_conf_dh_param( mbedtls_ssl_config *conf, const char *dhm_P, const char *dhm_G );", "/**\n * \\brief Set the Diffie-Hellman public P and G values,\n * read from existing context (server-side only)\n *\n * \\param conf SSL configuration\n * \\param dhm_ctx Diffie-Hellman-Merkle context\n *\n * \\return 0 if successful\n */\nint mbedtls_ssl_conf_dh_param_ctx( mbedtls_ssl_config *conf, mbedtls_dhm_context *dhm_ctx );\n#endif /* MBEDTLS_DHM_C && defined(MBEDTLS_SSL_SRV_C) */", "#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)\n/**\n * \\brief Set the minimum length for Diffie-Hellman parameters.\n * (Client-side only.)\n * (Default: 1024 bits.)\n *\n * \\param conf SSL configuration\n * \\param bitlen Minimum bit length of the DHM prime\n */\nvoid mbedtls_ssl_conf_dhm_min_bitlen( mbedtls_ssl_config *conf,\n unsigned int bitlen );\n#endif /* MBEDTLS_DHM_C && MBEDTLS_SSL_CLI_C */", "#if defined(MBEDTLS_ECP_C)\n/**\n * \\brief Set the allowed curves in order of preference.\n * (Default: all defined curves.)\n *\n * On server: this only affects selection of the ECDHE curve;\n * the curves used for ECDH and ECDSA are determined by the\n * list of available certificates instead.\n *\n * On client: this affects the list of curves offered for any\n * use. The server can override our preference order.\n *\n * Both sides: limits the set of curves accepted for use in\n * ECDHE and in the peer's end-entity certificate.\n *\n * \\note This has no influence on which curves are allowed inside the\n * certificate chains, see \\c mbedtls_ssl_conf_cert_profile()\n * for that. For the end-entity certificate however, the key\n * will be accepted only if it is allowed both by this list\n * and by the cert profile.\n *\n * \\note This list should be ordered by decreasing preference\n * (preferred curve first).\n *\n * \\param conf SSL configuration\n * \\param curves Ordered list of allowed curves,\n * terminated by MBEDTLS_ECP_DP_NONE.\n */\nvoid mbedtls_ssl_conf_curves( mbedtls_ssl_config *conf,\n const mbedtls_ecp_group_id *curves );\n#endif /* MBEDTLS_ECP_C */", "#if defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED)\n/**\n * \\brief Set the allowed hashes for signatures during the handshake.\n * (Default: all available hashes except MD5.)\n *\n * \\note This only affects which hashes are offered and can be used\n * for signatures during the handshake. Hashes for message\n * authentication and the TLS PRF are controlled by the\n * ciphersuite, see \\c mbedtls_ssl_conf_ciphersuites(). Hashes\n * used for certificate signature are controlled by the\n * verification profile, see \\c mbedtls_ssl_conf_cert_profile().\n *\n * \\note This list should be ordered by decreasing preference\n * (preferred hash first).\n *\n * \\param conf SSL configuration\n * \\param hashes Ordered list of allowed signature hashes,\n * terminated by \\c MBEDTLS_MD_NONE.\n */\nvoid mbedtls_ssl_conf_sig_hashes( mbedtls_ssl_config *conf,\n const int *hashes );\n#endif /* MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED */", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n/**\n * \\brief Set the hostname to check against the received server\n * certificate. It sets the ServerName TLS extension too,\n * if the extension is enabled.\n * (client-side only)\n *\n * \\param ssl SSL context\n * \\param hostname the server hostname\n *\n * \\return 0 if successful or MBEDTLS_ERR_SSL_ALLOC_FAILED\n */\nint mbedtls_ssl_set_hostname( mbedtls_ssl_context *ssl, const char *hostname );\n#endif /* MBEDTLS_X509_CRT_PARSE_C */", "#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)\n/**\n * \\brief Set own certificate and key for the current handshake\n *\n * \\note Same as \\c mbedtls_ssl_conf_own_cert() but for use within\n * the SNI callback.\n *\n * \\param ssl SSL context\n * \\param own_cert own public certificate chain\n * \\param pk_key own private key\n *\n * \\return 0 on success or MBEDTLS_ERR_SSL_ALLOC_FAILED\n */\nint mbedtls_ssl_set_hs_own_cert( mbedtls_ssl_context *ssl,\n mbedtls_x509_crt *own_cert,\n mbedtls_pk_context *pk_key );", "/**\n * \\brief Set the data required to verify peer certificate for the\n * current handshake\n *\n * \\note Same as \\c mbedtls_ssl_conf_ca_chain() but for use within\n * the SNI callback.\n *\n * \\param ssl SSL context\n * \\param ca_chain trusted CA chain (meaning all fully trusted top-level CAs)\n * \\param ca_crl trusted CA CRLs\n */\nvoid mbedtls_ssl_set_hs_ca_chain( mbedtls_ssl_context *ssl,\n mbedtls_x509_crt *ca_chain,\n mbedtls_x509_crl *ca_crl );", "/**\n * \\brief Set authmode for the current handshake.\n *\n * \\note Same as \\c mbedtls_ssl_conf_authmode() but for use within\n * the SNI callback.\n *\n * \\param ssl SSL context\n * \\param authmode MBEDTLS_SSL_VERIFY_NONE, MBEDTLS_SSL_VERIFY_OPTIONAL or\n * MBEDTLS_SSL_VERIFY_REQUIRED\n */\nvoid mbedtls_ssl_set_hs_authmode( mbedtls_ssl_context *ssl,\n int authmode );", "/**\n * \\brief Set server side ServerName TLS extension callback\n * (optional, server-side only).\n *\n * If set, the ServerName callback is called whenever the\n * server receives a ServerName TLS extension from the client\n * during a handshake. The ServerName callback has the\n * following parameters: (void *parameter, mbedtls_ssl_context *ssl,\n * const unsigned char *hostname, size_t len). If a suitable\n * certificate is found, the callback must set the\n * certificate(s) and key(s) to use with \\c\n * mbedtls_ssl_set_hs_own_cert() (can be called repeatedly),\n * and may optionally adjust the CA and associated CRL with \\c\n * mbedtls_ssl_set_hs_ca_chain() as well as the client\n * authentication mode with \\c mbedtls_ssl_set_hs_authmode(),\n * then must return 0. If no matching name is found, the\n * callback must either set a default cert, or\n * return non-zero to abort the handshake at this point.\n *\n * \\param conf SSL configuration\n * \\param f_sni verification function\n * \\param p_sni verification parameter\n */\nvoid mbedtls_ssl_conf_sni( mbedtls_ssl_config *conf,\n int (*f_sni)(void *, mbedtls_ssl_context *, const unsigned char *,\n size_t),\n void *p_sni );\n#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */", "#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)\n/**\n * \\brief Set the EC J-PAKE password for current handshake.\n *\n * \\note An internal copy is made, and destroyed as soon as the\n * handshake is completed, or when the SSL context is reset or\n * freed.\n *\n * \\note The SSL context needs to be already set up. The right place\n * to call this function is between \\c mbedtls_ssl_setup() or\n * \\c mbedtls_ssl_reset() and \\c mbedtls_ssl_handshake().\n *\n * \\param ssl SSL context\n * \\param pw EC J-PAKE password (pre-shared secret)\n * \\param pw_len length of pw in bytes\n *\n * \\return 0 on success, or a negative error code.\n */\nint mbedtls_ssl_set_hs_ecjpake_password( mbedtls_ssl_context *ssl,\n const unsigned char *pw,\n size_t pw_len );\n#endif /*MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */", "#if defined(MBEDTLS_SSL_ALPN)\n/**\n * \\brief Set the supported Application Layer Protocols.\n *\n * \\param conf SSL configuration\n * \\param protos Pointer to a NULL-terminated list of supported protocols,\n * in decreasing preference order. The pointer to the list is\n * recorded by the library for later reference as required, so\n * the lifetime of the table must be atleast as long as the\n * lifetime of the SSL configuration structure.\n *\n * \\return 0 on success, or MBEDTLS_ERR_SSL_BAD_INPUT_DATA.\n */\nint mbedtls_ssl_conf_alpn_protocols( mbedtls_ssl_config *conf, const char **protos );", "/**\n * \\brief Get the name of the negotiated Application Layer Protocol.\n * This function should be called after the handshake is\n * completed.\n *\n * \\param ssl SSL context\n *\n * \\return Protcol name, or NULL if no protocol was negotiated.\n */\nconst char *mbedtls_ssl_get_alpn_protocol( const mbedtls_ssl_context *ssl );\n#endif /* MBEDTLS_SSL_ALPN */", "/**\n * \\brief Set the maximum supported version sent from the client side\n * and/or accepted at the server side\n * (Default: MBEDTLS_SSL_MAX_MAJOR_VERSION, MBEDTLS_SSL_MAX_MINOR_VERSION)\n *\n * \\note This ignores ciphersuites from higher versions.\n *\n * \\note With DTLS, use MBEDTLS_SSL_MINOR_VERSION_2 for DTLS 1.0 and\n * MBEDTLS_SSL_MINOR_VERSION_3 for DTLS 1.2\n *\n * \\param conf SSL configuration\n * \\param major Major version number (only MBEDTLS_SSL_MAJOR_VERSION_3 supported)\n * \\param minor Minor version number (MBEDTLS_SSL_MINOR_VERSION_0,\n * MBEDTLS_SSL_MINOR_VERSION_1 and MBEDTLS_SSL_MINOR_VERSION_2,\n * MBEDTLS_SSL_MINOR_VERSION_3 supported)\n */\nvoid mbedtls_ssl_conf_max_version( mbedtls_ssl_config *conf, int major, int minor );", "/**\n * \\brief Set the minimum accepted SSL/TLS protocol version\n * (Default: TLS 1.0)\n *\n * \\note Input outside of the SSL_MAX_XXXXX_VERSION and\n * SSL_MIN_XXXXX_VERSION range is ignored.\n *\n * \\note MBEDTLS_SSL_MINOR_VERSION_0 (SSL v3) should be avoided.\n *\n * \\note With DTLS, use MBEDTLS_SSL_MINOR_VERSION_2 for DTLS 1.0 and\n * MBEDTLS_SSL_MINOR_VERSION_3 for DTLS 1.2\n *\n * \\param conf SSL configuration\n * \\param major Major version number (only MBEDTLS_SSL_MAJOR_VERSION_3 supported)\n * \\param minor Minor version number (MBEDTLS_SSL_MINOR_VERSION_0,\n * MBEDTLS_SSL_MINOR_VERSION_1 and MBEDTLS_SSL_MINOR_VERSION_2,\n * MBEDTLS_SSL_MINOR_VERSION_3 supported)\n */\nvoid mbedtls_ssl_conf_min_version( mbedtls_ssl_config *conf, int major, int minor );", "#if defined(MBEDTLS_SSL_FALLBACK_SCSV) && defined(MBEDTLS_SSL_CLI_C)\n/**\n * \\brief Set the fallback flag (client-side only).\n * (Default: MBEDTLS_SSL_IS_NOT_FALLBACK).\n *\n * \\note Set to MBEDTLS_SSL_IS_FALLBACK when preparing a fallback\n * connection, that is a connection with max_version set to a\n * lower value than the value you're willing to use. Such\n * fallback connections are not recommended but are sometimes\n * necessary to interoperate with buggy (version-intolerant)\n * servers.\n *\n * \\warning You should NOT set this to MBEDTLS_SSL_IS_FALLBACK for\n * non-fallback connections! This would appear to work for a\n * while, then cause failures when the server is upgraded to\n * support a newer TLS version.\n *\n * \\param conf SSL configuration\n * \\param fallback MBEDTLS_SSL_IS_NOT_FALLBACK or MBEDTLS_SSL_IS_FALLBACK\n */\nvoid mbedtls_ssl_conf_fallback( mbedtls_ssl_config *conf, char fallback );\n#endif /* MBEDTLS_SSL_FALLBACK_SCSV && MBEDTLS_SSL_CLI_C */", "#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)\n/**\n * \\brief Enable or disable Encrypt-then-MAC\n * (Default: MBEDTLS_SSL_ETM_ENABLED)\n *\n * \\note This should always be enabled, it is a security\n * improvement, and should not cause any interoperability\n * issue (used only if the peer supports it too).\n *\n * \\param conf SSL configuration\n * \\param etm MBEDTLS_SSL_ETM_ENABLED or MBEDTLS_SSL_ETM_DISABLED\n */\nvoid mbedtls_ssl_conf_encrypt_then_mac( mbedtls_ssl_config *conf, char etm );\n#endif /* MBEDTLS_SSL_ENCRYPT_THEN_MAC */", "#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)\n/**\n * \\brief Enable or disable Extended Master Secret negotiation.\n * (Default: MBEDTLS_SSL_EXTENDED_MS_ENABLED)\n *\n * \\note This should always be enabled, it is a security fix to the\n * protocol, and should not cause any interoperability issue\n * (used only if the peer supports it too).\n *\n * \\param conf SSL configuration\n * \\param ems MBEDTLS_SSL_EXTENDED_MS_ENABLED or MBEDTLS_SSL_EXTENDED_MS_DISABLED\n */\nvoid mbedtls_ssl_conf_extended_master_secret( mbedtls_ssl_config *conf, char ems );\n#endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */", "#if defined(MBEDTLS_ARC4_C)\n/**\n * \\brief Disable or enable support for RC4\n * (Default: MBEDTLS_SSL_ARC4_DISABLED)\n *\n * \\warning Use of RC4 in DTLS/TLS has been prohibited by RFC 7465\n * for security reasons. Use at your own risk.\n *\n * \\note This function is deprecated and will likely be removed in\n * a future version of the library.\n * RC4 is disabled by default at compile time and needs to be\n * actively enabled for use with legacy systems.\n *\n * \\param conf SSL configuration\n * \\param arc4 MBEDTLS_SSL_ARC4_ENABLED or MBEDTLS_SSL_ARC4_DISABLED\n */\nvoid mbedtls_ssl_conf_arc4_support( mbedtls_ssl_config *conf, char arc4 );\n#endif /* MBEDTLS_ARC4_C */", "#if defined(MBEDTLS_SSL_SRV_C)\n/**\n * \\brief Whether to send a list of acceptable CAs in\n * CertificateRequest messages.\n * (Default: do send)\n *\n * \\param conf SSL configuration\n * \\param cert_req_ca_list MBEDTLS_SSL_CERT_REQ_CA_LIST_ENABLED or\n * MBEDTLS_SSL_CERT_REQ_CA_LIST_DISABLED\n */\nvoid mbedtls_ssl_conf_cert_req_ca_list( mbedtls_ssl_config *conf,\n char cert_req_ca_list );\n#endif /* MBEDTLS_SSL_SRV_C */", "#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)\n/**\n * \\brief Set the maximum fragment length to emit and/or negotiate\n * (Default: MBEDTLS_SSL_MAX_CONTENT_LEN, usually 2^14 bytes)\n * (Server: set maximum fragment length to emit,\n * usually negotiated by the client during handshake\n * (Client: set maximum fragment length to emit *and*\n * negotiate with the server during handshake)\n *\n * \\param conf SSL configuration\n * \\param mfl_code Code for maximum fragment length (allowed values:\n * MBEDTLS_SSL_MAX_FRAG_LEN_512, MBEDTLS_SSL_MAX_FRAG_LEN_1024,\n * MBEDTLS_SSL_MAX_FRAG_LEN_2048, MBEDTLS_SSL_MAX_FRAG_LEN_4096)\n *\n * \\return 0 if successful or MBEDTLS_ERR_SSL_BAD_INPUT_DATA\n */\nint mbedtls_ssl_conf_max_frag_len( mbedtls_ssl_config *conf, unsigned char mfl_code );\n#endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */", "#if defined(MBEDTLS_SSL_TRUNCATED_HMAC)\n/**\n * \\brief Activate negotiation of truncated HMAC\n * (Default: MBEDTLS_SSL_TRUNC_HMAC_DISABLED)\n *\n * \\param conf SSL configuration\n * \\param truncate Enable or disable (MBEDTLS_SSL_TRUNC_HMAC_ENABLED or\n * MBEDTLS_SSL_TRUNC_HMAC_DISABLED)\n */\nvoid mbedtls_ssl_conf_truncated_hmac( mbedtls_ssl_config *conf, int truncate );\n#endif /* MBEDTLS_SSL_TRUNCATED_HMAC */", "#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)\n/**\n * \\brief Enable / Disable 1/n-1 record splitting\n * (Default: MBEDTLS_SSL_CBC_RECORD_SPLITTING_ENABLED)\n *\n * \\note Only affects SSLv3 and TLS 1.0, not higher versions.\n * Does not affect non-CBC ciphersuites in any version.\n *\n * \\param conf SSL configuration\n * \\param split MBEDTLS_SSL_CBC_RECORD_SPLITTING_ENABLED or\n * MBEDTLS_SSL_CBC_RECORD_SPLITTING_DISABLED\n */\nvoid mbedtls_ssl_conf_cbc_record_splitting( mbedtls_ssl_config *conf, char split );\n#endif /* MBEDTLS_SSL_CBC_RECORD_SPLITTING */", "#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)\n/**\n * \\brief Enable / Disable session tickets (client only).\n * (Default: MBEDTLS_SSL_SESSION_TICKETS_ENABLED.)\n *\n * \\note On server, use \\c mbedtls_ssl_conf_session_tickets_cb().\n *\n * \\param conf SSL configuration\n * \\param use_tickets Enable or disable (MBEDTLS_SSL_SESSION_TICKETS_ENABLED or\n * MBEDTLS_SSL_SESSION_TICKETS_DISABLED)\n */\nvoid mbedtls_ssl_conf_session_tickets( mbedtls_ssl_config *conf, int use_tickets );\n#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_CLI_C */", "#if defined(MBEDTLS_SSL_RENEGOTIATION)\n/**\n * \\brief Enable / Disable renegotiation support for connection when\n * initiated by peer\n * (Default: MBEDTLS_SSL_RENEGOTIATION_DISABLED)\n *\n * \\warning It is recommended to always disable renegotation unless you\n * know you need it and you know what you're doing. In the\n * past, there have been several issues associated with\n * renegotiation or a poor understanding of its properties.\n *\n * \\note Server-side, enabling renegotiation also makes the server\n * susceptible to a resource DoS by a malicious client.\n *\n * \\param conf SSL configuration\n * \\param renegotiation Enable or disable (MBEDTLS_SSL_RENEGOTIATION_ENABLED or\n * MBEDTLS_SSL_RENEGOTIATION_DISABLED)\n */\nvoid mbedtls_ssl_conf_renegotiation( mbedtls_ssl_config *conf, int renegotiation );\n#endif /* MBEDTLS_SSL_RENEGOTIATION */", "/**\n * \\brief Prevent or allow legacy renegotiation.\n * (Default: MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION)\n *\n * MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION allows connections to\n * be established even if the peer does not support\n * secure renegotiation, but does not allow renegotiation\n * to take place if not secure.\n * (Interoperable and secure option)\n *\n * MBEDTLS_SSL_LEGACY_ALLOW_RENEGOTIATION allows renegotiations\n * with non-upgraded peers. Allowing legacy renegotiation\n * makes the connection vulnerable to specific man in the\n * middle attacks. (See RFC 5746)\n * (Most interoperable and least secure option)\n *\n * MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE breaks off connections\n * if peer does not support secure renegotiation. Results\n * in interoperability issues with non-upgraded peers\n * that do not support renegotiation altogether.\n * (Most secure option, interoperability issues)\n *\n * \\param conf SSL configuration\n * \\param allow_legacy Prevent or allow (SSL_NO_LEGACY_RENEGOTIATION,\n * SSL_ALLOW_LEGACY_RENEGOTIATION or\n * MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE)\n */\nvoid mbedtls_ssl_conf_legacy_renegotiation( mbedtls_ssl_config *conf, int allow_legacy );", "#if defined(MBEDTLS_SSL_RENEGOTIATION)\n/**\n * \\brief Enforce renegotiation requests.\n * (Default: enforced, max_records = 16)\n *\n * When we request a renegotiation, the peer can comply or\n * ignore the request. This function allows us to decide\n * whether to enforce our renegotiation requests by closing\n * the connection if the peer doesn't comply.\n *\n * However, records could already be in transit from the peer\n * when the request is emitted. In order to increase\n * reliability, we can accept a number of records before the\n * expected handshake records.\n *\n * The optimal value is highly dependent on the specific usage\n * scenario.\n *\n * \\note With DTLS and server-initiated renegotiation, the\n * HelloRequest is retransmited every time mbedtls_ssl_read() times\n * out or receives Application Data, until:\n * - max_records records have beens seen, if it is >= 0, or\n * - the number of retransmits that would happen during an\n * actual handshake has been reached.\n * Please remember the request might be lost a few times\n * if you consider setting max_records to a really low value.\n *\n * \\warning On client, the grace period can only happen during\n * mbedtls_ssl_read(), as opposed to mbedtls_ssl_write() and mbedtls_ssl_renegotiate()\n * which always behave as if max_record was 0. The reason is,\n * if we receive application data from the server, we need a\n * place to write it, which only happens during mbedtls_ssl_read().\n *\n * \\param conf SSL configuration\n * \\param max_records Use MBEDTLS_SSL_RENEGOTIATION_NOT_ENFORCED if you don't want to\n * enforce renegotiation, or a non-negative value to enforce\n * it but allow for a grace period of max_records records.\n */\nvoid mbedtls_ssl_conf_renegotiation_enforced( mbedtls_ssl_config *conf, int max_records );", "/**\n * \\brief Set record counter threshold for periodic renegotiation.\n * (Default: 2^48 - 1)\n *\n * Renegotiation is automatically triggered when a record\n * counter (outgoing or ingoing) crosses the defined\n * threshold. The default value is meant to prevent the\n * connection from being closed when the counter is about to\n * reached its maximal value (it is not allowed to wrap).\n *\n * Lower values can be used to enforce policies such as \"keys\n * must be refreshed every N packets with cipher X\".\n *\n * The renegotiation period can be disabled by setting\n * conf->disable_renegotiation to\n * MBEDTLS_SSL_RENEGOTIATION_DISABLED.\n *\n * \\note When the configured transport is\n * MBEDTLS_SSL_TRANSPORT_DATAGRAM the maximum renegotiation\n * period is 2^48 - 1, and for MBEDTLS_SSL_TRANSPORT_STREAM,\n * the maximum renegotiation period is 2^64 - 1.\n *\n * \\param conf SSL configuration\n * \\param period The threshold value: a big-endian 64-bit number.\n */\nvoid mbedtls_ssl_conf_renegotiation_period( mbedtls_ssl_config *conf,\n const unsigned char period[8] );\n#endif /* MBEDTLS_SSL_RENEGOTIATION */", "/**\n * \\brief Return the number of data bytes available to read\n *\n * \\param ssl SSL context\n *\n * \\return how many bytes are available in the read buffer\n */\nsize_t mbedtls_ssl_get_bytes_avail( const mbedtls_ssl_context *ssl );", "/**\n * \\brief Return the result of the certificate verification\n *\n * \\param ssl SSL context\n *\n * \\return 0 if successful,\n * -1 if result is not available (eg because the handshake was\n * aborted too early), or\n * a combination of BADCERT_xxx and BADCRL_xxx flags, see\n * x509.h\n */\nuint32_t mbedtls_ssl_get_verify_result( const mbedtls_ssl_context *ssl );", "/**\n * \\brief Return the name of the current ciphersuite\n *\n * \\param ssl SSL context\n *\n * \\return a string containing the ciphersuite name\n */\nconst char *mbedtls_ssl_get_ciphersuite( const mbedtls_ssl_context *ssl );", "/**\n * \\brief Return the current SSL version (SSLv3/TLSv1/etc)\n *\n * \\param ssl SSL context\n *\n * \\return a string containing the SSL version\n */\nconst char *mbedtls_ssl_get_version( const mbedtls_ssl_context *ssl );", "/**\n * \\brief Return the (maximum) number of bytes added by the record\n * layer: header + encryption/MAC overhead (inc. padding)\n *\n * \\param ssl SSL context\n *\n * \\return Current maximum record expansion in bytes, or\n * MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE if compression is\n * enabled, which makes expansion much less predictable\n */\nint mbedtls_ssl_get_record_expansion( const mbedtls_ssl_context *ssl );", "#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)\n/**\n * \\brief Return the maximum fragment length (payload, in bytes).\n * This is the value negotiated with peer if any,\n * or the locally configured value.\n *\n * \\note With DTLS, \\c mbedtls_ssl_write() will return an error if\n * called with a larger length value.\n * With TLS, \\c mbedtls_ssl_write() will fragment the input if\n * necessary and return the number of bytes written; it is up\n * to the caller to call \\c mbedtls_ssl_write() again in\n * order to send the remaining bytes if any.\n *\n * \\param ssl SSL context\n *\n * \\return Current maximum fragment length.\n */\nsize_t mbedtls_ssl_get_max_frag_len( const mbedtls_ssl_context *ssl );\n#endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n/**\n * \\brief Return the peer certificate from the current connection\n *\n * Note: Can be NULL in case no certificate was sent during\n * the handshake. Different calls for the same connection can\n * return the same or different pointers for the same\n * certificate and even a different certificate altogether.\n * The peer cert CAN change in a single connection if\n * renegotiation is performed.\n *\n * \\param ssl SSL context\n *\n * \\return the current peer certificate\n */\nconst mbedtls_x509_crt *mbedtls_ssl_get_peer_cert( const mbedtls_ssl_context *ssl );\n#endif /* MBEDTLS_X509_CRT_PARSE_C */", "#if defined(MBEDTLS_SSL_CLI_C)\n/**\n * \\brief Save session in order to resume it later (client-side only)\n * Session data is copied to presented session structure.\n *\n * \\warning Currently, peer certificate is lost in the operation.\n *\n * \\param ssl SSL context\n * \\param session session context\n *\n * \\return 0 if successful,\n * MBEDTLS_ERR_SSL_ALLOC_FAILED if memory allocation failed,\n * MBEDTLS_ERR_SSL_BAD_INPUT_DATA if used server-side or\n * arguments are otherwise invalid\n *\n * \\sa mbedtls_ssl_set_session()\n */\nint mbedtls_ssl_get_session( const mbedtls_ssl_context *ssl, mbedtls_ssl_session *session );\n#endif /* MBEDTLS_SSL_CLI_C */", "/**\n * \\brief Perform the SSL handshake\n *\n * \\param ssl SSL context\n *\n * \\return 0 if successful, or\n * MBEDTLS_ERR_SSL_WANT_READ or MBEDTLS_ERR_SSL_WANT_WRITE, or\n * MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED (see below), or\n * a specific SSL error code.\n *\n * \\note If this function returns something other than 0 or\n * MBEDTLS_ERR_SSL_WANT_READ/WRITE, then the ssl context\n * becomes unusable, and you should either free it or call\n * \\c mbedtls_ssl_session_reset() on it before re-using it for\n * a new connection; the current connection must be closed.\n *\n * \\note If DTLS is in use, then you may choose to handle\n * MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED specially for logging\n * purposes, as it is an expected return value rather than an\n * actual error, but you still need to reset/free the context.\n */\nint mbedtls_ssl_handshake( mbedtls_ssl_context *ssl );", "/**\n * \\brief Perform a single step of the SSL handshake\n *\n * \\note The state of the context (ssl->state) will be at\n * the next state after execution of this function. Do not\n * call this function if state is MBEDTLS_SSL_HANDSHAKE_OVER.\n *\n * \\note If this function returns something other than 0 or\n * MBEDTLS_ERR_SSL_WANT_READ/WRITE, then the ssl context\n * becomes unusable, and you should either free it or call\n * \\c mbedtls_ssl_session_reset() on it before re-using it for\n * a new connection; the current connection must be closed.\n *\n * \\param ssl SSL context\n *\n * \\return 0 if successful, or\n * MBEDTLS_ERR_SSL_WANT_READ or MBEDTLS_ERR_SSL_WANT_WRITE, or\n * a specific SSL error code.\n */\nint mbedtls_ssl_handshake_step( mbedtls_ssl_context *ssl );", "#if defined(MBEDTLS_SSL_RENEGOTIATION)\n/**\n * \\brief Initiate an SSL renegotiation on the running connection.\n * Client: perform the renegotiation right now.\n * Server: request renegotiation, which will be performed\n * during the next call to mbedtls_ssl_read() if honored by\n * client.\n *\n * \\param ssl SSL context\n *\n * \\return 0 if successful, or any mbedtls_ssl_handshake() return\n * value.\n *\n * \\note If this function returns something other than 0 or\n * MBEDTLS_ERR_SSL_WANT_READ/WRITE, then the ssl context\n * becomes unusable, and you should either free it or call\n * \\c mbedtls_ssl_session_reset() on it before re-using it for\n * a new connection; the current connection must be closed.\n */\nint mbedtls_ssl_renegotiate( mbedtls_ssl_context *ssl );\n#endif /* MBEDTLS_SSL_RENEGOTIATION */", "/**\n * \\brief Read at most 'len' application data bytes\n *\n * \\param ssl SSL context\n * \\param buf buffer that will hold the data\n * \\param len maximum number of bytes to read\n *\n * \\return the number of bytes read, or\n * 0 for EOF, or\n * MBEDTLS_ERR_SSL_WANT_READ or MBEDTLS_ERR_SSL_WANT_WRITE, or\n * MBEDTLS_ERR_SSL_CLIENT_RECONNECT (see below), or\n * another negative error code.\n *\n * \\note If this function returns something other than a positive\n * value or MBEDTLS_ERR_SSL_WANT_READ/WRITE or\n * MBEDTLS_ERR_SSL_CLIENT_RECONNECT, then the ssl context\n * becomes unusable, and you should either free it or call\n * \\c mbedtls_ssl_session_reset() on it before re-using it for\n * a new connection; the current connection must be closed.\n *\n * \\note When this function return MBEDTLS_ERR_SSL_CLIENT_RECONNECT\n * (which can only happen server-side), it means that a client\n * is initiating a new connection using the same source port.\n * You can either treat that as a connection close and wait\n * for the client to resend a ClientHello, or directly\n * continue with \\c mbedtls_ssl_handshake() with the same\n * context (as it has beeen reset internally). Either way, you\n * should make sure this is seen by the application as a new\n * connection: application state, if any, should be reset, and\n * most importantly the identity of the client must be checked\n * again. WARNING: not validating the identity of the client\n * again, or not transmitting the new identity to the\n * application layer, would allow authentication bypass!\n */\nint mbedtls_ssl_read( mbedtls_ssl_context *ssl, unsigned char *buf, size_t len );", "/**\n * \\brief Try to write exactly 'len' application data bytes\n *\n * \\warning This function will do partial writes in some cases. If the\n * return value is non-negative but less than length, the\n * function must be called again with updated arguments:\n * buf + ret, len - ret (if ret is the return value) until\n * it returns a value equal to the last 'len' argument.\n *\n * \\param ssl SSL context\n * \\param buf buffer holding the data\n * \\param len how many bytes must be written\n *\n * \\return the number of bytes actually written (may be less than len),\n * or MBEDTLS_ERR_SSL_WANT_WRITE or MBEDTLS_ERR_SSL_WANT_READ,\n * or another negative error code.\n *\n * \\note If this function returns something other than a positive\n * value or MBEDTLS_ERR_SSL_WANT_READ/WRITE, the ssl context\n * becomes unusable, and you should either free it or call\n * \\c mbedtls_ssl_session_reset() on it before re-using it for\n * a new connection; the current connection must be closed.\n *\n * \\note When this function returns MBEDTLS_ERR_SSL_WANT_WRITE/READ,\n * it must be called later with the *same* arguments,\n * until it returns a positive value.\n *\n * \\note If the requested length is greater than the maximum\n * fragment length (either the built-in limit or the one set\n * or negotiated with the peer), then:\n * - with TLS, less bytes than requested are written.\n * - with DTLS, MBEDTLS_ERR_SSL_BAD_INPUT_DATA is returned.\n * \\c mbedtls_ssl_get_max_frag_len() may be used to query the\n * active maximum fragment length.\n */\nint mbedtls_ssl_write( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len );", "/**\n * \\brief Send an alert message\n *\n * \\param ssl SSL context\n * \\param level The alert level of the message\n * (MBEDTLS_SSL_ALERT_LEVEL_WARNING or MBEDTLS_SSL_ALERT_LEVEL_FATAL)\n * \\param message The alert message (SSL_ALERT_MSG_*)\n *\n * \\return 0 if successful, or a specific SSL error code.\n *\n * \\note If this function returns something other than 0 or\n * MBEDTLS_ERR_SSL_WANT_READ/WRITE, then the ssl context\n * becomes unusable, and you should either free it or call\n * \\c mbedtls_ssl_session_reset() on it before re-using it for\n * a new connection; the current connection must be closed.\n */\nint mbedtls_ssl_send_alert_message( mbedtls_ssl_context *ssl,\n unsigned char level,\n unsigned char message );\n/**\n * \\brief Notify the peer that the connection is being closed\n *\n * \\param ssl SSL context\n *\n * \\return 0 if successful, or a specific SSL error code.\n *\n * \\note If this function returns something other than 0 or\n * MBEDTLS_ERR_SSL_WANT_READ/WRITE, then the ssl context\n * becomes unusable, and you should either free it or call\n * \\c mbedtls_ssl_session_reset() on it before re-using it for\n * a new connection; the current connection must be closed.\n */\nint mbedtls_ssl_close_notify( mbedtls_ssl_context *ssl );", "/**\n * \\brief Free referenced items in an SSL context and clear memory\n *\n * \\param ssl SSL context\n */\nvoid mbedtls_ssl_free( mbedtls_ssl_context *ssl );", "/**\n * \\brief Initialize an SSL configuration context\n * Just makes the context ready for\n * mbedtls_ssl_config_defaults() or mbedtls_ssl_config_free().\n *\n * \\note You need to call mbedtls_ssl_config_defaults() unless you\n * manually set all of the relevent fields yourself.\n *\n * \\param conf SSL configuration context\n */\nvoid mbedtls_ssl_config_init( mbedtls_ssl_config *conf );", "/**\n * \\brief Load reasonnable default SSL configuration values.\n * (You need to call mbedtls_ssl_config_init() first.)\n *\n * \\param conf SSL configuration context\n * \\param endpoint MBEDTLS_SSL_IS_CLIENT or MBEDTLS_SSL_IS_SERVER\n * \\param transport MBEDTLS_SSL_TRANSPORT_STREAM for TLS, or\n * MBEDTLS_SSL_TRANSPORT_DATAGRAM for DTLS\n * \\param preset a MBEDTLS_SSL_PRESET_XXX value\n *\n * \\note See \\c mbedtls_ssl_conf_transport() for notes on DTLS.\n *\n * \\return 0 if successful, or\n * MBEDTLS_ERR_XXX_ALLOC_FAILED on memory allocation error.\n */\nint mbedtls_ssl_config_defaults( mbedtls_ssl_config *conf,\n int endpoint, int transport, int preset );", "/**\n * \\brief Free an SSL configuration context\n *\n * \\param conf SSL configuration context\n */\nvoid mbedtls_ssl_config_free( mbedtls_ssl_config *conf );", "/**\n * \\brief Initialize SSL session structure\n *\n * \\param session SSL session\n */\nvoid mbedtls_ssl_session_init( mbedtls_ssl_session *session );", "/**\n * \\brief Free referenced items in an SSL session including the\n * peer certificate and clear memory\n *\n * \\param session SSL session\n */\nvoid mbedtls_ssl_session_free( mbedtls_ssl_session *session );", "#ifdef __cplusplus\n}\n#endif", "#endif /* ssl.h */" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [8, 75, 1056, 78, 271, 482, 2312, 1208], "buggy_code_start_loc": [8, 74, 1055, 78, 270, 482, 2060, 1207], "filenames": ["ChangeLog", "include/mbedtls/error.h", "include/mbedtls/ssl.h", "include/mbedtls/x509.h", "include/mbedtls/x509_crt.h", "library/error.c", "library/x509_crt.c", "tests/suites/test_suite_x509parse.data"], "fixing_code_end_loc": [12, 75, 1056, 80, 277, 485, 2317, 1208], "fixing_code_start_loc": [9, 74, 1055, 79, 270, 483, 2060, 1207], "message": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.10:*:*:*:*:*:*:*", "matchCriteriaId": "28621156-2430-447B-8816-47B0FB58245B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.11:*:*:*:*:*:*:*", "matchCriteriaId": "E11BBB2C-0423-47B1-AE12-EB849E17BAF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.12:*:*:*:*:*:*:*", "matchCriteriaId": "4131CE76-6260-412C-A6A6-20B0E978E569", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.13:*:*:*:*:*:*:*", "matchCriteriaId": "DE92D8F7-5705-47B6-B2C2-9DE6C7880647", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.14:*:*:*:*:*:*:*", "matchCriteriaId": "EA50C256-2054-4661-9C42-D31D7D87BAF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.15:*:*:*:*:*:*:*", "matchCriteriaId": "7791D4E9-3FEE-42DA-B320-CF7188A10294", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.16:*:*:*:*:*:*:*", "matchCriteriaId": "BE415DAA-A89F-4204-AC2C-577FCB447E4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.17:*:*:*:*:*:*:*", "matchCriteriaId": "95F691DB-9552-4EBB-B29D-16658561FA4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.18:*:*:*:*:*:*:*", "matchCriteriaId": "F1547B2A-E0D5-41D1-9449-1CCF35022B0E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.19:*:*:*:*:*:*:*", "matchCriteriaId": "CF762122-64BC-4A1A-A26D-81C1270541A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.20:*:*:*:*:*:*:*", "matchCriteriaId": "59D6B559-5F99-4E38-A861-3AB8A7D2E6BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.21:*:*:*:*:*:*:*", "matchCriteriaId": "4A8956C8-6CF0-4C37-84F9-8A89726806C3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "0B395D81-876F-43FC-8DB9-44377647A37A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F92622F1-82DA-4819-8275-06DC9DBE1BA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5871FDE9-02D0-466C-BDB7-90A14C4F637E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE6B4875-3FC3-499F-A76B-2D04982F743A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "B3B67842-5AFA-459F-9CCF-772B9DC7139F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "AD0500EE-52C0-4896-B3D8-5BE731D66039", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "015739E9-C0E3-4A62-BB9D-FA836BFD4351", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "842B0D15-6A3D-4CEE-AD02-49B0436E78E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "3CF6E05C-E6E5-40B8-AFEA-A5ED937F5439", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "D4133C86-70E0-44FD-BBDB-D61EFB31F027", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "6F9D24F0-3892-417F-9C3A-CACEF00C2293", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "8911513E-968C-403E-9D00-2DC0AA82F99B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "48D98945-82BB-4954-AA6D-7D98E4CE1154", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "6378C1CC-7C8F-47E3-A1A7-CDEC76E4CBE4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "525190A3-2194-4E4E-9D34-0048583B9C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "70407352-624A-40E6-82E4-7B4FAFE0C0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "DD52988E-4B2F-41AF-BC25-F38F87D9B8C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "FD1F7803-31F3-40A9-A878-FDC757FCE83F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected."}, {"lang": "es", "value": "ARM mbed TLS en versiones anteriores a la 1.3.21 y en versiones 2.x anteriores a la 2.1.9, si se configura la autenticaci\u00f3n opcional, permite a los atacantes omitir la autenticaci\u00f3n Peer mediante una cadena de certificados X.509 con muchos intermediarios. NOTA: aunque mbed TLS se conoc\u00eda antes como PolarSSL, las versiones lanzadas con el nombre PolarSSL no est\u00e1n afectadas."}], "evaluatorComment": null, "id": "CVE-2017-14032", "lastModified": "2017-11-08T02:29:02.850", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-08-30T20:29:00.337", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.debian.org/security/2017/dsa-3967"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugs.debian.org/873557"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/d15795acd5074e0b44e71f7ede8bdfe1b48591fc"}, {"source": "cve@mitre.org", "tags": ["Vendor Advisory"], "url": "https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2017-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, "type": "CWE-287"}
351
Determine whether the {function_name} code is vulnerable or not.
[ "/**\n * \\file x509.h\n *\n * \\brief X.509 generic defines and structures\n *\n * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved\n * SPDX-License-Identifier: Apache-2.0\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n * not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is part of mbed TLS (https://tls.mbed.org)\n */\n#ifndef MBEDTLS_X509_H\n#define MBEDTLS_X509_H", "#if !defined(MBEDTLS_CONFIG_FILE)\n#include \"config.h\"\n#else\n#include MBEDTLS_CONFIG_FILE\n#endif", "#include \"asn1.h\"\n#include \"pk.h\"", "#if defined(MBEDTLS_RSA_C)\n#include \"rsa.h\"\n#endif", "/**\n * \\addtogroup x509_module\n * \\{\n */", "#if !defined(MBEDTLS_X509_MAX_INTERMEDIATE_CA)\n/**\n * Maximum number of intermediate CAs in a verification chain.\n * That is, maximum length of the chain, excluding the end-entity certificate\n * and the trusted root certificate.\n *\n * Set this to a low value to prevent an adversary from making you waste\n * resources verifying an overlong certificate chain.\n */\n#define MBEDTLS_X509_MAX_INTERMEDIATE_CA 8\n#endif", "/**\n * \\name X509 Error codes\n * \\{\n */\n#define MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE -0x2080 /**< Unavailable feature, e.g. RSA hashing/encryption combination. */\n#define MBEDTLS_ERR_X509_UNKNOWN_OID -0x2100 /**< Requested OID is unknown. */\n#define MBEDTLS_ERR_X509_INVALID_FORMAT -0x2180 /**< The CRT/CRL/CSR format is invalid, e.g. different type expected. */\n#define MBEDTLS_ERR_X509_INVALID_VERSION -0x2200 /**< The CRT/CRL/CSR version element is invalid. */\n#define MBEDTLS_ERR_X509_INVALID_SERIAL -0x2280 /**< The serial tag or value is invalid. */\n#define MBEDTLS_ERR_X509_INVALID_ALG -0x2300 /**< The algorithm tag or value is invalid. */\n#define MBEDTLS_ERR_X509_INVALID_NAME -0x2380 /**< The name tag or value is invalid. */\n#define MBEDTLS_ERR_X509_INVALID_DATE -0x2400 /**< The date tag or value is invalid. */\n#define MBEDTLS_ERR_X509_INVALID_SIGNATURE -0x2480 /**< The signature tag or value invalid. */\n#define MBEDTLS_ERR_X509_INVALID_EXTENSIONS -0x2500 /**< The extension tag or value is invalid. */\n#define MBEDTLS_ERR_X509_UNKNOWN_VERSION -0x2580 /**< CRT/CRL/CSR has an unsupported version number. */\n#define MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG -0x2600 /**< Signature algorithm (oid) is unsupported. */\n#define MBEDTLS_ERR_X509_SIG_MISMATCH -0x2680 /**< Signature algorithms do not match. (see \\c ::mbedtls_x509_crt sig_oid) */\n#define MBEDTLS_ERR_X509_CERT_VERIFY_FAILED -0x2700 /**< Certificate verification failed, e.g. CRL, CA or signature check failed. */\n#define MBEDTLS_ERR_X509_CERT_UNKNOWN_FORMAT -0x2780 /**< Format not recognized as DER or PEM. */\n#define MBEDTLS_ERR_X509_BAD_INPUT_DATA -0x2800 /**< Input invalid. */\n#define MBEDTLS_ERR_X509_ALLOC_FAILED -0x2880 /**< Allocation of memory failed. */\n#define MBEDTLS_ERR_X509_FILE_IO_ERROR -0x2900 /**< Read/write of file failed. */\n#define MBEDTLS_ERR_X509_BUFFER_TOO_SMALL -0x2980 /**< Destination buffer is too small. */", "", "/* \\} name */", "/**\n * \\name X509 Verify codes\n * \\{\n */\n/* Reminder: update x509_crt_verify_strings[] in library/x509_crt.c */\n#define MBEDTLS_X509_BADCERT_EXPIRED 0x01 /**< The certificate validity has expired. */\n#define MBEDTLS_X509_BADCERT_REVOKED 0x02 /**< The certificate has been revoked (is on a CRL). */\n#define MBEDTLS_X509_BADCERT_CN_MISMATCH 0x04 /**< The certificate Common Name (CN) does not match with the expected CN. */\n#define MBEDTLS_X509_BADCERT_NOT_TRUSTED 0x08 /**< The certificate is not correctly signed by the trusted CA. */\n#define MBEDTLS_X509_BADCRL_NOT_TRUSTED 0x10 /**< The CRL is not correctly signed by the trusted CA. */\n#define MBEDTLS_X509_BADCRL_EXPIRED 0x20 /**< The CRL is expired. */\n#define MBEDTLS_X509_BADCERT_MISSING 0x40 /**< Certificate was missing. */\n#define MBEDTLS_X509_BADCERT_SKIP_VERIFY 0x80 /**< Certificate verification was skipped. */\n#define MBEDTLS_X509_BADCERT_OTHER 0x0100 /**< Other reason (can be used by verify callback) */\n#define MBEDTLS_X509_BADCERT_FUTURE 0x0200 /**< The certificate validity starts in the future. */\n#define MBEDTLS_X509_BADCRL_FUTURE 0x0400 /**< The CRL is from the future */\n#define MBEDTLS_X509_BADCERT_KEY_USAGE 0x0800 /**< Usage does not match the keyUsage extension. */\n#define MBEDTLS_X509_BADCERT_EXT_KEY_USAGE 0x1000 /**< Usage does not match the extendedKeyUsage extension. */\n#define MBEDTLS_X509_BADCERT_NS_CERT_TYPE 0x2000 /**< Usage does not match the nsCertType extension. */\n#define MBEDTLS_X509_BADCERT_BAD_MD 0x4000 /**< The certificate is signed with an unacceptable hash. */\n#define MBEDTLS_X509_BADCERT_BAD_PK 0x8000 /**< The certificate is signed with an unacceptable PK alg (eg RSA vs ECDSA). */\n#define MBEDTLS_X509_BADCERT_BAD_KEY 0x010000 /**< The certificate is signed with an unacceptable key (eg bad curve, RSA too short). */\n#define MBEDTLS_X509_BADCRL_BAD_MD 0x020000 /**< The CRL is signed with an unacceptable hash. */\n#define MBEDTLS_X509_BADCRL_BAD_PK 0x040000 /**< The CRL is signed with an unacceptable PK alg (eg RSA vs ECDSA). */\n#define MBEDTLS_X509_BADCRL_BAD_KEY 0x080000 /**< The CRL is signed with an unacceptable key (eg bad curve, RSA too short). */", "/* \\} name */\n/* \\} addtogroup x509_module */", "/*\n * X.509 v3 Key Usage Extension flags\n * Reminder: update x509_info_key_usage() when adding new flags.\n */\n#define MBEDTLS_X509_KU_DIGITAL_SIGNATURE (0x80) /* bit 0 */\n#define MBEDTLS_X509_KU_NON_REPUDIATION (0x40) /* bit 1 */\n#define MBEDTLS_X509_KU_KEY_ENCIPHERMENT (0x20) /* bit 2 */\n#define MBEDTLS_X509_KU_DATA_ENCIPHERMENT (0x10) /* bit 3 */\n#define MBEDTLS_X509_KU_KEY_AGREEMENT (0x08) /* bit 4 */\n#define MBEDTLS_X509_KU_KEY_CERT_SIGN (0x04) /* bit 5 */\n#define MBEDTLS_X509_KU_CRL_SIGN (0x02) /* bit 6 */\n#define MBEDTLS_X509_KU_ENCIPHER_ONLY (0x01) /* bit 7 */\n#define MBEDTLS_X509_KU_DECIPHER_ONLY (0x8000) /* bit 8 */", "/*\n * Netscape certificate types\n * (http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn3.html)\n */", "#define MBEDTLS_X509_NS_CERT_TYPE_SSL_CLIENT (0x80) /* bit 0 */\n#define MBEDTLS_X509_NS_CERT_TYPE_SSL_SERVER (0x40) /* bit 1 */\n#define MBEDTLS_X509_NS_CERT_TYPE_EMAIL (0x20) /* bit 2 */\n#define MBEDTLS_X509_NS_CERT_TYPE_OBJECT_SIGNING (0x10) /* bit 3 */\n#define MBEDTLS_X509_NS_CERT_TYPE_RESERVED (0x08) /* bit 4 */\n#define MBEDTLS_X509_NS_CERT_TYPE_SSL_CA (0x04) /* bit 5 */\n#define MBEDTLS_X509_NS_CERT_TYPE_EMAIL_CA (0x02) /* bit 6 */\n#define MBEDTLS_X509_NS_CERT_TYPE_OBJECT_SIGNING_CA (0x01) /* bit 7 */", "/*\n * X.509 extension types\n *\n * Comments refer to the status for using certificates. Status can be\n * different for writing certificates or reading CRLs or CSRs.\n */\n#define MBEDTLS_X509_EXT_AUTHORITY_KEY_IDENTIFIER (1 << 0)\n#define MBEDTLS_X509_EXT_SUBJECT_KEY_IDENTIFIER (1 << 1)\n#define MBEDTLS_X509_EXT_KEY_USAGE (1 << 2)\n#define MBEDTLS_X509_EXT_CERTIFICATE_POLICIES (1 << 3)\n#define MBEDTLS_X509_EXT_POLICY_MAPPINGS (1 << 4)\n#define MBEDTLS_X509_EXT_SUBJECT_ALT_NAME (1 << 5) /* Supported (DNS) */\n#define MBEDTLS_X509_EXT_ISSUER_ALT_NAME (1 << 6)\n#define MBEDTLS_X509_EXT_SUBJECT_DIRECTORY_ATTRS (1 << 7)\n#define MBEDTLS_X509_EXT_BASIC_CONSTRAINTS (1 << 8) /* Supported */\n#define MBEDTLS_X509_EXT_NAME_CONSTRAINTS (1 << 9)\n#define MBEDTLS_X509_EXT_POLICY_CONSTRAINTS (1 << 10)\n#define MBEDTLS_X509_EXT_EXTENDED_KEY_USAGE (1 << 11)\n#define MBEDTLS_X509_EXT_CRL_DISTRIBUTION_POINTS (1 << 12)\n#define MBEDTLS_X509_EXT_INIHIBIT_ANYPOLICY (1 << 13)\n#define MBEDTLS_X509_EXT_FRESHEST_CRL (1 << 14)", "#define MBEDTLS_X509_EXT_NS_CERT_TYPE (1 << 16)", "/*\n * Storage format identifiers\n * Recognized formats: PEM and DER\n */\n#define MBEDTLS_X509_FORMAT_DER 1\n#define MBEDTLS_X509_FORMAT_PEM 2", "#define MBEDTLS_X509_MAX_DN_NAME_SIZE 256 /**< Maximum value size of a DN entry */", "#ifdef __cplusplus\nextern \"C\" {\n#endif", "/**\n * \\addtogroup x509_module\n * \\{ */", "/**\n * \\name Structures for parsing X.509 certificates, CRLs and CSRs\n * \\{\n */", "/**\n * Type-length-value structure that allows for ASN1 using DER.\n */\ntypedef mbedtls_asn1_buf mbedtls_x509_buf;", "/**\n * Container for ASN1 bit strings.\n */\ntypedef mbedtls_asn1_bitstring mbedtls_x509_bitstring;", "/**\n * Container for ASN1 named information objects.\n * It allows for Relative Distinguished Names (e.g. cn=localhost,ou=code,etc.).\n */\ntypedef mbedtls_asn1_named_data mbedtls_x509_name;", "/**\n * Container for a sequence of ASN.1 items\n */\ntypedef mbedtls_asn1_sequence mbedtls_x509_sequence;", "/** Container for date and time (precision in seconds). */\ntypedef struct mbedtls_x509_time\n{\n int year, mon, day; /**< Date. */\n int hour, min, sec; /**< Time. */\n}\nmbedtls_x509_time;", "/** \\} name Structures for parsing X.509 certificates, CRLs and CSRs */\n/** \\} addtogroup x509_module */", "/**\n * \\brief Store the certificate DN in printable form into buf;\n * no more than size characters will be written.\n *\n * \\param buf Buffer to write to\n * \\param size Maximum size of buffer\n * \\param dn The X509 name to represent\n *\n * \\return The length of the string written (not including the\n * terminated nul byte), or a negative error code.\n */\nint mbedtls_x509_dn_gets( char *buf, size_t size, const mbedtls_x509_name *dn );", "/**\n * \\brief Store the certificate serial in printable form into buf;\n * no more than size characters will be written.\n *\n * \\param buf Buffer to write to\n * \\param size Maximum size of buffer\n * \\param serial The X509 serial to represent\n *\n * \\return The length of the string written (not including the\n * terminated nul byte), or a negative error code.\n */\nint mbedtls_x509_serial_gets( char *buf, size_t size, const mbedtls_x509_buf *serial );", "/**\n * \\brief Check a given mbedtls_x509_time against the system time\n * and tell if it's in the past.\n *\n * \\note Intended usage is \"if( is_past( valid_to ) ) ERROR\".\n * Hence the return value of 1 if on internal errors.\n *\n * \\param time mbedtls_x509_time to check\n *\n * \\return 1 if the given time is in the past or an error occured,\n * 0 otherwise.\n */\nint mbedtls_x509_time_is_past( const mbedtls_x509_time *time );", "/**\n * \\brief Check a given mbedtls_x509_time against the system time\n * and tell if it's in the future.\n *\n * \\note Intended usage is \"if( is_future( valid_from ) ) ERROR\".\n * Hence the return value of 1 if on internal errors.\n *\n * \\param time mbedtls_x509_time to check\n *\n * \\return 1 if the given time is in the future or an error occured,\n * 0 otherwise.\n */\nint mbedtls_x509_time_is_future( const mbedtls_x509_time *time );", "/**\n * \\brief Checkup routine\n *\n * \\return 0 if successful, or 1 if the test failed\n */\nint mbedtls_x509_self_test( int verbose );", "/*\n * Internal module functions. You probably do not want to use these unless you\n * know you do.\n */\nint mbedtls_x509_get_name( unsigned char **p, const unsigned char *end,\n mbedtls_x509_name *cur );\nint mbedtls_x509_get_alg_null( unsigned char **p, const unsigned char *end,\n mbedtls_x509_buf *alg );\nint mbedtls_x509_get_alg( unsigned char **p, const unsigned char *end,\n mbedtls_x509_buf *alg, mbedtls_x509_buf *params );\n#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT)\nint mbedtls_x509_get_rsassa_pss_params( const mbedtls_x509_buf *params,\n mbedtls_md_type_t *md_alg, mbedtls_md_type_t *mgf_md,\n int *salt_len );\n#endif\nint mbedtls_x509_get_sig( unsigned char **p, const unsigned char *end, mbedtls_x509_buf *sig );\nint mbedtls_x509_get_sig_alg( const mbedtls_x509_buf *sig_oid, const mbedtls_x509_buf *sig_params,\n mbedtls_md_type_t *md_alg, mbedtls_pk_type_t *pk_alg,\n void **sig_opts );\nint mbedtls_x509_get_time( unsigned char **p, const unsigned char *end,\n mbedtls_x509_time *time );\nint mbedtls_x509_get_serial( unsigned char **p, const unsigned char *end,\n mbedtls_x509_buf *serial );\nint mbedtls_x509_get_ext( unsigned char **p, const unsigned char *end,\n mbedtls_x509_buf *ext, int tag );\nint mbedtls_x509_sig_alg_gets( char *buf, size_t size, const mbedtls_x509_buf *sig_oid,\n mbedtls_pk_type_t pk_alg, mbedtls_md_type_t md_alg,\n const void *sig_opts );\nint mbedtls_x509_key_size_helper( char *buf, size_t buf_size, const char *name );\nint mbedtls_x509_string_to_names( mbedtls_asn1_named_data **head, const char *name );\nint mbedtls_x509_set_extension( mbedtls_asn1_named_data **head, const char *oid, size_t oid_len,\n int critical, const unsigned char *val,\n size_t val_len );\nint mbedtls_x509_write_extensions( unsigned char **p, unsigned char *start,\n mbedtls_asn1_named_data *first );\nint mbedtls_x509_write_names( unsigned char **p, unsigned char *start,\n mbedtls_asn1_named_data *first );\nint mbedtls_x509_write_sig( unsigned char **p, unsigned char *start,\n const char *oid, size_t oid_len,\n unsigned char *sig, size_t size );", "#define MBEDTLS_X509_SAFE_SNPRINTF \\\n do { \\\n if( ret < 0 || (size_t) ret >= n ) \\\n return( MBEDTLS_ERR_X509_BUFFER_TOO_SMALL ); \\\n \\\n n -= (size_t) ret; \\\n p += (size_t) ret; \\\n } while( 0 )", "#ifdef __cplusplus\n}\n#endif", "#endif /* x509.h */" ]
[ 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [8, 75, 1056, 78, 271, 482, 2312, 1208], "buggy_code_start_loc": [8, 74, 1055, 78, 270, 482, 2060, 1207], "filenames": ["ChangeLog", "include/mbedtls/error.h", "include/mbedtls/ssl.h", "include/mbedtls/x509.h", "include/mbedtls/x509_crt.h", "library/error.c", "library/x509_crt.c", "tests/suites/test_suite_x509parse.data"], "fixing_code_end_loc": [12, 75, 1056, 80, 277, 485, 2317, 1208], "fixing_code_start_loc": [9, 74, 1055, 79, 270, 483, 2060, 1207], "message": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.10:*:*:*:*:*:*:*", "matchCriteriaId": "28621156-2430-447B-8816-47B0FB58245B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.11:*:*:*:*:*:*:*", "matchCriteriaId": "E11BBB2C-0423-47B1-AE12-EB849E17BAF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.12:*:*:*:*:*:*:*", "matchCriteriaId": "4131CE76-6260-412C-A6A6-20B0E978E569", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.13:*:*:*:*:*:*:*", "matchCriteriaId": "DE92D8F7-5705-47B6-B2C2-9DE6C7880647", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.14:*:*:*:*:*:*:*", "matchCriteriaId": "EA50C256-2054-4661-9C42-D31D7D87BAF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.15:*:*:*:*:*:*:*", "matchCriteriaId": "7791D4E9-3FEE-42DA-B320-CF7188A10294", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.16:*:*:*:*:*:*:*", "matchCriteriaId": "BE415DAA-A89F-4204-AC2C-577FCB447E4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.17:*:*:*:*:*:*:*", "matchCriteriaId": "95F691DB-9552-4EBB-B29D-16658561FA4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.18:*:*:*:*:*:*:*", "matchCriteriaId": "F1547B2A-E0D5-41D1-9449-1CCF35022B0E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.19:*:*:*:*:*:*:*", "matchCriteriaId": "CF762122-64BC-4A1A-A26D-81C1270541A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.20:*:*:*:*:*:*:*", "matchCriteriaId": "59D6B559-5F99-4E38-A861-3AB8A7D2E6BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.21:*:*:*:*:*:*:*", "matchCriteriaId": "4A8956C8-6CF0-4C37-84F9-8A89726806C3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "0B395D81-876F-43FC-8DB9-44377647A37A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F92622F1-82DA-4819-8275-06DC9DBE1BA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5871FDE9-02D0-466C-BDB7-90A14C4F637E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE6B4875-3FC3-499F-A76B-2D04982F743A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "B3B67842-5AFA-459F-9CCF-772B9DC7139F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "AD0500EE-52C0-4896-B3D8-5BE731D66039", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "015739E9-C0E3-4A62-BB9D-FA836BFD4351", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "842B0D15-6A3D-4CEE-AD02-49B0436E78E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "3CF6E05C-E6E5-40B8-AFEA-A5ED937F5439", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "D4133C86-70E0-44FD-BBDB-D61EFB31F027", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "6F9D24F0-3892-417F-9C3A-CACEF00C2293", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "8911513E-968C-403E-9D00-2DC0AA82F99B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "48D98945-82BB-4954-AA6D-7D98E4CE1154", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "6378C1CC-7C8F-47E3-A1A7-CDEC76E4CBE4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "525190A3-2194-4E4E-9D34-0048583B9C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "70407352-624A-40E6-82E4-7B4FAFE0C0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "DD52988E-4B2F-41AF-BC25-F38F87D9B8C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "FD1F7803-31F3-40A9-A878-FDC757FCE83F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected."}, {"lang": "es", "value": "ARM mbed TLS en versiones anteriores a la 1.3.21 y en versiones 2.x anteriores a la 2.1.9, si se configura la autenticaci\u00f3n opcional, permite a los atacantes omitir la autenticaci\u00f3n Peer mediante una cadena de certificados X.509 con muchos intermediarios. NOTA: aunque mbed TLS se conoc\u00eda antes como PolarSSL, las versiones lanzadas con el nombre PolarSSL no est\u00e1n afectadas."}], "evaluatorComment": null, "id": "CVE-2017-14032", "lastModified": "2017-11-08T02:29:02.850", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-08-30T20:29:00.337", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.debian.org/security/2017/dsa-3967"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugs.debian.org/873557"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/d15795acd5074e0b44e71f7ede8bdfe1b48591fc"}, {"source": "cve@mitre.org", "tags": ["Vendor Advisory"], "url": "https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2017-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, "type": "CWE-287"}
351
Determine whether the {function_name} code is vulnerable or not.
[ "/**\n * \\file x509.h\n *\n * \\brief X.509 generic defines and structures\n *\n * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved\n * SPDX-License-Identifier: Apache-2.0\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n * not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is part of mbed TLS (https://tls.mbed.org)\n */\n#ifndef MBEDTLS_X509_H\n#define MBEDTLS_X509_H", "#if !defined(MBEDTLS_CONFIG_FILE)\n#include \"config.h\"\n#else\n#include MBEDTLS_CONFIG_FILE\n#endif", "#include \"asn1.h\"\n#include \"pk.h\"", "#if defined(MBEDTLS_RSA_C)\n#include \"rsa.h\"\n#endif", "/**\n * \\addtogroup x509_module\n * \\{\n */", "#if !defined(MBEDTLS_X509_MAX_INTERMEDIATE_CA)\n/**\n * Maximum number of intermediate CAs in a verification chain.\n * That is, maximum length of the chain, excluding the end-entity certificate\n * and the trusted root certificate.\n *\n * Set this to a low value to prevent an adversary from making you waste\n * resources verifying an overlong certificate chain.\n */\n#define MBEDTLS_X509_MAX_INTERMEDIATE_CA 8\n#endif", "/**\n * \\name X509 Error codes\n * \\{\n */\n#define MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE -0x2080 /**< Unavailable feature, e.g. RSA hashing/encryption combination. */\n#define MBEDTLS_ERR_X509_UNKNOWN_OID -0x2100 /**< Requested OID is unknown. */\n#define MBEDTLS_ERR_X509_INVALID_FORMAT -0x2180 /**< The CRT/CRL/CSR format is invalid, e.g. different type expected. */\n#define MBEDTLS_ERR_X509_INVALID_VERSION -0x2200 /**< The CRT/CRL/CSR version element is invalid. */\n#define MBEDTLS_ERR_X509_INVALID_SERIAL -0x2280 /**< The serial tag or value is invalid. */\n#define MBEDTLS_ERR_X509_INVALID_ALG -0x2300 /**< The algorithm tag or value is invalid. */\n#define MBEDTLS_ERR_X509_INVALID_NAME -0x2380 /**< The name tag or value is invalid. */\n#define MBEDTLS_ERR_X509_INVALID_DATE -0x2400 /**< The date tag or value is invalid. */\n#define MBEDTLS_ERR_X509_INVALID_SIGNATURE -0x2480 /**< The signature tag or value invalid. */\n#define MBEDTLS_ERR_X509_INVALID_EXTENSIONS -0x2500 /**< The extension tag or value is invalid. */\n#define MBEDTLS_ERR_X509_UNKNOWN_VERSION -0x2580 /**< CRT/CRL/CSR has an unsupported version number. */\n#define MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG -0x2600 /**< Signature algorithm (oid) is unsupported. */\n#define MBEDTLS_ERR_X509_SIG_MISMATCH -0x2680 /**< Signature algorithms do not match. (see \\c ::mbedtls_x509_crt sig_oid) */\n#define MBEDTLS_ERR_X509_CERT_VERIFY_FAILED -0x2700 /**< Certificate verification failed, e.g. CRL, CA or signature check failed. */\n#define MBEDTLS_ERR_X509_CERT_UNKNOWN_FORMAT -0x2780 /**< Format not recognized as DER or PEM. */\n#define MBEDTLS_ERR_X509_BAD_INPUT_DATA -0x2800 /**< Input invalid. */\n#define MBEDTLS_ERR_X509_ALLOC_FAILED -0x2880 /**< Allocation of memory failed. */\n#define MBEDTLS_ERR_X509_FILE_IO_ERROR -0x2900 /**< Read/write of file failed. */\n#define MBEDTLS_ERR_X509_BUFFER_TOO_SMALL -0x2980 /**< Destination buffer is too small. */", "#define MBEDTLS_ERR_X509_FATAL_ERROR -0x3000 /**< A fatal error occured, eg the chain is too long or the vrfy callback failed. */", "/* \\} name */", "/**\n * \\name X509 Verify codes\n * \\{\n */\n/* Reminder: update x509_crt_verify_strings[] in library/x509_crt.c */\n#define MBEDTLS_X509_BADCERT_EXPIRED 0x01 /**< The certificate validity has expired. */\n#define MBEDTLS_X509_BADCERT_REVOKED 0x02 /**< The certificate has been revoked (is on a CRL). */\n#define MBEDTLS_X509_BADCERT_CN_MISMATCH 0x04 /**< The certificate Common Name (CN) does not match with the expected CN. */\n#define MBEDTLS_X509_BADCERT_NOT_TRUSTED 0x08 /**< The certificate is not correctly signed by the trusted CA. */\n#define MBEDTLS_X509_BADCRL_NOT_TRUSTED 0x10 /**< The CRL is not correctly signed by the trusted CA. */\n#define MBEDTLS_X509_BADCRL_EXPIRED 0x20 /**< The CRL is expired. */\n#define MBEDTLS_X509_BADCERT_MISSING 0x40 /**< Certificate was missing. */\n#define MBEDTLS_X509_BADCERT_SKIP_VERIFY 0x80 /**< Certificate verification was skipped. */\n#define MBEDTLS_X509_BADCERT_OTHER 0x0100 /**< Other reason (can be used by verify callback) */\n#define MBEDTLS_X509_BADCERT_FUTURE 0x0200 /**< The certificate validity starts in the future. */\n#define MBEDTLS_X509_BADCRL_FUTURE 0x0400 /**< The CRL is from the future */\n#define MBEDTLS_X509_BADCERT_KEY_USAGE 0x0800 /**< Usage does not match the keyUsage extension. */\n#define MBEDTLS_X509_BADCERT_EXT_KEY_USAGE 0x1000 /**< Usage does not match the extendedKeyUsage extension. */\n#define MBEDTLS_X509_BADCERT_NS_CERT_TYPE 0x2000 /**< Usage does not match the nsCertType extension. */\n#define MBEDTLS_X509_BADCERT_BAD_MD 0x4000 /**< The certificate is signed with an unacceptable hash. */\n#define MBEDTLS_X509_BADCERT_BAD_PK 0x8000 /**< The certificate is signed with an unacceptable PK alg (eg RSA vs ECDSA). */\n#define MBEDTLS_X509_BADCERT_BAD_KEY 0x010000 /**< The certificate is signed with an unacceptable key (eg bad curve, RSA too short). */\n#define MBEDTLS_X509_BADCRL_BAD_MD 0x020000 /**< The CRL is signed with an unacceptable hash. */\n#define MBEDTLS_X509_BADCRL_BAD_PK 0x040000 /**< The CRL is signed with an unacceptable PK alg (eg RSA vs ECDSA). */\n#define MBEDTLS_X509_BADCRL_BAD_KEY 0x080000 /**< The CRL is signed with an unacceptable key (eg bad curve, RSA too short). */", "/* \\} name */\n/* \\} addtogroup x509_module */", "/*\n * X.509 v3 Key Usage Extension flags\n * Reminder: update x509_info_key_usage() when adding new flags.\n */\n#define MBEDTLS_X509_KU_DIGITAL_SIGNATURE (0x80) /* bit 0 */\n#define MBEDTLS_X509_KU_NON_REPUDIATION (0x40) /* bit 1 */\n#define MBEDTLS_X509_KU_KEY_ENCIPHERMENT (0x20) /* bit 2 */\n#define MBEDTLS_X509_KU_DATA_ENCIPHERMENT (0x10) /* bit 3 */\n#define MBEDTLS_X509_KU_KEY_AGREEMENT (0x08) /* bit 4 */\n#define MBEDTLS_X509_KU_KEY_CERT_SIGN (0x04) /* bit 5 */\n#define MBEDTLS_X509_KU_CRL_SIGN (0x02) /* bit 6 */\n#define MBEDTLS_X509_KU_ENCIPHER_ONLY (0x01) /* bit 7 */\n#define MBEDTLS_X509_KU_DECIPHER_ONLY (0x8000) /* bit 8 */", "/*\n * Netscape certificate types\n * (http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn3.html)\n */", "#define MBEDTLS_X509_NS_CERT_TYPE_SSL_CLIENT (0x80) /* bit 0 */\n#define MBEDTLS_X509_NS_CERT_TYPE_SSL_SERVER (0x40) /* bit 1 */\n#define MBEDTLS_X509_NS_CERT_TYPE_EMAIL (0x20) /* bit 2 */\n#define MBEDTLS_X509_NS_CERT_TYPE_OBJECT_SIGNING (0x10) /* bit 3 */\n#define MBEDTLS_X509_NS_CERT_TYPE_RESERVED (0x08) /* bit 4 */\n#define MBEDTLS_X509_NS_CERT_TYPE_SSL_CA (0x04) /* bit 5 */\n#define MBEDTLS_X509_NS_CERT_TYPE_EMAIL_CA (0x02) /* bit 6 */\n#define MBEDTLS_X509_NS_CERT_TYPE_OBJECT_SIGNING_CA (0x01) /* bit 7 */", "/*\n * X.509 extension types\n *\n * Comments refer to the status for using certificates. Status can be\n * different for writing certificates or reading CRLs or CSRs.\n */\n#define MBEDTLS_X509_EXT_AUTHORITY_KEY_IDENTIFIER (1 << 0)\n#define MBEDTLS_X509_EXT_SUBJECT_KEY_IDENTIFIER (1 << 1)\n#define MBEDTLS_X509_EXT_KEY_USAGE (1 << 2)\n#define MBEDTLS_X509_EXT_CERTIFICATE_POLICIES (1 << 3)\n#define MBEDTLS_X509_EXT_POLICY_MAPPINGS (1 << 4)\n#define MBEDTLS_X509_EXT_SUBJECT_ALT_NAME (1 << 5) /* Supported (DNS) */\n#define MBEDTLS_X509_EXT_ISSUER_ALT_NAME (1 << 6)\n#define MBEDTLS_X509_EXT_SUBJECT_DIRECTORY_ATTRS (1 << 7)\n#define MBEDTLS_X509_EXT_BASIC_CONSTRAINTS (1 << 8) /* Supported */\n#define MBEDTLS_X509_EXT_NAME_CONSTRAINTS (1 << 9)\n#define MBEDTLS_X509_EXT_POLICY_CONSTRAINTS (1 << 10)\n#define MBEDTLS_X509_EXT_EXTENDED_KEY_USAGE (1 << 11)\n#define MBEDTLS_X509_EXT_CRL_DISTRIBUTION_POINTS (1 << 12)\n#define MBEDTLS_X509_EXT_INIHIBIT_ANYPOLICY (1 << 13)\n#define MBEDTLS_X509_EXT_FRESHEST_CRL (1 << 14)", "#define MBEDTLS_X509_EXT_NS_CERT_TYPE (1 << 16)", "/*\n * Storage format identifiers\n * Recognized formats: PEM and DER\n */\n#define MBEDTLS_X509_FORMAT_DER 1\n#define MBEDTLS_X509_FORMAT_PEM 2", "#define MBEDTLS_X509_MAX_DN_NAME_SIZE 256 /**< Maximum value size of a DN entry */", "#ifdef __cplusplus\nextern \"C\" {\n#endif", "/**\n * \\addtogroup x509_module\n * \\{ */", "/**\n * \\name Structures for parsing X.509 certificates, CRLs and CSRs\n * \\{\n */", "/**\n * Type-length-value structure that allows for ASN1 using DER.\n */\ntypedef mbedtls_asn1_buf mbedtls_x509_buf;", "/**\n * Container for ASN1 bit strings.\n */\ntypedef mbedtls_asn1_bitstring mbedtls_x509_bitstring;", "/**\n * Container for ASN1 named information objects.\n * It allows for Relative Distinguished Names (e.g. cn=localhost,ou=code,etc.).\n */\ntypedef mbedtls_asn1_named_data mbedtls_x509_name;", "/**\n * Container for a sequence of ASN.1 items\n */\ntypedef mbedtls_asn1_sequence mbedtls_x509_sequence;", "/** Container for date and time (precision in seconds). */\ntypedef struct mbedtls_x509_time\n{\n int year, mon, day; /**< Date. */\n int hour, min, sec; /**< Time. */\n}\nmbedtls_x509_time;", "/** \\} name Structures for parsing X.509 certificates, CRLs and CSRs */\n/** \\} addtogroup x509_module */", "/**\n * \\brief Store the certificate DN in printable form into buf;\n * no more than size characters will be written.\n *\n * \\param buf Buffer to write to\n * \\param size Maximum size of buffer\n * \\param dn The X509 name to represent\n *\n * \\return The length of the string written (not including the\n * terminated nul byte), or a negative error code.\n */\nint mbedtls_x509_dn_gets( char *buf, size_t size, const mbedtls_x509_name *dn );", "/**\n * \\brief Store the certificate serial in printable form into buf;\n * no more than size characters will be written.\n *\n * \\param buf Buffer to write to\n * \\param size Maximum size of buffer\n * \\param serial The X509 serial to represent\n *\n * \\return The length of the string written (not including the\n * terminated nul byte), or a negative error code.\n */\nint mbedtls_x509_serial_gets( char *buf, size_t size, const mbedtls_x509_buf *serial );", "/**\n * \\brief Check a given mbedtls_x509_time against the system time\n * and tell if it's in the past.\n *\n * \\note Intended usage is \"if( is_past( valid_to ) ) ERROR\".\n * Hence the return value of 1 if on internal errors.\n *\n * \\param time mbedtls_x509_time to check\n *\n * \\return 1 if the given time is in the past or an error occured,\n * 0 otherwise.\n */\nint mbedtls_x509_time_is_past( const mbedtls_x509_time *time );", "/**\n * \\brief Check a given mbedtls_x509_time against the system time\n * and tell if it's in the future.\n *\n * \\note Intended usage is \"if( is_future( valid_from ) ) ERROR\".\n * Hence the return value of 1 if on internal errors.\n *\n * \\param time mbedtls_x509_time to check\n *\n * \\return 1 if the given time is in the future or an error occured,\n * 0 otherwise.\n */\nint mbedtls_x509_time_is_future( const mbedtls_x509_time *time );", "/**\n * \\brief Checkup routine\n *\n * \\return 0 if successful, or 1 if the test failed\n */\nint mbedtls_x509_self_test( int verbose );", "/*\n * Internal module functions. You probably do not want to use these unless you\n * know you do.\n */\nint mbedtls_x509_get_name( unsigned char **p, const unsigned char *end,\n mbedtls_x509_name *cur );\nint mbedtls_x509_get_alg_null( unsigned char **p, const unsigned char *end,\n mbedtls_x509_buf *alg );\nint mbedtls_x509_get_alg( unsigned char **p, const unsigned char *end,\n mbedtls_x509_buf *alg, mbedtls_x509_buf *params );\n#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT)\nint mbedtls_x509_get_rsassa_pss_params( const mbedtls_x509_buf *params,\n mbedtls_md_type_t *md_alg, mbedtls_md_type_t *mgf_md,\n int *salt_len );\n#endif\nint mbedtls_x509_get_sig( unsigned char **p, const unsigned char *end, mbedtls_x509_buf *sig );\nint mbedtls_x509_get_sig_alg( const mbedtls_x509_buf *sig_oid, const mbedtls_x509_buf *sig_params,\n mbedtls_md_type_t *md_alg, mbedtls_pk_type_t *pk_alg,\n void **sig_opts );\nint mbedtls_x509_get_time( unsigned char **p, const unsigned char *end,\n mbedtls_x509_time *time );\nint mbedtls_x509_get_serial( unsigned char **p, const unsigned char *end,\n mbedtls_x509_buf *serial );\nint mbedtls_x509_get_ext( unsigned char **p, const unsigned char *end,\n mbedtls_x509_buf *ext, int tag );\nint mbedtls_x509_sig_alg_gets( char *buf, size_t size, const mbedtls_x509_buf *sig_oid,\n mbedtls_pk_type_t pk_alg, mbedtls_md_type_t md_alg,\n const void *sig_opts );\nint mbedtls_x509_key_size_helper( char *buf, size_t buf_size, const char *name );\nint mbedtls_x509_string_to_names( mbedtls_asn1_named_data **head, const char *name );\nint mbedtls_x509_set_extension( mbedtls_asn1_named_data **head, const char *oid, size_t oid_len,\n int critical, const unsigned char *val,\n size_t val_len );\nint mbedtls_x509_write_extensions( unsigned char **p, unsigned char *start,\n mbedtls_asn1_named_data *first );\nint mbedtls_x509_write_names( unsigned char **p, unsigned char *start,\n mbedtls_asn1_named_data *first );\nint mbedtls_x509_write_sig( unsigned char **p, unsigned char *start,\n const char *oid, size_t oid_len,\n unsigned char *sig, size_t size );", "#define MBEDTLS_X509_SAFE_SNPRINTF \\\n do { \\\n if( ret < 0 || (size_t) ret >= n ) \\\n return( MBEDTLS_ERR_X509_BUFFER_TOO_SMALL ); \\\n \\\n n -= (size_t) ret; \\\n p += (size_t) ret; \\\n } while( 0 )", "#ifdef __cplusplus\n}\n#endif", "#endif /* x509.h */" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [8, 75, 1056, 78, 271, 482, 2312, 1208], "buggy_code_start_loc": [8, 74, 1055, 78, 270, 482, 2060, 1207], "filenames": ["ChangeLog", "include/mbedtls/error.h", "include/mbedtls/ssl.h", "include/mbedtls/x509.h", "include/mbedtls/x509_crt.h", "library/error.c", "library/x509_crt.c", "tests/suites/test_suite_x509parse.data"], "fixing_code_end_loc": [12, 75, 1056, 80, 277, 485, 2317, 1208], "fixing_code_start_loc": [9, 74, 1055, 79, 270, 483, 2060, 1207], "message": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.10:*:*:*:*:*:*:*", "matchCriteriaId": "28621156-2430-447B-8816-47B0FB58245B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.11:*:*:*:*:*:*:*", "matchCriteriaId": "E11BBB2C-0423-47B1-AE12-EB849E17BAF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.12:*:*:*:*:*:*:*", "matchCriteriaId": "4131CE76-6260-412C-A6A6-20B0E978E569", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.13:*:*:*:*:*:*:*", "matchCriteriaId": "DE92D8F7-5705-47B6-B2C2-9DE6C7880647", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.14:*:*:*:*:*:*:*", "matchCriteriaId": "EA50C256-2054-4661-9C42-D31D7D87BAF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.15:*:*:*:*:*:*:*", "matchCriteriaId": "7791D4E9-3FEE-42DA-B320-CF7188A10294", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.16:*:*:*:*:*:*:*", "matchCriteriaId": "BE415DAA-A89F-4204-AC2C-577FCB447E4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.17:*:*:*:*:*:*:*", "matchCriteriaId": "95F691DB-9552-4EBB-B29D-16658561FA4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.18:*:*:*:*:*:*:*", "matchCriteriaId": "F1547B2A-E0D5-41D1-9449-1CCF35022B0E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.19:*:*:*:*:*:*:*", "matchCriteriaId": "CF762122-64BC-4A1A-A26D-81C1270541A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.20:*:*:*:*:*:*:*", "matchCriteriaId": "59D6B559-5F99-4E38-A861-3AB8A7D2E6BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.21:*:*:*:*:*:*:*", "matchCriteriaId": "4A8956C8-6CF0-4C37-84F9-8A89726806C3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "0B395D81-876F-43FC-8DB9-44377647A37A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F92622F1-82DA-4819-8275-06DC9DBE1BA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5871FDE9-02D0-466C-BDB7-90A14C4F637E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE6B4875-3FC3-499F-A76B-2D04982F743A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "B3B67842-5AFA-459F-9CCF-772B9DC7139F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "AD0500EE-52C0-4896-B3D8-5BE731D66039", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "015739E9-C0E3-4A62-BB9D-FA836BFD4351", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "842B0D15-6A3D-4CEE-AD02-49B0436E78E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "3CF6E05C-E6E5-40B8-AFEA-A5ED937F5439", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "D4133C86-70E0-44FD-BBDB-D61EFB31F027", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "6F9D24F0-3892-417F-9C3A-CACEF00C2293", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "8911513E-968C-403E-9D00-2DC0AA82F99B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "48D98945-82BB-4954-AA6D-7D98E4CE1154", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "6378C1CC-7C8F-47E3-A1A7-CDEC76E4CBE4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "525190A3-2194-4E4E-9D34-0048583B9C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "70407352-624A-40E6-82E4-7B4FAFE0C0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "DD52988E-4B2F-41AF-BC25-F38F87D9B8C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "FD1F7803-31F3-40A9-A878-FDC757FCE83F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected."}, {"lang": "es", "value": "ARM mbed TLS en versiones anteriores a la 1.3.21 y en versiones 2.x anteriores a la 2.1.9, si se configura la autenticaci\u00f3n opcional, permite a los atacantes omitir la autenticaci\u00f3n Peer mediante una cadena de certificados X.509 con muchos intermediarios. NOTA: aunque mbed TLS se conoc\u00eda antes como PolarSSL, las versiones lanzadas con el nombre PolarSSL no est\u00e1n afectadas."}], "evaluatorComment": null, "id": "CVE-2017-14032", "lastModified": "2017-11-08T02:29:02.850", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-08-30T20:29:00.337", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.debian.org/security/2017/dsa-3967"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugs.debian.org/873557"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/d15795acd5074e0b44e71f7ede8bdfe1b48591fc"}, {"source": "cve@mitre.org", "tags": ["Vendor Advisory"], "url": "https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2017-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, "type": "CWE-287"}
351
Determine whether the {function_name} code is vulnerable or not.
[ "/**\n * \\file x509_crt.h\n *\n * \\brief X.509 certificate parsing and writing\n *\n * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved\n * SPDX-License-Identifier: Apache-2.0\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n * not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is part of mbed TLS (https://tls.mbed.org)\n */\n#ifndef MBEDTLS_X509_CRT_H\n#define MBEDTLS_X509_CRT_H", "#if !defined(MBEDTLS_CONFIG_FILE)\n#include \"config.h\"\n#else\n#include MBEDTLS_CONFIG_FILE\n#endif", "#include \"x509.h\"\n#include \"x509_crl.h\"", "/**\n * \\addtogroup x509_module\n * \\{\n */", "#ifdef __cplusplus\nextern \"C\" {\n#endif", "/**\n * \\name Structures and functions for parsing and writing X.509 certificates\n * \\{\n */", "/**\n * Container for an X.509 certificate. The certificate may be chained.\n */\ntypedef struct mbedtls_x509_crt\n{\n mbedtls_x509_buf raw; /**< The raw certificate data (DER). */\n mbedtls_x509_buf tbs; /**< The raw certificate body (DER). The part that is To Be Signed. */", " int version; /**< The X.509 version. (1=v1, 2=v2, 3=v3) */\n mbedtls_x509_buf serial; /**< Unique id for certificate issued by a specific CA. */\n mbedtls_x509_buf sig_oid; /**< Signature algorithm, e.g. sha1RSA */", " mbedtls_x509_buf issuer_raw; /**< The raw issuer data (DER). Used for quick comparison. */\n mbedtls_x509_buf subject_raw; /**< The raw subject data (DER). Used for quick comparison. */", " mbedtls_x509_name issuer; /**< The parsed issuer data (named information object). */\n mbedtls_x509_name subject; /**< The parsed subject data (named information object). */", " mbedtls_x509_time valid_from; /**< Start time of certificate validity. */\n mbedtls_x509_time valid_to; /**< End time of certificate validity. */", " mbedtls_pk_context pk; /**< Container for the public key context. */", " mbedtls_x509_buf issuer_id; /**< Optional X.509 v2/v3 issuer unique identifier. */\n mbedtls_x509_buf subject_id; /**< Optional X.509 v2/v3 subject unique identifier. */\n mbedtls_x509_buf v3_ext; /**< Optional X.509 v3 extensions. */\n mbedtls_x509_sequence subject_alt_names; /**< Optional list of Subject Alternative Names (Only dNSName supported). */", " int ext_types; /**< Bit string containing detected and parsed extensions */\n int ca_istrue; /**< Optional Basic Constraint extension value: 1 if this certificate belongs to a CA, 0 otherwise. */\n int max_pathlen; /**< Optional Basic Constraint extension value: The maximum path length to the root certificate. Path length is 1 higher than RFC 5280 'meaning', so 1+ */", " unsigned int key_usage; /**< Optional key usage extension value: See the values in x509.h */", " mbedtls_x509_sequence ext_key_usage; /**< Optional list of extended key usage OIDs. */", " unsigned char ns_cert_type; /**< Optional Netscape certificate type extension value: See the values in x509.h */", " mbedtls_x509_buf sig; /**< Signature: hash of the tbs part signed with the private key. */\n mbedtls_md_type_t sig_md; /**< Internal representation of the MD algorithm of the signature algorithm, e.g. MBEDTLS_MD_SHA256 */\n mbedtls_pk_type_t sig_pk; /**< Internal representation of the Public Key algorithm of the signature algorithm, e.g. MBEDTLS_PK_RSA */\n void *sig_opts; /**< Signature options to be passed to mbedtls_pk_verify_ext(), e.g. for RSASSA-PSS */", " struct mbedtls_x509_crt *next; /**< Next certificate in the CA-chain. */\n}\nmbedtls_x509_crt;", "/**\n * Build flag from an algorithm/curve identifier (pk, md, ecp)\n * Since 0 is always XXX_NONE, ignore it.\n */\n#define MBEDTLS_X509_ID_FLAG( id ) ( 1 << ( id - 1 ) )", "/**\n * Security profile for certificate verification.\n *\n * All lists are bitfields, built by ORing flags from MBEDTLS_X509_ID_FLAG().\n */\ntypedef struct\n{\n uint32_t allowed_mds; /**< MDs for signatures */\n uint32_t allowed_pks; /**< PK algs for signatures */\n uint32_t allowed_curves; /**< Elliptic curves for ECDSA */\n uint32_t rsa_min_bitlen; /**< Minimum size for RSA keys */\n}\nmbedtls_x509_crt_profile;", "#define MBEDTLS_X509_CRT_VERSION_1 0\n#define MBEDTLS_X509_CRT_VERSION_2 1\n#define MBEDTLS_X509_CRT_VERSION_3 2", "#define MBEDTLS_X509_RFC5280_MAX_SERIAL_LEN 32\n#define MBEDTLS_X509_RFC5280_UTC_TIME_LEN 15", "#if !defined( MBEDTLS_X509_MAX_FILE_PATH_LEN )\n#define MBEDTLS_X509_MAX_FILE_PATH_LEN 512\n#endif", "/**\n * Container for writing a certificate (CRT)\n */\ntypedef struct mbedtls_x509write_cert\n{\n int version;\n mbedtls_mpi serial;\n mbedtls_pk_context *subject_key;\n mbedtls_pk_context *issuer_key;\n mbedtls_asn1_named_data *subject;\n mbedtls_asn1_named_data *issuer;\n mbedtls_md_type_t md_alg;\n char not_before[MBEDTLS_X509_RFC5280_UTC_TIME_LEN + 1];\n char not_after[MBEDTLS_X509_RFC5280_UTC_TIME_LEN + 1];\n mbedtls_asn1_named_data *extensions;\n}\nmbedtls_x509write_cert;", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n/**\n * Default security profile. Should provide a good balance between security\n * and compatibility with current deployments.\n */\nextern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_default;", "/**\n * Expected next default profile. Recommended for new deployments.\n * Currently targets a 128-bit security level, except for RSA-2048.\n */\nextern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_next;", "/**\n * NSA Suite B profile.\n */\nextern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_suiteb;", "/**\n * \\brief Parse a single DER formatted certificate and add it\n * to the chained list.\n *\n * \\param chain points to the start of the chain\n * \\param buf buffer holding the certificate DER data\n * \\param buflen size of the buffer\n *\n * \\return 0 if successful, or a specific X509 or PEM error code\n */\nint mbedtls_x509_crt_parse_der( mbedtls_x509_crt *chain, const unsigned char *buf,\n size_t buflen );", "/**\n * \\brief Parse one or more certificates and add them\n * to the chained list. Parses permissively. If some\n * certificates can be parsed, the result is the number\n * of failed certificates it encountered. If none complete\n * correctly, the first error is returned.\n *\n * \\param chain points to the start of the chain\n * \\param buf buffer holding the certificate data in PEM or DER format\n * \\param buflen size of the buffer\n * (including the terminating null byte for PEM data)\n *\n * \\return 0 if all certificates parsed successfully, a positive number\n * if partly successful or a specific X509 or PEM error code\n */\nint mbedtls_x509_crt_parse( mbedtls_x509_crt *chain, const unsigned char *buf, size_t buflen );", "#if defined(MBEDTLS_FS_IO)\n/**\n * \\brief Load one or more certificates and add them\n * to the chained list. Parses permissively. If some\n * certificates can be parsed, the result is the number\n * of failed certificates it encountered. If none complete\n * correctly, the first error is returned.\n *\n * \\param chain points to the start of the chain\n * \\param path filename to read the certificates from\n *\n * \\return 0 if all certificates parsed successfully, a positive number\n * if partly successful or a specific X509 or PEM error code\n */\nint mbedtls_x509_crt_parse_file( mbedtls_x509_crt *chain, const char *path );", "/**\n * \\brief Load one or more certificate files from a path and add them\n * to the chained list. Parses permissively. If some\n * certificates can be parsed, the result is the number\n * of failed certificates it encountered. If none complete\n * correctly, the first error is returned.\n *\n * \\param chain points to the start of the chain\n * \\param path directory / folder to read the certificate files from\n *\n * \\return 0 if all certificates parsed successfully, a positive number\n * if partly successful or a specific X509 or PEM error code\n */\nint mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path );\n#endif /* MBEDTLS_FS_IO */", "/**\n * \\brief Returns an informational string about the\n * certificate.\n *\n * \\param buf Buffer to write to\n * \\param size Maximum size of buffer\n * \\param prefix A line prefix\n * \\param crt The X509 certificate to represent\n *\n * \\return The length of the string written (not including the\n * terminated nul byte), or a negative error code.\n */\nint mbedtls_x509_crt_info( char *buf, size_t size, const char *prefix,\n const mbedtls_x509_crt *crt );", "/**\n * \\brief Returns an informational string about the\n * verification status of a certificate.\n *\n * \\param buf Buffer to write to\n * \\param size Maximum size of buffer\n * \\param prefix A line prefix\n * \\param flags Verification flags created by mbedtls_x509_crt_verify()\n *\n * \\return The length of the string written (not including the\n * terminated nul byte), or a negative error code.\n */\nint mbedtls_x509_crt_verify_info( char *buf, size_t size, const char *prefix,\n uint32_t flags );", "/**\n * \\brief Verify the certificate signature\n *\n * The verify callback is a user-supplied callback that\n * can clear / modify / add flags for a certificate. If set,\n * the verification callback is called for each\n * certificate in the chain (from the trust-ca down to the\n * presented crt). The parameters for the callback are:\n * (void *parameter, mbedtls_x509_crt *crt, int certificate_depth,\n * int *flags). With the flags representing current flags for\n * that specific certificate and the certificate depth from\n * the bottom (Peer cert depth = 0).\n *\n * All flags left after returning from the callback\n * are also returned to the application. The function should", " * return 0 for anything but a fatal error.", " *\n * \\note In case verification failed, the results can be displayed\n * using \\c mbedtls_x509_crt_verify_info()\n *\n * \\note Same as \\c mbedtls_x509_crt_verify_with_profile() with the\n * default security profile.\n *\n * \\note It is your responsibility to provide up-to-date CRLs for\n * all trusted CAs. If no CRL is provided for the CA that was\n * used to sign the certificate, CRL verification is skipped\n * silently, that is *without* setting any flag.\n *\n * \\param crt a certificate (chain) to be verified\n * \\param trust_ca the list of trusted CAs\n * \\param ca_crl the list of CRLs for trusted CAs (see note above)\n * \\param cn expected Common Name (can be set to\n * NULL if the CN must not be verified)\n * \\param flags result of the verification\n * \\param f_vrfy verification function\n * \\param p_vrfy verification parameter\n *\n * \\return 0 if successful or MBEDTLS_ERR_X509_CERT_VERIFY_FAILED\n * in which case *flags will have one or more\n * MBEDTLS_X509_BADCERT_XXX or MBEDTLS_X509_BADCRL_XXX flags\n * set,\n * or another error in case of a fatal error encountered\n * during the verification process.\n */\nint mbedtls_x509_crt_verify( mbedtls_x509_crt *crt,\n mbedtls_x509_crt *trust_ca,\n mbedtls_x509_crl *ca_crl,\n const char *cn, uint32_t *flags,\n int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),\n void *p_vrfy );", "/**\n * \\brief Verify the certificate signature according to profile\n *\n * \\note Same as \\c mbedtls_x509_crt_verify(), but with explicit\n * security profile.\n *\n * \\note The restrictions on keys (RSA minimum size, allowed curves\n * for ECDSA) apply to all certificates: trusted root,\n * intermediate CAs if any, and end entity certificate.\n *\n * \\param crt a certificate (chain) to be verified\n * \\param trust_ca the list of trusted CAs\n * \\param ca_crl the list of CRLs for trusted CAs\n * \\param profile security profile for verification\n * \\param cn expected Common Name (can be set to\n * NULL if the CN must not be verified)\n * \\param flags result of the verification\n * \\param f_vrfy verification function\n * \\param p_vrfy verification parameter\n *\n * \\return 0 if successful or MBEDTLS_ERR_X509_CERT_VERIFY_FAILED\n * in which case *flags will have one or more\n * MBEDTLS_X509_BADCERT_XXX or MBEDTLS_X509_BADCRL_XXX flags\n * set,\n * or another error in case of a fatal error encountered\n * during the verification process.\n */\nint mbedtls_x509_crt_verify_with_profile( mbedtls_x509_crt *crt,\n mbedtls_x509_crt *trust_ca,\n mbedtls_x509_crl *ca_crl,\n const mbedtls_x509_crt_profile *profile,\n const char *cn, uint32_t *flags,\n int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),\n void *p_vrfy );", "#if defined(MBEDTLS_X509_CHECK_KEY_USAGE)\n/**\n * \\brief Check usage of certificate against keyUsage extension.\n *\n * \\param crt Leaf certificate used.\n * \\param usage Intended usage(s) (eg MBEDTLS_X509_KU_KEY_ENCIPHERMENT\n * before using the certificate to perform an RSA key\n * exchange).\n *\n * \\note Except for decipherOnly and encipherOnly, a bit set in the\n * usage argument means this bit MUST be set in the\n * certificate. For decipherOnly and encipherOnly, it means\n * that bit MAY be set.\n *\n * \\return 0 is these uses of the certificate are allowed,\n * MBEDTLS_ERR_X509_BAD_INPUT_DATA if the keyUsage extension\n * is present but does not match the usage argument.\n *\n * \\note You should only call this function on leaf certificates, on\n * (intermediate) CAs the keyUsage extension is automatically\n * checked by \\c mbedtls_x509_crt_verify().\n */\nint mbedtls_x509_crt_check_key_usage( const mbedtls_x509_crt *crt,\n unsigned int usage );\n#endif /* MBEDTLS_X509_CHECK_KEY_USAGE) */", "#if defined(MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE)\n/**\n * \\brief Check usage of certificate against extentedJeyUsage.\n *\n * \\param crt Leaf certificate used.\n * \\param usage_oid Intended usage (eg MBEDTLS_OID_SERVER_AUTH or MBEDTLS_OID_CLIENT_AUTH).\n * \\param usage_len Length of usage_oid (eg given by MBEDTLS_OID_SIZE()).\n *\n * \\return 0 if this use of the certificate is allowed,\n * MBEDTLS_ERR_X509_BAD_INPUT_DATA if not.\n *\n * \\note Usually only makes sense on leaf certificates.\n */\nint mbedtls_x509_crt_check_extended_key_usage( const mbedtls_x509_crt *crt,\n const char *usage_oid,\n size_t usage_len );\n#endif /* MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE) */", "#if defined(MBEDTLS_X509_CRL_PARSE_C)\n/**\n * \\brief Verify the certificate revocation status\n *\n * \\param crt a certificate to be verified\n * \\param crl the CRL to verify against\n *\n * \\return 1 if the certificate is revoked, 0 otherwise\n *\n */\nint mbedtls_x509_crt_is_revoked( const mbedtls_x509_crt *crt, const mbedtls_x509_crl *crl );\n#endif /* MBEDTLS_X509_CRL_PARSE_C */", "/**\n * \\brief Initialize a certificate (chain)\n *\n * \\param crt Certificate chain to initialize\n */\nvoid mbedtls_x509_crt_init( mbedtls_x509_crt *crt );", "/**\n * \\brief Unallocate all certificate data\n *\n * \\param crt Certificate chain to free\n */\nvoid mbedtls_x509_crt_free( mbedtls_x509_crt *crt );\n#endif /* MBEDTLS_X509_CRT_PARSE_C */", "/* \\} name */\n/* \\} addtogroup x509_module */", "#if defined(MBEDTLS_X509_CRT_WRITE_C)\n/**\n * \\brief Initialize a CRT writing context\n *\n * \\param ctx CRT context to initialize\n */\nvoid mbedtls_x509write_crt_init( mbedtls_x509write_cert *ctx );", "/**\n * \\brief Set the verion for a Certificate\n * Default: MBEDTLS_X509_CRT_VERSION_3\n *\n * \\param ctx CRT context to use\n * \\param version version to set (MBEDTLS_X509_CRT_VERSION_1, MBEDTLS_X509_CRT_VERSION_2 or\n * MBEDTLS_X509_CRT_VERSION_3)\n */\nvoid mbedtls_x509write_crt_set_version( mbedtls_x509write_cert *ctx, int version );", "/**\n * \\brief Set the serial number for a Certificate.\n *\n * \\param ctx CRT context to use\n * \\param serial serial number to set\n *\n * \\return 0 if successful\n */\nint mbedtls_x509write_crt_set_serial( mbedtls_x509write_cert *ctx, const mbedtls_mpi *serial );", "/**\n * \\brief Set the validity period for a Certificate\n * Timestamps should be in string format for UTC timezone\n * i.e. \"YYYYMMDDhhmmss\"\n * e.g. \"20131231235959\" for December 31st 2013\n * at 23:59:59\n *\n * \\param ctx CRT context to use\n * \\param not_before not_before timestamp\n * \\param not_after not_after timestamp\n *\n * \\return 0 if timestamp was parsed successfully, or\n * a specific error code\n */\nint mbedtls_x509write_crt_set_validity( mbedtls_x509write_cert *ctx, const char *not_before,\n const char *not_after );", "/**\n * \\brief Set the issuer name for a Certificate\n * Issuer names should contain a comma-separated list\n * of OID types and values:\n * e.g. \"C=UK,O=ARM,CN=mbed TLS CA\"\n *\n * \\param ctx CRT context to use\n * \\param issuer_name issuer name to set\n *\n * \\return 0 if issuer name was parsed successfully, or\n * a specific error code\n */\nint mbedtls_x509write_crt_set_issuer_name( mbedtls_x509write_cert *ctx,\n const char *issuer_name );", "/**\n * \\brief Set the subject name for a Certificate\n * Subject names should contain a comma-separated list\n * of OID types and values:\n * e.g. \"C=UK,O=ARM,CN=mbed TLS Server 1\"\n *\n * \\param ctx CRT context to use\n * \\param subject_name subject name to set\n *\n * \\return 0 if subject name was parsed successfully, or\n * a specific error code\n */\nint mbedtls_x509write_crt_set_subject_name( mbedtls_x509write_cert *ctx,\n const char *subject_name );", "/**\n * \\brief Set the subject public key for the certificate\n *\n * \\param ctx CRT context to use\n * \\param key public key to include\n */\nvoid mbedtls_x509write_crt_set_subject_key( mbedtls_x509write_cert *ctx, mbedtls_pk_context *key );", "/**\n * \\brief Set the issuer key used for signing the certificate\n *\n * \\param ctx CRT context to use\n * \\param key private key to sign with\n */\nvoid mbedtls_x509write_crt_set_issuer_key( mbedtls_x509write_cert *ctx, mbedtls_pk_context *key );", "/**\n * \\brief Set the MD algorithm to use for the signature\n * (e.g. MBEDTLS_MD_SHA1)\n *\n * \\param ctx CRT context to use\n * \\param md_alg MD algorithm to use\n */\nvoid mbedtls_x509write_crt_set_md_alg( mbedtls_x509write_cert *ctx, mbedtls_md_type_t md_alg );", "/**\n * \\brief Generic function to add to or replace an extension in the\n * CRT\n *\n * \\param ctx CRT context to use\n * \\param oid OID of the extension\n * \\param oid_len length of the OID\n * \\param critical if the extension is critical (per the RFC's definition)\n * \\param val value of the extension OCTET STRING\n * \\param val_len length of the value data\n *\n * \\return 0 if successful, or a MBEDTLS_ERR_X509_ALLOC_FAILED\n */\nint mbedtls_x509write_crt_set_extension( mbedtls_x509write_cert *ctx,\n const char *oid, size_t oid_len,\n int critical,\n const unsigned char *val, size_t val_len );", "/**\n * \\brief Set the basicConstraints extension for a CRT\n *\n * \\param ctx CRT context to use\n * \\param is_ca is this a CA certificate\n * \\param max_pathlen maximum length of certificate chains below this\n * certificate (only for CA certificates, -1 is\n * inlimited)\n *\n * \\return 0 if successful, or a MBEDTLS_ERR_X509_ALLOC_FAILED\n */\nint mbedtls_x509write_crt_set_basic_constraints( mbedtls_x509write_cert *ctx,\n int is_ca, int max_pathlen );", "#if defined(MBEDTLS_SHA1_C)\n/**\n * \\brief Set the subjectKeyIdentifier extension for a CRT\n * Requires that mbedtls_x509write_crt_set_subject_key() has been\n * called before\n *\n * \\param ctx CRT context to use\n *\n * \\return 0 if successful, or a MBEDTLS_ERR_X509_ALLOC_FAILED\n */\nint mbedtls_x509write_crt_set_subject_key_identifier( mbedtls_x509write_cert *ctx );", "/**\n * \\brief Set the authorityKeyIdentifier extension for a CRT\n * Requires that mbedtls_x509write_crt_set_issuer_key() has been\n * called before\n *\n * \\param ctx CRT context to use\n *\n * \\return 0 if successful, or a MBEDTLS_ERR_X509_ALLOC_FAILED\n */\nint mbedtls_x509write_crt_set_authority_key_identifier( mbedtls_x509write_cert *ctx );\n#endif /* MBEDTLS_SHA1_C */", "/**\n * \\brief Set the Key Usage Extension flags\n * (e.g. MBEDTLS_X509_KU_DIGITAL_SIGNATURE | MBEDTLS_X509_KU_KEY_CERT_SIGN)\n *\n * \\param ctx CRT context to use\n * \\param key_usage key usage flags to set\n *\n * \\return 0 if successful, or MBEDTLS_ERR_X509_ALLOC_FAILED\n */\nint mbedtls_x509write_crt_set_key_usage( mbedtls_x509write_cert *ctx,\n unsigned int key_usage );", "/**\n * \\brief Set the Netscape Cert Type flags\n * (e.g. MBEDTLS_X509_NS_CERT_TYPE_SSL_CLIENT | MBEDTLS_X509_NS_CERT_TYPE_EMAIL)\n *\n * \\param ctx CRT context to use\n * \\param ns_cert_type Netscape Cert Type flags to set\n *\n * \\return 0 if successful, or MBEDTLS_ERR_X509_ALLOC_FAILED\n */\nint mbedtls_x509write_crt_set_ns_cert_type( mbedtls_x509write_cert *ctx,\n unsigned char ns_cert_type );", "/**\n * \\brief Free the contents of a CRT write context\n *\n * \\param ctx CRT context to free\n */\nvoid mbedtls_x509write_crt_free( mbedtls_x509write_cert *ctx );", "/**\n * \\brief Write a built up certificate to a X509 DER structure\n * Note: data is written at the end of the buffer! Use the\n * return value to determine where you should start\n * using the buffer\n *\n * \\param ctx certificate to write away\n * \\param buf buffer to write to\n * \\param size size of the buffer\n * \\param f_rng RNG function (for signature, see note)\n * \\param p_rng RNG parameter\n *\n * \\return length of data written if successful, or a specific\n * error code\n *\n * \\note f_rng may be NULL if RSA is used for signature and the\n * signature is made offline (otherwise f_rng is desirable\n * for countermeasures against timing attacks).\n * ECDSA signatures always require a non-NULL f_rng.\n */\nint mbedtls_x509write_crt_der( mbedtls_x509write_cert *ctx, unsigned char *buf, size_t size,\n int (*f_rng)(void *, unsigned char *, size_t),\n void *p_rng );", "#if defined(MBEDTLS_PEM_WRITE_C)\n/**\n * \\brief Write a built up certificate to a X509 PEM string\n *\n * \\param ctx certificate to write away\n * \\param buf buffer to write to\n * \\param size size of the buffer\n * \\param f_rng RNG function (for signature, see note)\n * \\param p_rng RNG parameter\n *\n * \\return 0 if successful, or a specific error code\n *\n * \\note f_rng may be NULL if RSA is used for signature and the\n * signature is made offline (otherwise f_rng is desirable\n * for countermeasures against timing attacks).\n * ECDSA signatures always require a non-NULL f_rng.\n */\nint mbedtls_x509write_crt_pem( mbedtls_x509write_cert *ctx, unsigned char *buf, size_t size,\n int (*f_rng)(void *, unsigned char *, size_t),\n void *p_rng );\n#endif /* MBEDTLS_PEM_WRITE_C */\n#endif /* MBEDTLS_X509_CRT_WRITE_C */", "#ifdef __cplusplus\n}\n#endif", "#endif /* mbedtls_x509_crt.h */" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [8, 75, 1056, 78, 271, 482, 2312, 1208], "buggy_code_start_loc": [8, 74, 1055, 78, 270, 482, 2060, 1207], "filenames": ["ChangeLog", "include/mbedtls/error.h", "include/mbedtls/ssl.h", "include/mbedtls/x509.h", "include/mbedtls/x509_crt.h", "library/error.c", "library/x509_crt.c", "tests/suites/test_suite_x509parse.data"], "fixing_code_end_loc": [12, 75, 1056, 80, 277, 485, 2317, 1208], "fixing_code_start_loc": [9, 74, 1055, 79, 270, 483, 2060, 1207], "message": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.10:*:*:*:*:*:*:*", "matchCriteriaId": "28621156-2430-447B-8816-47B0FB58245B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.11:*:*:*:*:*:*:*", "matchCriteriaId": "E11BBB2C-0423-47B1-AE12-EB849E17BAF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.12:*:*:*:*:*:*:*", "matchCriteriaId": "4131CE76-6260-412C-A6A6-20B0E978E569", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.13:*:*:*:*:*:*:*", "matchCriteriaId": "DE92D8F7-5705-47B6-B2C2-9DE6C7880647", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.14:*:*:*:*:*:*:*", "matchCriteriaId": "EA50C256-2054-4661-9C42-D31D7D87BAF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.15:*:*:*:*:*:*:*", "matchCriteriaId": "7791D4E9-3FEE-42DA-B320-CF7188A10294", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.16:*:*:*:*:*:*:*", "matchCriteriaId": "BE415DAA-A89F-4204-AC2C-577FCB447E4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.17:*:*:*:*:*:*:*", "matchCriteriaId": "95F691DB-9552-4EBB-B29D-16658561FA4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.18:*:*:*:*:*:*:*", "matchCriteriaId": "F1547B2A-E0D5-41D1-9449-1CCF35022B0E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.19:*:*:*:*:*:*:*", "matchCriteriaId": "CF762122-64BC-4A1A-A26D-81C1270541A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.20:*:*:*:*:*:*:*", "matchCriteriaId": "59D6B559-5F99-4E38-A861-3AB8A7D2E6BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.21:*:*:*:*:*:*:*", "matchCriteriaId": "4A8956C8-6CF0-4C37-84F9-8A89726806C3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "0B395D81-876F-43FC-8DB9-44377647A37A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F92622F1-82DA-4819-8275-06DC9DBE1BA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5871FDE9-02D0-466C-BDB7-90A14C4F637E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE6B4875-3FC3-499F-A76B-2D04982F743A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "B3B67842-5AFA-459F-9CCF-772B9DC7139F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "AD0500EE-52C0-4896-B3D8-5BE731D66039", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "015739E9-C0E3-4A62-BB9D-FA836BFD4351", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "842B0D15-6A3D-4CEE-AD02-49B0436E78E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "3CF6E05C-E6E5-40B8-AFEA-A5ED937F5439", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "D4133C86-70E0-44FD-BBDB-D61EFB31F027", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "6F9D24F0-3892-417F-9C3A-CACEF00C2293", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "8911513E-968C-403E-9D00-2DC0AA82F99B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "48D98945-82BB-4954-AA6D-7D98E4CE1154", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "6378C1CC-7C8F-47E3-A1A7-CDEC76E4CBE4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "525190A3-2194-4E4E-9D34-0048583B9C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "70407352-624A-40E6-82E4-7B4FAFE0C0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "DD52988E-4B2F-41AF-BC25-F38F87D9B8C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "FD1F7803-31F3-40A9-A878-FDC757FCE83F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected."}, {"lang": "es", "value": "ARM mbed TLS en versiones anteriores a la 1.3.21 y en versiones 2.x anteriores a la 2.1.9, si se configura la autenticaci\u00f3n opcional, permite a los atacantes omitir la autenticaci\u00f3n Peer mediante una cadena de certificados X.509 con muchos intermediarios. NOTA: aunque mbed TLS se conoc\u00eda antes como PolarSSL, las versiones lanzadas con el nombre PolarSSL no est\u00e1n afectadas."}], "evaluatorComment": null, "id": "CVE-2017-14032", "lastModified": "2017-11-08T02:29:02.850", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-08-30T20:29:00.337", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.debian.org/security/2017/dsa-3967"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugs.debian.org/873557"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/d15795acd5074e0b44e71f7ede8bdfe1b48591fc"}, {"source": "cve@mitre.org", "tags": ["Vendor Advisory"], "url": "https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2017-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, "type": "CWE-287"}
351
Determine whether the {function_name} code is vulnerable or not.
[ "/**\n * \\file x509_crt.h\n *\n * \\brief X.509 certificate parsing and writing\n *\n * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved\n * SPDX-License-Identifier: Apache-2.0\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n * not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is part of mbed TLS (https://tls.mbed.org)\n */\n#ifndef MBEDTLS_X509_CRT_H\n#define MBEDTLS_X509_CRT_H", "#if !defined(MBEDTLS_CONFIG_FILE)\n#include \"config.h\"\n#else\n#include MBEDTLS_CONFIG_FILE\n#endif", "#include \"x509.h\"\n#include \"x509_crl.h\"", "/**\n * \\addtogroup x509_module\n * \\{\n */", "#ifdef __cplusplus\nextern \"C\" {\n#endif", "/**\n * \\name Structures and functions for parsing and writing X.509 certificates\n * \\{\n */", "/**\n * Container for an X.509 certificate. The certificate may be chained.\n */\ntypedef struct mbedtls_x509_crt\n{\n mbedtls_x509_buf raw; /**< The raw certificate data (DER). */\n mbedtls_x509_buf tbs; /**< The raw certificate body (DER). The part that is To Be Signed. */", " int version; /**< The X.509 version. (1=v1, 2=v2, 3=v3) */\n mbedtls_x509_buf serial; /**< Unique id for certificate issued by a specific CA. */\n mbedtls_x509_buf sig_oid; /**< Signature algorithm, e.g. sha1RSA */", " mbedtls_x509_buf issuer_raw; /**< The raw issuer data (DER). Used for quick comparison. */\n mbedtls_x509_buf subject_raw; /**< The raw subject data (DER). Used for quick comparison. */", " mbedtls_x509_name issuer; /**< The parsed issuer data (named information object). */\n mbedtls_x509_name subject; /**< The parsed subject data (named information object). */", " mbedtls_x509_time valid_from; /**< Start time of certificate validity. */\n mbedtls_x509_time valid_to; /**< End time of certificate validity. */", " mbedtls_pk_context pk; /**< Container for the public key context. */", " mbedtls_x509_buf issuer_id; /**< Optional X.509 v2/v3 issuer unique identifier. */\n mbedtls_x509_buf subject_id; /**< Optional X.509 v2/v3 subject unique identifier. */\n mbedtls_x509_buf v3_ext; /**< Optional X.509 v3 extensions. */\n mbedtls_x509_sequence subject_alt_names; /**< Optional list of Subject Alternative Names (Only dNSName supported). */", " int ext_types; /**< Bit string containing detected and parsed extensions */\n int ca_istrue; /**< Optional Basic Constraint extension value: 1 if this certificate belongs to a CA, 0 otherwise. */\n int max_pathlen; /**< Optional Basic Constraint extension value: The maximum path length to the root certificate. Path length is 1 higher than RFC 5280 'meaning', so 1+ */", " unsigned int key_usage; /**< Optional key usage extension value: See the values in x509.h */", " mbedtls_x509_sequence ext_key_usage; /**< Optional list of extended key usage OIDs. */", " unsigned char ns_cert_type; /**< Optional Netscape certificate type extension value: See the values in x509.h */", " mbedtls_x509_buf sig; /**< Signature: hash of the tbs part signed with the private key. */\n mbedtls_md_type_t sig_md; /**< Internal representation of the MD algorithm of the signature algorithm, e.g. MBEDTLS_MD_SHA256 */\n mbedtls_pk_type_t sig_pk; /**< Internal representation of the Public Key algorithm of the signature algorithm, e.g. MBEDTLS_PK_RSA */\n void *sig_opts; /**< Signature options to be passed to mbedtls_pk_verify_ext(), e.g. for RSASSA-PSS */", " struct mbedtls_x509_crt *next; /**< Next certificate in the CA-chain. */\n}\nmbedtls_x509_crt;", "/**\n * Build flag from an algorithm/curve identifier (pk, md, ecp)\n * Since 0 is always XXX_NONE, ignore it.\n */\n#define MBEDTLS_X509_ID_FLAG( id ) ( 1 << ( id - 1 ) )", "/**\n * Security profile for certificate verification.\n *\n * All lists are bitfields, built by ORing flags from MBEDTLS_X509_ID_FLAG().\n */\ntypedef struct\n{\n uint32_t allowed_mds; /**< MDs for signatures */\n uint32_t allowed_pks; /**< PK algs for signatures */\n uint32_t allowed_curves; /**< Elliptic curves for ECDSA */\n uint32_t rsa_min_bitlen; /**< Minimum size for RSA keys */\n}\nmbedtls_x509_crt_profile;", "#define MBEDTLS_X509_CRT_VERSION_1 0\n#define MBEDTLS_X509_CRT_VERSION_2 1\n#define MBEDTLS_X509_CRT_VERSION_3 2", "#define MBEDTLS_X509_RFC5280_MAX_SERIAL_LEN 32\n#define MBEDTLS_X509_RFC5280_UTC_TIME_LEN 15", "#if !defined( MBEDTLS_X509_MAX_FILE_PATH_LEN )\n#define MBEDTLS_X509_MAX_FILE_PATH_LEN 512\n#endif", "/**\n * Container for writing a certificate (CRT)\n */\ntypedef struct mbedtls_x509write_cert\n{\n int version;\n mbedtls_mpi serial;\n mbedtls_pk_context *subject_key;\n mbedtls_pk_context *issuer_key;\n mbedtls_asn1_named_data *subject;\n mbedtls_asn1_named_data *issuer;\n mbedtls_md_type_t md_alg;\n char not_before[MBEDTLS_X509_RFC5280_UTC_TIME_LEN + 1];\n char not_after[MBEDTLS_X509_RFC5280_UTC_TIME_LEN + 1];\n mbedtls_asn1_named_data *extensions;\n}\nmbedtls_x509write_cert;", "#if defined(MBEDTLS_X509_CRT_PARSE_C)\n/**\n * Default security profile. Should provide a good balance between security\n * and compatibility with current deployments.\n */\nextern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_default;", "/**\n * Expected next default profile. Recommended for new deployments.\n * Currently targets a 128-bit security level, except for RSA-2048.\n */\nextern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_next;", "/**\n * NSA Suite B profile.\n */\nextern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_suiteb;", "/**\n * \\brief Parse a single DER formatted certificate and add it\n * to the chained list.\n *\n * \\param chain points to the start of the chain\n * \\param buf buffer holding the certificate DER data\n * \\param buflen size of the buffer\n *\n * \\return 0 if successful, or a specific X509 or PEM error code\n */\nint mbedtls_x509_crt_parse_der( mbedtls_x509_crt *chain, const unsigned char *buf,\n size_t buflen );", "/**\n * \\brief Parse one or more certificates and add them\n * to the chained list. Parses permissively. If some\n * certificates can be parsed, the result is the number\n * of failed certificates it encountered. If none complete\n * correctly, the first error is returned.\n *\n * \\param chain points to the start of the chain\n * \\param buf buffer holding the certificate data in PEM or DER format\n * \\param buflen size of the buffer\n * (including the terminating null byte for PEM data)\n *\n * \\return 0 if all certificates parsed successfully, a positive number\n * if partly successful or a specific X509 or PEM error code\n */\nint mbedtls_x509_crt_parse( mbedtls_x509_crt *chain, const unsigned char *buf, size_t buflen );", "#if defined(MBEDTLS_FS_IO)\n/**\n * \\brief Load one or more certificates and add them\n * to the chained list. Parses permissively. If some\n * certificates can be parsed, the result is the number\n * of failed certificates it encountered. If none complete\n * correctly, the first error is returned.\n *\n * \\param chain points to the start of the chain\n * \\param path filename to read the certificates from\n *\n * \\return 0 if all certificates parsed successfully, a positive number\n * if partly successful or a specific X509 or PEM error code\n */\nint mbedtls_x509_crt_parse_file( mbedtls_x509_crt *chain, const char *path );", "/**\n * \\brief Load one or more certificate files from a path and add them\n * to the chained list. Parses permissively. If some\n * certificates can be parsed, the result is the number\n * of failed certificates it encountered. If none complete\n * correctly, the first error is returned.\n *\n * \\param chain points to the start of the chain\n * \\param path directory / folder to read the certificate files from\n *\n * \\return 0 if all certificates parsed successfully, a positive number\n * if partly successful or a specific X509 or PEM error code\n */\nint mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path );\n#endif /* MBEDTLS_FS_IO */", "/**\n * \\brief Returns an informational string about the\n * certificate.\n *\n * \\param buf Buffer to write to\n * \\param size Maximum size of buffer\n * \\param prefix A line prefix\n * \\param crt The X509 certificate to represent\n *\n * \\return The length of the string written (not including the\n * terminated nul byte), or a negative error code.\n */\nint mbedtls_x509_crt_info( char *buf, size_t size, const char *prefix,\n const mbedtls_x509_crt *crt );", "/**\n * \\brief Returns an informational string about the\n * verification status of a certificate.\n *\n * \\param buf Buffer to write to\n * \\param size Maximum size of buffer\n * \\param prefix A line prefix\n * \\param flags Verification flags created by mbedtls_x509_crt_verify()\n *\n * \\return The length of the string written (not including the\n * terminated nul byte), or a negative error code.\n */\nint mbedtls_x509_crt_verify_info( char *buf, size_t size, const char *prefix,\n uint32_t flags );", "/**\n * \\brief Verify the certificate signature\n *\n * The verify callback is a user-supplied callback that\n * can clear / modify / add flags for a certificate. If set,\n * the verification callback is called for each\n * certificate in the chain (from the trust-ca down to the\n * presented crt). The parameters for the callback are:\n * (void *parameter, mbedtls_x509_crt *crt, int certificate_depth,\n * int *flags). With the flags representing current flags for\n * that specific certificate and the certificate depth from\n * the bottom (Peer cert depth = 0).\n *\n * All flags left after returning from the callback\n * are also returned to the application. The function should", " * return 0 for anything (including invalid certificates)\n * other than fatal error, as a non-zero return code\n * immediately aborts the verification process. For fatal\n * errors, a specific error code should be used (different\n * from MBEDTLS_ERR_X509_CERT_VERIFY_FAILED which should not\n * be returned at this point), or MBEDTLS_ERR_X509_FATAL_ERROR\n * can be used if no better code is available.", " *\n * \\note In case verification failed, the results can be displayed\n * using \\c mbedtls_x509_crt_verify_info()\n *\n * \\note Same as \\c mbedtls_x509_crt_verify_with_profile() with the\n * default security profile.\n *\n * \\note It is your responsibility to provide up-to-date CRLs for\n * all trusted CAs. If no CRL is provided for the CA that was\n * used to sign the certificate, CRL verification is skipped\n * silently, that is *without* setting any flag.\n *\n * \\param crt a certificate (chain) to be verified\n * \\param trust_ca the list of trusted CAs\n * \\param ca_crl the list of CRLs for trusted CAs (see note above)\n * \\param cn expected Common Name (can be set to\n * NULL if the CN must not be verified)\n * \\param flags result of the verification\n * \\param f_vrfy verification function\n * \\param p_vrfy verification parameter\n *\n * \\return 0 if successful or MBEDTLS_ERR_X509_CERT_VERIFY_FAILED\n * in which case *flags will have one or more\n * MBEDTLS_X509_BADCERT_XXX or MBEDTLS_X509_BADCRL_XXX flags\n * set,\n * or another error in case of a fatal error encountered\n * during the verification process.\n */\nint mbedtls_x509_crt_verify( mbedtls_x509_crt *crt,\n mbedtls_x509_crt *trust_ca,\n mbedtls_x509_crl *ca_crl,\n const char *cn, uint32_t *flags,\n int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),\n void *p_vrfy );", "/**\n * \\brief Verify the certificate signature according to profile\n *\n * \\note Same as \\c mbedtls_x509_crt_verify(), but with explicit\n * security profile.\n *\n * \\note The restrictions on keys (RSA minimum size, allowed curves\n * for ECDSA) apply to all certificates: trusted root,\n * intermediate CAs if any, and end entity certificate.\n *\n * \\param crt a certificate (chain) to be verified\n * \\param trust_ca the list of trusted CAs\n * \\param ca_crl the list of CRLs for trusted CAs\n * \\param profile security profile for verification\n * \\param cn expected Common Name (can be set to\n * NULL if the CN must not be verified)\n * \\param flags result of the verification\n * \\param f_vrfy verification function\n * \\param p_vrfy verification parameter\n *\n * \\return 0 if successful or MBEDTLS_ERR_X509_CERT_VERIFY_FAILED\n * in which case *flags will have one or more\n * MBEDTLS_X509_BADCERT_XXX or MBEDTLS_X509_BADCRL_XXX flags\n * set,\n * or another error in case of a fatal error encountered\n * during the verification process.\n */\nint mbedtls_x509_crt_verify_with_profile( mbedtls_x509_crt *crt,\n mbedtls_x509_crt *trust_ca,\n mbedtls_x509_crl *ca_crl,\n const mbedtls_x509_crt_profile *profile,\n const char *cn, uint32_t *flags,\n int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),\n void *p_vrfy );", "#if defined(MBEDTLS_X509_CHECK_KEY_USAGE)\n/**\n * \\brief Check usage of certificate against keyUsage extension.\n *\n * \\param crt Leaf certificate used.\n * \\param usage Intended usage(s) (eg MBEDTLS_X509_KU_KEY_ENCIPHERMENT\n * before using the certificate to perform an RSA key\n * exchange).\n *\n * \\note Except for decipherOnly and encipherOnly, a bit set in the\n * usage argument means this bit MUST be set in the\n * certificate. For decipherOnly and encipherOnly, it means\n * that bit MAY be set.\n *\n * \\return 0 is these uses of the certificate are allowed,\n * MBEDTLS_ERR_X509_BAD_INPUT_DATA if the keyUsage extension\n * is present but does not match the usage argument.\n *\n * \\note You should only call this function on leaf certificates, on\n * (intermediate) CAs the keyUsage extension is automatically\n * checked by \\c mbedtls_x509_crt_verify().\n */\nint mbedtls_x509_crt_check_key_usage( const mbedtls_x509_crt *crt,\n unsigned int usage );\n#endif /* MBEDTLS_X509_CHECK_KEY_USAGE) */", "#if defined(MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE)\n/**\n * \\brief Check usage of certificate against extentedJeyUsage.\n *\n * \\param crt Leaf certificate used.\n * \\param usage_oid Intended usage (eg MBEDTLS_OID_SERVER_AUTH or MBEDTLS_OID_CLIENT_AUTH).\n * \\param usage_len Length of usage_oid (eg given by MBEDTLS_OID_SIZE()).\n *\n * \\return 0 if this use of the certificate is allowed,\n * MBEDTLS_ERR_X509_BAD_INPUT_DATA if not.\n *\n * \\note Usually only makes sense on leaf certificates.\n */\nint mbedtls_x509_crt_check_extended_key_usage( const mbedtls_x509_crt *crt,\n const char *usage_oid,\n size_t usage_len );\n#endif /* MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE) */", "#if defined(MBEDTLS_X509_CRL_PARSE_C)\n/**\n * \\brief Verify the certificate revocation status\n *\n * \\param crt a certificate to be verified\n * \\param crl the CRL to verify against\n *\n * \\return 1 if the certificate is revoked, 0 otherwise\n *\n */\nint mbedtls_x509_crt_is_revoked( const mbedtls_x509_crt *crt, const mbedtls_x509_crl *crl );\n#endif /* MBEDTLS_X509_CRL_PARSE_C */", "/**\n * \\brief Initialize a certificate (chain)\n *\n * \\param crt Certificate chain to initialize\n */\nvoid mbedtls_x509_crt_init( mbedtls_x509_crt *crt );", "/**\n * \\brief Unallocate all certificate data\n *\n * \\param crt Certificate chain to free\n */\nvoid mbedtls_x509_crt_free( mbedtls_x509_crt *crt );\n#endif /* MBEDTLS_X509_CRT_PARSE_C */", "/* \\} name */\n/* \\} addtogroup x509_module */", "#if defined(MBEDTLS_X509_CRT_WRITE_C)\n/**\n * \\brief Initialize a CRT writing context\n *\n * \\param ctx CRT context to initialize\n */\nvoid mbedtls_x509write_crt_init( mbedtls_x509write_cert *ctx );", "/**\n * \\brief Set the verion for a Certificate\n * Default: MBEDTLS_X509_CRT_VERSION_3\n *\n * \\param ctx CRT context to use\n * \\param version version to set (MBEDTLS_X509_CRT_VERSION_1, MBEDTLS_X509_CRT_VERSION_2 or\n * MBEDTLS_X509_CRT_VERSION_3)\n */\nvoid mbedtls_x509write_crt_set_version( mbedtls_x509write_cert *ctx, int version );", "/**\n * \\brief Set the serial number for a Certificate.\n *\n * \\param ctx CRT context to use\n * \\param serial serial number to set\n *\n * \\return 0 if successful\n */\nint mbedtls_x509write_crt_set_serial( mbedtls_x509write_cert *ctx, const mbedtls_mpi *serial );", "/**\n * \\brief Set the validity period for a Certificate\n * Timestamps should be in string format for UTC timezone\n * i.e. \"YYYYMMDDhhmmss\"\n * e.g. \"20131231235959\" for December 31st 2013\n * at 23:59:59\n *\n * \\param ctx CRT context to use\n * \\param not_before not_before timestamp\n * \\param not_after not_after timestamp\n *\n * \\return 0 if timestamp was parsed successfully, or\n * a specific error code\n */\nint mbedtls_x509write_crt_set_validity( mbedtls_x509write_cert *ctx, const char *not_before,\n const char *not_after );", "/**\n * \\brief Set the issuer name for a Certificate\n * Issuer names should contain a comma-separated list\n * of OID types and values:\n * e.g. \"C=UK,O=ARM,CN=mbed TLS CA\"\n *\n * \\param ctx CRT context to use\n * \\param issuer_name issuer name to set\n *\n * \\return 0 if issuer name was parsed successfully, or\n * a specific error code\n */\nint mbedtls_x509write_crt_set_issuer_name( mbedtls_x509write_cert *ctx,\n const char *issuer_name );", "/**\n * \\brief Set the subject name for a Certificate\n * Subject names should contain a comma-separated list\n * of OID types and values:\n * e.g. \"C=UK,O=ARM,CN=mbed TLS Server 1\"\n *\n * \\param ctx CRT context to use\n * \\param subject_name subject name to set\n *\n * \\return 0 if subject name was parsed successfully, or\n * a specific error code\n */\nint mbedtls_x509write_crt_set_subject_name( mbedtls_x509write_cert *ctx,\n const char *subject_name );", "/**\n * \\brief Set the subject public key for the certificate\n *\n * \\param ctx CRT context to use\n * \\param key public key to include\n */\nvoid mbedtls_x509write_crt_set_subject_key( mbedtls_x509write_cert *ctx, mbedtls_pk_context *key );", "/**\n * \\brief Set the issuer key used for signing the certificate\n *\n * \\param ctx CRT context to use\n * \\param key private key to sign with\n */\nvoid mbedtls_x509write_crt_set_issuer_key( mbedtls_x509write_cert *ctx, mbedtls_pk_context *key );", "/**\n * \\brief Set the MD algorithm to use for the signature\n * (e.g. MBEDTLS_MD_SHA1)\n *\n * \\param ctx CRT context to use\n * \\param md_alg MD algorithm to use\n */\nvoid mbedtls_x509write_crt_set_md_alg( mbedtls_x509write_cert *ctx, mbedtls_md_type_t md_alg );", "/**\n * \\brief Generic function to add to or replace an extension in the\n * CRT\n *\n * \\param ctx CRT context to use\n * \\param oid OID of the extension\n * \\param oid_len length of the OID\n * \\param critical if the extension is critical (per the RFC's definition)\n * \\param val value of the extension OCTET STRING\n * \\param val_len length of the value data\n *\n * \\return 0 if successful, or a MBEDTLS_ERR_X509_ALLOC_FAILED\n */\nint mbedtls_x509write_crt_set_extension( mbedtls_x509write_cert *ctx,\n const char *oid, size_t oid_len,\n int critical,\n const unsigned char *val, size_t val_len );", "/**\n * \\brief Set the basicConstraints extension for a CRT\n *\n * \\param ctx CRT context to use\n * \\param is_ca is this a CA certificate\n * \\param max_pathlen maximum length of certificate chains below this\n * certificate (only for CA certificates, -1 is\n * inlimited)\n *\n * \\return 0 if successful, or a MBEDTLS_ERR_X509_ALLOC_FAILED\n */\nint mbedtls_x509write_crt_set_basic_constraints( mbedtls_x509write_cert *ctx,\n int is_ca, int max_pathlen );", "#if defined(MBEDTLS_SHA1_C)\n/**\n * \\brief Set the subjectKeyIdentifier extension for a CRT\n * Requires that mbedtls_x509write_crt_set_subject_key() has been\n * called before\n *\n * \\param ctx CRT context to use\n *\n * \\return 0 if successful, or a MBEDTLS_ERR_X509_ALLOC_FAILED\n */\nint mbedtls_x509write_crt_set_subject_key_identifier( mbedtls_x509write_cert *ctx );", "/**\n * \\brief Set the authorityKeyIdentifier extension for a CRT\n * Requires that mbedtls_x509write_crt_set_issuer_key() has been\n * called before\n *\n * \\param ctx CRT context to use\n *\n * \\return 0 if successful, or a MBEDTLS_ERR_X509_ALLOC_FAILED\n */\nint mbedtls_x509write_crt_set_authority_key_identifier( mbedtls_x509write_cert *ctx );\n#endif /* MBEDTLS_SHA1_C */", "/**\n * \\brief Set the Key Usage Extension flags\n * (e.g. MBEDTLS_X509_KU_DIGITAL_SIGNATURE | MBEDTLS_X509_KU_KEY_CERT_SIGN)\n *\n * \\param ctx CRT context to use\n * \\param key_usage key usage flags to set\n *\n * \\return 0 if successful, or MBEDTLS_ERR_X509_ALLOC_FAILED\n */\nint mbedtls_x509write_crt_set_key_usage( mbedtls_x509write_cert *ctx,\n unsigned int key_usage );", "/**\n * \\brief Set the Netscape Cert Type flags\n * (e.g. MBEDTLS_X509_NS_CERT_TYPE_SSL_CLIENT | MBEDTLS_X509_NS_CERT_TYPE_EMAIL)\n *\n * \\param ctx CRT context to use\n * \\param ns_cert_type Netscape Cert Type flags to set\n *\n * \\return 0 if successful, or MBEDTLS_ERR_X509_ALLOC_FAILED\n */\nint mbedtls_x509write_crt_set_ns_cert_type( mbedtls_x509write_cert *ctx,\n unsigned char ns_cert_type );", "/**\n * \\brief Free the contents of a CRT write context\n *\n * \\param ctx CRT context to free\n */\nvoid mbedtls_x509write_crt_free( mbedtls_x509write_cert *ctx );", "/**\n * \\brief Write a built up certificate to a X509 DER structure\n * Note: data is written at the end of the buffer! Use the\n * return value to determine where you should start\n * using the buffer\n *\n * \\param ctx certificate to write away\n * \\param buf buffer to write to\n * \\param size size of the buffer\n * \\param f_rng RNG function (for signature, see note)\n * \\param p_rng RNG parameter\n *\n * \\return length of data written if successful, or a specific\n * error code\n *\n * \\note f_rng may be NULL if RSA is used for signature and the\n * signature is made offline (otherwise f_rng is desirable\n * for countermeasures against timing attacks).\n * ECDSA signatures always require a non-NULL f_rng.\n */\nint mbedtls_x509write_crt_der( mbedtls_x509write_cert *ctx, unsigned char *buf, size_t size,\n int (*f_rng)(void *, unsigned char *, size_t),\n void *p_rng );", "#if defined(MBEDTLS_PEM_WRITE_C)\n/**\n * \\brief Write a built up certificate to a X509 PEM string\n *\n * \\param ctx certificate to write away\n * \\param buf buffer to write to\n * \\param size size of the buffer\n * \\param f_rng RNG function (for signature, see note)\n * \\param p_rng RNG parameter\n *\n * \\return 0 if successful, or a specific error code\n *\n * \\note f_rng may be NULL if RSA is used for signature and the\n * signature is made offline (otherwise f_rng is desirable\n * for countermeasures against timing attacks).\n * ECDSA signatures always require a non-NULL f_rng.\n */\nint mbedtls_x509write_crt_pem( mbedtls_x509write_cert *ctx, unsigned char *buf, size_t size,\n int (*f_rng)(void *, unsigned char *, size_t),\n void *p_rng );\n#endif /* MBEDTLS_PEM_WRITE_C */\n#endif /* MBEDTLS_X509_CRT_WRITE_C */", "#ifdef __cplusplus\n}\n#endif", "#endif /* mbedtls_x509_crt.h */" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [8, 75, 1056, 78, 271, 482, 2312, 1208], "buggy_code_start_loc": [8, 74, 1055, 78, 270, 482, 2060, 1207], "filenames": ["ChangeLog", "include/mbedtls/error.h", "include/mbedtls/ssl.h", "include/mbedtls/x509.h", "include/mbedtls/x509_crt.h", "library/error.c", "library/x509_crt.c", "tests/suites/test_suite_x509parse.data"], "fixing_code_end_loc": [12, 75, 1056, 80, 277, 485, 2317, 1208], "fixing_code_start_loc": [9, 74, 1055, 79, 270, 483, 2060, 1207], "message": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.10:*:*:*:*:*:*:*", "matchCriteriaId": "28621156-2430-447B-8816-47B0FB58245B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.11:*:*:*:*:*:*:*", "matchCriteriaId": "E11BBB2C-0423-47B1-AE12-EB849E17BAF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.12:*:*:*:*:*:*:*", "matchCriteriaId": "4131CE76-6260-412C-A6A6-20B0E978E569", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.13:*:*:*:*:*:*:*", "matchCriteriaId": "DE92D8F7-5705-47B6-B2C2-9DE6C7880647", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.14:*:*:*:*:*:*:*", "matchCriteriaId": "EA50C256-2054-4661-9C42-D31D7D87BAF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.15:*:*:*:*:*:*:*", "matchCriteriaId": "7791D4E9-3FEE-42DA-B320-CF7188A10294", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.16:*:*:*:*:*:*:*", "matchCriteriaId": "BE415DAA-A89F-4204-AC2C-577FCB447E4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.17:*:*:*:*:*:*:*", "matchCriteriaId": "95F691DB-9552-4EBB-B29D-16658561FA4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.18:*:*:*:*:*:*:*", "matchCriteriaId": "F1547B2A-E0D5-41D1-9449-1CCF35022B0E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.19:*:*:*:*:*:*:*", "matchCriteriaId": "CF762122-64BC-4A1A-A26D-81C1270541A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.20:*:*:*:*:*:*:*", "matchCriteriaId": "59D6B559-5F99-4E38-A861-3AB8A7D2E6BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.21:*:*:*:*:*:*:*", "matchCriteriaId": "4A8956C8-6CF0-4C37-84F9-8A89726806C3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "0B395D81-876F-43FC-8DB9-44377647A37A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F92622F1-82DA-4819-8275-06DC9DBE1BA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5871FDE9-02D0-466C-BDB7-90A14C4F637E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE6B4875-3FC3-499F-A76B-2D04982F743A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "B3B67842-5AFA-459F-9CCF-772B9DC7139F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "AD0500EE-52C0-4896-B3D8-5BE731D66039", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "015739E9-C0E3-4A62-BB9D-FA836BFD4351", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "842B0D15-6A3D-4CEE-AD02-49B0436E78E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "3CF6E05C-E6E5-40B8-AFEA-A5ED937F5439", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "D4133C86-70E0-44FD-BBDB-D61EFB31F027", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "6F9D24F0-3892-417F-9C3A-CACEF00C2293", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "8911513E-968C-403E-9D00-2DC0AA82F99B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "48D98945-82BB-4954-AA6D-7D98E4CE1154", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "6378C1CC-7C8F-47E3-A1A7-CDEC76E4CBE4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "525190A3-2194-4E4E-9D34-0048583B9C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "70407352-624A-40E6-82E4-7B4FAFE0C0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "DD52988E-4B2F-41AF-BC25-F38F87D9B8C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "FD1F7803-31F3-40A9-A878-FDC757FCE83F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected."}, {"lang": "es", "value": "ARM mbed TLS en versiones anteriores a la 1.3.21 y en versiones 2.x anteriores a la 2.1.9, si se configura la autenticaci\u00f3n opcional, permite a los atacantes omitir la autenticaci\u00f3n Peer mediante una cadena de certificados X.509 con muchos intermediarios. NOTA: aunque mbed TLS se conoc\u00eda antes como PolarSSL, las versiones lanzadas con el nombre PolarSSL no est\u00e1n afectadas."}], "evaluatorComment": null, "id": "CVE-2017-14032", "lastModified": "2017-11-08T02:29:02.850", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-08-30T20:29:00.337", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.debian.org/security/2017/dsa-3967"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugs.debian.org/873557"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/d15795acd5074e0b44e71f7ede8bdfe1b48591fc"}, {"source": "cve@mitre.org", "tags": ["Vendor Advisory"], "url": "https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2017-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, "type": "CWE-287"}
351
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n * Error message information\n *\n * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved\n * SPDX-License-Identifier: Apache-2.0\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n * not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is part of mbed TLS (https://tls.mbed.org)\n */", "#if !defined(MBEDTLS_CONFIG_FILE)\n#include \"mbedtls/config.h\"\n#else\n#include MBEDTLS_CONFIG_FILE\n#endif", "#if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY)\n#include \"mbedtls/error.h\"\n#include <string.h>\n#endif", "#if defined(MBEDTLS_PLATFORM_C)\n#include \"mbedtls/platform.h\"\n#else\n#define mbedtls_snprintf snprintf\n#define mbedtls_time_t time_t\n#endif", "#if defined(MBEDTLS_ERROR_C)", "#include <stdio.h>", "#if defined(MBEDTLS_AES_C)\n#include \"mbedtls/aes.h\"\n#endif", "#if defined(MBEDTLS_BASE64_C)\n#include \"mbedtls/base64.h\"\n#endif", "#if defined(MBEDTLS_BIGNUM_C)\n#include \"mbedtls/bignum.h\"\n#endif", "#if defined(MBEDTLS_BLOWFISH_C)\n#include \"mbedtls/blowfish.h\"\n#endif", "#if defined(MBEDTLS_CAMELLIA_C)\n#include \"mbedtls/camellia.h\"\n#endif", "#if defined(MBEDTLS_CCM_C)\n#include \"mbedtls/ccm.h\"\n#endif", "#if defined(MBEDTLS_CIPHER_C)\n#include \"mbedtls/cipher.h\"\n#endif", "#if defined(MBEDTLS_CTR_DRBG_C)\n#include \"mbedtls/ctr_drbg.h\"\n#endif", "#if defined(MBEDTLS_DES_C)\n#include \"mbedtls/des.h\"\n#endif", "#if defined(MBEDTLS_DHM_C)\n#include \"mbedtls/dhm.h\"\n#endif", "#if defined(MBEDTLS_ECP_C)\n#include \"mbedtls/ecp.h\"\n#endif", "#if defined(MBEDTLS_ENTROPY_C)\n#include \"mbedtls/entropy.h\"\n#endif", "#if defined(MBEDTLS_GCM_C)\n#include \"mbedtls/gcm.h\"\n#endif", "#if defined(MBEDTLS_HMAC_DRBG_C)\n#include \"mbedtls/hmac_drbg.h\"\n#endif", "#if defined(MBEDTLS_MD_C)\n#include \"mbedtls/md.h\"\n#endif", "#if defined(MBEDTLS_NET_C)\n#include \"mbedtls/net_sockets.h\"\n#endif", "#if defined(MBEDTLS_OID_C)\n#include \"mbedtls/oid.h\"\n#endif", "#if defined(MBEDTLS_PADLOCK_C)\n#include \"mbedtls/padlock.h\"\n#endif", "#if defined(MBEDTLS_PEM_PARSE_C) || defined(MBEDTLS_PEM_WRITE_C)\n#include \"mbedtls/pem.h\"\n#endif", "#if defined(MBEDTLS_PK_C)\n#include \"mbedtls/pk.h\"\n#endif", "#if defined(MBEDTLS_PKCS12_C)\n#include \"mbedtls/pkcs12.h\"\n#endif", "#if defined(MBEDTLS_PKCS5_C)\n#include \"mbedtls/pkcs5.h\"\n#endif", "#if defined(MBEDTLS_RSA_C)\n#include \"mbedtls/rsa.h\"\n#endif", "#if defined(MBEDTLS_SSL_TLS_C)\n#include \"mbedtls/ssl.h\"\n#endif", "#if defined(MBEDTLS_THREADING_C)\n#include \"mbedtls/threading.h\"\n#endif", "#if defined(MBEDTLS_X509_USE_C) || defined(MBEDTLS_X509_CREATE_C)\n#include \"mbedtls/x509.h\"\n#endif", "#if defined(MBEDTLS_XTEA_C)\n#include \"mbedtls/xtea.h\"\n#endif", "\nvoid mbedtls_strerror( int ret, char *buf, size_t buflen )\n{\n size_t len;\n int use_ret;", " if( buflen == 0 )\n return;", " memset( buf, 0x00, buflen );", " if( ret < 0 )\n ret = -ret;", " if( ret & 0xFF80 )\n {\n use_ret = ret & 0xFF80;", " // High level error codes\n //\n // BEGIN generated code\n#if defined(MBEDTLS_CIPHER_C)\n if( use_ret == -(MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"CIPHER - The selected feature is not available\" );\n if( use_ret == -(MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"CIPHER - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_CIPHER_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"CIPHER - Failed to allocate memory\" );\n if( use_ret == -(MBEDTLS_ERR_CIPHER_INVALID_PADDING) )\n mbedtls_snprintf( buf, buflen, \"CIPHER - Input data contains invalid padding and is rejected\" );\n if( use_ret == -(MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED) )\n mbedtls_snprintf( buf, buflen, \"CIPHER - Decryption of block requires a full block\" );\n if( use_ret == -(MBEDTLS_ERR_CIPHER_AUTH_FAILED) )\n mbedtls_snprintf( buf, buflen, \"CIPHER - Authentication failed (for AEAD modes)\" );\n if( use_ret == -(MBEDTLS_ERR_CIPHER_INVALID_CONTEXT) )\n mbedtls_snprintf( buf, buflen, \"CIPHER - The context is invalid, eg because it was free()ed\" );\n#endif /* MBEDTLS_CIPHER_C */", "#if defined(MBEDTLS_DHM_C)\n if( use_ret == -(MBEDTLS_ERR_DHM_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"DHM - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_DHM_READ_PARAMS_FAILED) )\n mbedtls_snprintf( buf, buflen, \"DHM - Reading of the DHM parameters failed\" );\n if( use_ret == -(MBEDTLS_ERR_DHM_MAKE_PARAMS_FAILED) )\n mbedtls_snprintf( buf, buflen, \"DHM - Making of the DHM parameters failed\" );\n if( use_ret == -(MBEDTLS_ERR_DHM_READ_PUBLIC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"DHM - Reading of the public values failed\" );\n if( use_ret == -(MBEDTLS_ERR_DHM_MAKE_PUBLIC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"DHM - Making of the public value failed\" );\n if( use_ret == -(MBEDTLS_ERR_DHM_CALC_SECRET_FAILED) )\n mbedtls_snprintf( buf, buflen, \"DHM - Calculation of the DHM secret failed\" );\n if( use_ret == -(MBEDTLS_ERR_DHM_INVALID_FORMAT) )\n mbedtls_snprintf( buf, buflen, \"DHM - The ASN.1 data is not formatted correctly\" );\n if( use_ret == -(MBEDTLS_ERR_DHM_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"DHM - Allocation of memory failed\" );\n if( use_ret == -(MBEDTLS_ERR_DHM_FILE_IO_ERROR) )\n mbedtls_snprintf( buf, buflen, \"DHM - Read/write of file failed\" );\n#endif /* MBEDTLS_DHM_C */", "#if defined(MBEDTLS_ECP_C)\n if( use_ret == -(MBEDTLS_ERR_ECP_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"ECP - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL) )\n mbedtls_snprintf( buf, buflen, \"ECP - The buffer is too small to write to\" );\n if( use_ret == -(MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"ECP - Requested curve not available\" );\n if( use_ret == -(MBEDTLS_ERR_ECP_VERIFY_FAILED) )\n mbedtls_snprintf( buf, buflen, \"ECP - The signature is not valid\" );\n if( use_ret == -(MBEDTLS_ERR_ECP_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"ECP - Memory allocation failed\" );\n if( use_ret == -(MBEDTLS_ERR_ECP_RANDOM_FAILED) )\n mbedtls_snprintf( buf, buflen, \"ECP - Generation of random value, such as (ephemeral) key, failed\" );\n if( use_ret == -(MBEDTLS_ERR_ECP_INVALID_KEY) )\n mbedtls_snprintf( buf, buflen, \"ECP - Invalid private or public key\" );\n if( use_ret == -(MBEDTLS_ERR_ECP_SIG_LEN_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"ECP - Signature is valid but shorter than the user-supplied length\" );\n#endif /* MBEDTLS_ECP_C */", "#if defined(MBEDTLS_MD_C)\n if( use_ret == -(MBEDTLS_ERR_MD_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"MD - The selected feature is not available\" );\n if( use_ret == -(MBEDTLS_ERR_MD_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"MD - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_MD_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"MD - Failed to allocate memory\" );\n if( use_ret == -(MBEDTLS_ERR_MD_FILE_IO_ERROR) )\n mbedtls_snprintf( buf, buflen, \"MD - Opening or reading of file failed\" );\n#endif /* MBEDTLS_MD_C */", "#if defined(MBEDTLS_PEM_PARSE_C) || defined(MBEDTLS_PEM_WRITE_C)\n if( use_ret == -(MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT) )\n mbedtls_snprintf( buf, buflen, \"PEM - No PEM header or footer found\" );\n if( use_ret == -(MBEDTLS_ERR_PEM_INVALID_DATA) )\n mbedtls_snprintf( buf, buflen, \"PEM - PEM string is not as expected\" );\n if( use_ret == -(MBEDTLS_ERR_PEM_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"PEM - Failed to allocate memory\" );\n if( use_ret == -(MBEDTLS_ERR_PEM_INVALID_ENC_IV) )\n mbedtls_snprintf( buf, buflen, \"PEM - RSA IV is not in hex-format\" );\n if( use_ret == -(MBEDTLS_ERR_PEM_UNKNOWN_ENC_ALG) )\n mbedtls_snprintf( buf, buflen, \"PEM - Unsupported key encryption algorithm\" );\n if( use_ret == -(MBEDTLS_ERR_PEM_PASSWORD_REQUIRED) )\n mbedtls_snprintf( buf, buflen, \"PEM - Private key password can't be empty\" );\n if( use_ret == -(MBEDTLS_ERR_PEM_PASSWORD_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"PEM - Given private key password does not allow for correct decryption\" );\n if( use_ret == -(MBEDTLS_ERR_PEM_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"PEM - Unavailable feature, e.g. hashing/encryption combination\" );\n if( use_ret == -(MBEDTLS_ERR_PEM_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"PEM - Bad input parameters to function\" );\n#endif /* MBEDTLS_PEM_PARSE_C || MBEDTLS_PEM_WRITE_C */", "#if defined(MBEDTLS_PK_C)\n if( use_ret == -(MBEDTLS_ERR_PK_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"PK - Memory allocation failed\" );\n if( use_ret == -(MBEDTLS_ERR_PK_TYPE_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"PK - Type mismatch, eg attempt to encrypt with an ECDSA key\" );\n if( use_ret == -(MBEDTLS_ERR_PK_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"PK - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_PK_FILE_IO_ERROR) )\n mbedtls_snprintf( buf, buflen, \"PK - Read/write of file failed\" );\n if( use_ret == -(MBEDTLS_ERR_PK_KEY_INVALID_VERSION) )\n mbedtls_snprintf( buf, buflen, \"PK - Unsupported key version\" );\n if( use_ret == -(MBEDTLS_ERR_PK_KEY_INVALID_FORMAT) )\n mbedtls_snprintf( buf, buflen, \"PK - Invalid key tag or value\" );\n if( use_ret == -(MBEDTLS_ERR_PK_UNKNOWN_PK_ALG) )\n mbedtls_snprintf( buf, buflen, \"PK - Key algorithm is unsupported (only RSA and EC are supported)\" );\n if( use_ret == -(MBEDTLS_ERR_PK_PASSWORD_REQUIRED) )\n mbedtls_snprintf( buf, buflen, \"PK - Private key password can't be empty\" );\n if( use_ret == -(MBEDTLS_ERR_PK_PASSWORD_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"PK - Given private key password does not allow for correct decryption\" );\n if( use_ret == -(MBEDTLS_ERR_PK_INVALID_PUBKEY) )\n mbedtls_snprintf( buf, buflen, \"PK - The pubkey tag or value is invalid (only RSA and EC are supported)\" );\n if( use_ret == -(MBEDTLS_ERR_PK_INVALID_ALG) )\n mbedtls_snprintf( buf, buflen, \"PK - The algorithm tag or value is invalid\" );\n if( use_ret == -(MBEDTLS_ERR_PK_UNKNOWN_NAMED_CURVE) )\n mbedtls_snprintf( buf, buflen, \"PK - Elliptic curve is unsupported (only NIST curves are supported)\" );\n if( use_ret == -(MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"PK - Unavailable feature, e.g. RSA disabled for RSA key\" );\n if( use_ret == -(MBEDTLS_ERR_PK_SIG_LEN_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"PK - The signature is valid but its length is less than expected\" );\n#endif /* MBEDTLS_PK_C */", "#if defined(MBEDTLS_PKCS12_C)\n if( use_ret == -(MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"PKCS12 - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_PKCS12_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"PKCS12 - Feature not available, e.g. unsupported encryption scheme\" );\n if( use_ret == -(MBEDTLS_ERR_PKCS12_PBE_INVALID_FORMAT) )\n mbedtls_snprintf( buf, buflen, \"PKCS12 - PBE ASN.1 data not as expected\" );\n if( use_ret == -(MBEDTLS_ERR_PKCS12_PASSWORD_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"PKCS12 - Given private key password does not allow for correct decryption\" );\n#endif /* MBEDTLS_PKCS12_C */", "#if defined(MBEDTLS_PKCS5_C)\n if( use_ret == -(MBEDTLS_ERR_PKCS5_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"PKCS5 - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_PKCS5_INVALID_FORMAT) )\n mbedtls_snprintf( buf, buflen, \"PKCS5 - Unexpected ASN.1 data\" );\n if( use_ret == -(MBEDTLS_ERR_PKCS5_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"PKCS5 - Requested encryption or digest alg not available\" );\n if( use_ret == -(MBEDTLS_ERR_PKCS5_PASSWORD_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"PKCS5 - Given private key password does not allow for correct decryption\" );\n#endif /* MBEDTLS_PKCS5_C */", "#if defined(MBEDTLS_RSA_C)\n if( use_ret == -(MBEDTLS_ERR_RSA_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"RSA - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_RSA_INVALID_PADDING) )\n mbedtls_snprintf( buf, buflen, \"RSA - Input data contains invalid padding and is rejected\" );\n if( use_ret == -(MBEDTLS_ERR_RSA_KEY_GEN_FAILED) )\n mbedtls_snprintf( buf, buflen, \"RSA - Something failed during generation of a key\" );\n if( use_ret == -(MBEDTLS_ERR_RSA_KEY_CHECK_FAILED) )\n mbedtls_snprintf( buf, buflen, \"RSA - Key failed to pass the library's validity check\" );\n if( use_ret == -(MBEDTLS_ERR_RSA_PUBLIC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"RSA - The public key operation failed\" );\n if( use_ret == -(MBEDTLS_ERR_RSA_PRIVATE_FAILED) )\n mbedtls_snprintf( buf, buflen, \"RSA - The private key operation failed\" );\n if( use_ret == -(MBEDTLS_ERR_RSA_VERIFY_FAILED) )\n mbedtls_snprintf( buf, buflen, \"RSA - The PKCS#1 verification failed\" );\n if( use_ret == -(MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE) )\n mbedtls_snprintf( buf, buflen, \"RSA - The output buffer for decryption is not large enough\" );\n if( use_ret == -(MBEDTLS_ERR_RSA_RNG_FAILED) )\n mbedtls_snprintf( buf, buflen, \"RSA - The random generator failed to generate non-zeros\" );\n#endif /* MBEDTLS_RSA_C */", "#if defined(MBEDTLS_SSL_TLS_C)\n if( use_ret == -(MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"SSL - The requested feature is not available\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"SSL - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_INVALID_MAC) )\n mbedtls_snprintf( buf, buflen, \"SSL - Verification of the message MAC failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_INVALID_RECORD) )\n mbedtls_snprintf( buf, buflen, \"SSL - An invalid SSL record was received\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_CONN_EOF) )\n mbedtls_snprintf( buf, buflen, \"SSL - The connection indicated an EOF\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_UNKNOWN_CIPHER) )\n mbedtls_snprintf( buf, buflen, \"SSL - An unknown cipher was received\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN) )\n mbedtls_snprintf( buf, buflen, \"SSL - The server has no ciphersuites in common with the client\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_NO_RNG) )\n mbedtls_snprintf( buf, buflen, \"SSL - No RNG was provided to the SSL module\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_NO_CLIENT_CERTIFICATE) )\n mbedtls_snprintf( buf, buflen, \"SSL - No client certification received from the client, but required by the authentication mode\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_CERTIFICATE_TOO_LARGE) )\n mbedtls_snprintf( buf, buflen, \"SSL - Our own certificate(s) is/are too large to send in an SSL message\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_CERTIFICATE_REQUIRED) )\n mbedtls_snprintf( buf, buflen, \"SSL - The own certificate is not set, but needed by the server\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED) )\n mbedtls_snprintf( buf, buflen, \"SSL - The own private key or pre-shared key is not set, but needed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_CA_CHAIN_REQUIRED) )\n mbedtls_snprintf( buf, buflen, \"SSL - No CA Chain is set, but required to operate\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE) )\n mbedtls_snprintf( buf, buflen, \"SSL - An unexpected message was received from our peer\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE) )\n {\n mbedtls_snprintf( buf, buflen, \"SSL - A fatal alert message was received from our peer\" );\n return;\n }\n if( use_ret == -(MBEDTLS_ERR_SSL_PEER_VERIFY_FAILED) )\n mbedtls_snprintf( buf, buflen, \"SSL - Verification of our peer failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) )\n mbedtls_snprintf( buf, buflen, \"SSL - The peer notified us that the connection is going to be closed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CLIENT_HELLO) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the ClientHello handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the ServerHello handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the Certificate handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the CertificateRequest handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the ServerKeyExchange handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO_DONE) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the ServerHelloDone handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the ClientKeyExchange handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_RP) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the ClientKeyExchange handshake message failed in DHM / ECDH Read Public\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_CS) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the ClientKeyExchange handshake message failed in DHM / ECDH Calculate Secret\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the CertificateVerify handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the ChangeCipherSpec handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_FINISHED) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the Finished handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"SSL - Memory allocation failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_HW_ACCEL_FAILED) )\n mbedtls_snprintf( buf, buflen, \"SSL - Hardware acceleration function returned with error\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH) )\n mbedtls_snprintf( buf, buflen, \"SSL - Hardware acceleration function skipped / left alone data\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_COMPRESSION_FAILED) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the compression / decompression failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION) )\n mbedtls_snprintf( buf, buflen, \"SSL - Handshake protocol not within min/max boundaries\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_NEW_SESSION_TICKET) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the NewSessionTicket handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED) )\n mbedtls_snprintf( buf, buflen, \"SSL - Session ticket has expired\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"SSL - Public key type mismatch (eg, asked for RSA key exchange and presented EC key)\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY) )\n mbedtls_snprintf( buf, buflen, \"SSL - Unknown identity received (eg, PSK identity)\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_INTERNAL_ERROR) )\n mbedtls_snprintf( buf, buflen, \"SSL - Internal error (eg, unexpected failure in lower-level module)\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_COUNTER_WRAPPING) )\n mbedtls_snprintf( buf, buflen, \"SSL - A counter would wrap (eg, too many messages exchanged)\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO) )\n mbedtls_snprintf( buf, buflen, \"SSL - Unexpected message at ServerHello in renegotiation\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED) )\n mbedtls_snprintf( buf, buflen, \"SSL - DTLS client must retry for hello verification\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL) )\n mbedtls_snprintf( buf, buflen, \"SSL - A buffer is too small to receive or write a message\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_NO_USABLE_CIPHERSUITE) )\n mbedtls_snprintf( buf, buflen, \"SSL - None of the common ciphersuites is usable (eg, no suitable certificate, see debug messages)\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_WANT_READ) )\n mbedtls_snprintf( buf, buflen, \"SSL - Connection requires a read call\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_WANT_WRITE) )\n mbedtls_snprintf( buf, buflen, \"SSL - Connection requires a write call\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_TIMEOUT) )\n mbedtls_snprintf( buf, buflen, \"SSL - The operation timed out\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_CLIENT_RECONNECT) )\n mbedtls_snprintf( buf, buflen, \"SSL - The client initiated a reconnect from the same port\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_UNEXPECTED_RECORD) )\n mbedtls_snprintf( buf, buflen, \"SSL - Record header looks valid but is not expected\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_NON_FATAL) )\n mbedtls_snprintf( buf, buflen, \"SSL - The alert message received indicates a non-fatal error\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_INVALID_VERIFY_HASH) )\n mbedtls_snprintf( buf, buflen, \"SSL - Couldn't set the hash for verifying CertificateVerify\" );\n#endif /* MBEDTLS_SSL_TLS_C */", "#if defined(MBEDTLS_X509_USE_C) || defined(MBEDTLS_X509_CREATE_C)\n if( use_ret == -(MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"X509 - Unavailable feature, e.g. RSA hashing/encryption combination\" );\n if( use_ret == -(MBEDTLS_ERR_X509_UNKNOWN_OID) )\n mbedtls_snprintf( buf, buflen, \"X509 - Requested OID is unknown\" );\n if( use_ret == -(MBEDTLS_ERR_X509_INVALID_FORMAT) )\n mbedtls_snprintf( buf, buflen, \"X509 - The CRT/CRL/CSR format is invalid, e.g. different type expected\" );\n if( use_ret == -(MBEDTLS_ERR_X509_INVALID_VERSION) )\n mbedtls_snprintf( buf, buflen, \"X509 - The CRT/CRL/CSR version element is invalid\" );\n if( use_ret == -(MBEDTLS_ERR_X509_INVALID_SERIAL) )\n mbedtls_snprintf( buf, buflen, \"X509 - The serial tag or value is invalid\" );\n if( use_ret == -(MBEDTLS_ERR_X509_INVALID_ALG) )\n mbedtls_snprintf( buf, buflen, \"X509 - The algorithm tag or value is invalid\" );\n if( use_ret == -(MBEDTLS_ERR_X509_INVALID_NAME) )\n mbedtls_snprintf( buf, buflen, \"X509 - The name tag or value is invalid\" );\n if( use_ret == -(MBEDTLS_ERR_X509_INVALID_DATE) )\n mbedtls_snprintf( buf, buflen, \"X509 - The date tag or value is invalid\" );\n if( use_ret == -(MBEDTLS_ERR_X509_INVALID_SIGNATURE) )\n mbedtls_snprintf( buf, buflen, \"X509 - The signature tag or value invalid\" );\n if( use_ret == -(MBEDTLS_ERR_X509_INVALID_EXTENSIONS) )\n mbedtls_snprintf( buf, buflen, \"X509 - The extension tag or value is invalid\" );\n if( use_ret == -(MBEDTLS_ERR_X509_UNKNOWN_VERSION) )\n mbedtls_snprintf( buf, buflen, \"X509 - CRT/CRL/CSR has an unsupported version number\" );\n if( use_ret == -(MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG) )\n mbedtls_snprintf( buf, buflen, \"X509 - Signature algorithm (oid) is unsupported\" );\n if( use_ret == -(MBEDTLS_ERR_X509_SIG_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"X509 - Signature algorithms do not match. (see \\\\c ::mbedtls_x509_crt sig_oid)\" );\n if( use_ret == -(MBEDTLS_ERR_X509_CERT_VERIFY_FAILED) )\n mbedtls_snprintf( buf, buflen, \"X509 - Certificate verification failed, e.g. CRL, CA or signature check failed\" );\n if( use_ret == -(MBEDTLS_ERR_X509_CERT_UNKNOWN_FORMAT) )\n mbedtls_snprintf( buf, buflen, \"X509 - Format not recognized as DER or PEM\" );\n if( use_ret == -(MBEDTLS_ERR_X509_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"X509 - Input invalid\" );\n if( use_ret == -(MBEDTLS_ERR_X509_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"X509 - Allocation of memory failed\" );\n if( use_ret == -(MBEDTLS_ERR_X509_FILE_IO_ERROR) )\n mbedtls_snprintf( buf, buflen, \"X509 - Read/write of file failed\" );\n if( use_ret == -(MBEDTLS_ERR_X509_BUFFER_TOO_SMALL) )\n mbedtls_snprintf( buf, buflen, \"X509 - Destination buffer is too small\" );", "", "#endif /* MBEDTLS_X509_USE_C || MBEDTLS_X509_CREATE_C */\n // END generated code", " if( strlen( buf ) == 0 )\n mbedtls_snprintf( buf, buflen, \"UNKNOWN ERROR CODE (%04X)\", use_ret );\n }", " use_ret = ret & ~0xFF80;", " if( use_ret == 0 )\n return;", " // If high level code is present, make a concatenation between both\n // error strings.\n //\n len = strlen( buf );", " if( len > 0 )\n {\n if( buflen - len < 5 )\n return;", " mbedtls_snprintf( buf + len, buflen - len, \" : \" );", " buf += len + 3;\n buflen -= len + 3;\n }", " // Low level error codes\n //\n // BEGIN generated code\n#if defined(MBEDTLS_AES_C)\n if( use_ret == -(MBEDTLS_ERR_AES_INVALID_KEY_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"AES - Invalid key length\" );\n if( use_ret == -(MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"AES - Invalid data input length\" );\n#endif /* MBEDTLS_AES_C */", "#if defined(MBEDTLS_ASN1_PARSE_C)\n if( use_ret == -(MBEDTLS_ERR_ASN1_OUT_OF_DATA) )\n mbedtls_snprintf( buf, buflen, \"ASN1 - Out of data when parsing an ASN1 data structure\" );\n if( use_ret == -(MBEDTLS_ERR_ASN1_UNEXPECTED_TAG) )\n mbedtls_snprintf( buf, buflen, \"ASN1 - ASN1 tag was of an unexpected value\" );\n if( use_ret == -(MBEDTLS_ERR_ASN1_INVALID_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"ASN1 - Error when trying to determine the length or invalid length\" );\n if( use_ret == -(MBEDTLS_ERR_ASN1_LENGTH_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"ASN1 - Actual length differs from expected length\" );\n if( use_ret == -(MBEDTLS_ERR_ASN1_INVALID_DATA) )\n mbedtls_snprintf( buf, buflen, \"ASN1 - Data is invalid. (not used)\" );\n if( use_ret == -(MBEDTLS_ERR_ASN1_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"ASN1 - Memory allocation failed\" );\n if( use_ret == -(MBEDTLS_ERR_ASN1_BUF_TOO_SMALL) )\n mbedtls_snprintf( buf, buflen, \"ASN1 - Buffer too small when writing ASN.1 data structure\" );\n#endif /* MBEDTLS_ASN1_PARSE_C */", "#if defined(MBEDTLS_BASE64_C)\n if( use_ret == -(MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL) )\n mbedtls_snprintf( buf, buflen, \"BASE64 - Output buffer too small\" );\n if( use_ret == -(MBEDTLS_ERR_BASE64_INVALID_CHARACTER) )\n mbedtls_snprintf( buf, buflen, \"BASE64 - Invalid character in input\" );\n#endif /* MBEDTLS_BASE64_C */", "#if defined(MBEDTLS_BIGNUM_C)\n if( use_ret == -(MBEDTLS_ERR_MPI_FILE_IO_ERROR) )\n mbedtls_snprintf( buf, buflen, \"BIGNUM - An error occurred while reading from or writing to a file\" );\n if( use_ret == -(MBEDTLS_ERR_MPI_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"BIGNUM - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_MPI_INVALID_CHARACTER) )\n mbedtls_snprintf( buf, buflen, \"BIGNUM - There is an invalid character in the digit string\" );\n if( use_ret == -(MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL) )\n mbedtls_snprintf( buf, buflen, \"BIGNUM - The buffer is too small to write to\" );\n if( use_ret == -(MBEDTLS_ERR_MPI_NEGATIVE_VALUE) )\n mbedtls_snprintf( buf, buflen, \"BIGNUM - The input arguments are negative or result in illegal output\" );\n if( use_ret == -(MBEDTLS_ERR_MPI_DIVISION_BY_ZERO) )\n mbedtls_snprintf( buf, buflen, \"BIGNUM - The input argument for division is zero, which is not allowed\" );\n if( use_ret == -(MBEDTLS_ERR_MPI_NOT_ACCEPTABLE) )\n mbedtls_snprintf( buf, buflen, \"BIGNUM - The input arguments are not acceptable\" );\n if( use_ret == -(MBEDTLS_ERR_MPI_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"BIGNUM - Memory allocation failed\" );\n#endif /* MBEDTLS_BIGNUM_C */", "#if defined(MBEDTLS_BLOWFISH_C)\n if( use_ret == -(MBEDTLS_ERR_BLOWFISH_INVALID_KEY_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"BLOWFISH - Invalid key length\" );\n if( use_ret == -(MBEDTLS_ERR_BLOWFISH_INVALID_INPUT_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"BLOWFISH - Invalid data input length\" );\n#endif /* MBEDTLS_BLOWFISH_C */", "#if defined(MBEDTLS_CAMELLIA_C)\n if( use_ret == -(MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"CAMELLIA - Invalid key length\" );\n if( use_ret == -(MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"CAMELLIA - Invalid data input length\" );\n#endif /* MBEDTLS_CAMELLIA_C */", "#if defined(MBEDTLS_CCM_C)\n if( use_ret == -(MBEDTLS_ERR_CCM_BAD_INPUT) )\n mbedtls_snprintf( buf, buflen, \"CCM - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_CCM_AUTH_FAILED) )\n mbedtls_snprintf( buf, buflen, \"CCM - Authenticated decryption failed\" );\n#endif /* MBEDTLS_CCM_C */", "#if defined(MBEDTLS_CTR_DRBG_C)\n if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED) )\n mbedtls_snprintf( buf, buflen, \"CTR_DRBG - The entropy source failed\" );\n if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG) )\n mbedtls_snprintf( buf, buflen, \"CTR_DRBG - Too many random requested in single call\" );\n if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG) )\n mbedtls_snprintf( buf, buflen, \"CTR_DRBG - Input too large (Entropy + additional)\" );\n if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR) )\n mbedtls_snprintf( buf, buflen, \"CTR_DRBG - Read/write error in file\" );\n#endif /* MBEDTLS_CTR_DRBG_C */", "#if defined(MBEDTLS_DES_C)\n if( use_ret == -(MBEDTLS_ERR_DES_INVALID_INPUT_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"DES - The data input has an invalid length\" );\n#endif /* MBEDTLS_DES_C */", "#if defined(MBEDTLS_ENTROPY_C)\n if( use_ret == -(MBEDTLS_ERR_ENTROPY_SOURCE_FAILED) )\n mbedtls_snprintf( buf, buflen, \"ENTROPY - Critical entropy source failure\" );\n if( use_ret == -(MBEDTLS_ERR_ENTROPY_MAX_SOURCES) )\n mbedtls_snprintf( buf, buflen, \"ENTROPY - No more sources can be added\" );\n if( use_ret == -(MBEDTLS_ERR_ENTROPY_NO_SOURCES_DEFINED) )\n mbedtls_snprintf( buf, buflen, \"ENTROPY - No sources have been added to poll\" );\n if( use_ret == -(MBEDTLS_ERR_ENTROPY_NO_STRONG_SOURCE) )\n mbedtls_snprintf( buf, buflen, \"ENTROPY - No strong sources have been added to poll\" );\n if( use_ret == -(MBEDTLS_ERR_ENTROPY_FILE_IO_ERROR) )\n mbedtls_snprintf( buf, buflen, \"ENTROPY - Read/write error in file\" );\n#endif /* MBEDTLS_ENTROPY_C */", "#if defined(MBEDTLS_GCM_C)\n if( use_ret == -(MBEDTLS_ERR_GCM_AUTH_FAILED) )\n mbedtls_snprintf( buf, buflen, \"GCM - Authenticated decryption failed\" );\n if( use_ret == -(MBEDTLS_ERR_GCM_BAD_INPUT) )\n mbedtls_snprintf( buf, buflen, \"GCM - Bad input parameters to function\" );\n#endif /* MBEDTLS_GCM_C */", "#if defined(MBEDTLS_HMAC_DRBG_C)\n if( use_ret == -(MBEDTLS_ERR_HMAC_DRBG_REQUEST_TOO_BIG) )\n mbedtls_snprintf( buf, buflen, \"HMAC_DRBG - Too many random requested in single call\" );\n if( use_ret == -(MBEDTLS_ERR_HMAC_DRBG_INPUT_TOO_BIG) )\n mbedtls_snprintf( buf, buflen, \"HMAC_DRBG - Input too large (Entropy + additional)\" );\n if( use_ret == -(MBEDTLS_ERR_HMAC_DRBG_FILE_IO_ERROR) )\n mbedtls_snprintf( buf, buflen, \"HMAC_DRBG - Read/write error in file\" );\n if( use_ret == -(MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED) )\n mbedtls_snprintf( buf, buflen, \"HMAC_DRBG - The entropy source failed\" );\n#endif /* MBEDTLS_HMAC_DRBG_C */", "#if defined(MBEDTLS_NET_C)\n if( use_ret == -(MBEDTLS_ERR_NET_SOCKET_FAILED) )\n mbedtls_snprintf( buf, buflen, \"NET - Failed to open a socket\" );\n if( use_ret == -(MBEDTLS_ERR_NET_CONNECT_FAILED) )\n mbedtls_snprintf( buf, buflen, \"NET - The connection to the given server / port failed\" );\n if( use_ret == -(MBEDTLS_ERR_NET_BIND_FAILED) )\n mbedtls_snprintf( buf, buflen, \"NET - Binding of the socket failed\" );\n if( use_ret == -(MBEDTLS_ERR_NET_LISTEN_FAILED) )\n mbedtls_snprintf( buf, buflen, \"NET - Could not listen on the socket\" );\n if( use_ret == -(MBEDTLS_ERR_NET_ACCEPT_FAILED) )\n mbedtls_snprintf( buf, buflen, \"NET - Could not accept the incoming connection\" );\n if( use_ret == -(MBEDTLS_ERR_NET_RECV_FAILED) )\n mbedtls_snprintf( buf, buflen, \"NET - Reading information from the socket failed\" );\n if( use_ret == -(MBEDTLS_ERR_NET_SEND_FAILED) )\n mbedtls_snprintf( buf, buflen, \"NET - Sending information through the socket failed\" );\n if( use_ret == -(MBEDTLS_ERR_NET_CONN_RESET) )\n mbedtls_snprintf( buf, buflen, \"NET - Connection was reset by peer\" );\n if( use_ret == -(MBEDTLS_ERR_NET_UNKNOWN_HOST) )\n mbedtls_snprintf( buf, buflen, \"NET - Failed to get an IP address for the given hostname\" );\n if( use_ret == -(MBEDTLS_ERR_NET_BUFFER_TOO_SMALL) )\n mbedtls_snprintf( buf, buflen, \"NET - Buffer is too small to hold the data\" );\n if( use_ret == -(MBEDTLS_ERR_NET_INVALID_CONTEXT) )\n mbedtls_snprintf( buf, buflen, \"NET - The context is invalid, eg because it was free()ed\" );\n#endif /* MBEDTLS_NET_C */", "#if defined(MBEDTLS_OID_C)\n if( use_ret == -(MBEDTLS_ERR_OID_NOT_FOUND) )\n mbedtls_snprintf( buf, buflen, \"OID - OID is not found\" );\n if( use_ret == -(MBEDTLS_ERR_OID_BUF_TOO_SMALL) )\n mbedtls_snprintf( buf, buflen, \"OID - output buffer is too small\" );\n#endif /* MBEDTLS_OID_C */", "#if defined(MBEDTLS_PADLOCK_C)\n if( use_ret == -(MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED) )\n mbedtls_snprintf( buf, buflen, \"PADLOCK - Input data should be aligned\" );\n#endif /* MBEDTLS_PADLOCK_C */", "#if defined(MBEDTLS_THREADING_C)\n if( use_ret == -(MBEDTLS_ERR_THREADING_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"THREADING - The selected feature is not available\" );\n if( use_ret == -(MBEDTLS_ERR_THREADING_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"THREADING - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_THREADING_MUTEX_ERROR) )\n mbedtls_snprintf( buf, buflen, \"THREADING - Locking / unlocking / free failed with error code\" );\n#endif /* MBEDTLS_THREADING_C */", "#if defined(MBEDTLS_XTEA_C)\n if( use_ret == -(MBEDTLS_ERR_XTEA_INVALID_INPUT_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"XTEA - The data input has an invalid length\" );\n#endif /* MBEDTLS_XTEA_C */\n // END generated code", " if( strlen( buf ) != 0 )\n return;", " mbedtls_snprintf( buf, buflen, \"UNKNOWN ERROR CODE (%04X)\", use_ret );\n}", "#else /* MBEDTLS_ERROR_C */", "#if defined(MBEDTLS_ERROR_STRERROR_DUMMY)", "/*\n * Provide an non-function in case MBEDTLS_ERROR_C is not defined\n */\nvoid mbedtls_strerror( int ret, char *buf, size_t buflen )\n{\n ((void) ret);", " if( buflen > 0 )\n buf[0] = '\\0';\n}", "#endif /* MBEDTLS_ERROR_STRERROR_DUMMY */", "#endif /* MBEDTLS_ERROR_C */" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [8, 75, 1056, 78, 271, 482, 2312, 1208], "buggy_code_start_loc": [8, 74, 1055, 78, 270, 482, 2060, 1207], "filenames": ["ChangeLog", "include/mbedtls/error.h", "include/mbedtls/ssl.h", "include/mbedtls/x509.h", "include/mbedtls/x509_crt.h", "library/error.c", "library/x509_crt.c", "tests/suites/test_suite_x509parse.data"], "fixing_code_end_loc": [12, 75, 1056, 80, 277, 485, 2317, 1208], "fixing_code_start_loc": [9, 74, 1055, 79, 270, 483, 2060, 1207], "message": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.10:*:*:*:*:*:*:*", "matchCriteriaId": "28621156-2430-447B-8816-47B0FB58245B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.11:*:*:*:*:*:*:*", "matchCriteriaId": "E11BBB2C-0423-47B1-AE12-EB849E17BAF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.12:*:*:*:*:*:*:*", "matchCriteriaId": "4131CE76-6260-412C-A6A6-20B0E978E569", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.13:*:*:*:*:*:*:*", "matchCriteriaId": "DE92D8F7-5705-47B6-B2C2-9DE6C7880647", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.14:*:*:*:*:*:*:*", "matchCriteriaId": "EA50C256-2054-4661-9C42-D31D7D87BAF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.15:*:*:*:*:*:*:*", "matchCriteriaId": "7791D4E9-3FEE-42DA-B320-CF7188A10294", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.16:*:*:*:*:*:*:*", "matchCriteriaId": "BE415DAA-A89F-4204-AC2C-577FCB447E4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.17:*:*:*:*:*:*:*", "matchCriteriaId": "95F691DB-9552-4EBB-B29D-16658561FA4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.18:*:*:*:*:*:*:*", "matchCriteriaId": "F1547B2A-E0D5-41D1-9449-1CCF35022B0E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.19:*:*:*:*:*:*:*", "matchCriteriaId": "CF762122-64BC-4A1A-A26D-81C1270541A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.20:*:*:*:*:*:*:*", "matchCriteriaId": "59D6B559-5F99-4E38-A861-3AB8A7D2E6BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.21:*:*:*:*:*:*:*", "matchCriteriaId": "4A8956C8-6CF0-4C37-84F9-8A89726806C3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "0B395D81-876F-43FC-8DB9-44377647A37A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F92622F1-82DA-4819-8275-06DC9DBE1BA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5871FDE9-02D0-466C-BDB7-90A14C4F637E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE6B4875-3FC3-499F-A76B-2D04982F743A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "B3B67842-5AFA-459F-9CCF-772B9DC7139F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "AD0500EE-52C0-4896-B3D8-5BE731D66039", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "015739E9-C0E3-4A62-BB9D-FA836BFD4351", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "842B0D15-6A3D-4CEE-AD02-49B0436E78E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "3CF6E05C-E6E5-40B8-AFEA-A5ED937F5439", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "D4133C86-70E0-44FD-BBDB-D61EFB31F027", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "6F9D24F0-3892-417F-9C3A-CACEF00C2293", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "8911513E-968C-403E-9D00-2DC0AA82F99B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "48D98945-82BB-4954-AA6D-7D98E4CE1154", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "6378C1CC-7C8F-47E3-A1A7-CDEC76E4CBE4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "525190A3-2194-4E4E-9D34-0048583B9C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "70407352-624A-40E6-82E4-7B4FAFE0C0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "DD52988E-4B2F-41AF-BC25-F38F87D9B8C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "FD1F7803-31F3-40A9-A878-FDC757FCE83F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected."}, {"lang": "es", "value": "ARM mbed TLS en versiones anteriores a la 1.3.21 y en versiones 2.x anteriores a la 2.1.9, si se configura la autenticaci\u00f3n opcional, permite a los atacantes omitir la autenticaci\u00f3n Peer mediante una cadena de certificados X.509 con muchos intermediarios. NOTA: aunque mbed TLS se conoc\u00eda antes como PolarSSL, las versiones lanzadas con el nombre PolarSSL no est\u00e1n afectadas."}], "evaluatorComment": null, "id": "CVE-2017-14032", "lastModified": "2017-11-08T02:29:02.850", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-08-30T20:29:00.337", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.debian.org/security/2017/dsa-3967"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugs.debian.org/873557"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/d15795acd5074e0b44e71f7ede8bdfe1b48591fc"}, {"source": "cve@mitre.org", "tags": ["Vendor Advisory"], "url": "https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2017-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, "type": "CWE-287"}
351
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n * Error message information\n *\n * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved\n * SPDX-License-Identifier: Apache-2.0\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n * not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is part of mbed TLS (https://tls.mbed.org)\n */", "#if !defined(MBEDTLS_CONFIG_FILE)\n#include \"mbedtls/config.h\"\n#else\n#include MBEDTLS_CONFIG_FILE\n#endif", "#if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY)\n#include \"mbedtls/error.h\"\n#include <string.h>\n#endif", "#if defined(MBEDTLS_PLATFORM_C)\n#include \"mbedtls/platform.h\"\n#else\n#define mbedtls_snprintf snprintf\n#define mbedtls_time_t time_t\n#endif", "#if defined(MBEDTLS_ERROR_C)", "#include <stdio.h>", "#if defined(MBEDTLS_AES_C)\n#include \"mbedtls/aes.h\"\n#endif", "#if defined(MBEDTLS_BASE64_C)\n#include \"mbedtls/base64.h\"\n#endif", "#if defined(MBEDTLS_BIGNUM_C)\n#include \"mbedtls/bignum.h\"\n#endif", "#if defined(MBEDTLS_BLOWFISH_C)\n#include \"mbedtls/blowfish.h\"\n#endif", "#if defined(MBEDTLS_CAMELLIA_C)\n#include \"mbedtls/camellia.h\"\n#endif", "#if defined(MBEDTLS_CCM_C)\n#include \"mbedtls/ccm.h\"\n#endif", "#if defined(MBEDTLS_CIPHER_C)\n#include \"mbedtls/cipher.h\"\n#endif", "#if defined(MBEDTLS_CTR_DRBG_C)\n#include \"mbedtls/ctr_drbg.h\"\n#endif", "#if defined(MBEDTLS_DES_C)\n#include \"mbedtls/des.h\"\n#endif", "#if defined(MBEDTLS_DHM_C)\n#include \"mbedtls/dhm.h\"\n#endif", "#if defined(MBEDTLS_ECP_C)\n#include \"mbedtls/ecp.h\"\n#endif", "#if defined(MBEDTLS_ENTROPY_C)\n#include \"mbedtls/entropy.h\"\n#endif", "#if defined(MBEDTLS_GCM_C)\n#include \"mbedtls/gcm.h\"\n#endif", "#if defined(MBEDTLS_HMAC_DRBG_C)\n#include \"mbedtls/hmac_drbg.h\"\n#endif", "#if defined(MBEDTLS_MD_C)\n#include \"mbedtls/md.h\"\n#endif", "#if defined(MBEDTLS_NET_C)\n#include \"mbedtls/net_sockets.h\"\n#endif", "#if defined(MBEDTLS_OID_C)\n#include \"mbedtls/oid.h\"\n#endif", "#if defined(MBEDTLS_PADLOCK_C)\n#include \"mbedtls/padlock.h\"\n#endif", "#if defined(MBEDTLS_PEM_PARSE_C) || defined(MBEDTLS_PEM_WRITE_C)\n#include \"mbedtls/pem.h\"\n#endif", "#if defined(MBEDTLS_PK_C)\n#include \"mbedtls/pk.h\"\n#endif", "#if defined(MBEDTLS_PKCS12_C)\n#include \"mbedtls/pkcs12.h\"\n#endif", "#if defined(MBEDTLS_PKCS5_C)\n#include \"mbedtls/pkcs5.h\"\n#endif", "#if defined(MBEDTLS_RSA_C)\n#include \"mbedtls/rsa.h\"\n#endif", "#if defined(MBEDTLS_SSL_TLS_C)\n#include \"mbedtls/ssl.h\"\n#endif", "#if defined(MBEDTLS_THREADING_C)\n#include \"mbedtls/threading.h\"\n#endif", "#if defined(MBEDTLS_X509_USE_C) || defined(MBEDTLS_X509_CREATE_C)\n#include \"mbedtls/x509.h\"\n#endif", "#if defined(MBEDTLS_XTEA_C)\n#include \"mbedtls/xtea.h\"\n#endif", "\nvoid mbedtls_strerror( int ret, char *buf, size_t buflen )\n{\n size_t len;\n int use_ret;", " if( buflen == 0 )\n return;", " memset( buf, 0x00, buflen );", " if( ret < 0 )\n ret = -ret;", " if( ret & 0xFF80 )\n {\n use_ret = ret & 0xFF80;", " // High level error codes\n //\n // BEGIN generated code\n#if defined(MBEDTLS_CIPHER_C)\n if( use_ret == -(MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"CIPHER - The selected feature is not available\" );\n if( use_ret == -(MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"CIPHER - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_CIPHER_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"CIPHER - Failed to allocate memory\" );\n if( use_ret == -(MBEDTLS_ERR_CIPHER_INVALID_PADDING) )\n mbedtls_snprintf( buf, buflen, \"CIPHER - Input data contains invalid padding and is rejected\" );\n if( use_ret == -(MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED) )\n mbedtls_snprintf( buf, buflen, \"CIPHER - Decryption of block requires a full block\" );\n if( use_ret == -(MBEDTLS_ERR_CIPHER_AUTH_FAILED) )\n mbedtls_snprintf( buf, buflen, \"CIPHER - Authentication failed (for AEAD modes)\" );\n if( use_ret == -(MBEDTLS_ERR_CIPHER_INVALID_CONTEXT) )\n mbedtls_snprintf( buf, buflen, \"CIPHER - The context is invalid, eg because it was free()ed\" );\n#endif /* MBEDTLS_CIPHER_C */", "#if defined(MBEDTLS_DHM_C)\n if( use_ret == -(MBEDTLS_ERR_DHM_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"DHM - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_DHM_READ_PARAMS_FAILED) )\n mbedtls_snprintf( buf, buflen, \"DHM - Reading of the DHM parameters failed\" );\n if( use_ret == -(MBEDTLS_ERR_DHM_MAKE_PARAMS_FAILED) )\n mbedtls_snprintf( buf, buflen, \"DHM - Making of the DHM parameters failed\" );\n if( use_ret == -(MBEDTLS_ERR_DHM_READ_PUBLIC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"DHM - Reading of the public values failed\" );\n if( use_ret == -(MBEDTLS_ERR_DHM_MAKE_PUBLIC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"DHM - Making of the public value failed\" );\n if( use_ret == -(MBEDTLS_ERR_DHM_CALC_SECRET_FAILED) )\n mbedtls_snprintf( buf, buflen, \"DHM - Calculation of the DHM secret failed\" );\n if( use_ret == -(MBEDTLS_ERR_DHM_INVALID_FORMAT) )\n mbedtls_snprintf( buf, buflen, \"DHM - The ASN.1 data is not formatted correctly\" );\n if( use_ret == -(MBEDTLS_ERR_DHM_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"DHM - Allocation of memory failed\" );\n if( use_ret == -(MBEDTLS_ERR_DHM_FILE_IO_ERROR) )\n mbedtls_snprintf( buf, buflen, \"DHM - Read/write of file failed\" );\n#endif /* MBEDTLS_DHM_C */", "#if defined(MBEDTLS_ECP_C)\n if( use_ret == -(MBEDTLS_ERR_ECP_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"ECP - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL) )\n mbedtls_snprintf( buf, buflen, \"ECP - The buffer is too small to write to\" );\n if( use_ret == -(MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"ECP - Requested curve not available\" );\n if( use_ret == -(MBEDTLS_ERR_ECP_VERIFY_FAILED) )\n mbedtls_snprintf( buf, buflen, \"ECP - The signature is not valid\" );\n if( use_ret == -(MBEDTLS_ERR_ECP_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"ECP - Memory allocation failed\" );\n if( use_ret == -(MBEDTLS_ERR_ECP_RANDOM_FAILED) )\n mbedtls_snprintf( buf, buflen, \"ECP - Generation of random value, such as (ephemeral) key, failed\" );\n if( use_ret == -(MBEDTLS_ERR_ECP_INVALID_KEY) )\n mbedtls_snprintf( buf, buflen, \"ECP - Invalid private or public key\" );\n if( use_ret == -(MBEDTLS_ERR_ECP_SIG_LEN_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"ECP - Signature is valid but shorter than the user-supplied length\" );\n#endif /* MBEDTLS_ECP_C */", "#if defined(MBEDTLS_MD_C)\n if( use_ret == -(MBEDTLS_ERR_MD_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"MD - The selected feature is not available\" );\n if( use_ret == -(MBEDTLS_ERR_MD_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"MD - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_MD_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"MD - Failed to allocate memory\" );\n if( use_ret == -(MBEDTLS_ERR_MD_FILE_IO_ERROR) )\n mbedtls_snprintf( buf, buflen, \"MD - Opening or reading of file failed\" );\n#endif /* MBEDTLS_MD_C */", "#if defined(MBEDTLS_PEM_PARSE_C) || defined(MBEDTLS_PEM_WRITE_C)\n if( use_ret == -(MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT) )\n mbedtls_snprintf( buf, buflen, \"PEM - No PEM header or footer found\" );\n if( use_ret == -(MBEDTLS_ERR_PEM_INVALID_DATA) )\n mbedtls_snprintf( buf, buflen, \"PEM - PEM string is not as expected\" );\n if( use_ret == -(MBEDTLS_ERR_PEM_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"PEM - Failed to allocate memory\" );\n if( use_ret == -(MBEDTLS_ERR_PEM_INVALID_ENC_IV) )\n mbedtls_snprintf( buf, buflen, \"PEM - RSA IV is not in hex-format\" );\n if( use_ret == -(MBEDTLS_ERR_PEM_UNKNOWN_ENC_ALG) )\n mbedtls_snprintf( buf, buflen, \"PEM - Unsupported key encryption algorithm\" );\n if( use_ret == -(MBEDTLS_ERR_PEM_PASSWORD_REQUIRED) )\n mbedtls_snprintf( buf, buflen, \"PEM - Private key password can't be empty\" );\n if( use_ret == -(MBEDTLS_ERR_PEM_PASSWORD_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"PEM - Given private key password does not allow for correct decryption\" );\n if( use_ret == -(MBEDTLS_ERR_PEM_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"PEM - Unavailable feature, e.g. hashing/encryption combination\" );\n if( use_ret == -(MBEDTLS_ERR_PEM_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"PEM - Bad input parameters to function\" );\n#endif /* MBEDTLS_PEM_PARSE_C || MBEDTLS_PEM_WRITE_C */", "#if defined(MBEDTLS_PK_C)\n if( use_ret == -(MBEDTLS_ERR_PK_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"PK - Memory allocation failed\" );\n if( use_ret == -(MBEDTLS_ERR_PK_TYPE_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"PK - Type mismatch, eg attempt to encrypt with an ECDSA key\" );\n if( use_ret == -(MBEDTLS_ERR_PK_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"PK - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_PK_FILE_IO_ERROR) )\n mbedtls_snprintf( buf, buflen, \"PK - Read/write of file failed\" );\n if( use_ret == -(MBEDTLS_ERR_PK_KEY_INVALID_VERSION) )\n mbedtls_snprintf( buf, buflen, \"PK - Unsupported key version\" );\n if( use_ret == -(MBEDTLS_ERR_PK_KEY_INVALID_FORMAT) )\n mbedtls_snprintf( buf, buflen, \"PK - Invalid key tag or value\" );\n if( use_ret == -(MBEDTLS_ERR_PK_UNKNOWN_PK_ALG) )\n mbedtls_snprintf( buf, buflen, \"PK - Key algorithm is unsupported (only RSA and EC are supported)\" );\n if( use_ret == -(MBEDTLS_ERR_PK_PASSWORD_REQUIRED) )\n mbedtls_snprintf( buf, buflen, \"PK - Private key password can't be empty\" );\n if( use_ret == -(MBEDTLS_ERR_PK_PASSWORD_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"PK - Given private key password does not allow for correct decryption\" );\n if( use_ret == -(MBEDTLS_ERR_PK_INVALID_PUBKEY) )\n mbedtls_snprintf( buf, buflen, \"PK - The pubkey tag or value is invalid (only RSA and EC are supported)\" );\n if( use_ret == -(MBEDTLS_ERR_PK_INVALID_ALG) )\n mbedtls_snprintf( buf, buflen, \"PK - The algorithm tag or value is invalid\" );\n if( use_ret == -(MBEDTLS_ERR_PK_UNKNOWN_NAMED_CURVE) )\n mbedtls_snprintf( buf, buflen, \"PK - Elliptic curve is unsupported (only NIST curves are supported)\" );\n if( use_ret == -(MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"PK - Unavailable feature, e.g. RSA disabled for RSA key\" );\n if( use_ret == -(MBEDTLS_ERR_PK_SIG_LEN_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"PK - The signature is valid but its length is less than expected\" );\n#endif /* MBEDTLS_PK_C */", "#if defined(MBEDTLS_PKCS12_C)\n if( use_ret == -(MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"PKCS12 - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_PKCS12_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"PKCS12 - Feature not available, e.g. unsupported encryption scheme\" );\n if( use_ret == -(MBEDTLS_ERR_PKCS12_PBE_INVALID_FORMAT) )\n mbedtls_snprintf( buf, buflen, \"PKCS12 - PBE ASN.1 data not as expected\" );\n if( use_ret == -(MBEDTLS_ERR_PKCS12_PASSWORD_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"PKCS12 - Given private key password does not allow for correct decryption\" );\n#endif /* MBEDTLS_PKCS12_C */", "#if defined(MBEDTLS_PKCS5_C)\n if( use_ret == -(MBEDTLS_ERR_PKCS5_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"PKCS5 - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_PKCS5_INVALID_FORMAT) )\n mbedtls_snprintf( buf, buflen, \"PKCS5 - Unexpected ASN.1 data\" );\n if( use_ret == -(MBEDTLS_ERR_PKCS5_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"PKCS5 - Requested encryption or digest alg not available\" );\n if( use_ret == -(MBEDTLS_ERR_PKCS5_PASSWORD_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"PKCS5 - Given private key password does not allow for correct decryption\" );\n#endif /* MBEDTLS_PKCS5_C */", "#if defined(MBEDTLS_RSA_C)\n if( use_ret == -(MBEDTLS_ERR_RSA_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"RSA - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_RSA_INVALID_PADDING) )\n mbedtls_snprintf( buf, buflen, \"RSA - Input data contains invalid padding and is rejected\" );\n if( use_ret == -(MBEDTLS_ERR_RSA_KEY_GEN_FAILED) )\n mbedtls_snprintf( buf, buflen, \"RSA - Something failed during generation of a key\" );\n if( use_ret == -(MBEDTLS_ERR_RSA_KEY_CHECK_FAILED) )\n mbedtls_snprintf( buf, buflen, \"RSA - Key failed to pass the library's validity check\" );\n if( use_ret == -(MBEDTLS_ERR_RSA_PUBLIC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"RSA - The public key operation failed\" );\n if( use_ret == -(MBEDTLS_ERR_RSA_PRIVATE_FAILED) )\n mbedtls_snprintf( buf, buflen, \"RSA - The private key operation failed\" );\n if( use_ret == -(MBEDTLS_ERR_RSA_VERIFY_FAILED) )\n mbedtls_snprintf( buf, buflen, \"RSA - The PKCS#1 verification failed\" );\n if( use_ret == -(MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE) )\n mbedtls_snprintf( buf, buflen, \"RSA - The output buffer for decryption is not large enough\" );\n if( use_ret == -(MBEDTLS_ERR_RSA_RNG_FAILED) )\n mbedtls_snprintf( buf, buflen, \"RSA - The random generator failed to generate non-zeros\" );\n#endif /* MBEDTLS_RSA_C */", "#if defined(MBEDTLS_SSL_TLS_C)\n if( use_ret == -(MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"SSL - The requested feature is not available\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"SSL - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_INVALID_MAC) )\n mbedtls_snprintf( buf, buflen, \"SSL - Verification of the message MAC failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_INVALID_RECORD) )\n mbedtls_snprintf( buf, buflen, \"SSL - An invalid SSL record was received\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_CONN_EOF) )\n mbedtls_snprintf( buf, buflen, \"SSL - The connection indicated an EOF\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_UNKNOWN_CIPHER) )\n mbedtls_snprintf( buf, buflen, \"SSL - An unknown cipher was received\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN) )\n mbedtls_snprintf( buf, buflen, \"SSL - The server has no ciphersuites in common with the client\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_NO_RNG) )\n mbedtls_snprintf( buf, buflen, \"SSL - No RNG was provided to the SSL module\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_NO_CLIENT_CERTIFICATE) )\n mbedtls_snprintf( buf, buflen, \"SSL - No client certification received from the client, but required by the authentication mode\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_CERTIFICATE_TOO_LARGE) )\n mbedtls_snprintf( buf, buflen, \"SSL - Our own certificate(s) is/are too large to send in an SSL message\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_CERTIFICATE_REQUIRED) )\n mbedtls_snprintf( buf, buflen, \"SSL - The own certificate is not set, but needed by the server\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED) )\n mbedtls_snprintf( buf, buflen, \"SSL - The own private key or pre-shared key is not set, but needed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_CA_CHAIN_REQUIRED) )\n mbedtls_snprintf( buf, buflen, \"SSL - No CA Chain is set, but required to operate\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE) )\n mbedtls_snprintf( buf, buflen, \"SSL - An unexpected message was received from our peer\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE) )\n {\n mbedtls_snprintf( buf, buflen, \"SSL - A fatal alert message was received from our peer\" );\n return;\n }\n if( use_ret == -(MBEDTLS_ERR_SSL_PEER_VERIFY_FAILED) )\n mbedtls_snprintf( buf, buflen, \"SSL - Verification of our peer failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) )\n mbedtls_snprintf( buf, buflen, \"SSL - The peer notified us that the connection is going to be closed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CLIENT_HELLO) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the ClientHello handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the ServerHello handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the Certificate handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the CertificateRequest handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the ServerKeyExchange handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO_DONE) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the ServerHelloDone handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the ClientKeyExchange handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_RP) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the ClientKeyExchange handshake message failed in DHM / ECDH Read Public\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_CS) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the ClientKeyExchange handshake message failed in DHM / ECDH Calculate Secret\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the CertificateVerify handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the ChangeCipherSpec handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_FINISHED) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the Finished handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"SSL - Memory allocation failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_HW_ACCEL_FAILED) )\n mbedtls_snprintf( buf, buflen, \"SSL - Hardware acceleration function returned with error\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH) )\n mbedtls_snprintf( buf, buflen, \"SSL - Hardware acceleration function skipped / left alone data\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_COMPRESSION_FAILED) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the compression / decompression failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION) )\n mbedtls_snprintf( buf, buflen, \"SSL - Handshake protocol not within min/max boundaries\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_NEW_SESSION_TICKET) )\n mbedtls_snprintf( buf, buflen, \"SSL - Processing of the NewSessionTicket handshake message failed\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED) )\n mbedtls_snprintf( buf, buflen, \"SSL - Session ticket has expired\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"SSL - Public key type mismatch (eg, asked for RSA key exchange and presented EC key)\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY) )\n mbedtls_snprintf( buf, buflen, \"SSL - Unknown identity received (eg, PSK identity)\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_INTERNAL_ERROR) )\n mbedtls_snprintf( buf, buflen, \"SSL - Internal error (eg, unexpected failure in lower-level module)\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_COUNTER_WRAPPING) )\n mbedtls_snprintf( buf, buflen, \"SSL - A counter would wrap (eg, too many messages exchanged)\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO) )\n mbedtls_snprintf( buf, buflen, \"SSL - Unexpected message at ServerHello in renegotiation\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED) )\n mbedtls_snprintf( buf, buflen, \"SSL - DTLS client must retry for hello verification\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL) )\n mbedtls_snprintf( buf, buflen, \"SSL - A buffer is too small to receive or write a message\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_NO_USABLE_CIPHERSUITE) )\n mbedtls_snprintf( buf, buflen, \"SSL - None of the common ciphersuites is usable (eg, no suitable certificate, see debug messages)\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_WANT_READ) )\n mbedtls_snprintf( buf, buflen, \"SSL - Connection requires a read call\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_WANT_WRITE) )\n mbedtls_snprintf( buf, buflen, \"SSL - Connection requires a write call\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_TIMEOUT) )\n mbedtls_snprintf( buf, buflen, \"SSL - The operation timed out\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_CLIENT_RECONNECT) )\n mbedtls_snprintf( buf, buflen, \"SSL - The client initiated a reconnect from the same port\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_UNEXPECTED_RECORD) )\n mbedtls_snprintf( buf, buflen, \"SSL - Record header looks valid but is not expected\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_NON_FATAL) )\n mbedtls_snprintf( buf, buflen, \"SSL - The alert message received indicates a non-fatal error\" );\n if( use_ret == -(MBEDTLS_ERR_SSL_INVALID_VERIFY_HASH) )\n mbedtls_snprintf( buf, buflen, \"SSL - Couldn't set the hash for verifying CertificateVerify\" );\n#endif /* MBEDTLS_SSL_TLS_C */", "#if defined(MBEDTLS_X509_USE_C) || defined(MBEDTLS_X509_CREATE_C)\n if( use_ret == -(MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"X509 - Unavailable feature, e.g. RSA hashing/encryption combination\" );\n if( use_ret == -(MBEDTLS_ERR_X509_UNKNOWN_OID) )\n mbedtls_snprintf( buf, buflen, \"X509 - Requested OID is unknown\" );\n if( use_ret == -(MBEDTLS_ERR_X509_INVALID_FORMAT) )\n mbedtls_snprintf( buf, buflen, \"X509 - The CRT/CRL/CSR format is invalid, e.g. different type expected\" );\n if( use_ret == -(MBEDTLS_ERR_X509_INVALID_VERSION) )\n mbedtls_snprintf( buf, buflen, \"X509 - The CRT/CRL/CSR version element is invalid\" );\n if( use_ret == -(MBEDTLS_ERR_X509_INVALID_SERIAL) )\n mbedtls_snprintf( buf, buflen, \"X509 - The serial tag or value is invalid\" );\n if( use_ret == -(MBEDTLS_ERR_X509_INVALID_ALG) )\n mbedtls_snprintf( buf, buflen, \"X509 - The algorithm tag or value is invalid\" );\n if( use_ret == -(MBEDTLS_ERR_X509_INVALID_NAME) )\n mbedtls_snprintf( buf, buflen, \"X509 - The name tag or value is invalid\" );\n if( use_ret == -(MBEDTLS_ERR_X509_INVALID_DATE) )\n mbedtls_snprintf( buf, buflen, \"X509 - The date tag or value is invalid\" );\n if( use_ret == -(MBEDTLS_ERR_X509_INVALID_SIGNATURE) )\n mbedtls_snprintf( buf, buflen, \"X509 - The signature tag or value invalid\" );\n if( use_ret == -(MBEDTLS_ERR_X509_INVALID_EXTENSIONS) )\n mbedtls_snprintf( buf, buflen, \"X509 - The extension tag or value is invalid\" );\n if( use_ret == -(MBEDTLS_ERR_X509_UNKNOWN_VERSION) )\n mbedtls_snprintf( buf, buflen, \"X509 - CRT/CRL/CSR has an unsupported version number\" );\n if( use_ret == -(MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG) )\n mbedtls_snprintf( buf, buflen, \"X509 - Signature algorithm (oid) is unsupported\" );\n if( use_ret == -(MBEDTLS_ERR_X509_SIG_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"X509 - Signature algorithms do not match. (see \\\\c ::mbedtls_x509_crt sig_oid)\" );\n if( use_ret == -(MBEDTLS_ERR_X509_CERT_VERIFY_FAILED) )\n mbedtls_snprintf( buf, buflen, \"X509 - Certificate verification failed, e.g. CRL, CA or signature check failed\" );\n if( use_ret == -(MBEDTLS_ERR_X509_CERT_UNKNOWN_FORMAT) )\n mbedtls_snprintf( buf, buflen, \"X509 - Format not recognized as DER or PEM\" );\n if( use_ret == -(MBEDTLS_ERR_X509_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"X509 - Input invalid\" );\n if( use_ret == -(MBEDTLS_ERR_X509_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"X509 - Allocation of memory failed\" );\n if( use_ret == -(MBEDTLS_ERR_X509_FILE_IO_ERROR) )\n mbedtls_snprintf( buf, buflen, \"X509 - Read/write of file failed\" );\n if( use_ret == -(MBEDTLS_ERR_X509_BUFFER_TOO_SMALL) )\n mbedtls_snprintf( buf, buflen, \"X509 - Destination buffer is too small\" );", " if( use_ret == -(MBEDTLS_ERR_X509_FATAL_ERROR) )\n mbedtls_snprintf( buf, buflen, \"X509 - A fatal error occured, eg the chain is too long or the vrfy callback failed\" );", "#endif /* MBEDTLS_X509_USE_C || MBEDTLS_X509_CREATE_C */\n // END generated code", " if( strlen( buf ) == 0 )\n mbedtls_snprintf( buf, buflen, \"UNKNOWN ERROR CODE (%04X)\", use_ret );\n }", " use_ret = ret & ~0xFF80;", " if( use_ret == 0 )\n return;", " // If high level code is present, make a concatenation between both\n // error strings.\n //\n len = strlen( buf );", " if( len > 0 )\n {\n if( buflen - len < 5 )\n return;", " mbedtls_snprintf( buf + len, buflen - len, \" : \" );", " buf += len + 3;\n buflen -= len + 3;\n }", " // Low level error codes\n //\n // BEGIN generated code\n#if defined(MBEDTLS_AES_C)\n if( use_ret == -(MBEDTLS_ERR_AES_INVALID_KEY_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"AES - Invalid key length\" );\n if( use_ret == -(MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"AES - Invalid data input length\" );\n#endif /* MBEDTLS_AES_C */", "#if defined(MBEDTLS_ASN1_PARSE_C)\n if( use_ret == -(MBEDTLS_ERR_ASN1_OUT_OF_DATA) )\n mbedtls_snprintf( buf, buflen, \"ASN1 - Out of data when parsing an ASN1 data structure\" );\n if( use_ret == -(MBEDTLS_ERR_ASN1_UNEXPECTED_TAG) )\n mbedtls_snprintf( buf, buflen, \"ASN1 - ASN1 tag was of an unexpected value\" );\n if( use_ret == -(MBEDTLS_ERR_ASN1_INVALID_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"ASN1 - Error when trying to determine the length or invalid length\" );\n if( use_ret == -(MBEDTLS_ERR_ASN1_LENGTH_MISMATCH) )\n mbedtls_snprintf( buf, buflen, \"ASN1 - Actual length differs from expected length\" );\n if( use_ret == -(MBEDTLS_ERR_ASN1_INVALID_DATA) )\n mbedtls_snprintf( buf, buflen, \"ASN1 - Data is invalid. (not used)\" );\n if( use_ret == -(MBEDTLS_ERR_ASN1_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"ASN1 - Memory allocation failed\" );\n if( use_ret == -(MBEDTLS_ERR_ASN1_BUF_TOO_SMALL) )\n mbedtls_snprintf( buf, buflen, \"ASN1 - Buffer too small when writing ASN.1 data structure\" );\n#endif /* MBEDTLS_ASN1_PARSE_C */", "#if defined(MBEDTLS_BASE64_C)\n if( use_ret == -(MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL) )\n mbedtls_snprintf( buf, buflen, \"BASE64 - Output buffer too small\" );\n if( use_ret == -(MBEDTLS_ERR_BASE64_INVALID_CHARACTER) )\n mbedtls_snprintf( buf, buflen, \"BASE64 - Invalid character in input\" );\n#endif /* MBEDTLS_BASE64_C */", "#if defined(MBEDTLS_BIGNUM_C)\n if( use_ret == -(MBEDTLS_ERR_MPI_FILE_IO_ERROR) )\n mbedtls_snprintf( buf, buflen, \"BIGNUM - An error occurred while reading from or writing to a file\" );\n if( use_ret == -(MBEDTLS_ERR_MPI_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"BIGNUM - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_MPI_INVALID_CHARACTER) )\n mbedtls_snprintf( buf, buflen, \"BIGNUM - There is an invalid character in the digit string\" );\n if( use_ret == -(MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL) )\n mbedtls_snprintf( buf, buflen, \"BIGNUM - The buffer is too small to write to\" );\n if( use_ret == -(MBEDTLS_ERR_MPI_NEGATIVE_VALUE) )\n mbedtls_snprintf( buf, buflen, \"BIGNUM - The input arguments are negative or result in illegal output\" );\n if( use_ret == -(MBEDTLS_ERR_MPI_DIVISION_BY_ZERO) )\n mbedtls_snprintf( buf, buflen, \"BIGNUM - The input argument for division is zero, which is not allowed\" );\n if( use_ret == -(MBEDTLS_ERR_MPI_NOT_ACCEPTABLE) )\n mbedtls_snprintf( buf, buflen, \"BIGNUM - The input arguments are not acceptable\" );\n if( use_ret == -(MBEDTLS_ERR_MPI_ALLOC_FAILED) )\n mbedtls_snprintf( buf, buflen, \"BIGNUM - Memory allocation failed\" );\n#endif /* MBEDTLS_BIGNUM_C */", "#if defined(MBEDTLS_BLOWFISH_C)\n if( use_ret == -(MBEDTLS_ERR_BLOWFISH_INVALID_KEY_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"BLOWFISH - Invalid key length\" );\n if( use_ret == -(MBEDTLS_ERR_BLOWFISH_INVALID_INPUT_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"BLOWFISH - Invalid data input length\" );\n#endif /* MBEDTLS_BLOWFISH_C */", "#if defined(MBEDTLS_CAMELLIA_C)\n if( use_ret == -(MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"CAMELLIA - Invalid key length\" );\n if( use_ret == -(MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"CAMELLIA - Invalid data input length\" );\n#endif /* MBEDTLS_CAMELLIA_C */", "#if defined(MBEDTLS_CCM_C)\n if( use_ret == -(MBEDTLS_ERR_CCM_BAD_INPUT) )\n mbedtls_snprintf( buf, buflen, \"CCM - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_CCM_AUTH_FAILED) )\n mbedtls_snprintf( buf, buflen, \"CCM - Authenticated decryption failed\" );\n#endif /* MBEDTLS_CCM_C */", "#if defined(MBEDTLS_CTR_DRBG_C)\n if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED) )\n mbedtls_snprintf( buf, buflen, \"CTR_DRBG - The entropy source failed\" );\n if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG) )\n mbedtls_snprintf( buf, buflen, \"CTR_DRBG - Too many random requested in single call\" );\n if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG) )\n mbedtls_snprintf( buf, buflen, \"CTR_DRBG - Input too large (Entropy + additional)\" );\n if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR) )\n mbedtls_snprintf( buf, buflen, \"CTR_DRBG - Read/write error in file\" );\n#endif /* MBEDTLS_CTR_DRBG_C */", "#if defined(MBEDTLS_DES_C)\n if( use_ret == -(MBEDTLS_ERR_DES_INVALID_INPUT_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"DES - The data input has an invalid length\" );\n#endif /* MBEDTLS_DES_C */", "#if defined(MBEDTLS_ENTROPY_C)\n if( use_ret == -(MBEDTLS_ERR_ENTROPY_SOURCE_FAILED) )\n mbedtls_snprintf( buf, buflen, \"ENTROPY - Critical entropy source failure\" );\n if( use_ret == -(MBEDTLS_ERR_ENTROPY_MAX_SOURCES) )\n mbedtls_snprintf( buf, buflen, \"ENTROPY - No more sources can be added\" );\n if( use_ret == -(MBEDTLS_ERR_ENTROPY_NO_SOURCES_DEFINED) )\n mbedtls_snprintf( buf, buflen, \"ENTROPY - No sources have been added to poll\" );\n if( use_ret == -(MBEDTLS_ERR_ENTROPY_NO_STRONG_SOURCE) )\n mbedtls_snprintf( buf, buflen, \"ENTROPY - No strong sources have been added to poll\" );\n if( use_ret == -(MBEDTLS_ERR_ENTROPY_FILE_IO_ERROR) )\n mbedtls_snprintf( buf, buflen, \"ENTROPY - Read/write error in file\" );\n#endif /* MBEDTLS_ENTROPY_C */", "#if defined(MBEDTLS_GCM_C)\n if( use_ret == -(MBEDTLS_ERR_GCM_AUTH_FAILED) )\n mbedtls_snprintf( buf, buflen, \"GCM - Authenticated decryption failed\" );\n if( use_ret == -(MBEDTLS_ERR_GCM_BAD_INPUT) )\n mbedtls_snprintf( buf, buflen, \"GCM - Bad input parameters to function\" );\n#endif /* MBEDTLS_GCM_C */", "#if defined(MBEDTLS_HMAC_DRBG_C)\n if( use_ret == -(MBEDTLS_ERR_HMAC_DRBG_REQUEST_TOO_BIG) )\n mbedtls_snprintf( buf, buflen, \"HMAC_DRBG - Too many random requested in single call\" );\n if( use_ret == -(MBEDTLS_ERR_HMAC_DRBG_INPUT_TOO_BIG) )\n mbedtls_snprintf( buf, buflen, \"HMAC_DRBG - Input too large (Entropy + additional)\" );\n if( use_ret == -(MBEDTLS_ERR_HMAC_DRBG_FILE_IO_ERROR) )\n mbedtls_snprintf( buf, buflen, \"HMAC_DRBG - Read/write error in file\" );\n if( use_ret == -(MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED) )\n mbedtls_snprintf( buf, buflen, \"HMAC_DRBG - The entropy source failed\" );\n#endif /* MBEDTLS_HMAC_DRBG_C */", "#if defined(MBEDTLS_NET_C)\n if( use_ret == -(MBEDTLS_ERR_NET_SOCKET_FAILED) )\n mbedtls_snprintf( buf, buflen, \"NET - Failed to open a socket\" );\n if( use_ret == -(MBEDTLS_ERR_NET_CONNECT_FAILED) )\n mbedtls_snprintf( buf, buflen, \"NET - The connection to the given server / port failed\" );\n if( use_ret == -(MBEDTLS_ERR_NET_BIND_FAILED) )\n mbedtls_snprintf( buf, buflen, \"NET - Binding of the socket failed\" );\n if( use_ret == -(MBEDTLS_ERR_NET_LISTEN_FAILED) )\n mbedtls_snprintf( buf, buflen, \"NET - Could not listen on the socket\" );\n if( use_ret == -(MBEDTLS_ERR_NET_ACCEPT_FAILED) )\n mbedtls_snprintf( buf, buflen, \"NET - Could not accept the incoming connection\" );\n if( use_ret == -(MBEDTLS_ERR_NET_RECV_FAILED) )\n mbedtls_snprintf( buf, buflen, \"NET - Reading information from the socket failed\" );\n if( use_ret == -(MBEDTLS_ERR_NET_SEND_FAILED) )\n mbedtls_snprintf( buf, buflen, \"NET - Sending information through the socket failed\" );\n if( use_ret == -(MBEDTLS_ERR_NET_CONN_RESET) )\n mbedtls_snprintf( buf, buflen, \"NET - Connection was reset by peer\" );\n if( use_ret == -(MBEDTLS_ERR_NET_UNKNOWN_HOST) )\n mbedtls_snprintf( buf, buflen, \"NET - Failed to get an IP address for the given hostname\" );\n if( use_ret == -(MBEDTLS_ERR_NET_BUFFER_TOO_SMALL) )\n mbedtls_snprintf( buf, buflen, \"NET - Buffer is too small to hold the data\" );\n if( use_ret == -(MBEDTLS_ERR_NET_INVALID_CONTEXT) )\n mbedtls_snprintf( buf, buflen, \"NET - The context is invalid, eg because it was free()ed\" );\n#endif /* MBEDTLS_NET_C */", "#if defined(MBEDTLS_OID_C)\n if( use_ret == -(MBEDTLS_ERR_OID_NOT_FOUND) )\n mbedtls_snprintf( buf, buflen, \"OID - OID is not found\" );\n if( use_ret == -(MBEDTLS_ERR_OID_BUF_TOO_SMALL) )\n mbedtls_snprintf( buf, buflen, \"OID - output buffer is too small\" );\n#endif /* MBEDTLS_OID_C */", "#if defined(MBEDTLS_PADLOCK_C)\n if( use_ret == -(MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED) )\n mbedtls_snprintf( buf, buflen, \"PADLOCK - Input data should be aligned\" );\n#endif /* MBEDTLS_PADLOCK_C */", "#if defined(MBEDTLS_THREADING_C)\n if( use_ret == -(MBEDTLS_ERR_THREADING_FEATURE_UNAVAILABLE) )\n mbedtls_snprintf( buf, buflen, \"THREADING - The selected feature is not available\" );\n if( use_ret == -(MBEDTLS_ERR_THREADING_BAD_INPUT_DATA) )\n mbedtls_snprintf( buf, buflen, \"THREADING - Bad input parameters to function\" );\n if( use_ret == -(MBEDTLS_ERR_THREADING_MUTEX_ERROR) )\n mbedtls_snprintf( buf, buflen, \"THREADING - Locking / unlocking / free failed with error code\" );\n#endif /* MBEDTLS_THREADING_C */", "#if defined(MBEDTLS_XTEA_C)\n if( use_ret == -(MBEDTLS_ERR_XTEA_INVALID_INPUT_LENGTH) )\n mbedtls_snprintf( buf, buflen, \"XTEA - The data input has an invalid length\" );\n#endif /* MBEDTLS_XTEA_C */\n // END generated code", " if( strlen( buf ) != 0 )\n return;", " mbedtls_snprintf( buf, buflen, \"UNKNOWN ERROR CODE (%04X)\", use_ret );\n}", "#else /* MBEDTLS_ERROR_C */", "#if defined(MBEDTLS_ERROR_STRERROR_DUMMY)", "/*\n * Provide an non-function in case MBEDTLS_ERROR_C is not defined\n */\nvoid mbedtls_strerror( int ret, char *buf, size_t buflen )\n{\n ((void) ret);", " if( buflen > 0 )\n buf[0] = '\\0';\n}", "#endif /* MBEDTLS_ERROR_STRERROR_DUMMY */", "#endif /* MBEDTLS_ERROR_C */" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [8, 75, 1056, 78, 271, 482, 2312, 1208], "buggy_code_start_loc": [8, 74, 1055, 78, 270, 482, 2060, 1207], "filenames": ["ChangeLog", "include/mbedtls/error.h", "include/mbedtls/ssl.h", "include/mbedtls/x509.h", "include/mbedtls/x509_crt.h", "library/error.c", "library/x509_crt.c", "tests/suites/test_suite_x509parse.data"], "fixing_code_end_loc": [12, 75, 1056, 80, 277, 485, 2317, 1208], "fixing_code_start_loc": [9, 74, 1055, 79, 270, 483, 2060, 1207], "message": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.10:*:*:*:*:*:*:*", "matchCriteriaId": "28621156-2430-447B-8816-47B0FB58245B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.11:*:*:*:*:*:*:*", "matchCriteriaId": "E11BBB2C-0423-47B1-AE12-EB849E17BAF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.12:*:*:*:*:*:*:*", "matchCriteriaId": "4131CE76-6260-412C-A6A6-20B0E978E569", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.13:*:*:*:*:*:*:*", "matchCriteriaId": "DE92D8F7-5705-47B6-B2C2-9DE6C7880647", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.14:*:*:*:*:*:*:*", "matchCriteriaId": "EA50C256-2054-4661-9C42-D31D7D87BAF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.15:*:*:*:*:*:*:*", "matchCriteriaId": "7791D4E9-3FEE-42DA-B320-CF7188A10294", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.16:*:*:*:*:*:*:*", "matchCriteriaId": "BE415DAA-A89F-4204-AC2C-577FCB447E4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.17:*:*:*:*:*:*:*", "matchCriteriaId": "95F691DB-9552-4EBB-B29D-16658561FA4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.18:*:*:*:*:*:*:*", "matchCriteriaId": "F1547B2A-E0D5-41D1-9449-1CCF35022B0E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.19:*:*:*:*:*:*:*", "matchCriteriaId": "CF762122-64BC-4A1A-A26D-81C1270541A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.20:*:*:*:*:*:*:*", "matchCriteriaId": "59D6B559-5F99-4E38-A861-3AB8A7D2E6BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.21:*:*:*:*:*:*:*", "matchCriteriaId": "4A8956C8-6CF0-4C37-84F9-8A89726806C3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "0B395D81-876F-43FC-8DB9-44377647A37A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F92622F1-82DA-4819-8275-06DC9DBE1BA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5871FDE9-02D0-466C-BDB7-90A14C4F637E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE6B4875-3FC3-499F-A76B-2D04982F743A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "B3B67842-5AFA-459F-9CCF-772B9DC7139F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "AD0500EE-52C0-4896-B3D8-5BE731D66039", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "015739E9-C0E3-4A62-BB9D-FA836BFD4351", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "842B0D15-6A3D-4CEE-AD02-49B0436E78E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "3CF6E05C-E6E5-40B8-AFEA-A5ED937F5439", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "D4133C86-70E0-44FD-BBDB-D61EFB31F027", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "6F9D24F0-3892-417F-9C3A-CACEF00C2293", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "8911513E-968C-403E-9D00-2DC0AA82F99B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "48D98945-82BB-4954-AA6D-7D98E4CE1154", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "6378C1CC-7C8F-47E3-A1A7-CDEC76E4CBE4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "525190A3-2194-4E4E-9D34-0048583B9C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "70407352-624A-40E6-82E4-7B4FAFE0C0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "DD52988E-4B2F-41AF-BC25-F38F87D9B8C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "FD1F7803-31F3-40A9-A878-FDC757FCE83F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected."}, {"lang": "es", "value": "ARM mbed TLS en versiones anteriores a la 1.3.21 y en versiones 2.x anteriores a la 2.1.9, si se configura la autenticaci\u00f3n opcional, permite a los atacantes omitir la autenticaci\u00f3n Peer mediante una cadena de certificados X.509 con muchos intermediarios. NOTA: aunque mbed TLS se conoc\u00eda antes como PolarSSL, las versiones lanzadas con el nombre PolarSSL no est\u00e1n afectadas."}], "evaluatorComment": null, "id": "CVE-2017-14032", "lastModified": "2017-11-08T02:29:02.850", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-08-30T20:29:00.337", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.debian.org/security/2017/dsa-3967"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugs.debian.org/873557"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/d15795acd5074e0b44e71f7ede8bdfe1b48591fc"}, {"source": "cve@mitre.org", "tags": ["Vendor Advisory"], "url": "https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2017-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, "type": "CWE-287"}
351
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n * X.509 certificate parsing and verification\n *\n * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved\n * SPDX-License-Identifier: Apache-2.0\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n * not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is part of mbed TLS (https://tls.mbed.org)\n */\n/*\n * The ITU-T X.509 standard defines a certificate format for PKI.\n *\n * http://www.ietf.org/rfc/rfc5280.txt (Certificates and CRLs)\n * http://www.ietf.org/rfc/rfc3279.txt (Alg IDs for CRLs)\n * http://www.ietf.org/rfc/rfc2986.txt (CSRs, aka PKCS#10)\n *\n * http://www.itu.int/ITU-T/studygroups/com17/languages/X.680-0207.pdf\n * http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf\n */", "#if !defined(MBEDTLS_CONFIG_FILE)\n#include \"mbedtls/config.h\"\n#else\n#include MBEDTLS_CONFIG_FILE\n#endif", "#if defined(MBEDTLS_X509_CRT_PARSE_C)", "#include \"mbedtls/x509_crt.h\"\n#include \"mbedtls/oid.h\"", "#include <stdio.h>\n#include <string.h>", "#if defined(MBEDTLS_PEM_PARSE_C)\n#include \"mbedtls/pem.h\"\n#endif", "#if defined(MBEDTLS_PLATFORM_C)\n#include \"mbedtls/platform.h\"\n#else\n#include <stdlib.h>\n#define mbedtls_free free\n#define mbedtls_calloc calloc\n#define mbedtls_snprintf snprintf\n#endif", "#if defined(MBEDTLS_THREADING_C)\n#include \"mbedtls/threading.h\"\n#endif", "#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)\n#include <windows.h>\n#else\n#include <time.h>\n#endif", "#if defined(MBEDTLS_FS_IO)\n#include <stdio.h>\n#if !defined(_WIN32) || defined(EFIX64) || defined(EFI32)\n#include <sys/types.h>\n#include <sys/stat.h>\n#include <dirent.h>\n#endif /* !_WIN32 || EFIX64 || EFI32 */\n#endif", "/* Implementation that should never be optimized out by the compiler */\nstatic void mbedtls_zeroize( void *v, size_t n ) {\n volatile unsigned char *p = v; while( n-- ) *p++ = 0;\n}", "/*\n * Default profile\n */\nconst mbedtls_x509_crt_profile mbedtls_x509_crt_profile_default =\n{\n#if defined(MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES)\n /* Allow SHA-1 (weak, but still safe in controlled environments) */\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA1 ) |\n#endif\n /* Only SHA-2 hashes */\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA224 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA256 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA384 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA512 ),\n 0xFFFFFFF, /* Any PK alg */\n 0xFFFFFFF, /* Any curve */\n 2048,\n};", "/*\n * Next-default profile\n */\nconst mbedtls_x509_crt_profile mbedtls_x509_crt_profile_next =\n{\n /* Hashes from SHA-256 and above */\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA256 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA384 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA512 ),\n 0xFFFFFFF, /* Any PK alg */\n#if defined(MBEDTLS_ECP_C)\n /* Curves at or above 128-bit security level */\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_SECP256R1 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_SECP384R1 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_SECP521R1 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_BP256R1 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_BP384R1 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_BP512R1 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_SECP256K1 ),\n#else\n 0,\n#endif\n 2048,\n};", "/*\n * NSA Suite B Profile\n */\nconst mbedtls_x509_crt_profile mbedtls_x509_crt_profile_suiteb =\n{\n /* Only SHA-256 and 384 */\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA256 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA384 ),\n /* Only ECDSA */\n MBEDTLS_X509_ID_FLAG( MBEDTLS_PK_ECDSA ),\n#if defined(MBEDTLS_ECP_C)\n /* Only NIST P-256 and P-384 */\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_SECP256R1 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_SECP384R1 ),\n#else\n 0,\n#endif\n 0,\n};", "/*\n * Check md_alg against profile\n * Return 0 if md_alg acceptable for this profile, -1 otherwise\n */\nstatic int x509_profile_check_md_alg( const mbedtls_x509_crt_profile *profile,\n mbedtls_md_type_t md_alg )\n{\n if( ( profile->allowed_mds & MBEDTLS_X509_ID_FLAG( md_alg ) ) != 0 )\n return( 0 );", " return( -1 );\n}", "/*\n * Check pk_alg against profile\n * Return 0 if pk_alg acceptable for this profile, -1 otherwise\n */\nstatic int x509_profile_check_pk_alg( const mbedtls_x509_crt_profile *profile,\n mbedtls_pk_type_t pk_alg )\n{\n if( ( profile->allowed_pks & MBEDTLS_X509_ID_FLAG( pk_alg ) ) != 0 )\n return( 0 );", " return( -1 );\n}", "/*\n * Check key against profile\n * Return 0 if pk_alg acceptable for this profile, -1 otherwise\n */\nstatic int x509_profile_check_key( const mbedtls_x509_crt_profile *profile,\n mbedtls_pk_type_t pk_alg,\n const mbedtls_pk_context *pk )\n{\n#if defined(MBEDTLS_RSA_C)\n if( pk_alg == MBEDTLS_PK_RSA || pk_alg == MBEDTLS_PK_RSASSA_PSS )\n {\n if( mbedtls_pk_get_bitlen( pk ) >= profile->rsa_min_bitlen )\n return( 0 );", " return( -1 );\n }\n#endif", "#if defined(MBEDTLS_ECP_C)\n if( pk_alg == MBEDTLS_PK_ECDSA ||\n pk_alg == MBEDTLS_PK_ECKEY ||\n pk_alg == MBEDTLS_PK_ECKEY_DH )\n {\n mbedtls_ecp_group_id gid = mbedtls_pk_ec( *pk )->grp.id;", " if( ( profile->allowed_curves & MBEDTLS_X509_ID_FLAG( gid ) ) != 0 )\n return( 0 );", " return( -1 );\n }\n#endif", " return( -1 );\n}", "/*\n * Version ::= INTEGER { v1(0), v2(1), v3(2) }\n */\nstatic int x509_get_version( unsigned char **p,\n const unsigned char *end,\n int *ver )\n{\n int ret;\n size_t len;", " if( ( ret = mbedtls_asn1_get_tag( p, end, &len,\n MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED | 0 ) ) != 0 )\n {\n if( ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG )\n {\n *ver = 0;\n return( 0 );\n }", " return( ret );\n }", " end = *p + len;", " if( ( ret = mbedtls_asn1_get_int( p, end, ver ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_VERSION + ret );", " if( *p != end )\n return( MBEDTLS_ERR_X509_INVALID_VERSION +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );", " return( 0 );\n}", "/*\n * Validity ::= SEQUENCE {\n * notBefore Time,\n * notAfter Time }\n */\nstatic int x509_get_dates( unsigned char **p,\n const unsigned char *end,\n mbedtls_x509_time *from,\n mbedtls_x509_time *to )\n{\n int ret;\n size_t len;", " if( ( ret = mbedtls_asn1_get_tag( p, end, &len,\n MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_DATE + ret );", " end = *p + len;", " if( ( ret = mbedtls_x509_get_time( p, end, from ) ) != 0 )\n return( ret );", " if( ( ret = mbedtls_x509_get_time( p, end, to ) ) != 0 )\n return( ret );", " if( *p != end )\n return( MBEDTLS_ERR_X509_INVALID_DATE +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );", " return( 0 );\n}", "/*\n * X.509 v2/v3 unique identifier (not parsed)\n */\nstatic int x509_get_uid( unsigned char **p,\n const unsigned char *end,\n mbedtls_x509_buf *uid, int n )\n{\n int ret;", " if( *p == end )\n return( 0 );", " uid->tag = **p;", " if( ( ret = mbedtls_asn1_get_tag( p, end, &uid->len,\n MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED | n ) ) != 0 )\n {\n if( ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG )\n return( 0 );", " return( ret );\n }", " uid->p = *p;\n *p += uid->len;", " return( 0 );\n}", "static int x509_get_basic_constraints( unsigned char **p,\n const unsigned char *end,\n int *ca_istrue,\n int *max_pathlen )\n{\n int ret;\n size_t len;", " /*\n * BasicConstraints ::= SEQUENCE {\n * cA BOOLEAN DEFAULT FALSE,\n * pathLenConstraint INTEGER (0..MAX) OPTIONAL }\n */\n *ca_istrue = 0; /* DEFAULT FALSE */\n *max_pathlen = 0; /* endless */", " if( ( ret = mbedtls_asn1_get_tag( p, end, &len,\n MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " if( *p == end )\n return( 0 );", " if( ( ret = mbedtls_asn1_get_bool( p, end, ca_istrue ) ) != 0 )\n {\n if( ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG )\n ret = mbedtls_asn1_get_int( p, end, ca_istrue );", " if( ret != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " if( *ca_istrue != 0 )\n *ca_istrue = 1;\n }", " if( *p == end )\n return( 0 );", " if( ( ret = mbedtls_asn1_get_int( p, end, max_pathlen ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " if( *p != end )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );", " (*max_pathlen)++;", " return( 0 );\n}", "static int x509_get_ns_cert_type( unsigned char **p,\n const unsigned char *end,\n unsigned char *ns_cert_type)\n{\n int ret;\n mbedtls_x509_bitstring bs = { 0, 0, NULL };", " if( ( ret = mbedtls_asn1_get_bitstring( p, end, &bs ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " if( bs.len != 1 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_INVALID_LENGTH );", " /* Get actual bitstring */\n *ns_cert_type = *bs.p;\n return( 0 );\n}", "static int x509_get_key_usage( unsigned char **p,\n const unsigned char *end,\n unsigned int *key_usage)\n{\n int ret;\n size_t i;\n mbedtls_x509_bitstring bs = { 0, 0, NULL };", " if( ( ret = mbedtls_asn1_get_bitstring( p, end, &bs ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " if( bs.len < 1 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_INVALID_LENGTH );", " /* Get actual bitstring */\n *key_usage = 0;\n for( i = 0; i < bs.len && i < sizeof( unsigned int ); i++ )\n {\n *key_usage |= (unsigned int) bs.p[i] << (8*i);\n }", " return( 0 );\n}", "/*\n * ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId\n *\n * KeyPurposeId ::= OBJECT IDENTIFIER\n */\nstatic int x509_get_ext_key_usage( unsigned char **p,\n const unsigned char *end,\n mbedtls_x509_sequence *ext_key_usage)\n{\n int ret;", " if( ( ret = mbedtls_asn1_get_sequence_of( p, end, ext_key_usage, MBEDTLS_ASN1_OID ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " /* Sequence length must be >= 1 */\n if( ext_key_usage->buf.p == NULL )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_INVALID_LENGTH );", " return( 0 );\n}", "/*\n * SubjectAltName ::= GeneralNames\n *\n * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName\n *\n * GeneralName ::= CHOICE {\n * otherName [0] OtherName,\n * rfc822Name [1] IA5String,\n * dNSName [2] IA5String,\n * x400Address [3] ORAddress,\n * directoryName [4] Name,\n * ediPartyName [5] EDIPartyName,\n * uniformResourceIdentifier [6] IA5String,\n * iPAddress [7] OCTET STRING,\n * registeredID [8] OBJECT IDENTIFIER }\n *\n * OtherName ::= SEQUENCE {\n * type-id OBJECT IDENTIFIER,\n * value [0] EXPLICIT ANY DEFINED BY type-id }\n *\n * EDIPartyName ::= SEQUENCE {\n * nameAssigner [0] DirectoryString OPTIONAL,\n * partyName [1] DirectoryString }\n *\n * NOTE: we only parse and use dNSName at this point.\n */\nstatic int x509_get_subject_alt_name( unsigned char **p,\n const unsigned char *end,\n mbedtls_x509_sequence *subject_alt_name )\n{\n int ret;\n size_t len, tag_len;\n mbedtls_asn1_buf *buf;\n unsigned char tag;\n mbedtls_asn1_sequence *cur = subject_alt_name;", " /* Get main sequence tag */\n if( ( ret = mbedtls_asn1_get_tag( p, end, &len,\n MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " if( *p + len != end )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );", " while( *p < end )\n {\n if( ( end - *p ) < 1 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_OUT_OF_DATA );", " tag = **p;\n (*p)++;\n if( ( ret = mbedtls_asn1_get_len( p, end, &tag_len ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " if( ( tag & MBEDTLS_ASN1_CONTEXT_SPECIFIC ) != MBEDTLS_ASN1_CONTEXT_SPECIFIC )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_UNEXPECTED_TAG );", " /* Skip everything but DNS name */\n if( tag != ( MBEDTLS_ASN1_CONTEXT_SPECIFIC | 2 ) )\n {\n *p += tag_len;\n continue;\n }", " /* Allocate and assign next pointer */\n if( cur->buf.p != NULL )\n {\n if( cur->next != NULL )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS );", " cur->next = mbedtls_calloc( 1, sizeof( mbedtls_asn1_sequence ) );", " if( cur->next == NULL )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_ALLOC_FAILED );", " cur = cur->next;\n }", " buf = &(cur->buf);\n buf->tag = tag;\n buf->p = *p;\n buf->len = tag_len;\n *p += buf->len;\n }", " /* Set final sequence entry's next pointer to NULL */\n cur->next = NULL;", " if( *p != end )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );", " return( 0 );\n}", "/*\n * X.509 v3 extensions\n *\n */\nstatic int x509_get_crt_ext( unsigned char **p,\n const unsigned char *end,\n mbedtls_x509_crt *crt )\n{\n int ret;\n size_t len;\n unsigned char *end_ext_data, *end_ext_octet;", " if( ( ret = mbedtls_x509_get_ext( p, end, &crt->v3_ext, 3 ) ) != 0 )\n {\n if( ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG )\n return( 0 );", " return( ret );\n }", " while( *p < end )\n {\n /*\n * Extension ::= SEQUENCE {\n * extnID OBJECT IDENTIFIER,\n * critical BOOLEAN DEFAULT FALSE,\n * extnValue OCTET STRING }\n */\n mbedtls_x509_buf extn_oid = {0, 0, NULL};\n int is_critical = 0; /* DEFAULT FALSE */\n int ext_type = 0;", " if( ( ret = mbedtls_asn1_get_tag( p, end, &len,\n MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " end_ext_data = *p + len;", " /* Get extension ID */\n extn_oid.tag = **p;", " if( ( ret = mbedtls_asn1_get_tag( p, end, &extn_oid.len, MBEDTLS_ASN1_OID ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " extn_oid.p = *p;\n *p += extn_oid.len;", " if( ( end - *p ) < 1 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_OUT_OF_DATA );", " /* Get optional critical */\n if( ( ret = mbedtls_asn1_get_bool( p, end_ext_data, &is_critical ) ) != 0 &&\n ( ret != MBEDTLS_ERR_ASN1_UNEXPECTED_TAG ) )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " /* Data should be octet string type */\n if( ( ret = mbedtls_asn1_get_tag( p, end_ext_data, &len,\n MBEDTLS_ASN1_OCTET_STRING ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " end_ext_octet = *p + len;", " if( end_ext_octet != end_ext_data )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );", " /*\n * Detect supported extensions\n */\n ret = mbedtls_oid_get_x509_ext_type( &extn_oid, &ext_type );", " if( ret != 0 )\n {\n /* No parser found, skip extension */\n *p = end_ext_octet;", "#if !defined(MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION)\n if( is_critical )\n {\n /* Data is marked as critical: fail */\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_UNEXPECTED_TAG );\n }\n#endif\n continue;\n }", " /* Forbid repeated extensions */\n if( ( crt->ext_types & ext_type ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS );", " crt->ext_types |= ext_type;", " switch( ext_type )\n {\n case MBEDTLS_X509_EXT_BASIC_CONSTRAINTS:\n /* Parse basic constraints */\n if( ( ret = x509_get_basic_constraints( p, end_ext_octet,\n &crt->ca_istrue, &crt->max_pathlen ) ) != 0 )\n return( ret );\n break;", " case MBEDTLS_X509_EXT_KEY_USAGE:\n /* Parse key usage */\n if( ( ret = x509_get_key_usage( p, end_ext_octet,\n &crt->key_usage ) ) != 0 )\n return( ret );\n break;", " case MBEDTLS_X509_EXT_EXTENDED_KEY_USAGE:\n /* Parse extended key usage */\n if( ( ret = x509_get_ext_key_usage( p, end_ext_octet,\n &crt->ext_key_usage ) ) != 0 )\n return( ret );\n break;", " case MBEDTLS_X509_EXT_SUBJECT_ALT_NAME:\n /* Parse subject alt name */\n if( ( ret = x509_get_subject_alt_name( p, end_ext_octet,\n &crt->subject_alt_names ) ) != 0 )\n return( ret );\n break;", " case MBEDTLS_X509_EXT_NS_CERT_TYPE:\n /* Parse netscape certificate type */\n if( ( ret = x509_get_ns_cert_type( p, end_ext_octet,\n &crt->ns_cert_type ) ) != 0 )\n return( ret );\n break;", " default:\n return( MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE );\n }\n }", " if( *p != end )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );", " return( 0 );\n}", "/*\n * Parse and fill a single X.509 certificate in DER format\n */\nstatic int x509_crt_parse_der_core( mbedtls_x509_crt *crt, const unsigned char *buf,\n size_t buflen )\n{\n int ret;\n size_t len;\n unsigned char *p, *end, *crt_end;\n mbedtls_x509_buf sig_params1, sig_params2, sig_oid2;", " memset( &sig_params1, 0, sizeof( mbedtls_x509_buf ) );\n memset( &sig_params2, 0, sizeof( mbedtls_x509_buf ) );\n memset( &sig_oid2, 0, sizeof( mbedtls_x509_buf ) );", " /*\n * Check for valid input\n */\n if( crt == NULL || buf == NULL )\n return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );", " // Use the original buffer until we figure out actual length\n p = (unsigned char*) buf;\n len = buflen;\n end = p + len;", " /*\n * Certificate ::= SEQUENCE {\n * tbsCertificate TBSCertificate,\n * signatureAlgorithm AlgorithmIdentifier,\n * signatureValue BIT STRING }\n */\n if( ( ret = mbedtls_asn1_get_tag( &p, end, &len,\n MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_INVALID_FORMAT );\n }", " if( len > (size_t) ( end - p ) )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_INVALID_FORMAT +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );\n }\n crt_end = p + len;", " // Create and populate a new buffer for the raw field\n crt->raw.len = crt_end - buf;\n crt->raw.p = p = mbedtls_calloc( 1, crt->raw.len );\n if( p == NULL )\n return( MBEDTLS_ERR_X509_ALLOC_FAILED );", " memcpy( p, buf, crt->raw.len );", " // Direct pointers to the new buffer \n p += crt->raw.len - len;\n end = crt_end = p + len;", " /*\n * TBSCertificate ::= SEQUENCE {\n */\n crt->tbs.p = p;", " if( ( ret = mbedtls_asn1_get_tag( &p, end, &len,\n MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_INVALID_FORMAT + ret );\n }", " end = p + len;\n crt->tbs.len = end - crt->tbs.p;", " /*\n * Version ::= INTEGER { v1(0), v2(1), v3(2) }\n *\n * CertificateSerialNumber ::= INTEGER\n *\n * signature AlgorithmIdentifier\n */\n if( ( ret = x509_get_version( &p, end, &crt->version ) ) != 0 ||\n ( ret = mbedtls_x509_get_serial( &p, end, &crt->serial ) ) != 0 ||\n ( ret = mbedtls_x509_get_alg( &p, end, &crt->sig_oid,\n &sig_params1 ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }", " crt->version++;", " if( crt->version > 3 )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_UNKNOWN_VERSION );\n }", " if( ( ret = mbedtls_x509_get_sig_alg( &crt->sig_oid, &sig_params1,\n &crt->sig_md, &crt->sig_pk,\n &crt->sig_opts ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }", " /*\n * issuer Name\n */\n crt->issuer_raw.p = p;", " if( ( ret = mbedtls_asn1_get_tag( &p, end, &len,\n MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_INVALID_FORMAT + ret );\n }", " if( ( ret = mbedtls_x509_get_name( &p, p + len, &crt->issuer ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }", " crt->issuer_raw.len = p - crt->issuer_raw.p;", " /*\n * Validity ::= SEQUENCE {\n * notBefore Time,\n * notAfter Time }\n *\n */\n if( ( ret = x509_get_dates( &p, end, &crt->valid_from,\n &crt->valid_to ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }", " /*\n * subject Name\n */\n crt->subject_raw.p = p;", " if( ( ret = mbedtls_asn1_get_tag( &p, end, &len,\n MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_INVALID_FORMAT + ret );\n }", " if( len && ( ret = mbedtls_x509_get_name( &p, p + len, &crt->subject ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }", " crt->subject_raw.len = p - crt->subject_raw.p;", " /*\n * SubjectPublicKeyInfo\n */\n if( ( ret = mbedtls_pk_parse_subpubkey( &p, end, &crt->pk ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }", " /*\n * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL,\n * -- If present, version shall be v2 or v3\n * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL,\n * -- If present, version shall be v2 or v3\n * extensions [3] EXPLICIT Extensions OPTIONAL\n * -- If present, version shall be v3\n */\n if( crt->version == 2 || crt->version == 3 )\n {\n ret = x509_get_uid( &p, end, &crt->issuer_id, 1 );\n if( ret != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }\n }", " if( crt->version == 2 || crt->version == 3 )\n {\n ret = x509_get_uid( &p, end, &crt->subject_id, 2 );\n if( ret != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }\n }", "#if !defined(MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3)\n if( crt->version == 3 )\n#endif\n {\n ret = x509_get_crt_ext( &p, end, crt );\n if( ret != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }\n }", " if( p != end )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_INVALID_FORMAT +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );\n }", " end = crt_end;", " /*\n * }\n * -- end of TBSCertificate\n *\n * signatureAlgorithm AlgorithmIdentifier,\n * signatureValue BIT STRING\n */\n if( ( ret = mbedtls_x509_get_alg( &p, end, &sig_oid2, &sig_params2 ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }", " if( crt->sig_oid.len != sig_oid2.len ||\n memcmp( crt->sig_oid.p, sig_oid2.p, crt->sig_oid.len ) != 0 ||\n sig_params1.len != sig_params2.len ||\n ( sig_params1.len != 0 &&\n memcmp( sig_params1.p, sig_params2.p, sig_params1.len ) != 0 ) )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_SIG_MISMATCH );\n }", " if( ( ret = mbedtls_x509_get_sig( &p, end, &crt->sig ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }", " if( p != end )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_INVALID_FORMAT +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );\n }", " return( 0 );\n}", "/*\n * Parse one X.509 certificate in DER format from a buffer and add them to a\n * chained list\n */\nint mbedtls_x509_crt_parse_der( mbedtls_x509_crt *chain, const unsigned char *buf,\n size_t buflen )\n{\n int ret;\n mbedtls_x509_crt *crt = chain, *prev = NULL;", " /*\n * Check for valid input\n */\n if( crt == NULL || buf == NULL )\n return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );", " while( crt->version != 0 && crt->next != NULL )\n {\n prev = crt;\n crt = crt->next;\n }", " /*\n * Add new certificate on the end of the chain if needed.\n */\n if( crt->version != 0 && crt->next == NULL )\n {\n crt->next = mbedtls_calloc( 1, sizeof( mbedtls_x509_crt ) );", " if( crt->next == NULL )\n return( MBEDTLS_ERR_X509_ALLOC_FAILED );", " prev = crt;\n mbedtls_x509_crt_init( crt->next );\n crt = crt->next;\n }", " if( ( ret = x509_crt_parse_der_core( crt, buf, buflen ) ) != 0 )\n {\n if( prev )\n prev->next = NULL;", " if( crt != chain )\n mbedtls_free( crt );", " return( ret );\n }", " return( 0 );\n}", "/*\n * Parse one or more PEM certificates from a buffer and add them to the chained\n * list\n */\nint mbedtls_x509_crt_parse( mbedtls_x509_crt *chain, const unsigned char *buf, size_t buflen )\n{\n#if defined(MBEDTLS_PEM_PARSE_C)\n int success = 0, first_error = 0, total_failed = 0;\n int buf_format = MBEDTLS_X509_FORMAT_DER;\n#endif", " /*\n * Check for valid input\n */\n if( chain == NULL || buf == NULL )\n return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );", " /*\n * Determine buffer content. Buffer contains either one DER certificate or\n * one or more PEM certificates.\n */\n#if defined(MBEDTLS_PEM_PARSE_C)\n if( buflen != 0 && buf[buflen - 1] == '\\0' &&\n strstr( (const char *) buf, \"-----BEGIN CERTIFICATE-----\" ) != NULL )\n {\n buf_format = MBEDTLS_X509_FORMAT_PEM;\n }", " if( buf_format == MBEDTLS_X509_FORMAT_DER )\n return mbedtls_x509_crt_parse_der( chain, buf, buflen );\n#else\n return mbedtls_x509_crt_parse_der( chain, buf, buflen );\n#endif", "#if defined(MBEDTLS_PEM_PARSE_C)\n if( buf_format == MBEDTLS_X509_FORMAT_PEM )\n {\n int ret;\n mbedtls_pem_context pem;", " /* 1 rather than 0 since the terminating NULL byte is counted in */\n while( buflen > 1 )\n {\n size_t use_len;\n mbedtls_pem_init( &pem );", " /* If we get there, we know the string is null-terminated */\n ret = mbedtls_pem_read_buffer( &pem,\n \"-----BEGIN CERTIFICATE-----\",\n \"-----END CERTIFICATE-----\",\n buf, NULL, 0, &use_len );", " if( ret == 0 )\n {\n /*\n * Was PEM encoded\n */\n buflen -= use_len;\n buf += use_len;\n }\n else if( ret == MBEDTLS_ERR_PEM_BAD_INPUT_DATA )\n {\n return( ret );\n }\n else if( ret != MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT )\n {\n mbedtls_pem_free( &pem );", " /*\n * PEM header and footer were found\n */\n buflen -= use_len;\n buf += use_len;", " if( first_error == 0 )\n first_error = ret;", " total_failed++;\n continue;\n }\n else\n break;", " ret = mbedtls_x509_crt_parse_der( chain, pem.buf, pem.buflen );", " mbedtls_pem_free( &pem );", " if( ret != 0 )\n {\n /*\n * Quit parsing on a memory error\n */\n if( ret == MBEDTLS_ERR_X509_ALLOC_FAILED )\n return( ret );", " if( first_error == 0 )\n first_error = ret;", " total_failed++;\n continue;\n }", " success = 1;\n }\n }", " if( success )\n return( total_failed );\n else if( first_error )\n return( first_error );\n else\n return( MBEDTLS_ERR_X509_CERT_UNKNOWN_FORMAT );\n#endif /* MBEDTLS_PEM_PARSE_C */\n}", "#if defined(MBEDTLS_FS_IO)\n/*\n * Load one or more certificates and add them to the chained list\n */\nint mbedtls_x509_crt_parse_file( mbedtls_x509_crt *chain, const char *path )\n{\n int ret;\n size_t n;\n unsigned char *buf;", " if( ( ret = mbedtls_pk_load_file( path, &buf, &n ) ) != 0 )\n return( ret );", " ret = mbedtls_x509_crt_parse( chain, buf, n );", " mbedtls_zeroize( buf, n );\n mbedtls_free( buf );", " return( ret );\n}", "int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path )\n{\n int ret = 0;\n#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)\n int w_ret;\n WCHAR szDir[MAX_PATH];\n char filename[MAX_PATH];\n char *p;\n size_t len = strlen( path );", " WIN32_FIND_DATAW file_data;\n HANDLE hFind;", " if( len > MAX_PATH - 3 )\n return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );", " memset( szDir, 0, sizeof(szDir) );\n memset( filename, 0, MAX_PATH );\n memcpy( filename, path, len );\n filename[len++] = '\\\\';\n p = filename + len;\n filename[len++] = '*';", " w_ret = MultiByteToWideChar( CP_ACP, 0, filename, (int)len, szDir,\n MAX_PATH - 3 );\n if( w_ret == 0 )\n return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );", " hFind = FindFirstFileW( szDir, &file_data );\n if( hFind == INVALID_HANDLE_VALUE )\n return( MBEDTLS_ERR_X509_FILE_IO_ERROR );", " len = MAX_PATH - len;\n do\n {\n memset( p, 0, len );", " if( file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )\n continue;", " w_ret = WideCharToMultiByte( CP_ACP, 0, file_data.cFileName,\n lstrlenW( file_data.cFileName ),\n p, (int) len - 1,\n NULL, NULL );\n if( w_ret == 0 )\n return( MBEDTLS_ERR_X509_FILE_IO_ERROR );", " w_ret = mbedtls_x509_crt_parse_file( chain, filename );\n if( w_ret < 0 )\n ret++;\n else\n ret += w_ret;\n }\n while( FindNextFileW( hFind, &file_data ) != 0 );", " if( GetLastError() != ERROR_NO_MORE_FILES )\n ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;", " FindClose( hFind );\n#else /* _WIN32 */\n int t_ret;\n int snp_ret;\n struct stat sb;\n struct dirent *entry;\n char entry_name[MBEDTLS_X509_MAX_FILE_PATH_LEN];\n DIR *dir = opendir( path );", " if( dir == NULL )\n return( MBEDTLS_ERR_X509_FILE_IO_ERROR );", "#if defined(MBEDTLS_THREADING_PTHREAD)\n if( ( ret = mbedtls_mutex_lock( &mbedtls_threading_readdir_mutex ) ) != 0 )\n {\n closedir( dir );\n return( ret );\n }\n#endif", " while( ( entry = readdir( dir ) ) != NULL )\n {\n snp_ret = mbedtls_snprintf( entry_name, sizeof entry_name,\n \"%s/%s\", path, entry->d_name );", " if( snp_ret < 0 || (size_t)snp_ret >= sizeof entry_name )\n {\n ret = MBEDTLS_ERR_X509_BUFFER_TOO_SMALL;\n goto cleanup;\n }\n else if( stat( entry_name, &sb ) == -1 )\n {\n ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;\n goto cleanup;\n }", " if( !S_ISREG( sb.st_mode ) )\n continue;", " // Ignore parse errors\n //\n t_ret = mbedtls_x509_crt_parse_file( chain, entry_name );\n if( t_ret < 0 )\n ret++;\n else\n ret += t_ret;\n }", "cleanup:\n closedir( dir );", "#if defined(MBEDTLS_THREADING_PTHREAD)\n if( mbedtls_mutex_unlock( &mbedtls_threading_readdir_mutex ) != 0 )\n ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR;\n#endif", "#endif /* _WIN32 */", " return( ret );\n}\n#endif /* MBEDTLS_FS_IO */", "static int x509_info_subject_alt_name( char **buf, size_t *size,\n const mbedtls_x509_sequence *subject_alt_name )\n{\n size_t i;\n size_t n = *size;\n char *p = *buf;\n const mbedtls_x509_sequence *cur = subject_alt_name;\n const char *sep = \"\";\n size_t sep_len = 0;", " while( cur != NULL )\n {\n if( cur->buf.len + sep_len >= n )\n {\n *p = '\\0';\n return( MBEDTLS_ERR_X509_BUFFER_TOO_SMALL );\n }", " n -= cur->buf.len + sep_len;\n for( i = 0; i < sep_len; i++ )\n *p++ = sep[i];\n for( i = 0; i < cur->buf.len; i++ )\n *p++ = cur->buf.p[i];", " sep = \", \";\n sep_len = 2;", " cur = cur->next;\n }", " *p = '\\0';", " *size = n;\n *buf = p;", " return( 0 );\n}", "#define PRINT_ITEM(i) \\\n { \\\n ret = mbedtls_snprintf( p, n, \"%s\" i, sep ); \\\n MBEDTLS_X509_SAFE_SNPRINTF; \\\n sep = \", \"; \\\n }", "#define CERT_TYPE(type,name) \\\n if( ns_cert_type & type ) \\\n PRINT_ITEM( name );", "static int x509_info_cert_type( char **buf, size_t *size,\n unsigned char ns_cert_type )\n{\n int ret;\n size_t n = *size;\n char *p = *buf;\n const char *sep = \"\";", " CERT_TYPE( MBEDTLS_X509_NS_CERT_TYPE_SSL_CLIENT, \"SSL Client\" );\n CERT_TYPE( MBEDTLS_X509_NS_CERT_TYPE_SSL_SERVER, \"SSL Server\" );\n CERT_TYPE( MBEDTLS_X509_NS_CERT_TYPE_EMAIL, \"Email\" );\n CERT_TYPE( MBEDTLS_X509_NS_CERT_TYPE_OBJECT_SIGNING, \"Object Signing\" );\n CERT_TYPE( MBEDTLS_X509_NS_CERT_TYPE_RESERVED, \"Reserved\" );\n CERT_TYPE( MBEDTLS_X509_NS_CERT_TYPE_SSL_CA, \"SSL CA\" );\n CERT_TYPE( MBEDTLS_X509_NS_CERT_TYPE_EMAIL_CA, \"Email CA\" );\n CERT_TYPE( MBEDTLS_X509_NS_CERT_TYPE_OBJECT_SIGNING_CA, \"Object Signing CA\" );", " *size = n;\n *buf = p;", " return( 0 );\n}", "#define KEY_USAGE(code,name) \\\n if( key_usage & code ) \\\n PRINT_ITEM( name );", "static int x509_info_key_usage( char **buf, size_t *size,\n unsigned int key_usage )\n{\n int ret;\n size_t n = *size;\n char *p = *buf;\n const char *sep = \"\";", " KEY_USAGE( MBEDTLS_X509_KU_DIGITAL_SIGNATURE, \"Digital Signature\" );\n KEY_USAGE( MBEDTLS_X509_KU_NON_REPUDIATION, \"Non Repudiation\" );\n KEY_USAGE( MBEDTLS_X509_KU_KEY_ENCIPHERMENT, \"Key Encipherment\" );\n KEY_USAGE( MBEDTLS_X509_KU_DATA_ENCIPHERMENT, \"Data Encipherment\" );\n KEY_USAGE( MBEDTLS_X509_KU_KEY_AGREEMENT, \"Key Agreement\" );\n KEY_USAGE( MBEDTLS_X509_KU_KEY_CERT_SIGN, \"Key Cert Sign\" );\n KEY_USAGE( MBEDTLS_X509_KU_CRL_SIGN, \"CRL Sign\" );\n KEY_USAGE( MBEDTLS_X509_KU_ENCIPHER_ONLY, \"Encipher Only\" );\n KEY_USAGE( MBEDTLS_X509_KU_DECIPHER_ONLY, \"Decipher Only\" );", " *size = n;\n *buf = p;", " return( 0 );\n}", "static int x509_info_ext_key_usage( char **buf, size_t *size,\n const mbedtls_x509_sequence *extended_key_usage )\n{\n int ret;\n const char *desc;\n size_t n = *size;\n char *p = *buf;\n const mbedtls_x509_sequence *cur = extended_key_usage;\n const char *sep = \"\";", " while( cur != NULL )\n {\n if( mbedtls_oid_get_extended_key_usage( &cur->buf, &desc ) != 0 )\n desc = \"???\";", " ret = mbedtls_snprintf( p, n, \"%s%s\", sep, desc );\n MBEDTLS_X509_SAFE_SNPRINTF;", " sep = \", \";", " cur = cur->next;\n }", " *size = n;\n *buf = p;", " return( 0 );\n}", "/*\n * Return an informational string about the certificate.\n */\n#define BEFORE_COLON 18\n#define BC \"18\"\nint mbedtls_x509_crt_info( char *buf, size_t size, const char *prefix,\n const mbedtls_x509_crt *crt )\n{\n int ret;\n size_t n;\n char *p;\n char key_size_str[BEFORE_COLON];", " p = buf;\n n = size;", " if( NULL == crt )\n {\n ret = mbedtls_snprintf( p, n, \"\\nCertificate is uninitialised!\\n\" );\n MBEDTLS_X509_SAFE_SNPRINTF;", " return( (int) ( size - n ) );\n }", " ret = mbedtls_snprintf( p, n, \"%scert. version : %d\\n\",\n prefix, crt->version );\n MBEDTLS_X509_SAFE_SNPRINTF;\n ret = mbedtls_snprintf( p, n, \"%sserial number : \",\n prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;", " ret = mbedtls_x509_serial_gets( p, n, &crt->serial );\n MBEDTLS_X509_SAFE_SNPRINTF;", " ret = mbedtls_snprintf( p, n, \"\\n%sissuer name : \", prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;\n ret = mbedtls_x509_dn_gets( p, n, &crt->issuer );\n MBEDTLS_X509_SAFE_SNPRINTF;", " ret = mbedtls_snprintf( p, n, \"\\n%ssubject name : \", prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;\n ret = mbedtls_x509_dn_gets( p, n, &crt->subject );\n MBEDTLS_X509_SAFE_SNPRINTF;", " ret = mbedtls_snprintf( p, n, \"\\n%sissued on : \" \\\n \"%04d-%02d-%02d %02d:%02d:%02d\", prefix,\n crt->valid_from.year, crt->valid_from.mon,\n crt->valid_from.day, crt->valid_from.hour,\n crt->valid_from.min, crt->valid_from.sec );\n MBEDTLS_X509_SAFE_SNPRINTF;", " ret = mbedtls_snprintf( p, n, \"\\n%sexpires on : \" \\\n \"%04d-%02d-%02d %02d:%02d:%02d\", prefix,\n crt->valid_to.year, crt->valid_to.mon,\n crt->valid_to.day, crt->valid_to.hour,\n crt->valid_to.min, crt->valid_to.sec );\n MBEDTLS_X509_SAFE_SNPRINTF;", " ret = mbedtls_snprintf( p, n, \"\\n%ssigned using : \", prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;", " ret = mbedtls_x509_sig_alg_gets( p, n, &crt->sig_oid, crt->sig_pk,\n crt->sig_md, crt->sig_opts );\n MBEDTLS_X509_SAFE_SNPRINTF;", " /* Key size */\n if( ( ret = mbedtls_x509_key_size_helper( key_size_str, BEFORE_COLON,\n mbedtls_pk_get_name( &crt->pk ) ) ) != 0 )\n {\n return( ret );\n }", " ret = mbedtls_snprintf( p, n, \"\\n%s%-\" BC \"s: %d bits\", prefix, key_size_str,\n (int) mbedtls_pk_get_bitlen( &crt->pk ) );\n MBEDTLS_X509_SAFE_SNPRINTF;", " /*\n * Optional extensions\n */", " if( crt->ext_types & MBEDTLS_X509_EXT_BASIC_CONSTRAINTS )\n {\n ret = mbedtls_snprintf( p, n, \"\\n%sbasic constraints : CA=%s\", prefix,\n crt->ca_istrue ? \"true\" : \"false\" );\n MBEDTLS_X509_SAFE_SNPRINTF;", " if( crt->max_pathlen > 0 )\n {\n ret = mbedtls_snprintf( p, n, \", max_pathlen=%d\", crt->max_pathlen - 1 );\n MBEDTLS_X509_SAFE_SNPRINTF;\n }\n }", " if( crt->ext_types & MBEDTLS_X509_EXT_SUBJECT_ALT_NAME )\n {\n ret = mbedtls_snprintf( p, n, \"\\n%ssubject alt name : \", prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;", " if( ( ret = x509_info_subject_alt_name( &p, &n,\n &crt->subject_alt_names ) ) != 0 )\n return( ret );\n }", " if( crt->ext_types & MBEDTLS_X509_EXT_NS_CERT_TYPE )\n {\n ret = mbedtls_snprintf( p, n, \"\\n%scert. type : \", prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;", " if( ( ret = x509_info_cert_type( &p, &n, crt->ns_cert_type ) ) != 0 )\n return( ret );\n }", " if( crt->ext_types & MBEDTLS_X509_EXT_KEY_USAGE )\n {\n ret = mbedtls_snprintf( p, n, \"\\n%skey usage : \", prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;", " if( ( ret = x509_info_key_usage( &p, &n, crt->key_usage ) ) != 0 )\n return( ret );\n }", " if( crt->ext_types & MBEDTLS_X509_EXT_EXTENDED_KEY_USAGE )\n {\n ret = mbedtls_snprintf( p, n, \"\\n%sext key usage : \", prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;", " if( ( ret = x509_info_ext_key_usage( &p, &n,\n &crt->ext_key_usage ) ) != 0 )\n return( ret );\n }", " ret = mbedtls_snprintf( p, n, \"\\n\" );\n MBEDTLS_X509_SAFE_SNPRINTF;", " return( (int) ( size - n ) );\n}", "struct x509_crt_verify_string {\n int code;\n const char *string;\n};", "static const struct x509_crt_verify_string x509_crt_verify_strings[] = {\n { MBEDTLS_X509_BADCERT_EXPIRED, \"The certificate validity has expired\" },\n { MBEDTLS_X509_BADCERT_REVOKED, \"The certificate has been revoked (is on a CRL)\" },\n { MBEDTLS_X509_BADCERT_CN_MISMATCH, \"The certificate Common Name (CN) does not match with the expected CN\" },\n { MBEDTLS_X509_BADCERT_NOT_TRUSTED, \"The certificate is not correctly signed by the trusted CA\" },\n { MBEDTLS_X509_BADCRL_NOT_TRUSTED, \"The CRL is not correctly signed by the trusted CA\" },\n { MBEDTLS_X509_BADCRL_EXPIRED, \"The CRL is expired\" },\n { MBEDTLS_X509_BADCERT_MISSING, \"Certificate was missing\" },\n { MBEDTLS_X509_BADCERT_SKIP_VERIFY, \"Certificate verification was skipped\" },\n { MBEDTLS_X509_BADCERT_OTHER, \"Other reason (can be used by verify callback)\" },\n { MBEDTLS_X509_BADCERT_FUTURE, \"The certificate validity starts in the future\" },\n { MBEDTLS_X509_BADCRL_FUTURE, \"The CRL is from the future\" },\n { MBEDTLS_X509_BADCERT_KEY_USAGE, \"Usage does not match the keyUsage extension\" },\n { MBEDTLS_X509_BADCERT_EXT_KEY_USAGE, \"Usage does not match the extendedKeyUsage extension\" },\n { MBEDTLS_X509_BADCERT_NS_CERT_TYPE, \"Usage does not match the nsCertType extension\" },\n { MBEDTLS_X509_BADCERT_BAD_MD, \"The certificate is signed with an unacceptable hash.\" },\n { MBEDTLS_X509_BADCERT_BAD_PK, \"The certificate is signed with an unacceptable PK alg (eg RSA vs ECDSA).\" },\n { MBEDTLS_X509_BADCERT_BAD_KEY, \"The certificate is signed with an unacceptable key (eg bad curve, RSA too short).\" },\n { MBEDTLS_X509_BADCRL_BAD_MD, \"The CRL is signed with an unacceptable hash.\" },\n { MBEDTLS_X509_BADCRL_BAD_PK, \"The CRL is signed with an unacceptable PK alg (eg RSA vs ECDSA).\" },\n { MBEDTLS_X509_BADCRL_BAD_KEY, \"The CRL is signed with an unacceptable key (eg bad curve, RSA too short).\" },\n { 0, NULL }\n};", "int mbedtls_x509_crt_verify_info( char *buf, size_t size, const char *prefix,\n uint32_t flags )\n{\n int ret;\n const struct x509_crt_verify_string *cur;\n char *p = buf;\n size_t n = size;", " for( cur = x509_crt_verify_strings; cur->string != NULL ; cur++ )\n {\n if( ( flags & cur->code ) == 0 )\n continue;", " ret = mbedtls_snprintf( p, n, \"%s%s\\n\", prefix, cur->string );\n MBEDTLS_X509_SAFE_SNPRINTF;\n flags ^= cur->code;\n }", " if( flags != 0 )\n {\n ret = mbedtls_snprintf( p, n, \"%sUnknown reason \"\n \"(this should not happen)\\n\", prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;\n }", " return( (int) ( size - n ) );\n}", "#if defined(MBEDTLS_X509_CHECK_KEY_USAGE)\nint mbedtls_x509_crt_check_key_usage( const mbedtls_x509_crt *crt,\n unsigned int usage )\n{\n unsigned int usage_must, usage_may;\n unsigned int may_mask = MBEDTLS_X509_KU_ENCIPHER_ONLY\n | MBEDTLS_X509_KU_DECIPHER_ONLY;", " if( ( crt->ext_types & MBEDTLS_X509_EXT_KEY_USAGE ) == 0 )\n return( 0 );", " usage_must = usage & ~may_mask;", " if( ( ( crt->key_usage & ~may_mask ) & usage_must ) != usage_must )\n return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );", " usage_may = usage & may_mask;", " if( ( ( crt->key_usage & may_mask ) | usage_may ) != usage_may )\n return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );", " return( 0 );\n}\n#endif", "#if defined(MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE)\nint mbedtls_x509_crt_check_extended_key_usage( const mbedtls_x509_crt *crt,\n const char *usage_oid,\n size_t usage_len )\n{\n const mbedtls_x509_sequence *cur;", " /* Extension is not mandatory, absent means no restriction */\n if( ( crt->ext_types & MBEDTLS_X509_EXT_EXTENDED_KEY_USAGE ) == 0 )\n return( 0 );", " /*\n * Look for the requested usage (or wildcard ANY) in our list\n */\n for( cur = &crt->ext_key_usage; cur != NULL; cur = cur->next )\n {\n const mbedtls_x509_buf *cur_oid = &cur->buf;", " if( cur_oid->len == usage_len &&\n memcmp( cur_oid->p, usage_oid, usage_len ) == 0 )\n {\n return( 0 );\n }", " if( MBEDTLS_OID_CMP( MBEDTLS_OID_ANY_EXTENDED_KEY_USAGE, cur_oid ) == 0 )\n return( 0 );\n }", " return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );\n}\n#endif /* MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE */", "#if defined(MBEDTLS_X509_CRL_PARSE_C)\n/*\n * Return 1 if the certificate is revoked, or 0 otherwise.\n */\nint mbedtls_x509_crt_is_revoked( const mbedtls_x509_crt *crt, const mbedtls_x509_crl *crl )\n{\n const mbedtls_x509_crl_entry *cur = &crl->entry;", " while( cur != NULL && cur->serial.len != 0 )\n {\n if( crt->serial.len == cur->serial.len &&\n memcmp( crt->serial.p, cur->serial.p, crt->serial.len ) == 0 )\n {\n if( mbedtls_x509_time_is_past( &cur->revocation_date ) )\n return( 1 );\n }", " cur = cur->next;\n }", " return( 0 );\n}", "/*\n * Check that the given certificate is not revoked according to the CRL.\n * Skip validation is no CRL for the given CA is present.\n */\nstatic int x509_crt_verifycrl( mbedtls_x509_crt *crt, mbedtls_x509_crt *ca,\n mbedtls_x509_crl *crl_list,\n const mbedtls_x509_crt_profile *profile )\n{\n int flags = 0;\n unsigned char hash[MBEDTLS_MD_MAX_SIZE];\n const mbedtls_md_info_t *md_info;", " if( ca == NULL )\n return( flags );", " while( crl_list != NULL )\n {\n if( crl_list->version == 0 ||\n crl_list->issuer_raw.len != ca->subject_raw.len ||\n memcmp( crl_list->issuer_raw.p, ca->subject_raw.p,\n crl_list->issuer_raw.len ) != 0 )\n {\n crl_list = crl_list->next;\n continue;\n }", " /*\n * Check if the CA is configured to sign CRLs\n */\n#if defined(MBEDTLS_X509_CHECK_KEY_USAGE)\n if( mbedtls_x509_crt_check_key_usage( ca, MBEDTLS_X509_KU_CRL_SIGN ) != 0 )\n {\n flags |= MBEDTLS_X509_BADCRL_NOT_TRUSTED;\n break;\n }\n#endif", " /*\n * Check if CRL is correctly signed by the trusted CA\n */\n if( x509_profile_check_md_alg( profile, crl_list->sig_md ) != 0 )\n flags |= MBEDTLS_X509_BADCRL_BAD_MD;", " if( x509_profile_check_pk_alg( profile, crl_list->sig_pk ) != 0 )\n flags |= MBEDTLS_X509_BADCRL_BAD_PK;", " md_info = mbedtls_md_info_from_type( crl_list->sig_md );\n if( md_info == NULL )\n {\n /*\n * Cannot check 'unknown' hash\n */\n flags |= MBEDTLS_X509_BADCRL_NOT_TRUSTED;\n break;\n }", " mbedtls_md( md_info, crl_list->tbs.p, crl_list->tbs.len, hash );", " if( x509_profile_check_key( profile, crl_list->sig_pk, &ca->pk ) != 0 )\n flags |= MBEDTLS_X509_BADCERT_BAD_KEY;", " if( mbedtls_pk_verify_ext( crl_list->sig_pk, crl_list->sig_opts, &ca->pk,\n crl_list->sig_md, hash, mbedtls_md_get_size( md_info ),\n crl_list->sig.p, crl_list->sig.len ) != 0 )\n {\n flags |= MBEDTLS_X509_BADCRL_NOT_TRUSTED;\n break;\n }", " /*\n * Check for validity of CRL (Do not drop out)\n */\n if( mbedtls_x509_time_is_past( &crl_list->next_update ) )\n flags |= MBEDTLS_X509_BADCRL_EXPIRED;", " if( mbedtls_x509_time_is_future( &crl_list->this_update ) )\n flags |= MBEDTLS_X509_BADCRL_FUTURE;", " /*\n * Check if certificate is revoked\n */\n if( mbedtls_x509_crt_is_revoked( crt, crl_list ) )\n {\n flags |= MBEDTLS_X509_BADCERT_REVOKED;\n break;\n }", " crl_list = crl_list->next;\n }", " return( flags );\n}\n#endif /* MBEDTLS_X509_CRL_PARSE_C */", "/*\n * Like memcmp, but case-insensitive and always returns -1 if different\n */\nstatic int x509_memcasecmp( const void *s1, const void *s2, size_t len )\n{\n size_t i;\n unsigned char diff;\n const unsigned char *n1 = s1, *n2 = s2;", " for( i = 0; i < len; i++ )\n {\n diff = n1[i] ^ n2[i];", " if( diff == 0 )\n continue;", " if( diff == 32 &&\n ( ( n1[i] >= 'a' && n1[i] <= 'z' ) ||\n ( n1[i] >= 'A' && n1[i] <= 'Z' ) ) )\n {\n continue;\n }", " return( -1 );\n }", " return( 0 );\n}", "/*\n * Return 0 if name matches wildcard, -1 otherwise\n */\nstatic int x509_check_wildcard( const char *cn, mbedtls_x509_buf *name )\n{\n size_t i;\n size_t cn_idx = 0, cn_len = strlen( cn );", " if( name->len < 3 || name->p[0] != '*' || name->p[1] != '.' )\n return( 0 );", " for( i = 0; i < cn_len; ++i )\n {\n if( cn[i] == '.' )\n {\n cn_idx = i;\n break;\n }\n }", " if( cn_idx == 0 )\n return( -1 );", " if( cn_len - cn_idx == name->len - 1 &&\n x509_memcasecmp( name->p + 1, cn + cn_idx, name->len - 1 ) == 0 )\n {\n return( 0 );\n }", " return( -1 );\n}", "/*\n * Compare two X.509 strings, case-insensitive, and allowing for some encoding\n * variations (but not all).\n *\n * Return 0 if equal, -1 otherwise.\n */\nstatic int x509_string_cmp( const mbedtls_x509_buf *a, const mbedtls_x509_buf *b )\n{\n if( a->tag == b->tag &&\n a->len == b->len &&\n memcmp( a->p, b->p, b->len ) == 0 )\n {\n return( 0 );\n }", " if( ( a->tag == MBEDTLS_ASN1_UTF8_STRING || a->tag == MBEDTLS_ASN1_PRINTABLE_STRING ) &&\n ( b->tag == MBEDTLS_ASN1_UTF8_STRING || b->tag == MBEDTLS_ASN1_PRINTABLE_STRING ) &&\n a->len == b->len &&\n x509_memcasecmp( a->p, b->p, b->len ) == 0 )\n {\n return( 0 );\n }", " return( -1 );\n}", "/*\n * Compare two X.509 Names (aka rdnSequence).\n *\n * See RFC 5280 section 7.1, though we don't implement the whole algorithm:\n * we sometimes return unequal when the full algorithm would return equal,\n * but never the other way. (In particular, we don't do Unicode normalisation\n * or space folding.)\n *\n * Return 0 if equal, -1 otherwise.\n */\nstatic int x509_name_cmp( const mbedtls_x509_name *a, const mbedtls_x509_name *b )\n{\n /* Avoid recursion, it might not be optimised by the compiler */\n while( a != NULL || b != NULL )\n {\n if( a == NULL || b == NULL )\n return( -1 );", " /* type */\n if( a->oid.tag != b->oid.tag ||\n a->oid.len != b->oid.len ||\n memcmp( a->oid.p, b->oid.p, b->oid.len ) != 0 )\n {\n return( -1 );\n }", " /* value */\n if( x509_string_cmp( &a->val, &b->val ) != 0 )\n return( -1 );", " /* structure of the list of sets */\n if( a->next_merged != b->next_merged )\n return( -1 );", " a = a->next;\n b = b->next;\n }", " /* a == NULL == b */\n return( 0 );\n}", "/*\n * Check if 'parent' is a suitable parent (signing CA) for 'child'.\n * Return 0 if yes, -1 if not.\n *\n * top means parent is a locally-trusted certificate\n * bottom means child is the end entity cert\n */\nstatic int x509_crt_check_parent( const mbedtls_x509_crt *child,\n const mbedtls_x509_crt *parent,\n int top, int bottom )\n{\n int need_ca_bit;", " /* Parent must be the issuer */\n if( x509_name_cmp( &child->issuer, &parent->subject ) != 0 )\n return( -1 );", " /* Parent must have the basicConstraints CA bit set as a general rule */\n need_ca_bit = 1;", " /* Exception: v1/v2 certificates that are locally trusted. */\n if( top && parent->version < 3 )\n need_ca_bit = 0;", " /* Exception: self-signed end-entity certs that are locally trusted. */\n if( top && bottom &&\n child->raw.len == parent->raw.len &&\n memcmp( child->raw.p, parent->raw.p, child->raw.len ) == 0 )\n {\n need_ca_bit = 0;\n }", " if( need_ca_bit && ! parent->ca_istrue )\n return( -1 );", "#if defined(MBEDTLS_X509_CHECK_KEY_USAGE)\n if( need_ca_bit &&\n mbedtls_x509_crt_check_key_usage( parent, MBEDTLS_X509_KU_KEY_CERT_SIGN ) != 0 )\n {\n return( -1 );\n }\n#endif", " return( 0 );\n}", "static int x509_crt_verify_top(\n mbedtls_x509_crt *child, mbedtls_x509_crt *trust_ca,\n mbedtls_x509_crl *ca_crl,\n const mbedtls_x509_crt_profile *profile,\n int path_cnt, int self_cnt, uint32_t *flags,\n int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),\n void *p_vrfy )\n{\n int ret;\n uint32_t ca_flags = 0;\n int check_path_cnt;\n unsigned char hash[MBEDTLS_MD_MAX_SIZE];\n const mbedtls_md_info_t *md_info;\n mbedtls_x509_crt *future_past_ca = NULL;", " if( mbedtls_x509_time_is_past( &child->valid_to ) )\n *flags |= MBEDTLS_X509_BADCERT_EXPIRED;", " if( mbedtls_x509_time_is_future( &child->valid_from ) )\n *flags |= MBEDTLS_X509_BADCERT_FUTURE;", " if( x509_profile_check_md_alg( profile, child->sig_md ) != 0 )\n *flags |= MBEDTLS_X509_BADCERT_BAD_MD;", " if( x509_profile_check_pk_alg( profile, child->sig_pk ) != 0 )\n *flags |= MBEDTLS_X509_BADCERT_BAD_PK;", " /*\n * Child is the top of the chain. Check against the trust_ca list.\n */\n *flags |= MBEDTLS_X509_BADCERT_NOT_TRUSTED;", " md_info = mbedtls_md_info_from_type( child->sig_md );\n if( md_info == NULL )\n {\n /*\n * Cannot check 'unknown', no need to try any CA\n */\n trust_ca = NULL;\n }\n else\n mbedtls_md( md_info, child->tbs.p, child->tbs.len, hash );", " for( /* trust_ca */ ; trust_ca != NULL; trust_ca = trust_ca->next )\n {\n if( x509_crt_check_parent( child, trust_ca, 1, path_cnt == 0 ) != 0 )\n continue;", " check_path_cnt = path_cnt + 1;", " /*\n * Reduce check_path_cnt to check against if top of the chain is\n * the same as the trusted CA\n */\n if( child->subject_raw.len == trust_ca->subject_raw.len &&\n memcmp( child->subject_raw.p, trust_ca->subject_raw.p,\n child->issuer_raw.len ) == 0 )\n {\n check_path_cnt--;\n }", " /* Self signed certificates do not count towards the limit */\n if( trust_ca->max_pathlen > 0 &&\n trust_ca->max_pathlen < check_path_cnt - self_cnt )\n {\n continue;\n }", " if( mbedtls_pk_verify_ext( child->sig_pk, child->sig_opts, &trust_ca->pk,\n child->sig_md, hash, mbedtls_md_get_size( md_info ),\n child->sig.p, child->sig.len ) != 0 )\n {\n continue;\n }", " if( mbedtls_x509_time_is_past( &trust_ca->valid_to ) ||\n mbedtls_x509_time_is_future( &trust_ca->valid_from ) )\n {\n if ( future_past_ca == NULL )\n future_past_ca = trust_ca;", " continue;\n }", " break;\n }", " if( trust_ca != NULL || ( trust_ca = future_past_ca ) != NULL )\n {\n /*\n * Top of chain is signed by a trusted CA\n */\n *flags &= ~MBEDTLS_X509_BADCERT_NOT_TRUSTED;", " if( x509_profile_check_key( profile, child->sig_pk, &trust_ca->pk ) != 0 )\n *flags |= MBEDTLS_X509_BADCERT_BAD_KEY;\n }", " /*\n * If top of chain is not the same as the trusted CA send a verify request\n * to the callback for any issues with validity and CRL presence for the\n * trusted CA certificate.\n */\n if( trust_ca != NULL &&\n ( child->subject_raw.len != trust_ca->subject_raw.len ||\n memcmp( child->subject_raw.p, trust_ca->subject_raw.p,\n child->issuer_raw.len ) != 0 ) )\n {\n#if defined(MBEDTLS_X509_CRL_PARSE_C)\n /* Check trusted CA's CRL for the chain's top crt */\n *flags |= x509_crt_verifycrl( child, trust_ca, ca_crl, profile );\n#else\n ((void) ca_crl);\n#endif", " if( mbedtls_x509_time_is_past( &trust_ca->valid_to ) )\n ca_flags |= MBEDTLS_X509_BADCERT_EXPIRED;", " if( mbedtls_x509_time_is_future( &trust_ca->valid_from ) )\n ca_flags |= MBEDTLS_X509_BADCERT_FUTURE;", " if( NULL != f_vrfy )\n {\n if( ( ret = f_vrfy( p_vrfy, trust_ca, path_cnt + 1,\n &ca_flags ) ) != 0 )\n {\n return( ret );\n }\n }\n }", " /* Call callback on top cert */\n if( NULL != f_vrfy )\n {\n if( ( ret = f_vrfy( p_vrfy, child, path_cnt, flags ) ) != 0 )\n return( ret );\n }", " *flags |= ca_flags;", " return( 0 );\n}", "static int x509_crt_verify_child(\n mbedtls_x509_crt *child, mbedtls_x509_crt *parent,\n mbedtls_x509_crt *trust_ca, mbedtls_x509_crl *ca_crl,\n const mbedtls_x509_crt_profile *profile,\n int path_cnt, int self_cnt, uint32_t *flags,\n int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),\n void *p_vrfy )\n{\n int ret;\n uint32_t parent_flags = 0;\n unsigned char hash[MBEDTLS_MD_MAX_SIZE];\n mbedtls_x509_crt *grandparent;\n const mbedtls_md_info_t *md_info;", " /* Counting intermediate self signed certificates */\n if( ( path_cnt != 0 ) && x509_name_cmp( &child->issuer, &child->subject ) == 0 )\n self_cnt++;", " /* path_cnt is 0 for the first intermediate CA */\n if( 1 + path_cnt > MBEDTLS_X509_MAX_INTERMEDIATE_CA )\n {", " *flags |= MBEDTLS_X509_BADCERT_NOT_TRUSTED;\n return( MBEDTLS_ERR_X509_CERT_VERIFY_FAILED );", " }", " if( mbedtls_x509_time_is_past( &child->valid_to ) )\n *flags |= MBEDTLS_X509_BADCERT_EXPIRED;", " if( mbedtls_x509_time_is_future( &child->valid_from ) )\n *flags |= MBEDTLS_X509_BADCERT_FUTURE;", " if( x509_profile_check_md_alg( profile, child->sig_md ) != 0 )\n *flags |= MBEDTLS_X509_BADCERT_BAD_MD;", " if( x509_profile_check_pk_alg( profile, child->sig_pk ) != 0 )\n *flags |= MBEDTLS_X509_BADCERT_BAD_PK;", " md_info = mbedtls_md_info_from_type( child->sig_md );\n if( md_info == NULL )\n {\n /*\n * Cannot check 'unknown' hash\n */\n *flags |= MBEDTLS_X509_BADCERT_NOT_TRUSTED;\n }\n else\n {\n mbedtls_md( md_info, child->tbs.p, child->tbs.len, hash );", " if( x509_profile_check_key( profile, child->sig_pk, &parent->pk ) != 0 )\n *flags |= MBEDTLS_X509_BADCERT_BAD_KEY;", " if( mbedtls_pk_verify_ext( child->sig_pk, child->sig_opts, &parent->pk,\n child->sig_md, hash, mbedtls_md_get_size( md_info ),\n child->sig.p, child->sig.len ) != 0 )\n {\n *flags |= MBEDTLS_X509_BADCERT_NOT_TRUSTED;\n }\n }", "#if defined(MBEDTLS_X509_CRL_PARSE_C)\n /* Check trusted CA's CRL for the given crt */\n *flags |= x509_crt_verifycrl(child, parent, ca_crl, profile );\n#endif", " /* Look for a grandparent in trusted CAs */\n for( grandparent = trust_ca;\n grandparent != NULL;\n grandparent = grandparent->next )\n {\n if( x509_crt_check_parent( parent, grandparent,\n 0, path_cnt == 0 ) == 0 )\n break;\n }", " if( grandparent != NULL )\n {\n ret = x509_crt_verify_top( parent, grandparent, ca_crl, profile,\n path_cnt + 1, self_cnt, &parent_flags, f_vrfy, p_vrfy );\n if( ret != 0 )\n return( ret );\n }\n else\n {\n /* Look for a grandparent upwards the chain */\n for( grandparent = parent->next;\n grandparent != NULL;\n grandparent = grandparent->next )\n {\n /* +2 because the current step is not yet accounted for\n * and because max_pathlen is one higher than it should be.\n * Also self signed certificates do not count to the limit. */\n if( grandparent->max_pathlen > 0 &&\n grandparent->max_pathlen < 2 + path_cnt - self_cnt )\n {\n continue;\n }", " if( x509_crt_check_parent( parent, grandparent,\n 0, path_cnt == 0 ) == 0 )\n break;\n }", " /* Is our parent part of the chain or at the top? */\n if( grandparent != NULL )\n {\n ret = x509_crt_verify_child( parent, grandparent, trust_ca, ca_crl,\n profile, path_cnt + 1, self_cnt, &parent_flags,\n f_vrfy, p_vrfy );\n if( ret != 0 )\n return( ret );\n }\n else\n {\n ret = x509_crt_verify_top( parent, trust_ca, ca_crl, profile,\n path_cnt + 1, self_cnt, &parent_flags,\n f_vrfy, p_vrfy );\n if( ret != 0 )\n return( ret );\n }\n }", " /* child is verified to be a child of the parent, call verify callback */\n if( NULL != f_vrfy )\n if( ( ret = f_vrfy( p_vrfy, child, path_cnt, flags ) ) != 0 )\n return( ret );", " *flags |= parent_flags;", " return( 0 );\n}", "/*\n * Verify the certificate validity\n */\nint mbedtls_x509_crt_verify( mbedtls_x509_crt *crt,\n mbedtls_x509_crt *trust_ca,\n mbedtls_x509_crl *ca_crl,\n const char *cn, uint32_t *flags,\n int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),\n void *p_vrfy )\n{\n return( mbedtls_x509_crt_verify_with_profile( crt, trust_ca, ca_crl,\n &mbedtls_x509_crt_profile_default, cn, flags, f_vrfy, p_vrfy ) );\n}", "\n/*\n * Verify the certificate validity, with profile\n */\nint mbedtls_x509_crt_verify_with_profile( mbedtls_x509_crt *crt,\n mbedtls_x509_crt *trust_ca,\n mbedtls_x509_crl *ca_crl,\n const mbedtls_x509_crt_profile *profile,\n const char *cn, uint32_t *flags,\n int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),\n void *p_vrfy )\n{\n size_t cn_len;\n int ret;\n int pathlen = 0, selfsigned = 0;\n mbedtls_x509_crt *parent;\n mbedtls_x509_name *name;\n mbedtls_x509_sequence *cur = NULL;\n mbedtls_pk_type_t pk_type;", " *flags = 0;", " if( profile == NULL )\n {\n ret = MBEDTLS_ERR_X509_BAD_INPUT_DATA;\n goto exit;\n }", " if( cn != NULL )\n {\n name = &crt->subject;\n cn_len = strlen( cn );", " if( crt->ext_types & MBEDTLS_X509_EXT_SUBJECT_ALT_NAME )\n {\n cur = &crt->subject_alt_names;", " while( cur != NULL )\n {\n if( cur->buf.len == cn_len &&\n x509_memcasecmp( cn, cur->buf.p, cn_len ) == 0 )\n break;", " if( cur->buf.len > 2 &&\n memcmp( cur->buf.p, \"*.\", 2 ) == 0 &&\n x509_check_wildcard( cn, &cur->buf ) == 0 )\n {\n break;\n }", " cur = cur->next;\n }", " if( cur == NULL )\n *flags |= MBEDTLS_X509_BADCERT_CN_MISMATCH;\n }\n else\n {\n while( name != NULL )\n {\n if( MBEDTLS_OID_CMP( MBEDTLS_OID_AT_CN, &name->oid ) == 0 )\n {\n if( name->val.len == cn_len &&\n x509_memcasecmp( name->val.p, cn, cn_len ) == 0 )\n break;", " if( name->val.len > 2 &&\n memcmp( name->val.p, \"*.\", 2 ) == 0 &&\n x509_check_wildcard( cn, &name->val ) == 0 )\n break;\n }", " name = name->next;\n }", " if( name == NULL )\n *flags |= MBEDTLS_X509_BADCERT_CN_MISMATCH;\n }\n }", " /* Check the type and size of the key */\n pk_type = mbedtls_pk_get_type( &crt->pk );", " if( x509_profile_check_pk_alg( profile, pk_type ) != 0 )\n *flags |= MBEDTLS_X509_BADCERT_BAD_PK;", " if( x509_profile_check_key( profile, pk_type, &crt->pk ) != 0 )\n *flags |= MBEDTLS_X509_BADCERT_BAD_KEY;", " /* Look for a parent in trusted CAs */\n for( parent = trust_ca; parent != NULL; parent = parent->next )\n {\n if( x509_crt_check_parent( crt, parent, 0, pathlen == 0 ) == 0 )\n break;\n }", " if( parent != NULL )\n {\n ret = x509_crt_verify_top( crt, parent, ca_crl, profile,\n pathlen, selfsigned, flags, f_vrfy, p_vrfy );\n if( ret != 0 )\n goto exit;\n }\n else\n {\n /* Look for a parent upwards the chain */\n for( parent = crt->next; parent != NULL; parent = parent->next )\n if( x509_crt_check_parent( crt, parent, 0, pathlen == 0 ) == 0 )\n break;", " /* Are we part of the chain or at the top? */\n if( parent != NULL )\n {\n ret = x509_crt_verify_child( crt, parent, trust_ca, ca_crl, profile,\n pathlen, selfsigned, flags, f_vrfy, p_vrfy );\n if( ret != 0 )\n goto exit;\n }\n else\n {\n ret = x509_crt_verify_top( crt, trust_ca, ca_crl, profile,\n pathlen, selfsigned, flags, f_vrfy, p_vrfy );\n if( ret != 0 )\n goto exit;\n }\n }", "exit:", "", " if( ret != 0 )\n {\n *flags = (uint32_t) -1;\n return( ret );\n }", " if( *flags != 0 )\n return( MBEDTLS_ERR_X509_CERT_VERIFY_FAILED );", " return( 0 );\n}", "/*\n * Initialize a certificate chain\n */\nvoid mbedtls_x509_crt_init( mbedtls_x509_crt *crt )\n{\n memset( crt, 0, sizeof(mbedtls_x509_crt) );\n}", "/*\n * Unallocate all certificate data\n */\nvoid mbedtls_x509_crt_free( mbedtls_x509_crt *crt )\n{\n mbedtls_x509_crt *cert_cur = crt;\n mbedtls_x509_crt *cert_prv;\n mbedtls_x509_name *name_cur;\n mbedtls_x509_name *name_prv;\n mbedtls_x509_sequence *seq_cur;\n mbedtls_x509_sequence *seq_prv;", " if( crt == NULL )\n return;", " do\n {\n mbedtls_pk_free( &cert_cur->pk );", "#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT)\n mbedtls_free( cert_cur->sig_opts );\n#endif", " name_cur = cert_cur->issuer.next;\n while( name_cur != NULL )\n {\n name_prv = name_cur;\n name_cur = name_cur->next;\n mbedtls_zeroize( name_prv, sizeof( mbedtls_x509_name ) );\n mbedtls_free( name_prv );\n }", " name_cur = cert_cur->subject.next;\n while( name_cur != NULL )\n {\n name_prv = name_cur;\n name_cur = name_cur->next;\n mbedtls_zeroize( name_prv, sizeof( mbedtls_x509_name ) );\n mbedtls_free( name_prv );\n }", " seq_cur = cert_cur->ext_key_usage.next;\n while( seq_cur != NULL )\n {\n seq_prv = seq_cur;\n seq_cur = seq_cur->next;\n mbedtls_zeroize( seq_prv, sizeof( mbedtls_x509_sequence ) );\n mbedtls_free( seq_prv );\n }", " seq_cur = cert_cur->subject_alt_names.next;\n while( seq_cur != NULL )\n {\n seq_prv = seq_cur;\n seq_cur = seq_cur->next;\n mbedtls_zeroize( seq_prv, sizeof( mbedtls_x509_sequence ) );\n mbedtls_free( seq_prv );\n }", " if( cert_cur->raw.p != NULL )\n {\n mbedtls_zeroize( cert_cur->raw.p, cert_cur->raw.len );\n mbedtls_free( cert_cur->raw.p );\n }", " cert_cur = cert_cur->next;\n }\n while( cert_cur != NULL );", " cert_cur = crt;\n do\n {\n cert_prv = cert_cur;\n cert_cur = cert_cur->next;", " mbedtls_zeroize( cert_prv, sizeof( mbedtls_x509_crt ) );\n if( cert_prv != crt )\n mbedtls_free( cert_prv );\n }\n while( cert_cur != NULL );\n}", "#endif /* MBEDTLS_X509_CRT_PARSE_C */" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [8, 75, 1056, 78, 271, 482, 2312, 1208], "buggy_code_start_loc": [8, 74, 1055, 78, 270, 482, 2060, 1207], "filenames": ["ChangeLog", "include/mbedtls/error.h", "include/mbedtls/ssl.h", "include/mbedtls/x509.h", "include/mbedtls/x509_crt.h", "library/error.c", "library/x509_crt.c", "tests/suites/test_suite_x509parse.data"], "fixing_code_end_loc": [12, 75, 1056, 80, 277, 485, 2317, 1208], "fixing_code_start_loc": [9, 74, 1055, 79, 270, 483, 2060, 1207], "message": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.10:*:*:*:*:*:*:*", "matchCriteriaId": "28621156-2430-447B-8816-47B0FB58245B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.11:*:*:*:*:*:*:*", "matchCriteriaId": "E11BBB2C-0423-47B1-AE12-EB849E17BAF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.12:*:*:*:*:*:*:*", "matchCriteriaId": "4131CE76-6260-412C-A6A6-20B0E978E569", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.13:*:*:*:*:*:*:*", "matchCriteriaId": "DE92D8F7-5705-47B6-B2C2-9DE6C7880647", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.14:*:*:*:*:*:*:*", "matchCriteriaId": "EA50C256-2054-4661-9C42-D31D7D87BAF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.15:*:*:*:*:*:*:*", "matchCriteriaId": "7791D4E9-3FEE-42DA-B320-CF7188A10294", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.16:*:*:*:*:*:*:*", "matchCriteriaId": "BE415DAA-A89F-4204-AC2C-577FCB447E4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.17:*:*:*:*:*:*:*", "matchCriteriaId": "95F691DB-9552-4EBB-B29D-16658561FA4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.18:*:*:*:*:*:*:*", "matchCriteriaId": "F1547B2A-E0D5-41D1-9449-1CCF35022B0E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.19:*:*:*:*:*:*:*", "matchCriteriaId": "CF762122-64BC-4A1A-A26D-81C1270541A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.20:*:*:*:*:*:*:*", "matchCriteriaId": "59D6B559-5F99-4E38-A861-3AB8A7D2E6BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.21:*:*:*:*:*:*:*", "matchCriteriaId": "4A8956C8-6CF0-4C37-84F9-8A89726806C3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "0B395D81-876F-43FC-8DB9-44377647A37A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F92622F1-82DA-4819-8275-06DC9DBE1BA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5871FDE9-02D0-466C-BDB7-90A14C4F637E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE6B4875-3FC3-499F-A76B-2D04982F743A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "B3B67842-5AFA-459F-9CCF-772B9DC7139F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "AD0500EE-52C0-4896-B3D8-5BE731D66039", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "015739E9-C0E3-4A62-BB9D-FA836BFD4351", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "842B0D15-6A3D-4CEE-AD02-49B0436E78E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "3CF6E05C-E6E5-40B8-AFEA-A5ED937F5439", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "D4133C86-70E0-44FD-BBDB-D61EFB31F027", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "6F9D24F0-3892-417F-9C3A-CACEF00C2293", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "8911513E-968C-403E-9D00-2DC0AA82F99B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "48D98945-82BB-4954-AA6D-7D98E4CE1154", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "6378C1CC-7C8F-47E3-A1A7-CDEC76E4CBE4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "525190A3-2194-4E4E-9D34-0048583B9C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "70407352-624A-40E6-82E4-7B4FAFE0C0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "DD52988E-4B2F-41AF-BC25-F38F87D9B8C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "FD1F7803-31F3-40A9-A878-FDC757FCE83F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected."}, {"lang": "es", "value": "ARM mbed TLS en versiones anteriores a la 1.3.21 y en versiones 2.x anteriores a la 2.1.9, si se configura la autenticaci\u00f3n opcional, permite a los atacantes omitir la autenticaci\u00f3n Peer mediante una cadena de certificados X.509 con muchos intermediarios. NOTA: aunque mbed TLS se conoc\u00eda antes como PolarSSL, las versiones lanzadas con el nombre PolarSSL no est\u00e1n afectadas."}], "evaluatorComment": null, "id": "CVE-2017-14032", "lastModified": "2017-11-08T02:29:02.850", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-08-30T20:29:00.337", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.debian.org/security/2017/dsa-3967"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugs.debian.org/873557"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/d15795acd5074e0b44e71f7ede8bdfe1b48591fc"}, {"source": "cve@mitre.org", "tags": ["Vendor Advisory"], "url": "https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2017-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, "type": "CWE-287"}
351
Determine whether the {function_name} code is vulnerable or not.
[ "/*\n * X.509 certificate parsing and verification\n *\n * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved\n * SPDX-License-Identifier: Apache-2.0\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n * not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is part of mbed TLS (https://tls.mbed.org)\n */\n/*\n * The ITU-T X.509 standard defines a certificate format for PKI.\n *\n * http://www.ietf.org/rfc/rfc5280.txt (Certificates and CRLs)\n * http://www.ietf.org/rfc/rfc3279.txt (Alg IDs for CRLs)\n * http://www.ietf.org/rfc/rfc2986.txt (CSRs, aka PKCS#10)\n *\n * http://www.itu.int/ITU-T/studygroups/com17/languages/X.680-0207.pdf\n * http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf\n */", "#if !defined(MBEDTLS_CONFIG_FILE)\n#include \"mbedtls/config.h\"\n#else\n#include MBEDTLS_CONFIG_FILE\n#endif", "#if defined(MBEDTLS_X509_CRT_PARSE_C)", "#include \"mbedtls/x509_crt.h\"\n#include \"mbedtls/oid.h\"", "#include <stdio.h>\n#include <string.h>", "#if defined(MBEDTLS_PEM_PARSE_C)\n#include \"mbedtls/pem.h\"\n#endif", "#if defined(MBEDTLS_PLATFORM_C)\n#include \"mbedtls/platform.h\"\n#else\n#include <stdlib.h>\n#define mbedtls_free free\n#define mbedtls_calloc calloc\n#define mbedtls_snprintf snprintf\n#endif", "#if defined(MBEDTLS_THREADING_C)\n#include \"mbedtls/threading.h\"\n#endif", "#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)\n#include <windows.h>\n#else\n#include <time.h>\n#endif", "#if defined(MBEDTLS_FS_IO)\n#include <stdio.h>\n#if !defined(_WIN32) || defined(EFIX64) || defined(EFI32)\n#include <sys/types.h>\n#include <sys/stat.h>\n#include <dirent.h>\n#endif /* !_WIN32 || EFIX64 || EFI32 */\n#endif", "/* Implementation that should never be optimized out by the compiler */\nstatic void mbedtls_zeroize( void *v, size_t n ) {\n volatile unsigned char *p = v; while( n-- ) *p++ = 0;\n}", "/*\n * Default profile\n */\nconst mbedtls_x509_crt_profile mbedtls_x509_crt_profile_default =\n{\n#if defined(MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES)\n /* Allow SHA-1 (weak, but still safe in controlled environments) */\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA1 ) |\n#endif\n /* Only SHA-2 hashes */\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA224 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA256 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA384 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA512 ),\n 0xFFFFFFF, /* Any PK alg */\n 0xFFFFFFF, /* Any curve */\n 2048,\n};", "/*\n * Next-default profile\n */\nconst mbedtls_x509_crt_profile mbedtls_x509_crt_profile_next =\n{\n /* Hashes from SHA-256 and above */\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA256 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA384 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA512 ),\n 0xFFFFFFF, /* Any PK alg */\n#if defined(MBEDTLS_ECP_C)\n /* Curves at or above 128-bit security level */\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_SECP256R1 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_SECP384R1 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_SECP521R1 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_BP256R1 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_BP384R1 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_BP512R1 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_SECP256K1 ),\n#else\n 0,\n#endif\n 2048,\n};", "/*\n * NSA Suite B Profile\n */\nconst mbedtls_x509_crt_profile mbedtls_x509_crt_profile_suiteb =\n{\n /* Only SHA-256 and 384 */\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA256 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA384 ),\n /* Only ECDSA */\n MBEDTLS_X509_ID_FLAG( MBEDTLS_PK_ECDSA ),\n#if defined(MBEDTLS_ECP_C)\n /* Only NIST P-256 and P-384 */\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_SECP256R1 ) |\n MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_SECP384R1 ),\n#else\n 0,\n#endif\n 0,\n};", "/*\n * Check md_alg against profile\n * Return 0 if md_alg acceptable for this profile, -1 otherwise\n */\nstatic int x509_profile_check_md_alg( const mbedtls_x509_crt_profile *profile,\n mbedtls_md_type_t md_alg )\n{\n if( ( profile->allowed_mds & MBEDTLS_X509_ID_FLAG( md_alg ) ) != 0 )\n return( 0 );", " return( -1 );\n}", "/*\n * Check pk_alg against profile\n * Return 0 if pk_alg acceptable for this profile, -1 otherwise\n */\nstatic int x509_profile_check_pk_alg( const mbedtls_x509_crt_profile *profile,\n mbedtls_pk_type_t pk_alg )\n{\n if( ( profile->allowed_pks & MBEDTLS_X509_ID_FLAG( pk_alg ) ) != 0 )\n return( 0 );", " return( -1 );\n}", "/*\n * Check key against profile\n * Return 0 if pk_alg acceptable for this profile, -1 otherwise\n */\nstatic int x509_profile_check_key( const mbedtls_x509_crt_profile *profile,\n mbedtls_pk_type_t pk_alg,\n const mbedtls_pk_context *pk )\n{\n#if defined(MBEDTLS_RSA_C)\n if( pk_alg == MBEDTLS_PK_RSA || pk_alg == MBEDTLS_PK_RSASSA_PSS )\n {\n if( mbedtls_pk_get_bitlen( pk ) >= profile->rsa_min_bitlen )\n return( 0 );", " return( -1 );\n }\n#endif", "#if defined(MBEDTLS_ECP_C)\n if( pk_alg == MBEDTLS_PK_ECDSA ||\n pk_alg == MBEDTLS_PK_ECKEY ||\n pk_alg == MBEDTLS_PK_ECKEY_DH )\n {\n mbedtls_ecp_group_id gid = mbedtls_pk_ec( *pk )->grp.id;", " if( ( profile->allowed_curves & MBEDTLS_X509_ID_FLAG( gid ) ) != 0 )\n return( 0 );", " return( -1 );\n }\n#endif", " return( -1 );\n}", "/*\n * Version ::= INTEGER { v1(0), v2(1), v3(2) }\n */\nstatic int x509_get_version( unsigned char **p,\n const unsigned char *end,\n int *ver )\n{\n int ret;\n size_t len;", " if( ( ret = mbedtls_asn1_get_tag( p, end, &len,\n MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED | 0 ) ) != 0 )\n {\n if( ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG )\n {\n *ver = 0;\n return( 0 );\n }", " return( ret );\n }", " end = *p + len;", " if( ( ret = mbedtls_asn1_get_int( p, end, ver ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_VERSION + ret );", " if( *p != end )\n return( MBEDTLS_ERR_X509_INVALID_VERSION +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );", " return( 0 );\n}", "/*\n * Validity ::= SEQUENCE {\n * notBefore Time,\n * notAfter Time }\n */\nstatic int x509_get_dates( unsigned char **p,\n const unsigned char *end,\n mbedtls_x509_time *from,\n mbedtls_x509_time *to )\n{\n int ret;\n size_t len;", " if( ( ret = mbedtls_asn1_get_tag( p, end, &len,\n MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_DATE + ret );", " end = *p + len;", " if( ( ret = mbedtls_x509_get_time( p, end, from ) ) != 0 )\n return( ret );", " if( ( ret = mbedtls_x509_get_time( p, end, to ) ) != 0 )\n return( ret );", " if( *p != end )\n return( MBEDTLS_ERR_X509_INVALID_DATE +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );", " return( 0 );\n}", "/*\n * X.509 v2/v3 unique identifier (not parsed)\n */\nstatic int x509_get_uid( unsigned char **p,\n const unsigned char *end,\n mbedtls_x509_buf *uid, int n )\n{\n int ret;", " if( *p == end )\n return( 0 );", " uid->tag = **p;", " if( ( ret = mbedtls_asn1_get_tag( p, end, &uid->len,\n MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED | n ) ) != 0 )\n {\n if( ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG )\n return( 0 );", " return( ret );\n }", " uid->p = *p;\n *p += uid->len;", " return( 0 );\n}", "static int x509_get_basic_constraints( unsigned char **p,\n const unsigned char *end,\n int *ca_istrue,\n int *max_pathlen )\n{\n int ret;\n size_t len;", " /*\n * BasicConstraints ::= SEQUENCE {\n * cA BOOLEAN DEFAULT FALSE,\n * pathLenConstraint INTEGER (0..MAX) OPTIONAL }\n */\n *ca_istrue = 0; /* DEFAULT FALSE */\n *max_pathlen = 0; /* endless */", " if( ( ret = mbedtls_asn1_get_tag( p, end, &len,\n MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " if( *p == end )\n return( 0 );", " if( ( ret = mbedtls_asn1_get_bool( p, end, ca_istrue ) ) != 0 )\n {\n if( ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG )\n ret = mbedtls_asn1_get_int( p, end, ca_istrue );", " if( ret != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " if( *ca_istrue != 0 )\n *ca_istrue = 1;\n }", " if( *p == end )\n return( 0 );", " if( ( ret = mbedtls_asn1_get_int( p, end, max_pathlen ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " if( *p != end )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );", " (*max_pathlen)++;", " return( 0 );\n}", "static int x509_get_ns_cert_type( unsigned char **p,\n const unsigned char *end,\n unsigned char *ns_cert_type)\n{\n int ret;\n mbedtls_x509_bitstring bs = { 0, 0, NULL };", " if( ( ret = mbedtls_asn1_get_bitstring( p, end, &bs ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " if( bs.len != 1 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_INVALID_LENGTH );", " /* Get actual bitstring */\n *ns_cert_type = *bs.p;\n return( 0 );\n}", "static int x509_get_key_usage( unsigned char **p,\n const unsigned char *end,\n unsigned int *key_usage)\n{\n int ret;\n size_t i;\n mbedtls_x509_bitstring bs = { 0, 0, NULL };", " if( ( ret = mbedtls_asn1_get_bitstring( p, end, &bs ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " if( bs.len < 1 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_INVALID_LENGTH );", " /* Get actual bitstring */\n *key_usage = 0;\n for( i = 0; i < bs.len && i < sizeof( unsigned int ); i++ )\n {\n *key_usage |= (unsigned int) bs.p[i] << (8*i);\n }", " return( 0 );\n}", "/*\n * ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId\n *\n * KeyPurposeId ::= OBJECT IDENTIFIER\n */\nstatic int x509_get_ext_key_usage( unsigned char **p,\n const unsigned char *end,\n mbedtls_x509_sequence *ext_key_usage)\n{\n int ret;", " if( ( ret = mbedtls_asn1_get_sequence_of( p, end, ext_key_usage, MBEDTLS_ASN1_OID ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " /* Sequence length must be >= 1 */\n if( ext_key_usage->buf.p == NULL )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_INVALID_LENGTH );", " return( 0 );\n}", "/*\n * SubjectAltName ::= GeneralNames\n *\n * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName\n *\n * GeneralName ::= CHOICE {\n * otherName [0] OtherName,\n * rfc822Name [1] IA5String,\n * dNSName [2] IA5String,\n * x400Address [3] ORAddress,\n * directoryName [4] Name,\n * ediPartyName [5] EDIPartyName,\n * uniformResourceIdentifier [6] IA5String,\n * iPAddress [7] OCTET STRING,\n * registeredID [8] OBJECT IDENTIFIER }\n *\n * OtherName ::= SEQUENCE {\n * type-id OBJECT IDENTIFIER,\n * value [0] EXPLICIT ANY DEFINED BY type-id }\n *\n * EDIPartyName ::= SEQUENCE {\n * nameAssigner [0] DirectoryString OPTIONAL,\n * partyName [1] DirectoryString }\n *\n * NOTE: we only parse and use dNSName at this point.\n */\nstatic int x509_get_subject_alt_name( unsigned char **p,\n const unsigned char *end,\n mbedtls_x509_sequence *subject_alt_name )\n{\n int ret;\n size_t len, tag_len;\n mbedtls_asn1_buf *buf;\n unsigned char tag;\n mbedtls_asn1_sequence *cur = subject_alt_name;", " /* Get main sequence tag */\n if( ( ret = mbedtls_asn1_get_tag( p, end, &len,\n MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " if( *p + len != end )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );", " while( *p < end )\n {\n if( ( end - *p ) < 1 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_OUT_OF_DATA );", " tag = **p;\n (*p)++;\n if( ( ret = mbedtls_asn1_get_len( p, end, &tag_len ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " if( ( tag & MBEDTLS_ASN1_CONTEXT_SPECIFIC ) != MBEDTLS_ASN1_CONTEXT_SPECIFIC )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_UNEXPECTED_TAG );", " /* Skip everything but DNS name */\n if( tag != ( MBEDTLS_ASN1_CONTEXT_SPECIFIC | 2 ) )\n {\n *p += tag_len;\n continue;\n }", " /* Allocate and assign next pointer */\n if( cur->buf.p != NULL )\n {\n if( cur->next != NULL )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS );", " cur->next = mbedtls_calloc( 1, sizeof( mbedtls_asn1_sequence ) );", " if( cur->next == NULL )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_ALLOC_FAILED );", " cur = cur->next;\n }", " buf = &(cur->buf);\n buf->tag = tag;\n buf->p = *p;\n buf->len = tag_len;\n *p += buf->len;\n }", " /* Set final sequence entry's next pointer to NULL */\n cur->next = NULL;", " if( *p != end )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );", " return( 0 );\n}", "/*\n * X.509 v3 extensions\n *\n */\nstatic int x509_get_crt_ext( unsigned char **p,\n const unsigned char *end,\n mbedtls_x509_crt *crt )\n{\n int ret;\n size_t len;\n unsigned char *end_ext_data, *end_ext_octet;", " if( ( ret = mbedtls_x509_get_ext( p, end, &crt->v3_ext, 3 ) ) != 0 )\n {\n if( ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG )\n return( 0 );", " return( ret );\n }", " while( *p < end )\n {\n /*\n * Extension ::= SEQUENCE {\n * extnID OBJECT IDENTIFIER,\n * critical BOOLEAN DEFAULT FALSE,\n * extnValue OCTET STRING }\n */\n mbedtls_x509_buf extn_oid = {0, 0, NULL};\n int is_critical = 0; /* DEFAULT FALSE */\n int ext_type = 0;", " if( ( ret = mbedtls_asn1_get_tag( p, end, &len,\n MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " end_ext_data = *p + len;", " /* Get extension ID */\n extn_oid.tag = **p;", " if( ( ret = mbedtls_asn1_get_tag( p, end, &extn_oid.len, MBEDTLS_ASN1_OID ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " extn_oid.p = *p;\n *p += extn_oid.len;", " if( ( end - *p ) < 1 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_OUT_OF_DATA );", " /* Get optional critical */\n if( ( ret = mbedtls_asn1_get_bool( p, end_ext_data, &is_critical ) ) != 0 &&\n ( ret != MBEDTLS_ERR_ASN1_UNEXPECTED_TAG ) )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " /* Data should be octet string type */\n if( ( ret = mbedtls_asn1_get_tag( p, end_ext_data, &len,\n MBEDTLS_ASN1_OCTET_STRING ) ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );", " end_ext_octet = *p + len;", " if( end_ext_octet != end_ext_data )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );", " /*\n * Detect supported extensions\n */\n ret = mbedtls_oid_get_x509_ext_type( &extn_oid, &ext_type );", " if( ret != 0 )\n {\n /* No parser found, skip extension */\n *p = end_ext_octet;", "#if !defined(MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION)\n if( is_critical )\n {\n /* Data is marked as critical: fail */\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_UNEXPECTED_TAG );\n }\n#endif\n continue;\n }", " /* Forbid repeated extensions */\n if( ( crt->ext_types & ext_type ) != 0 )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS );", " crt->ext_types |= ext_type;", " switch( ext_type )\n {\n case MBEDTLS_X509_EXT_BASIC_CONSTRAINTS:\n /* Parse basic constraints */\n if( ( ret = x509_get_basic_constraints( p, end_ext_octet,\n &crt->ca_istrue, &crt->max_pathlen ) ) != 0 )\n return( ret );\n break;", " case MBEDTLS_X509_EXT_KEY_USAGE:\n /* Parse key usage */\n if( ( ret = x509_get_key_usage( p, end_ext_octet,\n &crt->key_usage ) ) != 0 )\n return( ret );\n break;", " case MBEDTLS_X509_EXT_EXTENDED_KEY_USAGE:\n /* Parse extended key usage */\n if( ( ret = x509_get_ext_key_usage( p, end_ext_octet,\n &crt->ext_key_usage ) ) != 0 )\n return( ret );\n break;", " case MBEDTLS_X509_EXT_SUBJECT_ALT_NAME:\n /* Parse subject alt name */\n if( ( ret = x509_get_subject_alt_name( p, end_ext_octet,\n &crt->subject_alt_names ) ) != 0 )\n return( ret );\n break;", " case MBEDTLS_X509_EXT_NS_CERT_TYPE:\n /* Parse netscape certificate type */\n if( ( ret = x509_get_ns_cert_type( p, end_ext_octet,\n &crt->ns_cert_type ) ) != 0 )\n return( ret );\n break;", " default:\n return( MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE );\n }\n }", " if( *p != end )\n return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );", " return( 0 );\n}", "/*\n * Parse and fill a single X.509 certificate in DER format\n */\nstatic int x509_crt_parse_der_core( mbedtls_x509_crt *crt, const unsigned char *buf,\n size_t buflen )\n{\n int ret;\n size_t len;\n unsigned char *p, *end, *crt_end;\n mbedtls_x509_buf sig_params1, sig_params2, sig_oid2;", " memset( &sig_params1, 0, sizeof( mbedtls_x509_buf ) );\n memset( &sig_params2, 0, sizeof( mbedtls_x509_buf ) );\n memset( &sig_oid2, 0, sizeof( mbedtls_x509_buf ) );", " /*\n * Check for valid input\n */\n if( crt == NULL || buf == NULL )\n return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );", " // Use the original buffer until we figure out actual length\n p = (unsigned char*) buf;\n len = buflen;\n end = p + len;", " /*\n * Certificate ::= SEQUENCE {\n * tbsCertificate TBSCertificate,\n * signatureAlgorithm AlgorithmIdentifier,\n * signatureValue BIT STRING }\n */\n if( ( ret = mbedtls_asn1_get_tag( &p, end, &len,\n MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_INVALID_FORMAT );\n }", " if( len > (size_t) ( end - p ) )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_INVALID_FORMAT +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );\n }\n crt_end = p + len;", " // Create and populate a new buffer for the raw field\n crt->raw.len = crt_end - buf;\n crt->raw.p = p = mbedtls_calloc( 1, crt->raw.len );\n if( p == NULL )\n return( MBEDTLS_ERR_X509_ALLOC_FAILED );", " memcpy( p, buf, crt->raw.len );", " // Direct pointers to the new buffer \n p += crt->raw.len - len;\n end = crt_end = p + len;", " /*\n * TBSCertificate ::= SEQUENCE {\n */\n crt->tbs.p = p;", " if( ( ret = mbedtls_asn1_get_tag( &p, end, &len,\n MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_INVALID_FORMAT + ret );\n }", " end = p + len;\n crt->tbs.len = end - crt->tbs.p;", " /*\n * Version ::= INTEGER { v1(0), v2(1), v3(2) }\n *\n * CertificateSerialNumber ::= INTEGER\n *\n * signature AlgorithmIdentifier\n */\n if( ( ret = x509_get_version( &p, end, &crt->version ) ) != 0 ||\n ( ret = mbedtls_x509_get_serial( &p, end, &crt->serial ) ) != 0 ||\n ( ret = mbedtls_x509_get_alg( &p, end, &crt->sig_oid,\n &sig_params1 ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }", " crt->version++;", " if( crt->version > 3 )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_UNKNOWN_VERSION );\n }", " if( ( ret = mbedtls_x509_get_sig_alg( &crt->sig_oid, &sig_params1,\n &crt->sig_md, &crt->sig_pk,\n &crt->sig_opts ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }", " /*\n * issuer Name\n */\n crt->issuer_raw.p = p;", " if( ( ret = mbedtls_asn1_get_tag( &p, end, &len,\n MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_INVALID_FORMAT + ret );\n }", " if( ( ret = mbedtls_x509_get_name( &p, p + len, &crt->issuer ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }", " crt->issuer_raw.len = p - crt->issuer_raw.p;", " /*\n * Validity ::= SEQUENCE {\n * notBefore Time,\n * notAfter Time }\n *\n */\n if( ( ret = x509_get_dates( &p, end, &crt->valid_from,\n &crt->valid_to ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }", " /*\n * subject Name\n */\n crt->subject_raw.p = p;", " if( ( ret = mbedtls_asn1_get_tag( &p, end, &len,\n MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_INVALID_FORMAT + ret );\n }", " if( len && ( ret = mbedtls_x509_get_name( &p, p + len, &crt->subject ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }", " crt->subject_raw.len = p - crt->subject_raw.p;", " /*\n * SubjectPublicKeyInfo\n */\n if( ( ret = mbedtls_pk_parse_subpubkey( &p, end, &crt->pk ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }", " /*\n * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL,\n * -- If present, version shall be v2 or v3\n * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL,\n * -- If present, version shall be v2 or v3\n * extensions [3] EXPLICIT Extensions OPTIONAL\n * -- If present, version shall be v3\n */\n if( crt->version == 2 || crt->version == 3 )\n {\n ret = x509_get_uid( &p, end, &crt->issuer_id, 1 );\n if( ret != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }\n }", " if( crt->version == 2 || crt->version == 3 )\n {\n ret = x509_get_uid( &p, end, &crt->subject_id, 2 );\n if( ret != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }\n }", "#if !defined(MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3)\n if( crt->version == 3 )\n#endif\n {\n ret = x509_get_crt_ext( &p, end, crt );\n if( ret != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }\n }", " if( p != end )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_INVALID_FORMAT +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );\n }", " end = crt_end;", " /*\n * }\n * -- end of TBSCertificate\n *\n * signatureAlgorithm AlgorithmIdentifier,\n * signatureValue BIT STRING\n */\n if( ( ret = mbedtls_x509_get_alg( &p, end, &sig_oid2, &sig_params2 ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }", " if( crt->sig_oid.len != sig_oid2.len ||\n memcmp( crt->sig_oid.p, sig_oid2.p, crt->sig_oid.len ) != 0 ||\n sig_params1.len != sig_params2.len ||\n ( sig_params1.len != 0 &&\n memcmp( sig_params1.p, sig_params2.p, sig_params1.len ) != 0 ) )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_SIG_MISMATCH );\n }", " if( ( ret = mbedtls_x509_get_sig( &p, end, &crt->sig ) ) != 0 )\n {\n mbedtls_x509_crt_free( crt );\n return( ret );\n }", " if( p != end )\n {\n mbedtls_x509_crt_free( crt );\n return( MBEDTLS_ERR_X509_INVALID_FORMAT +\n MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );\n }", " return( 0 );\n}", "/*\n * Parse one X.509 certificate in DER format from a buffer and add them to a\n * chained list\n */\nint mbedtls_x509_crt_parse_der( mbedtls_x509_crt *chain, const unsigned char *buf,\n size_t buflen )\n{\n int ret;\n mbedtls_x509_crt *crt = chain, *prev = NULL;", " /*\n * Check for valid input\n */\n if( crt == NULL || buf == NULL )\n return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );", " while( crt->version != 0 && crt->next != NULL )\n {\n prev = crt;\n crt = crt->next;\n }", " /*\n * Add new certificate on the end of the chain if needed.\n */\n if( crt->version != 0 && crt->next == NULL )\n {\n crt->next = mbedtls_calloc( 1, sizeof( mbedtls_x509_crt ) );", " if( crt->next == NULL )\n return( MBEDTLS_ERR_X509_ALLOC_FAILED );", " prev = crt;\n mbedtls_x509_crt_init( crt->next );\n crt = crt->next;\n }", " if( ( ret = x509_crt_parse_der_core( crt, buf, buflen ) ) != 0 )\n {\n if( prev )\n prev->next = NULL;", " if( crt != chain )\n mbedtls_free( crt );", " return( ret );\n }", " return( 0 );\n}", "/*\n * Parse one or more PEM certificates from a buffer and add them to the chained\n * list\n */\nint mbedtls_x509_crt_parse( mbedtls_x509_crt *chain, const unsigned char *buf, size_t buflen )\n{\n#if defined(MBEDTLS_PEM_PARSE_C)\n int success = 0, first_error = 0, total_failed = 0;\n int buf_format = MBEDTLS_X509_FORMAT_DER;\n#endif", " /*\n * Check for valid input\n */\n if( chain == NULL || buf == NULL )\n return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );", " /*\n * Determine buffer content. Buffer contains either one DER certificate or\n * one or more PEM certificates.\n */\n#if defined(MBEDTLS_PEM_PARSE_C)\n if( buflen != 0 && buf[buflen - 1] == '\\0' &&\n strstr( (const char *) buf, \"-----BEGIN CERTIFICATE-----\" ) != NULL )\n {\n buf_format = MBEDTLS_X509_FORMAT_PEM;\n }", " if( buf_format == MBEDTLS_X509_FORMAT_DER )\n return mbedtls_x509_crt_parse_der( chain, buf, buflen );\n#else\n return mbedtls_x509_crt_parse_der( chain, buf, buflen );\n#endif", "#if defined(MBEDTLS_PEM_PARSE_C)\n if( buf_format == MBEDTLS_X509_FORMAT_PEM )\n {\n int ret;\n mbedtls_pem_context pem;", " /* 1 rather than 0 since the terminating NULL byte is counted in */\n while( buflen > 1 )\n {\n size_t use_len;\n mbedtls_pem_init( &pem );", " /* If we get there, we know the string is null-terminated */\n ret = mbedtls_pem_read_buffer( &pem,\n \"-----BEGIN CERTIFICATE-----\",\n \"-----END CERTIFICATE-----\",\n buf, NULL, 0, &use_len );", " if( ret == 0 )\n {\n /*\n * Was PEM encoded\n */\n buflen -= use_len;\n buf += use_len;\n }\n else if( ret == MBEDTLS_ERR_PEM_BAD_INPUT_DATA )\n {\n return( ret );\n }\n else if( ret != MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT )\n {\n mbedtls_pem_free( &pem );", " /*\n * PEM header and footer were found\n */\n buflen -= use_len;\n buf += use_len;", " if( first_error == 0 )\n first_error = ret;", " total_failed++;\n continue;\n }\n else\n break;", " ret = mbedtls_x509_crt_parse_der( chain, pem.buf, pem.buflen );", " mbedtls_pem_free( &pem );", " if( ret != 0 )\n {\n /*\n * Quit parsing on a memory error\n */\n if( ret == MBEDTLS_ERR_X509_ALLOC_FAILED )\n return( ret );", " if( first_error == 0 )\n first_error = ret;", " total_failed++;\n continue;\n }", " success = 1;\n }\n }", " if( success )\n return( total_failed );\n else if( first_error )\n return( first_error );\n else\n return( MBEDTLS_ERR_X509_CERT_UNKNOWN_FORMAT );\n#endif /* MBEDTLS_PEM_PARSE_C */\n}", "#if defined(MBEDTLS_FS_IO)\n/*\n * Load one or more certificates and add them to the chained list\n */\nint mbedtls_x509_crt_parse_file( mbedtls_x509_crt *chain, const char *path )\n{\n int ret;\n size_t n;\n unsigned char *buf;", " if( ( ret = mbedtls_pk_load_file( path, &buf, &n ) ) != 0 )\n return( ret );", " ret = mbedtls_x509_crt_parse( chain, buf, n );", " mbedtls_zeroize( buf, n );\n mbedtls_free( buf );", " return( ret );\n}", "int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path )\n{\n int ret = 0;\n#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)\n int w_ret;\n WCHAR szDir[MAX_PATH];\n char filename[MAX_PATH];\n char *p;\n size_t len = strlen( path );", " WIN32_FIND_DATAW file_data;\n HANDLE hFind;", " if( len > MAX_PATH - 3 )\n return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );", " memset( szDir, 0, sizeof(szDir) );\n memset( filename, 0, MAX_PATH );\n memcpy( filename, path, len );\n filename[len++] = '\\\\';\n p = filename + len;\n filename[len++] = '*';", " w_ret = MultiByteToWideChar( CP_ACP, 0, filename, (int)len, szDir,\n MAX_PATH - 3 );\n if( w_ret == 0 )\n return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );", " hFind = FindFirstFileW( szDir, &file_data );\n if( hFind == INVALID_HANDLE_VALUE )\n return( MBEDTLS_ERR_X509_FILE_IO_ERROR );", " len = MAX_PATH - len;\n do\n {\n memset( p, 0, len );", " if( file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )\n continue;", " w_ret = WideCharToMultiByte( CP_ACP, 0, file_data.cFileName,\n lstrlenW( file_data.cFileName ),\n p, (int) len - 1,\n NULL, NULL );\n if( w_ret == 0 )\n return( MBEDTLS_ERR_X509_FILE_IO_ERROR );", " w_ret = mbedtls_x509_crt_parse_file( chain, filename );\n if( w_ret < 0 )\n ret++;\n else\n ret += w_ret;\n }\n while( FindNextFileW( hFind, &file_data ) != 0 );", " if( GetLastError() != ERROR_NO_MORE_FILES )\n ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;", " FindClose( hFind );\n#else /* _WIN32 */\n int t_ret;\n int snp_ret;\n struct stat sb;\n struct dirent *entry;\n char entry_name[MBEDTLS_X509_MAX_FILE_PATH_LEN];\n DIR *dir = opendir( path );", " if( dir == NULL )\n return( MBEDTLS_ERR_X509_FILE_IO_ERROR );", "#if defined(MBEDTLS_THREADING_PTHREAD)\n if( ( ret = mbedtls_mutex_lock( &mbedtls_threading_readdir_mutex ) ) != 0 )\n {\n closedir( dir );\n return( ret );\n }\n#endif", " while( ( entry = readdir( dir ) ) != NULL )\n {\n snp_ret = mbedtls_snprintf( entry_name, sizeof entry_name,\n \"%s/%s\", path, entry->d_name );", " if( snp_ret < 0 || (size_t)snp_ret >= sizeof entry_name )\n {\n ret = MBEDTLS_ERR_X509_BUFFER_TOO_SMALL;\n goto cleanup;\n }\n else if( stat( entry_name, &sb ) == -1 )\n {\n ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;\n goto cleanup;\n }", " if( !S_ISREG( sb.st_mode ) )\n continue;", " // Ignore parse errors\n //\n t_ret = mbedtls_x509_crt_parse_file( chain, entry_name );\n if( t_ret < 0 )\n ret++;\n else\n ret += t_ret;\n }", "cleanup:\n closedir( dir );", "#if defined(MBEDTLS_THREADING_PTHREAD)\n if( mbedtls_mutex_unlock( &mbedtls_threading_readdir_mutex ) != 0 )\n ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR;\n#endif", "#endif /* _WIN32 */", " return( ret );\n}\n#endif /* MBEDTLS_FS_IO */", "static int x509_info_subject_alt_name( char **buf, size_t *size,\n const mbedtls_x509_sequence *subject_alt_name )\n{\n size_t i;\n size_t n = *size;\n char *p = *buf;\n const mbedtls_x509_sequence *cur = subject_alt_name;\n const char *sep = \"\";\n size_t sep_len = 0;", " while( cur != NULL )\n {\n if( cur->buf.len + sep_len >= n )\n {\n *p = '\\0';\n return( MBEDTLS_ERR_X509_BUFFER_TOO_SMALL );\n }", " n -= cur->buf.len + sep_len;\n for( i = 0; i < sep_len; i++ )\n *p++ = sep[i];\n for( i = 0; i < cur->buf.len; i++ )\n *p++ = cur->buf.p[i];", " sep = \", \";\n sep_len = 2;", " cur = cur->next;\n }", " *p = '\\0';", " *size = n;\n *buf = p;", " return( 0 );\n}", "#define PRINT_ITEM(i) \\\n { \\\n ret = mbedtls_snprintf( p, n, \"%s\" i, sep ); \\\n MBEDTLS_X509_SAFE_SNPRINTF; \\\n sep = \", \"; \\\n }", "#define CERT_TYPE(type,name) \\\n if( ns_cert_type & type ) \\\n PRINT_ITEM( name );", "static int x509_info_cert_type( char **buf, size_t *size,\n unsigned char ns_cert_type )\n{\n int ret;\n size_t n = *size;\n char *p = *buf;\n const char *sep = \"\";", " CERT_TYPE( MBEDTLS_X509_NS_CERT_TYPE_SSL_CLIENT, \"SSL Client\" );\n CERT_TYPE( MBEDTLS_X509_NS_CERT_TYPE_SSL_SERVER, \"SSL Server\" );\n CERT_TYPE( MBEDTLS_X509_NS_CERT_TYPE_EMAIL, \"Email\" );\n CERT_TYPE( MBEDTLS_X509_NS_CERT_TYPE_OBJECT_SIGNING, \"Object Signing\" );\n CERT_TYPE( MBEDTLS_X509_NS_CERT_TYPE_RESERVED, \"Reserved\" );\n CERT_TYPE( MBEDTLS_X509_NS_CERT_TYPE_SSL_CA, \"SSL CA\" );\n CERT_TYPE( MBEDTLS_X509_NS_CERT_TYPE_EMAIL_CA, \"Email CA\" );\n CERT_TYPE( MBEDTLS_X509_NS_CERT_TYPE_OBJECT_SIGNING_CA, \"Object Signing CA\" );", " *size = n;\n *buf = p;", " return( 0 );\n}", "#define KEY_USAGE(code,name) \\\n if( key_usage & code ) \\\n PRINT_ITEM( name );", "static int x509_info_key_usage( char **buf, size_t *size,\n unsigned int key_usage )\n{\n int ret;\n size_t n = *size;\n char *p = *buf;\n const char *sep = \"\";", " KEY_USAGE( MBEDTLS_X509_KU_DIGITAL_SIGNATURE, \"Digital Signature\" );\n KEY_USAGE( MBEDTLS_X509_KU_NON_REPUDIATION, \"Non Repudiation\" );\n KEY_USAGE( MBEDTLS_X509_KU_KEY_ENCIPHERMENT, \"Key Encipherment\" );\n KEY_USAGE( MBEDTLS_X509_KU_DATA_ENCIPHERMENT, \"Data Encipherment\" );\n KEY_USAGE( MBEDTLS_X509_KU_KEY_AGREEMENT, \"Key Agreement\" );\n KEY_USAGE( MBEDTLS_X509_KU_KEY_CERT_SIGN, \"Key Cert Sign\" );\n KEY_USAGE( MBEDTLS_X509_KU_CRL_SIGN, \"CRL Sign\" );\n KEY_USAGE( MBEDTLS_X509_KU_ENCIPHER_ONLY, \"Encipher Only\" );\n KEY_USAGE( MBEDTLS_X509_KU_DECIPHER_ONLY, \"Decipher Only\" );", " *size = n;\n *buf = p;", " return( 0 );\n}", "static int x509_info_ext_key_usage( char **buf, size_t *size,\n const mbedtls_x509_sequence *extended_key_usage )\n{\n int ret;\n const char *desc;\n size_t n = *size;\n char *p = *buf;\n const mbedtls_x509_sequence *cur = extended_key_usage;\n const char *sep = \"\";", " while( cur != NULL )\n {\n if( mbedtls_oid_get_extended_key_usage( &cur->buf, &desc ) != 0 )\n desc = \"???\";", " ret = mbedtls_snprintf( p, n, \"%s%s\", sep, desc );\n MBEDTLS_X509_SAFE_SNPRINTF;", " sep = \", \";", " cur = cur->next;\n }", " *size = n;\n *buf = p;", " return( 0 );\n}", "/*\n * Return an informational string about the certificate.\n */\n#define BEFORE_COLON 18\n#define BC \"18\"\nint mbedtls_x509_crt_info( char *buf, size_t size, const char *prefix,\n const mbedtls_x509_crt *crt )\n{\n int ret;\n size_t n;\n char *p;\n char key_size_str[BEFORE_COLON];", " p = buf;\n n = size;", " if( NULL == crt )\n {\n ret = mbedtls_snprintf( p, n, \"\\nCertificate is uninitialised!\\n\" );\n MBEDTLS_X509_SAFE_SNPRINTF;", " return( (int) ( size - n ) );\n }", " ret = mbedtls_snprintf( p, n, \"%scert. version : %d\\n\",\n prefix, crt->version );\n MBEDTLS_X509_SAFE_SNPRINTF;\n ret = mbedtls_snprintf( p, n, \"%sserial number : \",\n prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;", " ret = mbedtls_x509_serial_gets( p, n, &crt->serial );\n MBEDTLS_X509_SAFE_SNPRINTF;", " ret = mbedtls_snprintf( p, n, \"\\n%sissuer name : \", prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;\n ret = mbedtls_x509_dn_gets( p, n, &crt->issuer );\n MBEDTLS_X509_SAFE_SNPRINTF;", " ret = mbedtls_snprintf( p, n, \"\\n%ssubject name : \", prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;\n ret = mbedtls_x509_dn_gets( p, n, &crt->subject );\n MBEDTLS_X509_SAFE_SNPRINTF;", " ret = mbedtls_snprintf( p, n, \"\\n%sissued on : \" \\\n \"%04d-%02d-%02d %02d:%02d:%02d\", prefix,\n crt->valid_from.year, crt->valid_from.mon,\n crt->valid_from.day, crt->valid_from.hour,\n crt->valid_from.min, crt->valid_from.sec );\n MBEDTLS_X509_SAFE_SNPRINTF;", " ret = mbedtls_snprintf( p, n, \"\\n%sexpires on : \" \\\n \"%04d-%02d-%02d %02d:%02d:%02d\", prefix,\n crt->valid_to.year, crt->valid_to.mon,\n crt->valid_to.day, crt->valid_to.hour,\n crt->valid_to.min, crt->valid_to.sec );\n MBEDTLS_X509_SAFE_SNPRINTF;", " ret = mbedtls_snprintf( p, n, \"\\n%ssigned using : \", prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;", " ret = mbedtls_x509_sig_alg_gets( p, n, &crt->sig_oid, crt->sig_pk,\n crt->sig_md, crt->sig_opts );\n MBEDTLS_X509_SAFE_SNPRINTF;", " /* Key size */\n if( ( ret = mbedtls_x509_key_size_helper( key_size_str, BEFORE_COLON,\n mbedtls_pk_get_name( &crt->pk ) ) ) != 0 )\n {\n return( ret );\n }", " ret = mbedtls_snprintf( p, n, \"\\n%s%-\" BC \"s: %d bits\", prefix, key_size_str,\n (int) mbedtls_pk_get_bitlen( &crt->pk ) );\n MBEDTLS_X509_SAFE_SNPRINTF;", " /*\n * Optional extensions\n */", " if( crt->ext_types & MBEDTLS_X509_EXT_BASIC_CONSTRAINTS )\n {\n ret = mbedtls_snprintf( p, n, \"\\n%sbasic constraints : CA=%s\", prefix,\n crt->ca_istrue ? \"true\" : \"false\" );\n MBEDTLS_X509_SAFE_SNPRINTF;", " if( crt->max_pathlen > 0 )\n {\n ret = mbedtls_snprintf( p, n, \", max_pathlen=%d\", crt->max_pathlen - 1 );\n MBEDTLS_X509_SAFE_SNPRINTF;\n }\n }", " if( crt->ext_types & MBEDTLS_X509_EXT_SUBJECT_ALT_NAME )\n {\n ret = mbedtls_snprintf( p, n, \"\\n%ssubject alt name : \", prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;", " if( ( ret = x509_info_subject_alt_name( &p, &n,\n &crt->subject_alt_names ) ) != 0 )\n return( ret );\n }", " if( crt->ext_types & MBEDTLS_X509_EXT_NS_CERT_TYPE )\n {\n ret = mbedtls_snprintf( p, n, \"\\n%scert. type : \", prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;", " if( ( ret = x509_info_cert_type( &p, &n, crt->ns_cert_type ) ) != 0 )\n return( ret );\n }", " if( crt->ext_types & MBEDTLS_X509_EXT_KEY_USAGE )\n {\n ret = mbedtls_snprintf( p, n, \"\\n%skey usage : \", prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;", " if( ( ret = x509_info_key_usage( &p, &n, crt->key_usage ) ) != 0 )\n return( ret );\n }", " if( crt->ext_types & MBEDTLS_X509_EXT_EXTENDED_KEY_USAGE )\n {\n ret = mbedtls_snprintf( p, n, \"\\n%sext key usage : \", prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;", " if( ( ret = x509_info_ext_key_usage( &p, &n,\n &crt->ext_key_usage ) ) != 0 )\n return( ret );\n }", " ret = mbedtls_snprintf( p, n, \"\\n\" );\n MBEDTLS_X509_SAFE_SNPRINTF;", " return( (int) ( size - n ) );\n}", "struct x509_crt_verify_string {\n int code;\n const char *string;\n};", "static const struct x509_crt_verify_string x509_crt_verify_strings[] = {\n { MBEDTLS_X509_BADCERT_EXPIRED, \"The certificate validity has expired\" },\n { MBEDTLS_X509_BADCERT_REVOKED, \"The certificate has been revoked (is on a CRL)\" },\n { MBEDTLS_X509_BADCERT_CN_MISMATCH, \"The certificate Common Name (CN) does not match with the expected CN\" },\n { MBEDTLS_X509_BADCERT_NOT_TRUSTED, \"The certificate is not correctly signed by the trusted CA\" },\n { MBEDTLS_X509_BADCRL_NOT_TRUSTED, \"The CRL is not correctly signed by the trusted CA\" },\n { MBEDTLS_X509_BADCRL_EXPIRED, \"The CRL is expired\" },\n { MBEDTLS_X509_BADCERT_MISSING, \"Certificate was missing\" },\n { MBEDTLS_X509_BADCERT_SKIP_VERIFY, \"Certificate verification was skipped\" },\n { MBEDTLS_X509_BADCERT_OTHER, \"Other reason (can be used by verify callback)\" },\n { MBEDTLS_X509_BADCERT_FUTURE, \"The certificate validity starts in the future\" },\n { MBEDTLS_X509_BADCRL_FUTURE, \"The CRL is from the future\" },\n { MBEDTLS_X509_BADCERT_KEY_USAGE, \"Usage does not match the keyUsage extension\" },\n { MBEDTLS_X509_BADCERT_EXT_KEY_USAGE, \"Usage does not match the extendedKeyUsage extension\" },\n { MBEDTLS_X509_BADCERT_NS_CERT_TYPE, \"Usage does not match the nsCertType extension\" },\n { MBEDTLS_X509_BADCERT_BAD_MD, \"The certificate is signed with an unacceptable hash.\" },\n { MBEDTLS_X509_BADCERT_BAD_PK, \"The certificate is signed with an unacceptable PK alg (eg RSA vs ECDSA).\" },\n { MBEDTLS_X509_BADCERT_BAD_KEY, \"The certificate is signed with an unacceptable key (eg bad curve, RSA too short).\" },\n { MBEDTLS_X509_BADCRL_BAD_MD, \"The CRL is signed with an unacceptable hash.\" },\n { MBEDTLS_X509_BADCRL_BAD_PK, \"The CRL is signed with an unacceptable PK alg (eg RSA vs ECDSA).\" },\n { MBEDTLS_X509_BADCRL_BAD_KEY, \"The CRL is signed with an unacceptable key (eg bad curve, RSA too short).\" },\n { 0, NULL }\n};", "int mbedtls_x509_crt_verify_info( char *buf, size_t size, const char *prefix,\n uint32_t flags )\n{\n int ret;\n const struct x509_crt_verify_string *cur;\n char *p = buf;\n size_t n = size;", " for( cur = x509_crt_verify_strings; cur->string != NULL ; cur++ )\n {\n if( ( flags & cur->code ) == 0 )\n continue;", " ret = mbedtls_snprintf( p, n, \"%s%s\\n\", prefix, cur->string );\n MBEDTLS_X509_SAFE_SNPRINTF;\n flags ^= cur->code;\n }", " if( flags != 0 )\n {\n ret = mbedtls_snprintf( p, n, \"%sUnknown reason \"\n \"(this should not happen)\\n\", prefix );\n MBEDTLS_X509_SAFE_SNPRINTF;\n }", " return( (int) ( size - n ) );\n}", "#if defined(MBEDTLS_X509_CHECK_KEY_USAGE)\nint mbedtls_x509_crt_check_key_usage( const mbedtls_x509_crt *crt,\n unsigned int usage )\n{\n unsigned int usage_must, usage_may;\n unsigned int may_mask = MBEDTLS_X509_KU_ENCIPHER_ONLY\n | MBEDTLS_X509_KU_DECIPHER_ONLY;", " if( ( crt->ext_types & MBEDTLS_X509_EXT_KEY_USAGE ) == 0 )\n return( 0 );", " usage_must = usage & ~may_mask;", " if( ( ( crt->key_usage & ~may_mask ) & usage_must ) != usage_must )\n return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );", " usage_may = usage & may_mask;", " if( ( ( crt->key_usage & may_mask ) | usage_may ) != usage_may )\n return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );", " return( 0 );\n}\n#endif", "#if defined(MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE)\nint mbedtls_x509_crt_check_extended_key_usage( const mbedtls_x509_crt *crt,\n const char *usage_oid,\n size_t usage_len )\n{\n const mbedtls_x509_sequence *cur;", " /* Extension is not mandatory, absent means no restriction */\n if( ( crt->ext_types & MBEDTLS_X509_EXT_EXTENDED_KEY_USAGE ) == 0 )\n return( 0 );", " /*\n * Look for the requested usage (or wildcard ANY) in our list\n */\n for( cur = &crt->ext_key_usage; cur != NULL; cur = cur->next )\n {\n const mbedtls_x509_buf *cur_oid = &cur->buf;", " if( cur_oid->len == usage_len &&\n memcmp( cur_oid->p, usage_oid, usage_len ) == 0 )\n {\n return( 0 );\n }", " if( MBEDTLS_OID_CMP( MBEDTLS_OID_ANY_EXTENDED_KEY_USAGE, cur_oid ) == 0 )\n return( 0 );\n }", " return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );\n}\n#endif /* MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE */", "#if defined(MBEDTLS_X509_CRL_PARSE_C)\n/*\n * Return 1 if the certificate is revoked, or 0 otherwise.\n */\nint mbedtls_x509_crt_is_revoked( const mbedtls_x509_crt *crt, const mbedtls_x509_crl *crl )\n{\n const mbedtls_x509_crl_entry *cur = &crl->entry;", " while( cur != NULL && cur->serial.len != 0 )\n {\n if( crt->serial.len == cur->serial.len &&\n memcmp( crt->serial.p, cur->serial.p, crt->serial.len ) == 0 )\n {\n if( mbedtls_x509_time_is_past( &cur->revocation_date ) )\n return( 1 );\n }", " cur = cur->next;\n }", " return( 0 );\n}", "/*\n * Check that the given certificate is not revoked according to the CRL.\n * Skip validation is no CRL for the given CA is present.\n */\nstatic int x509_crt_verifycrl( mbedtls_x509_crt *crt, mbedtls_x509_crt *ca,\n mbedtls_x509_crl *crl_list,\n const mbedtls_x509_crt_profile *profile )\n{\n int flags = 0;\n unsigned char hash[MBEDTLS_MD_MAX_SIZE];\n const mbedtls_md_info_t *md_info;", " if( ca == NULL )\n return( flags );", " while( crl_list != NULL )\n {\n if( crl_list->version == 0 ||\n crl_list->issuer_raw.len != ca->subject_raw.len ||\n memcmp( crl_list->issuer_raw.p, ca->subject_raw.p,\n crl_list->issuer_raw.len ) != 0 )\n {\n crl_list = crl_list->next;\n continue;\n }", " /*\n * Check if the CA is configured to sign CRLs\n */\n#if defined(MBEDTLS_X509_CHECK_KEY_USAGE)\n if( mbedtls_x509_crt_check_key_usage( ca, MBEDTLS_X509_KU_CRL_SIGN ) != 0 )\n {\n flags |= MBEDTLS_X509_BADCRL_NOT_TRUSTED;\n break;\n }\n#endif", " /*\n * Check if CRL is correctly signed by the trusted CA\n */\n if( x509_profile_check_md_alg( profile, crl_list->sig_md ) != 0 )\n flags |= MBEDTLS_X509_BADCRL_BAD_MD;", " if( x509_profile_check_pk_alg( profile, crl_list->sig_pk ) != 0 )\n flags |= MBEDTLS_X509_BADCRL_BAD_PK;", " md_info = mbedtls_md_info_from_type( crl_list->sig_md );\n if( md_info == NULL )\n {\n /*\n * Cannot check 'unknown' hash\n */\n flags |= MBEDTLS_X509_BADCRL_NOT_TRUSTED;\n break;\n }", " mbedtls_md( md_info, crl_list->tbs.p, crl_list->tbs.len, hash );", " if( x509_profile_check_key( profile, crl_list->sig_pk, &ca->pk ) != 0 )\n flags |= MBEDTLS_X509_BADCERT_BAD_KEY;", " if( mbedtls_pk_verify_ext( crl_list->sig_pk, crl_list->sig_opts, &ca->pk,\n crl_list->sig_md, hash, mbedtls_md_get_size( md_info ),\n crl_list->sig.p, crl_list->sig.len ) != 0 )\n {\n flags |= MBEDTLS_X509_BADCRL_NOT_TRUSTED;\n break;\n }", " /*\n * Check for validity of CRL (Do not drop out)\n */\n if( mbedtls_x509_time_is_past( &crl_list->next_update ) )\n flags |= MBEDTLS_X509_BADCRL_EXPIRED;", " if( mbedtls_x509_time_is_future( &crl_list->this_update ) )\n flags |= MBEDTLS_X509_BADCRL_FUTURE;", " /*\n * Check if certificate is revoked\n */\n if( mbedtls_x509_crt_is_revoked( crt, crl_list ) )\n {\n flags |= MBEDTLS_X509_BADCERT_REVOKED;\n break;\n }", " crl_list = crl_list->next;\n }", " return( flags );\n}\n#endif /* MBEDTLS_X509_CRL_PARSE_C */", "/*\n * Like memcmp, but case-insensitive and always returns -1 if different\n */\nstatic int x509_memcasecmp( const void *s1, const void *s2, size_t len )\n{\n size_t i;\n unsigned char diff;\n const unsigned char *n1 = s1, *n2 = s2;", " for( i = 0; i < len; i++ )\n {\n diff = n1[i] ^ n2[i];", " if( diff == 0 )\n continue;", " if( diff == 32 &&\n ( ( n1[i] >= 'a' && n1[i] <= 'z' ) ||\n ( n1[i] >= 'A' && n1[i] <= 'Z' ) ) )\n {\n continue;\n }", " return( -1 );\n }", " return( 0 );\n}", "/*\n * Return 0 if name matches wildcard, -1 otherwise\n */\nstatic int x509_check_wildcard( const char *cn, mbedtls_x509_buf *name )\n{\n size_t i;\n size_t cn_idx = 0, cn_len = strlen( cn );", " if( name->len < 3 || name->p[0] != '*' || name->p[1] != '.' )\n return( 0 );", " for( i = 0; i < cn_len; ++i )\n {\n if( cn[i] == '.' )\n {\n cn_idx = i;\n break;\n }\n }", " if( cn_idx == 0 )\n return( -1 );", " if( cn_len - cn_idx == name->len - 1 &&\n x509_memcasecmp( name->p + 1, cn + cn_idx, name->len - 1 ) == 0 )\n {\n return( 0 );\n }", " return( -1 );\n}", "/*\n * Compare two X.509 strings, case-insensitive, and allowing for some encoding\n * variations (but not all).\n *\n * Return 0 if equal, -1 otherwise.\n */\nstatic int x509_string_cmp( const mbedtls_x509_buf *a, const mbedtls_x509_buf *b )\n{\n if( a->tag == b->tag &&\n a->len == b->len &&\n memcmp( a->p, b->p, b->len ) == 0 )\n {\n return( 0 );\n }", " if( ( a->tag == MBEDTLS_ASN1_UTF8_STRING || a->tag == MBEDTLS_ASN1_PRINTABLE_STRING ) &&\n ( b->tag == MBEDTLS_ASN1_UTF8_STRING || b->tag == MBEDTLS_ASN1_PRINTABLE_STRING ) &&\n a->len == b->len &&\n x509_memcasecmp( a->p, b->p, b->len ) == 0 )\n {\n return( 0 );\n }", " return( -1 );\n}", "/*\n * Compare two X.509 Names (aka rdnSequence).\n *\n * See RFC 5280 section 7.1, though we don't implement the whole algorithm:\n * we sometimes return unequal when the full algorithm would return equal,\n * but never the other way. (In particular, we don't do Unicode normalisation\n * or space folding.)\n *\n * Return 0 if equal, -1 otherwise.\n */\nstatic int x509_name_cmp( const mbedtls_x509_name *a, const mbedtls_x509_name *b )\n{\n /* Avoid recursion, it might not be optimised by the compiler */\n while( a != NULL || b != NULL )\n {\n if( a == NULL || b == NULL )\n return( -1 );", " /* type */\n if( a->oid.tag != b->oid.tag ||\n a->oid.len != b->oid.len ||\n memcmp( a->oid.p, b->oid.p, b->oid.len ) != 0 )\n {\n return( -1 );\n }", " /* value */\n if( x509_string_cmp( &a->val, &b->val ) != 0 )\n return( -1 );", " /* structure of the list of sets */\n if( a->next_merged != b->next_merged )\n return( -1 );", " a = a->next;\n b = b->next;\n }", " /* a == NULL == b */\n return( 0 );\n}", "/*\n * Check if 'parent' is a suitable parent (signing CA) for 'child'.\n * Return 0 if yes, -1 if not.\n *\n * top means parent is a locally-trusted certificate\n * bottom means child is the end entity cert\n */\nstatic int x509_crt_check_parent( const mbedtls_x509_crt *child,\n const mbedtls_x509_crt *parent,\n int top, int bottom )\n{\n int need_ca_bit;", " /* Parent must be the issuer */\n if( x509_name_cmp( &child->issuer, &parent->subject ) != 0 )\n return( -1 );", " /* Parent must have the basicConstraints CA bit set as a general rule */\n need_ca_bit = 1;", " /* Exception: v1/v2 certificates that are locally trusted. */\n if( top && parent->version < 3 )\n need_ca_bit = 0;", " /* Exception: self-signed end-entity certs that are locally trusted. */\n if( top && bottom &&\n child->raw.len == parent->raw.len &&\n memcmp( child->raw.p, parent->raw.p, child->raw.len ) == 0 )\n {\n need_ca_bit = 0;\n }", " if( need_ca_bit && ! parent->ca_istrue )\n return( -1 );", "#if defined(MBEDTLS_X509_CHECK_KEY_USAGE)\n if( need_ca_bit &&\n mbedtls_x509_crt_check_key_usage( parent, MBEDTLS_X509_KU_KEY_CERT_SIGN ) != 0 )\n {\n return( -1 );\n }\n#endif", " return( 0 );\n}", "static int x509_crt_verify_top(\n mbedtls_x509_crt *child, mbedtls_x509_crt *trust_ca,\n mbedtls_x509_crl *ca_crl,\n const mbedtls_x509_crt_profile *profile,\n int path_cnt, int self_cnt, uint32_t *flags,\n int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),\n void *p_vrfy )\n{\n int ret;\n uint32_t ca_flags = 0;\n int check_path_cnt;\n unsigned char hash[MBEDTLS_MD_MAX_SIZE];\n const mbedtls_md_info_t *md_info;\n mbedtls_x509_crt *future_past_ca = NULL;", " if( mbedtls_x509_time_is_past( &child->valid_to ) )\n *flags |= MBEDTLS_X509_BADCERT_EXPIRED;", " if( mbedtls_x509_time_is_future( &child->valid_from ) )\n *flags |= MBEDTLS_X509_BADCERT_FUTURE;", " if( x509_profile_check_md_alg( profile, child->sig_md ) != 0 )\n *flags |= MBEDTLS_X509_BADCERT_BAD_MD;", " if( x509_profile_check_pk_alg( profile, child->sig_pk ) != 0 )\n *flags |= MBEDTLS_X509_BADCERT_BAD_PK;", " /*\n * Child is the top of the chain. Check against the trust_ca list.\n */\n *flags |= MBEDTLS_X509_BADCERT_NOT_TRUSTED;", " md_info = mbedtls_md_info_from_type( child->sig_md );\n if( md_info == NULL )\n {\n /*\n * Cannot check 'unknown', no need to try any CA\n */\n trust_ca = NULL;\n }\n else\n mbedtls_md( md_info, child->tbs.p, child->tbs.len, hash );", " for( /* trust_ca */ ; trust_ca != NULL; trust_ca = trust_ca->next )\n {\n if( x509_crt_check_parent( child, trust_ca, 1, path_cnt == 0 ) != 0 )\n continue;", " check_path_cnt = path_cnt + 1;", " /*\n * Reduce check_path_cnt to check against if top of the chain is\n * the same as the trusted CA\n */\n if( child->subject_raw.len == trust_ca->subject_raw.len &&\n memcmp( child->subject_raw.p, trust_ca->subject_raw.p,\n child->issuer_raw.len ) == 0 )\n {\n check_path_cnt--;\n }", " /* Self signed certificates do not count towards the limit */\n if( trust_ca->max_pathlen > 0 &&\n trust_ca->max_pathlen < check_path_cnt - self_cnt )\n {\n continue;\n }", " if( mbedtls_pk_verify_ext( child->sig_pk, child->sig_opts, &trust_ca->pk,\n child->sig_md, hash, mbedtls_md_get_size( md_info ),\n child->sig.p, child->sig.len ) != 0 )\n {\n continue;\n }", " if( mbedtls_x509_time_is_past( &trust_ca->valid_to ) ||\n mbedtls_x509_time_is_future( &trust_ca->valid_from ) )\n {\n if ( future_past_ca == NULL )\n future_past_ca = trust_ca;", " continue;\n }", " break;\n }", " if( trust_ca != NULL || ( trust_ca = future_past_ca ) != NULL )\n {\n /*\n * Top of chain is signed by a trusted CA\n */\n *flags &= ~MBEDTLS_X509_BADCERT_NOT_TRUSTED;", " if( x509_profile_check_key( profile, child->sig_pk, &trust_ca->pk ) != 0 )\n *flags |= MBEDTLS_X509_BADCERT_BAD_KEY;\n }", " /*\n * If top of chain is not the same as the trusted CA send a verify request\n * to the callback for any issues with validity and CRL presence for the\n * trusted CA certificate.\n */\n if( trust_ca != NULL &&\n ( child->subject_raw.len != trust_ca->subject_raw.len ||\n memcmp( child->subject_raw.p, trust_ca->subject_raw.p,\n child->issuer_raw.len ) != 0 ) )\n {\n#if defined(MBEDTLS_X509_CRL_PARSE_C)\n /* Check trusted CA's CRL for the chain's top crt */\n *flags |= x509_crt_verifycrl( child, trust_ca, ca_crl, profile );\n#else\n ((void) ca_crl);\n#endif", " if( mbedtls_x509_time_is_past( &trust_ca->valid_to ) )\n ca_flags |= MBEDTLS_X509_BADCERT_EXPIRED;", " if( mbedtls_x509_time_is_future( &trust_ca->valid_from ) )\n ca_flags |= MBEDTLS_X509_BADCERT_FUTURE;", " if( NULL != f_vrfy )\n {\n if( ( ret = f_vrfy( p_vrfy, trust_ca, path_cnt + 1,\n &ca_flags ) ) != 0 )\n {\n return( ret );\n }\n }\n }", " /* Call callback on top cert */\n if( NULL != f_vrfy )\n {\n if( ( ret = f_vrfy( p_vrfy, child, path_cnt, flags ) ) != 0 )\n return( ret );\n }", " *flags |= ca_flags;", " return( 0 );\n}", "static int x509_crt_verify_child(\n mbedtls_x509_crt *child, mbedtls_x509_crt *parent,\n mbedtls_x509_crt *trust_ca, mbedtls_x509_crl *ca_crl,\n const mbedtls_x509_crt_profile *profile,\n int path_cnt, int self_cnt, uint32_t *flags,\n int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),\n void *p_vrfy )\n{\n int ret;\n uint32_t parent_flags = 0;\n unsigned char hash[MBEDTLS_MD_MAX_SIZE];\n mbedtls_x509_crt *grandparent;\n const mbedtls_md_info_t *md_info;", " /* Counting intermediate self signed certificates */\n if( ( path_cnt != 0 ) && x509_name_cmp( &child->issuer, &child->subject ) == 0 )\n self_cnt++;", " /* path_cnt is 0 for the first intermediate CA */\n if( 1 + path_cnt > MBEDTLS_X509_MAX_INTERMEDIATE_CA )\n {", " /* return immediately as the goal is to avoid unbounded recursion */\n return( MBEDTLS_ERR_X509_FATAL_ERROR );", " }", " if( mbedtls_x509_time_is_past( &child->valid_to ) )\n *flags |= MBEDTLS_X509_BADCERT_EXPIRED;", " if( mbedtls_x509_time_is_future( &child->valid_from ) )\n *flags |= MBEDTLS_X509_BADCERT_FUTURE;", " if( x509_profile_check_md_alg( profile, child->sig_md ) != 0 )\n *flags |= MBEDTLS_X509_BADCERT_BAD_MD;", " if( x509_profile_check_pk_alg( profile, child->sig_pk ) != 0 )\n *flags |= MBEDTLS_X509_BADCERT_BAD_PK;", " md_info = mbedtls_md_info_from_type( child->sig_md );\n if( md_info == NULL )\n {\n /*\n * Cannot check 'unknown' hash\n */\n *flags |= MBEDTLS_X509_BADCERT_NOT_TRUSTED;\n }\n else\n {\n mbedtls_md( md_info, child->tbs.p, child->tbs.len, hash );", " if( x509_profile_check_key( profile, child->sig_pk, &parent->pk ) != 0 )\n *flags |= MBEDTLS_X509_BADCERT_BAD_KEY;", " if( mbedtls_pk_verify_ext( child->sig_pk, child->sig_opts, &parent->pk,\n child->sig_md, hash, mbedtls_md_get_size( md_info ),\n child->sig.p, child->sig.len ) != 0 )\n {\n *flags |= MBEDTLS_X509_BADCERT_NOT_TRUSTED;\n }\n }", "#if defined(MBEDTLS_X509_CRL_PARSE_C)\n /* Check trusted CA's CRL for the given crt */\n *flags |= x509_crt_verifycrl(child, parent, ca_crl, profile );\n#endif", " /* Look for a grandparent in trusted CAs */\n for( grandparent = trust_ca;\n grandparent != NULL;\n grandparent = grandparent->next )\n {\n if( x509_crt_check_parent( parent, grandparent,\n 0, path_cnt == 0 ) == 0 )\n break;\n }", " if( grandparent != NULL )\n {\n ret = x509_crt_verify_top( parent, grandparent, ca_crl, profile,\n path_cnt + 1, self_cnt, &parent_flags, f_vrfy, p_vrfy );\n if( ret != 0 )\n return( ret );\n }\n else\n {\n /* Look for a grandparent upwards the chain */\n for( grandparent = parent->next;\n grandparent != NULL;\n grandparent = grandparent->next )\n {\n /* +2 because the current step is not yet accounted for\n * and because max_pathlen is one higher than it should be.\n * Also self signed certificates do not count to the limit. */\n if( grandparent->max_pathlen > 0 &&\n grandparent->max_pathlen < 2 + path_cnt - self_cnt )\n {\n continue;\n }", " if( x509_crt_check_parent( parent, grandparent,\n 0, path_cnt == 0 ) == 0 )\n break;\n }", " /* Is our parent part of the chain or at the top? */\n if( grandparent != NULL )\n {\n ret = x509_crt_verify_child( parent, grandparent, trust_ca, ca_crl,\n profile, path_cnt + 1, self_cnt, &parent_flags,\n f_vrfy, p_vrfy );\n if( ret != 0 )\n return( ret );\n }\n else\n {\n ret = x509_crt_verify_top( parent, trust_ca, ca_crl, profile,\n path_cnt + 1, self_cnt, &parent_flags,\n f_vrfy, p_vrfy );\n if( ret != 0 )\n return( ret );\n }\n }", " /* child is verified to be a child of the parent, call verify callback */\n if( NULL != f_vrfy )\n if( ( ret = f_vrfy( p_vrfy, child, path_cnt, flags ) ) != 0 )\n return( ret );", " *flags |= parent_flags;", " return( 0 );\n}", "/*\n * Verify the certificate validity\n */\nint mbedtls_x509_crt_verify( mbedtls_x509_crt *crt,\n mbedtls_x509_crt *trust_ca,\n mbedtls_x509_crl *ca_crl,\n const char *cn, uint32_t *flags,\n int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),\n void *p_vrfy )\n{\n return( mbedtls_x509_crt_verify_with_profile( crt, trust_ca, ca_crl,\n &mbedtls_x509_crt_profile_default, cn, flags, f_vrfy, p_vrfy ) );\n}", "\n/*\n * Verify the certificate validity, with profile\n */\nint mbedtls_x509_crt_verify_with_profile( mbedtls_x509_crt *crt,\n mbedtls_x509_crt *trust_ca,\n mbedtls_x509_crl *ca_crl,\n const mbedtls_x509_crt_profile *profile,\n const char *cn, uint32_t *flags,\n int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),\n void *p_vrfy )\n{\n size_t cn_len;\n int ret;\n int pathlen = 0, selfsigned = 0;\n mbedtls_x509_crt *parent;\n mbedtls_x509_name *name;\n mbedtls_x509_sequence *cur = NULL;\n mbedtls_pk_type_t pk_type;", " *flags = 0;", " if( profile == NULL )\n {\n ret = MBEDTLS_ERR_X509_BAD_INPUT_DATA;\n goto exit;\n }", " if( cn != NULL )\n {\n name = &crt->subject;\n cn_len = strlen( cn );", " if( crt->ext_types & MBEDTLS_X509_EXT_SUBJECT_ALT_NAME )\n {\n cur = &crt->subject_alt_names;", " while( cur != NULL )\n {\n if( cur->buf.len == cn_len &&\n x509_memcasecmp( cn, cur->buf.p, cn_len ) == 0 )\n break;", " if( cur->buf.len > 2 &&\n memcmp( cur->buf.p, \"*.\", 2 ) == 0 &&\n x509_check_wildcard( cn, &cur->buf ) == 0 )\n {\n break;\n }", " cur = cur->next;\n }", " if( cur == NULL )\n *flags |= MBEDTLS_X509_BADCERT_CN_MISMATCH;\n }\n else\n {\n while( name != NULL )\n {\n if( MBEDTLS_OID_CMP( MBEDTLS_OID_AT_CN, &name->oid ) == 0 )\n {\n if( name->val.len == cn_len &&\n x509_memcasecmp( name->val.p, cn, cn_len ) == 0 )\n break;", " if( name->val.len > 2 &&\n memcmp( name->val.p, \"*.\", 2 ) == 0 &&\n x509_check_wildcard( cn, &name->val ) == 0 )\n break;\n }", " name = name->next;\n }", " if( name == NULL )\n *flags |= MBEDTLS_X509_BADCERT_CN_MISMATCH;\n }\n }", " /* Check the type and size of the key */\n pk_type = mbedtls_pk_get_type( &crt->pk );", " if( x509_profile_check_pk_alg( profile, pk_type ) != 0 )\n *flags |= MBEDTLS_X509_BADCERT_BAD_PK;", " if( x509_profile_check_key( profile, pk_type, &crt->pk ) != 0 )\n *flags |= MBEDTLS_X509_BADCERT_BAD_KEY;", " /* Look for a parent in trusted CAs */\n for( parent = trust_ca; parent != NULL; parent = parent->next )\n {\n if( x509_crt_check_parent( crt, parent, 0, pathlen == 0 ) == 0 )\n break;\n }", " if( parent != NULL )\n {\n ret = x509_crt_verify_top( crt, parent, ca_crl, profile,\n pathlen, selfsigned, flags, f_vrfy, p_vrfy );\n if( ret != 0 )\n goto exit;\n }\n else\n {\n /* Look for a parent upwards the chain */\n for( parent = crt->next; parent != NULL; parent = parent->next )\n if( x509_crt_check_parent( crt, parent, 0, pathlen == 0 ) == 0 )\n break;", " /* Are we part of the chain or at the top? */\n if( parent != NULL )\n {\n ret = x509_crt_verify_child( crt, parent, trust_ca, ca_crl, profile,\n pathlen, selfsigned, flags, f_vrfy, p_vrfy );\n if( ret != 0 )\n goto exit;\n }\n else\n {\n ret = x509_crt_verify_top( crt, trust_ca, ca_crl, profile,\n pathlen, selfsigned, flags, f_vrfy, p_vrfy );\n if( ret != 0 )\n goto exit;\n }\n }", "exit:", " /* prevent misuse of the vrfy callback */\n if( ret == MBEDTLS_ERR_X509_CERT_VERIFY_FAILED )\n ret = MBEDTLS_ERR_X509_FATAL_ERROR;\n", " if( ret != 0 )\n {\n *flags = (uint32_t) -1;\n return( ret );\n }", " if( *flags != 0 )\n return( MBEDTLS_ERR_X509_CERT_VERIFY_FAILED );", " return( 0 );\n}", "/*\n * Initialize a certificate chain\n */\nvoid mbedtls_x509_crt_init( mbedtls_x509_crt *crt )\n{\n memset( crt, 0, sizeof(mbedtls_x509_crt) );\n}", "/*\n * Unallocate all certificate data\n */\nvoid mbedtls_x509_crt_free( mbedtls_x509_crt *crt )\n{\n mbedtls_x509_crt *cert_cur = crt;\n mbedtls_x509_crt *cert_prv;\n mbedtls_x509_name *name_cur;\n mbedtls_x509_name *name_prv;\n mbedtls_x509_sequence *seq_cur;\n mbedtls_x509_sequence *seq_prv;", " if( crt == NULL )\n return;", " do\n {\n mbedtls_pk_free( &cert_cur->pk );", "#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT)\n mbedtls_free( cert_cur->sig_opts );\n#endif", " name_cur = cert_cur->issuer.next;\n while( name_cur != NULL )\n {\n name_prv = name_cur;\n name_cur = name_cur->next;\n mbedtls_zeroize( name_prv, sizeof( mbedtls_x509_name ) );\n mbedtls_free( name_prv );\n }", " name_cur = cert_cur->subject.next;\n while( name_cur != NULL )\n {\n name_prv = name_cur;\n name_cur = name_cur->next;\n mbedtls_zeroize( name_prv, sizeof( mbedtls_x509_name ) );\n mbedtls_free( name_prv );\n }", " seq_cur = cert_cur->ext_key_usage.next;\n while( seq_cur != NULL )\n {\n seq_prv = seq_cur;\n seq_cur = seq_cur->next;\n mbedtls_zeroize( seq_prv, sizeof( mbedtls_x509_sequence ) );\n mbedtls_free( seq_prv );\n }", " seq_cur = cert_cur->subject_alt_names.next;\n while( seq_cur != NULL )\n {\n seq_prv = seq_cur;\n seq_cur = seq_cur->next;\n mbedtls_zeroize( seq_prv, sizeof( mbedtls_x509_sequence ) );\n mbedtls_free( seq_prv );\n }", " if( cert_cur->raw.p != NULL )\n {\n mbedtls_zeroize( cert_cur->raw.p, cert_cur->raw.len );\n mbedtls_free( cert_cur->raw.p );\n }", " cert_cur = cert_cur->next;\n }\n while( cert_cur != NULL );", " cert_cur = crt;\n do\n {\n cert_prv = cert_cur;\n cert_cur = cert_cur->next;", " mbedtls_zeroize( cert_prv, sizeof( mbedtls_x509_crt ) );\n if( cert_prv != crt )\n mbedtls_free( cert_prv );\n }\n while( cert_cur != NULL );\n}", "#endif /* MBEDTLS_X509_CRT_PARSE_C */" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [8, 75, 1056, 78, 271, 482, 2312, 1208], "buggy_code_start_loc": [8, 74, 1055, 78, 270, 482, 2060, 1207], "filenames": ["ChangeLog", "include/mbedtls/error.h", "include/mbedtls/ssl.h", "include/mbedtls/x509.h", "include/mbedtls/x509_crt.h", "library/error.c", "library/x509_crt.c", "tests/suites/test_suite_x509parse.data"], "fixing_code_end_loc": [12, 75, 1056, 80, 277, 485, 2317, 1208], "fixing_code_start_loc": [9, 74, 1055, 79, 270, 483, 2060, 1207], "message": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.10:*:*:*:*:*:*:*", "matchCriteriaId": "28621156-2430-447B-8816-47B0FB58245B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.11:*:*:*:*:*:*:*", "matchCriteriaId": "E11BBB2C-0423-47B1-AE12-EB849E17BAF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.12:*:*:*:*:*:*:*", "matchCriteriaId": "4131CE76-6260-412C-A6A6-20B0E978E569", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.13:*:*:*:*:*:*:*", "matchCriteriaId": "DE92D8F7-5705-47B6-B2C2-9DE6C7880647", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.14:*:*:*:*:*:*:*", "matchCriteriaId": "EA50C256-2054-4661-9C42-D31D7D87BAF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.15:*:*:*:*:*:*:*", "matchCriteriaId": "7791D4E9-3FEE-42DA-B320-CF7188A10294", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.16:*:*:*:*:*:*:*", "matchCriteriaId": "BE415DAA-A89F-4204-AC2C-577FCB447E4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.17:*:*:*:*:*:*:*", "matchCriteriaId": "95F691DB-9552-4EBB-B29D-16658561FA4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.18:*:*:*:*:*:*:*", "matchCriteriaId": "F1547B2A-E0D5-41D1-9449-1CCF35022B0E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.19:*:*:*:*:*:*:*", "matchCriteriaId": "CF762122-64BC-4A1A-A26D-81C1270541A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.20:*:*:*:*:*:*:*", "matchCriteriaId": "59D6B559-5F99-4E38-A861-3AB8A7D2E6BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.21:*:*:*:*:*:*:*", "matchCriteriaId": "4A8956C8-6CF0-4C37-84F9-8A89726806C3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "0B395D81-876F-43FC-8DB9-44377647A37A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F92622F1-82DA-4819-8275-06DC9DBE1BA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5871FDE9-02D0-466C-BDB7-90A14C4F637E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE6B4875-3FC3-499F-A76B-2D04982F743A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "B3B67842-5AFA-459F-9CCF-772B9DC7139F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "AD0500EE-52C0-4896-B3D8-5BE731D66039", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "015739E9-C0E3-4A62-BB9D-FA836BFD4351", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "842B0D15-6A3D-4CEE-AD02-49B0436E78E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "3CF6E05C-E6E5-40B8-AFEA-A5ED937F5439", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "D4133C86-70E0-44FD-BBDB-D61EFB31F027", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "6F9D24F0-3892-417F-9C3A-CACEF00C2293", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "8911513E-968C-403E-9D00-2DC0AA82F99B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "48D98945-82BB-4954-AA6D-7D98E4CE1154", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "6378C1CC-7C8F-47E3-A1A7-CDEC76E4CBE4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "525190A3-2194-4E4E-9D34-0048583B9C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "70407352-624A-40E6-82E4-7B4FAFE0C0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "DD52988E-4B2F-41AF-BC25-F38F87D9B8C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "FD1F7803-31F3-40A9-A878-FDC757FCE83F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected."}, {"lang": "es", "value": "ARM mbed TLS en versiones anteriores a la 1.3.21 y en versiones 2.x anteriores a la 2.1.9, si se configura la autenticaci\u00f3n opcional, permite a los atacantes omitir la autenticaci\u00f3n Peer mediante una cadena de certificados X.509 con muchos intermediarios. NOTA: aunque mbed TLS se conoc\u00eda antes como PolarSSL, las versiones lanzadas con el nombre PolarSSL no est\u00e1n afectadas."}], "evaluatorComment": null, "id": "CVE-2017-14032", "lastModified": "2017-11-08T02:29:02.850", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-08-30T20:29:00.337", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.debian.org/security/2017/dsa-3967"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugs.debian.org/873557"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/d15795acd5074e0b44e71f7ede8bdfe1b48591fc"}, {"source": "cve@mitre.org", "tags": ["Vendor Advisory"], "url": "https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2017-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, "type": "CWE-287"}
351
Determine whether the {function_name} code is vulnerable or not.
[ "X509 Certificate information #1\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/server1.crt\":\"cert. version \\: 3\\nserial number \\: 01\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nissued on \\: 2011-02-12 14\\:44\\:06\\nexpires on \\: 2021-02-12 14\\:44\\:06\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information #2\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/server2.crt\":\"cert. version \\: 3\\nserial number \\: 02\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2011-02-12 14\\:44\\:06\\nexpires on \\: 2021-02-12 14\\:44\\:06\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information #3\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/test-ca.crt\":\"cert. version \\: 3\\nserial number \\: 00\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nissued on \\: 2011-02-12 14\\:44\\:00\\nexpires on \\: 2021-02-12 14\\:44\\:00\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=true\\n\"", "X509 Certificate information MD2 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509_cert_info:\"data_files/cert_md2.crt\":\"cert. version \\: 3\\nserial number \\: 09\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Cert MD2\\nissued on \\: 2009-07-12 10\\:56\\:59\\nexpires on \\: 2011-07-12 10\\:56\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information MD4 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_MD4_C\nx509_cert_info:\"data_files/cert_md4.crt\":\"cert. version \\: 3\\nserial number \\: 05\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Cert MD4\\nissued on \\: 2011-02-12 14\\:44\\:07\\nexpires on \\: 2021-02-12 14\\:44\\:07\\nsigned using \\: RSA with MD4\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information MD5 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_MD5_C\nx509_cert_info:\"data_files/cert_md5.crt\":\"cert. version \\: 3\\nserial number \\: 06\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Cert MD5\\nissued on \\: 2011-02-12 14\\:44\\:07\\nexpires on \\: 2021-02-12 14\\:44\\:07\\nsigned using \\: RSA with MD5\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information SHA1 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/cert_sha1.crt\":\"cert. version \\: 3\\nserial number \\: 07\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Cert SHA1\\nissued on \\: 2011-02-12 14\\:44\\:07\\nexpires on \\: 2021-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information SHA224 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_cert_info:\"data_files/cert_sha224.crt\":\"cert. version \\: 3\\nserial number \\: 08\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Cert SHA224\\nissued on \\: 2011-02-12 14\\:44\\:07\\nexpires on \\: 2021-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA-224\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information SHA256 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_cert_info:\"data_files/cert_sha256.crt\":\"cert. version \\: 3\\nserial number \\: 09\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Cert SHA256\\nissued on \\: 2011-02-12 14\\:44\\:07\\nexpires on \\: 2021-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA-256\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information SHA384 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA512_C\nx509_cert_info:\"data_files/cert_sha384.crt\":\"cert. version \\: 3\\nserial number \\: 0A\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Cert SHA384\\nissued on \\: 2011-02-12 14\\:44\\:07\\nexpires on \\: 2021-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA-384\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information SHA512 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA512_C\nx509_cert_info:\"data_files/cert_sha512.crt\":\"cert. version \\: 3\\nserial number \\: 0B\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Cert SHA512\\nissued on \\: 2011-02-12 14\\:44\\:07\\nexpires on \\: 2021-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA-512\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information RSA-PSS, SHA1 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/server9.crt\":\"cert. version \\: 3\\nserial number \\: 16\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2014-01-20 13\\:38\\:16\\nexpires on \\: 2024-01-18 13\\:38\\:16\\nsigned using \\: RSASSA-PSS (SHA1, MGF1-SHA1, 0xEA)\\nRSA key size \\: 1024 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information RSA-PSS, SHA224 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C\nx509_cert_info:\"data_files/server9-sha224.crt\":\"cert. version \\: 3\\nserial number \\: 17\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2014-01-20 13\\:57\\:36\\nexpires on \\: 2024-01-18 13\\:57\\:36\\nsigned using \\: RSASSA-PSS (SHA224, MGF1-SHA224, 0xE2)\\nRSA key size \\: 1024 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information RSA-PSS, SHA256 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C\nx509_cert_info:\"data_files/server9-sha256.crt\":\"cert. version \\: 3\\nserial number \\: 18\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2014-01-20 13\\:57\\:45\\nexpires on \\: 2024-01-18 13\\:57\\:45\\nsigned using \\: RSASSA-PSS (SHA256, MGF1-SHA256, 0xDE)\\nRSA key size \\: 1024 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information RSA-PSS, SHA384 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C\nx509_cert_info:\"data_files/server9-sha384.crt\":\"cert. version \\: 3\\nserial number \\: 19\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2014-01-20 13\\:57\\:58\\nexpires on \\: 2024-01-18 13\\:57\\:58\\nsigned using \\: RSASSA-PSS (SHA384, MGF1-SHA384, 0xCE)\\nRSA key size \\: 1024 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information RSA-PSS, SHA512 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C\nx509_cert_info:\"data_files/server9-sha512.crt\":\"cert. version \\: 3\\nserial number \\: 1A\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2014-01-20 13\\:58\\:12\\nexpires on \\: 2024-01-18 13\\:58\\:12\\nsigned using \\: RSASSA-PSS (SHA512, MGF1-SHA512, 0xBE)\\nRSA key size \\: 1024 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information EC, SHA1 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/server5-sha1.crt\":\"cert. version \\: 3\\nserial number \\: 12\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2013-09-24 16\\:21\\:27\\nexpires on \\: 2023-09-22 16\\:21\\:27\\nsigned using \\: ECDSA with SHA1\\nEC key size \\: 256 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information EC, SHA224 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_cert_info:\"data_files/server5-sha224.crt\":\"cert. version \\: 3\\nserial number \\: 13\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2013-09-24 16\\:21\\:27\\nexpires on \\: 2023-09-22 16\\:21\\:27\\nsigned using \\: ECDSA with SHA224\\nEC key size \\: 256 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information EC, SHA256 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_cert_info:\"data_files/server5.crt\":\"cert. version \\: 3\\nserial number \\: 09\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2013-09-24 15\\:52\\:04\\nexpires on \\: 2023-09-22 15\\:52\\:04\\nsigned using \\: ECDSA with SHA256\\nEC key size \\: 256 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information EC, SHA384 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA512_C\nx509_cert_info:\"data_files/server5-sha384.crt\":\"cert. version \\: 3\\nserial number \\: 14\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2013-09-24 16\\:21\\:27\\nexpires on \\: 2023-09-22 16\\:21\\:27\\nsigned using \\: ECDSA with SHA384\\nEC key size \\: 256 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information EC, SHA512 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA512_C\nx509_cert_info:\"data_files/server5-sha512.crt\":\"cert. version \\: 3\\nserial number \\: 15\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2013-09-24 16\\:21\\:27\\nexpires on \\: 2023-09-22 16\\:21\\:27\\nsigned using \\: ECDSA with SHA512\\nEC key size \\: 256 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information, NS Cert Type\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/server1.cert_type.crt\":\"cert. version \\: 3\\nserial number \\: 01\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nissued on \\: 2011-02-12 14\\:44\\:06\\nexpires on \\: 2021-02-12 14\\:44\\:06\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\ncert. type \\: SSL Server\\n\"", "X509 Certificate information, Key Usage\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/server1.key_usage.crt\":\"cert. version \\: 3\\nserial number \\: 01\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nissued on \\: 2011-02-12 14\\:44\\:06\\nexpires on \\: 2021-02-12 14\\:44\\:06\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\nkey usage \\: Digital Signature, Non Repudiation, Key Encipherment\\n\"", "X509 Certificate information, Key Usage with decipherOnly\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/keyUsage.decipherOnly.crt\":\"cert. version \\: 3\\nserial number \\: 9B\\:13\\:CE\\:4C\\:A5\\:6F\\:DE\\:52\\nissuer name \\: C=GB, L=Cambridge, O=Default Company Ltd\\nsubject name \\: C=GB, L=Cambridge, O=Default Company Ltd\\nissued on \\: 2015-05-12 10\\:36\\:55\\nexpires on \\: 2018-05-11 10\\:36\\:55\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 1024 bits\\nbasic constraints \\: CA=false\\nkey usage \\: Digital Signature, Non Repudiation, Key Encipherment, Decipher Only\\n\"", "X509 Certificate information, Subject Alt Name\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/cert_example_multi.crt\":\"cert. version \\: 3\\nserial number \\: 11\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=www.example.com\\nissued on \\: 2012-05-10 13\\:23\\:41\\nexpires on \\: 2022-05-11 13\\:23\\:41\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\nsubject alt name \\: example.com, example.net, *.example.org\\n\"", "X509 Certificate information, Subject Alt Name + Key Usage\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/cert_example_multi_nocn.crt\":\"cert. version \\: 3\\nserial number \\: F7\\:C6\\:7F\\:F8\\:E9\\:A9\\:63\\:F9\\nissuer name \\: C=NL\\nsubject name \\: C=NL\\nissued on \\: 2014-01-22 10\\:04\\:33\\nexpires on \\: 2024-01-22 10\\:04\\:33\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 1024 bits\\nbasic constraints \\: CA=false\\nsubject alt name \\: www.shotokan-braunschweig.de, www.massimo-abate.eu\\nkey usage \\: Digital Signature, Non Repudiation, Key Encipherment\\n\"", "X509 Certificate information, Key Usage + Extended Key Usage\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_cert_info:\"data_files/server1.ext_ku.crt\":\"cert. version \\: 3\\nserial number \\: 21\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nissued on \\: 2014-04-01 14\\:44\\:43\\nexpires on \\: 2024-03-29 14\\:44\\:43\\nsigned using \\: RSA with SHA-256\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\nkey usage \\: Digital Signature, Non Repudiation, Key Encipherment\\next key usage \\: TLS Web Server Authentication\\n\"", "X509 Certificate information RSA signed by EC\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECDSA_C\nx509_cert_info:\"data_files/server4.crt\":\"cert. version \\: 3\\nserial number \\: 08\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2013-09-24 15\\:52\\:04\\nexpires on \\: 2023-09-22 15\\:52\\:04\\nsigned using \\: ECDSA with SHA256\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information EC signed by RSA\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP192R1_ENABLED:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/server3.crt\":\"cert. version \\: 3\\nserial number \\: 0D\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2013-08-09 09\\:17\\:03\\nexpires on \\: 2023-08-07 09\\:17\\:03\\nsigned using \\: RSA with SHA1\\nEC key size \\: 192 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information Bitstring in subject name\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/bitstring-in-dn.pem\":\"cert. version \\: 3\\nserial number \\: 02\\nissuer name \\: CN=Test CA 01, ST=Ecnivorp, C=XX, emailAddress=tca@example.com, O=Test CA Authority\\nsubject name \\: C=XX, O=tca, ST=Ecnivorp, OU=TCA, CN=Client, emailAddress=client@example.com, serialNumber=7101012255, uniqueIdentifier=?7101012255\\nissued on \\: 2015-03-11 12\\:06\\:51\\nexpires on \\: 2025-03-08 12\\:06\\:51\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\nsubject alt name \\: \\next key usage \\: TLS Web Client Authentication\\n\"", "X509 certificate v1 with extension\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/cert_v1_with_ext.crt\":\"cert. version \\: 1\\nserial number \\: BD\\:ED\\:44\\:C7\\:D2\\:3E\\:C2\\:A4\\nissuer name \\: C=XX, ST=XX, L=XX, O=XX, OU=XX, emailAddress=admin@identity-check.org, CN=identity-check.org\\nsubject name \\: C=XX, ST=XX, L=XX, O=XX, OU=XX, emailAddress=admin@identity-check.org, CN=identity-check.org\\nissued on \\: 2013-07-04 16\\:17\\:02\\nexpires on \\: 2014-07-04 16\\:17\\:02\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nsubject alt name \\: identity-check.org, www.identity-check.org\\n\"", "X509 CRL information #1\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C\nmbedtls_x509_crl_info:\"data_files/crl_expired.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2011-02-20 10\\:24\\:19\\nnext update \\: 2011-02-20 11\\:24\\:19\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2011-02-12 14\\:44\\:07\\nserial number\\: 03 revocation date\\: 2011-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA1\\n\"", "X509 CRL Information MD2 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_MD2_C\nmbedtls_x509_crl_info:\"data_files/crl_md2.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2009-07-19 19\\:56\\:37\\nnext update \\: 2009-09-17 19\\:56\\:37\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2009-02-09 21\\:12\\:36\\nserial number\\: 03 revocation date\\: 2009-02-09 21\\:12\\:36\\nsigned using \\: RSA with MD2\\n\"", "X509 CRL Information MD4 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_MD4_C\nmbedtls_x509_crl_info:\"data_files/crl_md4.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2011-02-12 14\\:44\\:07\\nnext update \\: 2011-04-13 14\\:44\\:07\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2011-02-12 14\\:44\\:07\\nserial number\\: 03 revocation date\\: 2011-02-12 14\\:44\\:07\\nsigned using \\: RSA with MD4\\n\"", "X509 CRL Information MD5 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_MD5_C\nmbedtls_x509_crl_info:\"data_files/crl_md5.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2011-02-12 14\\:44\\:07\\nnext update \\: 2011-04-13 14\\:44\\:07\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2011-02-12 14\\:44\\:07\\nserial number\\: 03 revocation date\\: 2011-02-12 14\\:44\\:07\\nsigned using \\: RSA with MD5\\n\"", "X509 CRL Information SHA1 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C\nmbedtls_x509_crl_info:\"data_files/crl_sha1.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2011-02-12 14\\:44\\:07\\nnext update \\: 2011-04-13 14\\:44\\:07\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2011-02-12 14\\:44\\:07\\nserial number\\: 03 revocation date\\: 2011-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA1\\n\"", "X509 CRL Information SHA224 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C\nmbedtls_x509_crl_info:\"data_files/crl_sha224.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2011-02-12 14\\:44\\:07\\nnext update \\: 2011-04-13 14\\:44\\:07\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2011-02-12 14\\:44\\:07\\nserial number\\: 03 revocation date\\: 2011-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA-224\\n\"", "X509 CRL Information SHA256 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C\nmbedtls_x509_crl_info:\"data_files/crl_sha256.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2011-02-12 14\\:44\\:07\\nnext update \\: 2011-04-13 14\\:44\\:07\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2011-02-12 14\\:44\\:07\\nserial number\\: 03 revocation date\\: 2011-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA-256\\n\"", "X509 CRL Information SHA384 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA512_C\nmbedtls_x509_crl_info:\"data_files/crl_sha384.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2011-02-12 14\\:44\\:07\\nnext update \\: 2011-04-13 14\\:44\\:07\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2011-02-12 14\\:44\\:07\\nserial number\\: 03 revocation date\\: 2011-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA-384\\n\"", "X509 CRL Information SHA512 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA512_C\nmbedtls_x509_crl_info:\"data_files/crl_sha512.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2011-02-12 14\\:44\\:07\\nnext update \\: 2011-04-13 14\\:44\\:07\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2011-02-12 14\\:44\\:07\\nserial number\\: 03 revocation date\\: 2011-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA-512\\n\"", "X509 CRL information RSA-PSS, SHA1 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nmbedtls_x509_crl_info:\"data_files/crl-rsa-pss-sha1.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2014-01-20 13\\:46\\:35\\nnext update \\: 2024-01-18 13\\:46\\:35\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nserial number\\: 16 revocation date\\: 2014-01-20 13\\:43\\:05\\nsigned using \\: RSASSA-PSS (SHA1, MGF1-SHA1, 0xEA)\\n\"", "X509 CRL information RSA-PSS, SHA224 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C\nmbedtls_x509_crl_info:\"data_files/crl-rsa-pss-sha224.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2014-01-20 13\\:56\\:06\\nnext update \\: 2024-01-18 13\\:56\\:06\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nserial number\\: 16 revocation date\\: 2014-01-20 13\\:43\\:05\\nsigned using \\: RSASSA-PSS (SHA224, MGF1-SHA224, 0xE2)\\n\"", "X509 CRL information RSA-PSS, SHA256 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C\nmbedtls_x509_crl_info:\"data_files/crl-rsa-pss-sha256.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2014-01-20 13\\:56\\:16\\nnext update \\: 2024-01-18 13\\:56\\:16\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nserial number\\: 16 revocation date\\: 2014-01-20 13\\:43\\:05\\nsigned using \\: RSASSA-PSS (SHA256, MGF1-SHA256, 0xDE)\\n\"", "X509 CRL information RSA-PSS, SHA384 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C\nmbedtls_x509_crl_info:\"data_files/crl-rsa-pss-sha384.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2014-01-20 13\\:56\\:28\\nnext update \\: 2024-01-18 13\\:56\\:28\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nserial number\\: 16 revocation date\\: 2014-01-20 13\\:43\\:05\\nsigned using \\: RSASSA-PSS (SHA384, MGF1-SHA384, 0xCE)\\n\"", "X509 CRL information RSA-PSS, SHA512 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C\nmbedtls_x509_crl_info:\"data_files/crl-rsa-pss-sha512.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2014-01-20 13\\:56\\:38\\nnext update \\: 2024-01-18 13\\:56\\:38\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nserial number\\: 16 revocation date\\: 2014-01-20 13\\:43\\:05\\nsigned using \\: RSASSA-PSS (SHA512, MGF1-SHA512, 0xBE)\\n\"", "X509 CRL Information EC, SHA1 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C\nmbedtls_x509_crl_info:\"data_files/crl-ec-sha1.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nthis update \\: 2013-09-24 16\\:31\\:08\\nnext update \\: 2023-09-22 16\\:31\\:08\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nsigned using \\: ECDSA with SHA1\\n\"", "X509 CRL Information EC, SHA224 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C\nmbedtls_x509_crl_info:\"data_files/crl-ec-sha224.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nthis update \\: 2013-09-24 16\\:31\\:08\\nnext update \\: 2023-09-22 16\\:31\\:08\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nsigned using \\: ECDSA with SHA224\\n\"", "X509 CRL Information EC, SHA256 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C\nmbedtls_x509_crl_info:\"data_files/crl-ec-sha256.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nthis update \\: 2013-09-24 16\\:31\\:08\\nnext update \\: 2023-09-22 16\\:31\\:08\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nsigned using \\: ECDSA with SHA256\\n\"", "X509 CRL Information EC, SHA384 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA512_C\nmbedtls_x509_crl_info:\"data_files/crl-ec-sha384.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nthis update \\: 2013-09-24 16\\:31\\:08\\nnext update \\: 2023-09-22 16\\:31\\:08\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nsigned using \\: ECDSA with SHA384\\n\"", "X509 CRL Information EC, SHA512 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA512_C\nmbedtls_x509_crl_info:\"data_files/crl-ec-sha512.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nthis update \\: 2013-09-24 16\\:31\\:08\\nnext update \\: 2023-09-22 16\\:31\\:08\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nsigned using \\: ECDSA with SHA512\\n\"", "X509 CRL Malformed Input (trailing spaces at end of file)\ndepends_on:MBEDTLS_PEM_PARSE_C\nmbedtls_x509_crl_parse:\"data_files/crl-malformed-trailing-spaces.pem\":MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT", "X509 CSR Information RSA with MD4\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_MD4_C\nmbedtls_x509_csr_info:\"data_files/server1.req.md4\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nsigned using \\: RSA with MD4\\nRSA key size \\: 2048 bits\\n\"", "X509 CSR Information RSA with MD5\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_MD5_C\nmbedtls_x509_csr_info:\"data_files/server1.req.md5\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nsigned using \\: RSA with MD5\\nRSA key size \\: 2048 bits\\n\"", "X509 CSR Information RSA with SHA1\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C\nmbedtls_x509_csr_info:\"data_files/server1.req.sha1\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\n\"", "X509 CSR Information RSA with SHA224\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C\nmbedtls_x509_csr_info:\"data_files/server1.req.sha224\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nsigned using \\: RSA with SHA-224\\nRSA key size \\: 2048 bits\\n\"", "X509 CSR Information RSA with SHA256\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C\nmbedtls_x509_csr_info:\"data_files/server1.req.sha256\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nsigned using \\: RSA with SHA-256\\nRSA key size \\: 2048 bits\\n\"", "X509 CSR Information RSA with SHA384\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA512_C\nmbedtls_x509_csr_info:\"data_files/server1.req.sha384\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nsigned using \\: RSA with SHA-384\\nRSA key size \\: 2048 bits\\n\"", "X509 CSR Information RSA with SHA512\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA512_C\nmbedtls_x509_csr_info:\"data_files/server1.req.sha512\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nsigned using \\: RSA with SHA-512\\nRSA key size \\: 2048 bits\\n\"", "X509 CSR Information EC with SHA1\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nmbedtls_x509_csr_info:\"data_files/server5.req.sha1\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: ECDSA with SHA1\\nEC key size \\: 256 bits\\n\"", "X509 CSR Information EC with SHA224\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nmbedtls_x509_csr_info:\"data_files/server5.req.sha224\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: ECDSA with SHA224\\nEC key size \\: 256 bits\\n\"", "X509 CSR Information EC with SHA256\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nmbedtls_x509_csr_info:\"data_files/server5.req.sha256\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: ECDSA with SHA256\\nEC key size \\: 256 bits\\n\"", "X509 CSR Information EC with SHA384\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA512_C\nmbedtls_x509_csr_info:\"data_files/server5.req.sha384\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: ECDSA with SHA384\\nEC key size \\: 256 bits\\n\"", "X509 CSR Information EC with SHA512\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA512_C\nmbedtls_x509_csr_info:\"data_files/server5.req.sha512\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: ECDSA with SHA512\\nEC key size \\: 256 bits\\n\"", "X509 CSR Information RSA-PSS with SHA1\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nmbedtls_x509_csr_info:\"data_files/server9.req.sha1\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: RSASSA-PSS (SHA1, MGF1-SHA1, 0x6A)\\nRSA key size \\: 1024 bits\\n\"", "X509 CSR Information RSA-PSS with SHA224\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C\nmbedtls_x509_csr_info:\"data_files/server9.req.sha224\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: RSASSA-PSS (SHA224, MGF1-SHA224, 0x62)\\nRSA key size \\: 1024 bits\\n\"", "X509 CSR Information RSA-PSS with SHA256\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C\nmbedtls_x509_csr_info:\"data_files/server9.req.sha256\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: RSASSA-PSS (SHA256, MGF1-SHA256, 0x5E)\\nRSA key size \\: 1024 bits\\n\"", "X509 CSR Information RSA-PSS with SHA384\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C\nmbedtls_x509_csr_info:\"data_files/server9.req.sha384\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: RSASSA-PSS (SHA384, MGF1-SHA384, 0x4E)\\nRSA key size \\: 1024 bits\\n\"", "X509 CSR Information RSA-PSS with SHA512\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C\nmbedtls_x509_csr_info:\"data_files/server9.req.sha512\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: RSASSA-PSS (SHA512, MGF1-SHA512, 0x3E)\\nRSA key size \\: 1024 bits\\n\"", "X509 Verify Information: empty\nx509_verify_info:0:\"\":\"\"", "X509 Verify Information: one issue\nx509_verify_info:MBEDTLS_X509_BADCERT_MISSING:\"\":\"Certificate was missing\\n\"", "X509 Verify Information: two issues\nx509_verify_info:MBEDTLS_X509_BADCERT_EXPIRED | MBEDTLS_X509_BADCRL_EXPIRED:\"\":\"The certificate validity has expired\\nThe CRL is expired\\n\"", "X509 Verify Information: two issues, one unknown\nx509_verify_info:MBEDTLS_X509_BADCERT_OTHER | 0x80000000:\"\":\"Other reason (can be used by verify callback)\\nUnknown reason (this should not happen)\\n\"", "X509 Verify Information: empty, with prefix\nx509_verify_info:0:\" ! \":\"\"", "X509 Verify Information: one issue, with prefix\nx509_verify_info:MBEDTLS_X509_BADCERT_MISSING:\" ! \":\" ! Certificate was missing\\n\"", "X509 Verify Information: two issues, with prefix\nx509_verify_info:MBEDTLS_X509_BADCERT_EXPIRED | MBEDTLS_X509_BADCRL_EXPIRED:\" ! \":\" ! The certificate validity has expired\\n ! The CRL is expired\\n\"", "X509 Get Distinguished Name #1\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nmbedtls_x509_dn_gets:\"data_files/server1.crt\":\"subject\":\"C=NL, O=PolarSSL, CN=PolarSSL Server 1\"", "X509 Get Distinguished Name #2\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nmbedtls_x509_dn_gets:\"data_files/server1.crt\":\"issuer\":\"C=NL, O=PolarSSL, CN=PolarSSL Test CA\"", "X509 Get Distinguished Name #3\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nmbedtls_x509_dn_gets:\"data_files/server2.crt\":\"subject\":\"C=NL, O=PolarSSL, CN=localhost\"", "X509 Get Distinguished Name #4\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nmbedtls_x509_dn_gets:\"data_files/server2.crt\":\"issuer\":\"C=NL, O=PolarSSL, CN=PolarSSL Test CA\"", "X509 Time Expired #1\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA1_C\nmbedtls_x509_time_is_past:\"data_files/server1.crt\":\"valid_from\":1", "X509 Time Expired #2\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA1_C\nmbedtls_x509_time_is_past:\"data_files/server1.crt\":\"valid_to\":0", "X509 Time Expired #3\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA1_C\nmbedtls_x509_time_is_past:\"data_files/server2.crt\":\"valid_from\":1", "X509 Time Expired #4\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA1_C\nmbedtls_x509_time_is_past:\"data_files/server2.crt\":\"valid_to\":0", "X509 Time Expired #5\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA1_C\nmbedtls_x509_time_is_past:\"data_files/test-ca.crt\":\"valid_from\":1", "X509 Time Expired #6\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA1_C\nmbedtls_x509_time_is_past:\"data_files/test-ca.crt\":\"valid_to\":0", "X509 Time Future #1\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA256_C\nmbedtls_x509_time_is_future:\"data_files/server5.crt\":\"valid_from\":0", "X509 Time Future #2\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA256_C\nmbedtls_x509_time_is_future:\"data_files/server5.crt\":\"valid_to\":1", "X509 Time Future #3\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA256_C\nmbedtls_x509_time_is_future:\"data_files/server5-future.crt\":\"valid_from\":1", "X509 Time Future #4\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA256_C\nmbedtls_x509_time_is_future:\"data_files/server5-future.crt\":\"valid_to\":1", "X509 Time Future #5\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA256_C\nmbedtls_x509_time_is_future:\"data_files/test-ca2.crt\":\"valid_from\":0", "X509 Time Future #6\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA256_C\nmbedtls_x509_time_is_future:\"data_files/test-ca2.crt\":\"valid_to\":1", "X509 Certificate verification #1 (Revoked Cert, Expired CRL, no CN)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/server1.crt\":\"data_files/test-ca.crt\":\"data_files/crl_expired.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED | MBEDTLS_X509_BADCRL_EXPIRED:\"compat\":\"NULL\"", "X509 Certificate verification #1a (Revoked Cert, Future CRL, no CN)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server6.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-future.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED | MBEDTLS_X509_BADCRL_FUTURE:\"compat\":\"NULL\"", "X509 Certificate verification #2 (Revoked Cert, Expired CRL)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/server1.crt\":\"data_files/test-ca.crt\":\"data_files/crl_expired.pem\":\"PolarSSL Server 1\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED | MBEDTLS_X509_BADCRL_EXPIRED:\"compat\":\"NULL\"", "X509 Certificate verification #2a (Revoked Cert, Future CRL)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server6.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-future.pem\":\"localhost\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED | MBEDTLS_X509_BADCRL_FUTURE:\"compat\":\"NULL\"", "X509 Certificate verification #3 (Revoked Cert, Future CRL, CN Mismatch)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/server1.crt\":\"data_files/test-ca.crt\":\"data_files/crl_expired.pem\":\"PolarSSL Wrong CN\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED | MBEDTLS_X509_BADCRL_EXPIRED | MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #3a (Revoked Cert, Expired CRL, CN Mismatch)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server6.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-future.pem\":\"Wrong CN\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED | MBEDTLS_X509_BADCRL_FUTURE | MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #4 (Valid Cert, Expired CRL)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/server2.crt\":\"data_files/test-ca.crt\":\"data_files/crl_expired.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCRL_EXPIRED:\"compat\":\"NULL\"", "X509 Certificate verification #4a (Revoked Cert, Future CRL)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-future.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCRL_FUTURE:\"compat\":\"NULL\"", "X509 Certificate verification #5 (Revoked Cert)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/server1.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED:\"compat\":\"NULL\"", "X509 Certificate verification #6 (Revoked Cert)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/server1.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"PolarSSL Server 1\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED:\"compat\":\"NULL\"", "X509 Certificate verification #7 (Revoked Cert, CN Mismatch)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/server1.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"PolarSSL Wrong CN\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED | MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #8 (Valid Cert)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #8a (Expired Cert)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server5-expired.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_EXPIRED:\"compat\":\"NULL\"", "X509 Certificate verification #8b (Future Cert)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server5-future.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_FUTURE:\"compat\":\"NULL\"", "X509 Certificate verification #9 (Not trusted Cert)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/server2.crt\":\"data_files/server1.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #10 (Not trusted Cert, Expired CRL)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server2.crt\":\"data_files/server1.crt\":\"data_files/crl_expired.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #12 (Valid Cert MD4 Digest)\ndepends_on:MBEDTLS_MD4_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_md4.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_BAD_MD:\"compat\":\"NULL\"", "X509 Certificate verification #13 (Valid Cert MD5 Digest)\ndepends_on:MBEDTLS_MD5_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_md5.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_BAD_MD:\"compat\":\"NULL\"", "X509 Certificate verification #14 (Valid Cert SHA1 Digest explicitly allowed in profile)\ndepends_on:MBEDTLS_SHA1_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_sha1.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #14 (Valid Cert SHA1 Digest allowed in compile-time default profile)\ndepends_on:MBEDTLS_SHA1_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES\nx509_verify:\"data_files/cert_sha1.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"default\":\"NULL\"", "X509 Certificate verification #14 (Valid Cert SHA1 Digest forbidden in default profile)\ndepends_on:MBEDTLS_SHA1_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:!MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES\nx509_verify:\"data_files/cert_sha1.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCRL_BAD_MD | MBEDTLS_X509_BADCERT_BAD_MD:\"default\":\"NULL\"", "X509 Certificate verification #15 (Valid Cert SHA224 Digest)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_sha224.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #16 (Valid Cert SHA256 Digest)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_sha256.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #17 (Valid Cert SHA384 Digest)\ndepends_on:MBEDTLS_SHA512_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_sha384.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #18 (Valid Cert SHA512 Digest)\ndepends_on:MBEDTLS_SHA512_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_sha512.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #19 (Valid Cert, denying callback)\ndepends_on:MBEDTLS_SHA512_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_sha512.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_OTHER:\"compat\":\"verify_none\"", "X509 Certificate verification #19 (Not trusted Cert, allowing callback)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server2.crt\":\"data_files/server1.crt\":\"data_files/crl_expired.pem\":\"NULL\":0:0:\"compat\":\"verify_all\"", "X509 Certificate verification #21 (domain matching wildcard certificate, case insensitive)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_wildcard.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"mail.ExAmPlE.com\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #22 (domain not matching wildcard certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_wildcard.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"mail.example.net\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #23 (domain not matching wildcard certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_wildcard.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"example.com\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #24 (domain matching CN of multi certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"www.example.com\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #25 (domain matching multi certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"example.net\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #26 (domain not matching multi certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"www.example.net\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #27 (domain not matching multi certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"xample.net\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #27 (domain not matching multi certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"bexample.net\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #28 (domain not matching wildcard in multi certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"example.org\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #29 (domain matching wildcard in multi certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"mail.example.org\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #30 (domain matching multi certificate without CN)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi_nocn.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"www.shotokan-braunschweig.de\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #31 (domain not matching multi certificate without CN)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi_nocn.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"www.example.net\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH + MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #32 (Valid, EC cert, RSA CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP192R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server3.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #33 (Valid, RSA cert, EC CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_ECP_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server4.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #34 (Valid, EC cert, EC CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #35 (Revoked, EC CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server6.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED:\"compat\":\"NULL\"", "X509 Certificate verification #36 (Valid, EC CA, SHA1 Digest)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server5-sha1.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #37 (Valid, EC CA, SHA224 Digest)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server5-sha224.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #38 (Valid, EC CA, SHA384 Digest)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_SHA256_C:MBEDTLS_SHA512_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server5-sha384.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #39 (Valid, EC CA, SHA512 Digest)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_SHA256_C:MBEDTLS_SHA512_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server5-sha512.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #40 (Valid, depth 0, RSA, CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/test-ca.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #41 (Valid, depth 0, EC, CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA256_C\nx509_verify:\"data_files/test-ca2.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #42 (Depth 0, not CA, RSA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server2.crt\":\"data_files/server2.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #43 (Depth 0, not CA, EC)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server5.crt\":\"data_files/server5.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #44 (Corrupted signature, EC)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server5-badsign.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #45 (Corrupted signature, RSA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server2-badsign.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #46 (Valid, depth 2, EC-RSA-EC)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server7_int-ca.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #47 (Untrusted, depth 2, EC-RSA-EC)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server7_int-ca.crt\":\"data_files/test-ca.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #48 (Missing intermediate CA, EC-RSA-EC)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server7.crt\":\"data_files/test-ca.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #49 (Valid, depth 2, RSA-EC-RSA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server8_int-ca2.crt\":\"data_files/test-ca.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #50 (Valid, multiple CAs)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server2.crt\":\"data_files/test-ca_cat12.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #51 (Valid, multiple CAs, reverse order)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server2.crt\":\"data_files/test-ca_cat21.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #52 (CA keyUsage valid)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2.ku-crt_crl.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #53 (CA keyUsage missing cRLSign)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_X509_CHECK_KEY_USAGE:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2.ku-crt.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCRL_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #54 (CA keyUsage missing cRLSign, no CRL)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2.ku-crt.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #55 (CA keyUsage missing keyCertSign)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_X509_CHECK_KEY_USAGE:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2.ku-crl.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #56 (CA keyUsage plain wrong)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_X509_CHECK_KEY_USAGE:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2.ku-ds.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #57 (Valid, RSASSA-PSS, SHA-1)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #58 (Valid, RSASSA-PSS, SHA-224)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-sha224.crt\":\"data_files/test-ca.crt\":\"data_files/crl-rsa-pss-sha224.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #59 (Valid, RSASSA-PSS, SHA-256)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-sha256.crt\":\"data_files/test-ca.crt\":\"data_files/crl-rsa-pss-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #60 (Valid, RSASSA-PSS, SHA-384)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-sha384.crt\":\"data_files/test-ca.crt\":\"data_files/crl-rsa-pss-sha384.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #61 (Valid, RSASSA-PSS, SHA-512)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-sha512.crt\":\"data_files/test-ca.crt\":\"data_files/crl-rsa-pss-sha512.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #62 (Revoked, RSASSA-PSS, SHA-1)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9.crt\":\"data_files/test-ca.crt\":\"data_files/crl-rsa-pss-sha1.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED:\"compat\":\"NULL\"", "X509 Certificate verification #63 (Revoked, RSASSA-PSS, SHA-1, CRL badsign)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9.crt\":\"data_files/test-ca.crt\":\"data_files/crl-rsa-pss-sha1-badsign.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCRL_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #64 (Valid, RSASSA-PSS, SHA-1, not top)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-with-ca.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #65 (RSASSA-PSS, SHA1, bad cert signature)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-badsign.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #66 (RSASSA-PSS, SHA1, no RSA CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server9.crt\":\"data_files/test-ca2.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #67 (Valid, RSASSA-PSS, all defaults)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-defaults.crt\":\"data_files/test-ca.crt\":\"data_files/crl-rsa-pss-sha1.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #68 (RSASSA-PSS, wrong salt_len)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-bad-saltlen.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #69 (RSASSA-PSS, wrong mgf_hash)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-bad-mgfhash.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #70 (v1 trusted CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server1-v1.crt\":\"data_files/test-ca-v1.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #71 (v1 trusted CA, other)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server2-v1.crt\":\"data_files/server1-v1.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #72 (v1 chain)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server2-v1-chain.crt\":\"data_files/test-ca-v1.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #73 (selfsigned trusted without CA bit)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server5-selfsigned.crt\":\"data_files/server5-selfsigned.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #74 (signed by selfsigned trusted without CA bit)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server6-ss-child.crt\":\"data_files/server5-selfsigned.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #75 (encoding mismatch)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/enco-cert-utf8str.pem\":\"data_files/enco-ca-prstr.pem\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #76 (multiple CRLs, not revoked)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca_cat12.crt\":\"data_files/crl_cat_ec-rsa.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #77 (multiple CRLs, revoked)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server6.crt\":\"data_files/test-ca_cat12.crt\":\"data_files/crl_cat_ec-rsa.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED:\"compat\":\"NULL\"", "X509 Certificate verification #78 (multiple CRLs, revoked by second)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server6.crt\":\"data_files/test-ca_cat12.crt\":\"data_files/crl_cat_rsa-ec.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED:\"compat\":\"NULL\"", "X509 Certificate verification #79 (multiple CRLs, revoked by future)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server6.crt\":\"data_files/test-ca_cat12.crt\":\"data_files/crl_cat_ecfut-rsa.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED|MBEDTLS_X509_BADCRL_FUTURE:\"compat\":\"NULL\"", "X509 Certificate verification #80 (multiple CRLs, first future, revoked by second)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server1.crt\":\"data_files/test-ca_cat12.crt\":\"data_files/crl_cat_ecfut-rsa.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED:\"compat\":\"NULL\"", "X509 Certificate verification #81 (multiple CRLs, none relevant)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/enco-cert-utf8str.pem\":\"data_files/enco-ca-prstr.pem\":\"data_files/crl_cat_rsa-ec.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #82 (Not yet valid CA and valid CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2_cat-future-present.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #83 (valid CA and Not yet valid CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2_cat-present-future.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #84 (valid CA and Not yet valid CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2_cat-present-past.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #85 (Not yet valid CA and valid CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2_cat-past-present.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #86 (Not yet valid CA and invalid CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2_cat-future-invalid.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_FUTURE:\"compat\":\"NULL\"", "X509 Certificate verification #87 (Expired CA and invalid CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2_cat-past-invalid.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_EXPIRED:\"compat\":\"NULL\"", "X509 Certificate verification callback: trusted EE cert\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nx509_verify_callback:\"data_files/server5-selfsigned.crt\":\"data_files/server5-selfsigned.crt\":0:\"depth 0 - serial 53\\:A2\\:CB\\:4B\\:12\\:4E\\:AD\\:83\\:7D\\:A8\\:94\\:B2 - subject CN=selfsigned, OU=testing, O=PolarSSL, C=NL\\n\"", "X509 Certificate verification callback: simple\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify_callback:\"data_files/server1.crt\":\"data_files/test-ca.crt\":0:\"depth 1 - serial 00 - subject C=NL, O=PolarSSL, CN=PolarSSL Test CA\\ndepth 0 - serial 01 - subject C=NL, O=PolarSSL, CN=PolarSSL Server 1\\n\"", "X509 Certificate verification callback: two trusted roots\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA256_C\nx509_verify_callback:\"data_files/server1.crt\":\"data_files/test-ca_cat12.crt\":0:\"depth 1 - serial 00 - subject C=NL, O=PolarSSL, CN=PolarSSL Test CA\\ndepth 0 - serial 01 - subject C=NL, O=PolarSSL, CN=PolarSSL Server 1\\n\"", "X509 Certificate verification callback: two trusted roots, reversed order\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA256_C\nx509_verify_callback:\"data_files/server1.crt\":\"data_files/test-ca_cat21.crt\":0:\"depth 1 - serial 00 - subject C=NL, O=PolarSSL, CN=PolarSSL Test CA\\ndepth 0 - serial 01 - subject C=NL, O=PolarSSL, CN=PolarSSL Server 1\\n\"", "X509 Certificate verification callback: root included\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA256_C\nx509_verify_callback:\"data_files/server1_ca.crt\":\"data_files/test-ca_cat21.crt\":0:\"depth 1 - serial 00 - subject C=NL, O=PolarSSL, CN=PolarSSL Test CA\\ndepth 0 - serial 01 - subject C=NL, O=PolarSSL, CN=PolarSSL Server 1\\n\"", "X509 Certificate verification callback: intermediate ca\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify_callback:\"data_files/server7_int-ca.crt\":\"data_files/test-ca_cat12.crt\":0:\"depth 2 - serial C1\\:43\\:E2\\:7E\\:62\\:43\\:CC\\:E8 - subject C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\ndepth 1 - serial 0E - subject C=NL, O=PolarSSL, CN=PolarSSL Test Intermediate CA\\ndepth 0 - serial 10 - subject C=NL, O=PolarSSL, CN=localhost\\n\"", "X509 Certificate verification callback: intermediate ca, root included\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify_callback:\"data_files/server7_int-ca_ca2.crt\":\"data_files/test-ca_cat12.crt\":0:\"depth 2 - serial C1\\:43\\:E2\\:7E\\:62\\:43\\:CC\\:E8 - subject C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\ndepth 1 - serial 0E - subject C=NL, O=PolarSSL, CN=PolarSSL Test Intermediate CA\\ndepth 0 - serial 10 - subject C=NL, O=PolarSSL, CN=localhost\\n\"", "X509 Certificate verification callback: intermediate ca trusted\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C\nx509_verify_callback:\"data_files/server7_int-ca_ca2.crt\":\"data_files/test-int-ca.crt\":0:\"depth 1 - serial 0E - subject C=NL, O=PolarSSL, CN=PolarSSL Test Intermediate CA\\ndepth 0 - serial 10 - subject C=NL, O=PolarSSL, CN=localhost\\n\"", "X509 Certificate verification callback: two intermediates\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify_callback:\"data_files/server10_int3_int-ca2.crt\":\"data_files/test-ca_cat21.crt\":0:\"depth 3 - serial 00 - subject C=NL, O=PolarSSL, CN=PolarSSL Test CA\\ndepth 2 - serial 0F - subject C=NL, O=PolarSSL, CN=PolarSSL Test Intermediate EC CA\\ndepth 1 - serial 4D - subject C=UK, O=mbed TLS, CN=mbed TLS Test intermediate CA 3\\ndepth 0 - serial 4B - subject CN=localhost\\n\"", "X509 Certificate verification callback: two intermediates, root included\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify_callback:\"data_files/server10_int3_int-ca2_ca.crt\":\"data_files/test-ca_cat21.crt\":0:\"depth 3 - serial 00 - subject C=NL, O=PolarSSL, CN=PolarSSL Test CA\\ndepth 2 - serial 0F - subject C=NL, O=PolarSSL, CN=PolarSSL Test Intermediate EC CA\\ndepth 1 - serial 4D - subject C=UK, O=mbed TLS, CN=mbed TLS Test intermediate CA 3\\ndepth 0 - serial 4B - subject CN=localhost\\n\"", "X509 Certificate verification callback: two intermediates, top int trusted\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C\nx509_verify_callback:\"data_files/server10_int3_int-ca2.crt\":\"data_files/test-int-ca2.crt\":0:\"depth 2 - serial 0F - subject C=NL, O=PolarSSL, CN=PolarSSL Test Intermediate EC CA\\ndepth 1 - serial 4D - subject C=UK, O=mbed TLS, CN=mbed TLS Test intermediate CA 3\\ndepth 0 - serial 4B - subject CN=localhost\\n\"", "X509 Certificate verification callback: two intermediates, low int trusted\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify_callback:\"data_files/server10_int3_int-ca2_ca.crt\":\"data_files/test-int-ca3.crt\":0:\"depth 1 - serial 4D - subject C=UK, O=mbed TLS, CN=mbed TLS Test intermediate CA 3\\ndepth 0 - serial 4B - subject CN=localhost\\n\"", "X509 Parse Selftest\ndepends_on:MBEDTLS_SHA1_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_CERTS_C\nx509_selftest:", "X509 Certificate ASN1 (Incorrect first tag)\nx509parse_crt:\"\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT", "X509 Certificate ASN1 (Correct first tag, data length does not match)\nx509parse_crt:\"300000\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (Correct first tag, no more data)\nx509parse_crt:\"3000\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (Correct first tag, length data incorrect)\nx509parse_crt:\"30023085\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_INVALID_LENGTH", "X509 Certificate ASN1 (Correct first tag, length data incomplete)\nx509parse_crt:\"30023083\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (Correct first tag, length data incomplete)\nx509parse_crt:\"30023081\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (Correct first tag, length data incomplete)\nx509parse_crt:\"3003308200\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (Correct first tag, second tag no TBSCertificate)\nx509parse_crt:\"300100\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, no version tag, serial missing)\nx509parse_crt:\"3003300100\":\"\":MBEDTLS_ERR_X509_INVALID_SERIAL + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, invalid version tag)\nx509parse_crt:\"30053003a00101\":\"\":MBEDTLS_ERR_X509_INVALID_VERSION + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, valid version tag, no length)\nx509parse_crt:\"30053003a00102\":\"\":MBEDTLS_ERR_X509_INVALID_VERSION + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, valid version tag, invalid length)\nx509parse_crt:\"30163014a012021000000000000000000000000000000000\":\"\":MBEDTLS_ERR_X509_INVALID_VERSION + MBEDTLS_ERR_ASN1_INVALID_LENGTH", "X509 Certificate ASN1 (TBSCertificate, valid version tag, no serial)\nx509parse_crt:\"30073005a003020104\":\"\":MBEDTLS_ERR_X509_INVALID_SERIAL + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, invalid length version tag)\nx509parse_crt:\"30083006a00402010400\":\"\":MBEDTLS_ERR_X509_INVALID_VERSION + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (TBSCertificate, incorrect serial tag)\nx509parse_crt:\"30083006a00302010400\":\"\":MBEDTLS_ERR_X509_INVALID_SERIAL + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, incorrect serial length)\nx509parse_crt:\"30083006a00302010482\":\"\":MBEDTLS_ERR_X509_INVALID_SERIAL + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, correct serial, no alg)\nx509parse_crt:\"300d300ba0030201048204deadbeef\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, correct serial, no alg oid)\nx509parse_crt:\"300e300ca0030201048204deadbeef00\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, alg oid no data in sequence)\nx509parse_crt:\"300f300da0030201048204deadbeef3000\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, alg with params)\nx509parse_crt:\"30163014a0030201048204deadbeef30070604cafed00d01\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, correct alg data, no params unknown version)\nx509parse_crt:\"30153013a0030201048204deadbeef30060604cafed00d\":\"\":MBEDTLS_ERR_X509_UNKNOWN_VERSION", "X509 Certificate ASN1 (TBSCertificate, correct alg data, unknown version)\nx509parse_crt:\"30173015a0030201048204deadbeef30080604cafed00d0500\":\"\":MBEDTLS_ERR_X509_UNKNOWN_VERSION", "X509 Certificate ASN1 (TBSCertificate, correct alg data, length mismatch)\nx509parse_crt:\"30183016a0030201048204deadbeef30090604cafed00d050000\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (TBSCertificate, correct alg, unknown alg_id)\nx509parse_crt:\"30173015a0030201028204deadbeef30080604cafed00d0500\":\"\":MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG + MBEDTLS_ERR_OID_NOT_FOUND", "X509 Certificate ASN1 (TBSCertificate, correct alg, specific alg_id)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"301c301aa0030201028204deadbeef300d06092a864886f70d0101020500\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, correct alg, unknown specific alg_id)\nx509parse_crt:\"301c301aa0030201028204deadbeef300d06092a864886f70d0101010500\":\"\":MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG + MBEDTLS_ERR_OID_NOT_FOUND", "X509 Certificate ASN1 (TBSCertificate, correct alg, bad RSASSA-PSS params)\ndepends_on:MBEDTLS_X509_RSASSA_PSS_SUPPORT\nx509parse_crt:\"30193017A003020102020118300D06092A864886F70D01010A3100\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, issuer no set data)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"301e301ca0030201028204deadbeef300d06092a864886f70d01010205003000\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, issuer no inner seq data)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"3020301ea0030201028204deadbeef300d06092a864886f70d010102050030023100\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, issuer no inner set data)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30223020a0030201028204deadbeef300d06092a864886f70d0101020500300431023000\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, issuer two inner set datas)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30243022a0030201028204deadbeef300d06092a864886f70d01010205003006310430003000\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, issuer no oid data)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30243022a0030201028204deadbeef300d06092a864886f70d01010205003006310430020600\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, issuer invalid tag)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"302a3028a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600060454657374\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, issuer, no string data)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30253023a0030201028204deadbeef300d06092a864886f70d0101020500300731053003060013\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, issuer, no full following string)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"302b3029a0030201028204deadbeef300d06092a864886f70d0101020500300d310b3009060013045465737400\":\"\":MBEDTLS_ERR_X509_INVALID_NAME+MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, valid issuer, no validity)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"302a3028a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374\":\"\":MBEDTLS_ERR_X509_INVALID_DATE + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, too much date data)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30493047a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301d170c303930313031303030303030170c30393132333132333539353900\":\"\":MBEDTLS_ERR_X509_INVALID_DATE + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (TBSCertificate, invalid from date)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30483046a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303000000000170c303931323331323300000000\":\"\":MBEDTLS_ERR_X509_INVALID_DATE", "X509 Certificate ASN1 (TBSCertificate, invalid to date)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30483046a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323300000000\":\"\":MBEDTLS_ERR_X509_INVALID_DATE", "X509 Certificate ASN1 (TBSCertificate, valid validity, no subject)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30493047a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c30393132333132333539353930\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, valid subject, no pubkeyinfo)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30563054a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374\":\"\":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, pubkey, no alg)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30583056a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743000\":\"\":MBEDTLS_ERR_PK_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, valid subject, unknown pk alg)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30673065a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374300f300d06092A864886F70D0101000500\":\"\":MBEDTLS_ERR_PK_UNKNOWN_PK_ALG", "X509 Certificate ASN1 (TBSCertificate, pubkey, no bitstring)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30673065a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374300f300d06092A864886F70D0101010500\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, pubkey, no bitstring data)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30693067a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743011300d06092A864886F70D01010105000300\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_INVALID_DATA", "X509 Certificate ASN1 (TBSCertificate, pubkey, invalid bitstring start)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"306a3068a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743012300d06092A864886F70D0101010500030101\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_INVALID_DATA", "X509 Certificate ASN1 (TBSCertificate, pubkey, invalid internal bitstring length)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"306d306ba0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743015300d06092A864886F70D0101010500030400300000\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (TBSCertificate, pubkey, invalid internal bitstring tag)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"306d306ba0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743015300d06092A864886F70D0101010500030400310000\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, pubkey, invalid mbedtls_mpi)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30743072a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374301c300d06092A864886F70D0101010500030b0030080202ffff0302ffff\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, pubkey, total length mismatch)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30753073a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374301d300d06092A864886F70D0101010500030b0030080202ffff0202ffff00\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (TBSCertificate, pubkey, check failed)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30743072a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374301c300d06092A864886F70D0101010500030b0030080202ffff0202ffff\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY", "X509 Certificate ASN1 (TBSCertificate, pubkey, check failed, expanded length notation)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308183308180a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210fffffffffffffffffffffffffffffffe0202ffff\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY", "X509 Certificate ASN1 (TBSCertificate v3, Optional UIDs, Extensions not present)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308183308180a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate v3, issuerID wrong tag)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308184308181a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff00\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (TBSCertificate v3, UIDs, no ext)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308189308186a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bb\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate v3, UIDs, invalid length)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308189308186a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa185aaa201bb\":\"\":MBEDTLS_ERR_ASN1_INVALID_LENGTH", "X509 Certificate ASN1 (TBSCertificate v3, ext empty)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30818b308188a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba300\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate v3, ext length mismatch)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30818e30818ba0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba303300000\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (TBSCertificate v3, first ext invalid)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30818f30818ca0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba30330023000\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate v3, first ext invalid tag)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30819030818da0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba3043002310000\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate v3, ext BasicContraint tag, bool len missing)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308198308195a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba30c300a30060603551d1301010100\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate v3, ext BasicContraint tag, data missing)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308198308195a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba30c300a30080603551d1301010100\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate v3, ext BasicContraint tag, no octet present)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308198308195a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba30d300b30090603551d1301010100\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate v3, ext BasicContraint tag, octet data missing)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30819c308199a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba311300f300d0603551d130101010403300100\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate v3, ext BasicContraint tag, no pathlen)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30819f30819ca0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba314301230100603551d130101010406300402010102\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate v3, ext BasicContraint tag, octet len mismatch)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"3081a230819fa0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba317301530130603551d130101010409300702010102010100\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (ExtKeyUsage, bad second tag)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nx509parse_crt:\"3081de3081dba003020102020900ebdbcd14105e1839300906072a8648ce3d0401300f310d300b0603550403130454657374301e170d3134313131313230353935345a170d3234313130383230353935345a300f310d300b06035504031304546573743059301306072a8648ce3d020106082a8648ce3d0301070342000437cc56d976091e5a723ec7592dff206eee7cf9069174d0ad14b5f768225962924ee500d82311ffea2fd2345d5d16bd8a88c26b770d55cd8a2a0efa01c8b4edffa321301f301d0603551d250416301406082b0601050507030107082b06010505070302\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (SubjectAltName repeated)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nx509parse_crt:\"3081fd3081faa003020102020900a8b31ff37d09a37f300906072a8648ce3d0401300f310d300b0603550403130454657374301e170d3134313131313231333731365a170d3234313130383231333731365a300f310d300b06035504031304546573743059301306072a8648ce3d020106082a8648ce3d0301070342000437cc56d976091e5a723ec7592dff206eee7cf9069174d0ad14b5f768225962924ee500d82311ffea2fd2345d5d16bd8a88c26b770d55cd8a2a0efa01c8b4edffa321301f301d0603551d11041630148208666f6f2e7465737482086261722e74657374301d0603551d11041630148208666f6f2e7465737482086261722e74657374\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS", "X509 Certificate ASN1 (ExtKeyUsage repeated)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nx509parse_crt:\"3081fd3081faa003020102020900ebdbcd14105e1839300906072a8648ce3d0401300f310d300b0603550403130454657374301e170d3134313131313230353935345a170d3234313130383230353935345a300f310d300b06035504031304546573743059301306072a8648ce3d020106082a8648ce3d0301070342000437cc56d976091e5a723ec7592dff206eee7cf9069174d0ad14b5f768225962924ee500d82311ffea2fd2345d5d16bd8a88c26b770d55cd8a2a0efa01c8b4edffa340303e301d0603551d250416301406082b0601050507030106082b06010505070302301d0603551d250416301406082b0601050507030106082b06010505070302\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS", "X509 Certificate ASN1 (correct pubkey, no sig_alg)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308183308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (sig_alg mismatch)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308192308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0102020500\":\"\":MBEDTLS_ERR_X509_SIG_MISMATCH", "X509 Certificate ASN1 (sig_alg, no sig)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308192308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500\":\"\":MBEDTLS_ERR_X509_INVALID_SIGNATURE + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (signature, invalid sig data)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308195308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030100\":\"\":MBEDTLS_ERR_X509_INVALID_SIGNATURE + MBEDTLS_ERR_ASN1_INVALID_DATA", "X509 Certificate ASN1 (signature, data left)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308197308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff00\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (correct)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308196308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: ?\\?=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (GeneralizedTime instead of UTCTime)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308198308182a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301e180e3230313030313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: ?\\?=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2010-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with X520 CN)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b0603550403130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: CN=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with X520 C)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b0603550406130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: C=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with X520 L)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b0603550407130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: L=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with X520 ST)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b0603550408130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: ST=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with X520 O)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b060355040a130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: O=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with X520 OU)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b060355040b130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: OU=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with unknown X520 part)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b06035504de130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: ?\\?=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with composite RDN)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509parse_crt:\"3082029f30820208a00302010202044c20e3bd300d06092a864886f70d01010505003056310b3009060355040613025553310b300906035504080c0243413121301f060355040a0c18496e7465726e6574205769646769747320507479204c74643117301506035504030c0e4672616e6b656e63657274204341301e170d3133303830323135313433375a170d3135303831373035353433315a3081d1310b3009060355040613025553311330110603550408130a57617368696e67746f6e31133011060b2b0601040182373c0201031302555331193017060b2b0601040182373c020102130844656c6177617265311a3018060355040a1311417574686f72697a652e4e6574204c4c43311d301b060355040f131450726976617465204f7267616e697a6174696f6e312a300e06035504051307343336393139313018060355040313117777772e617574686f72697a652e6e6574311630140603550407130d53616e204672616e636973636f30819f300d06092a864886f70d010101050003818d0030818902818100d885c62e209b6ac005c64f0bcfdaac1f2b67a18802f75b08851ff933deed888b7b68a62fcabdb21d4a8914becfeaaa1b7e08a09ffaf9916563586dc95e2877262b0b5f5ec27eb4d754aa6facd1d39d25b38a2372891bacdd3e919f791ed25704e8920e380e5623a38e6a23935978a3aec7a8e761e211d42effa2713e44e7de0b0203010001300d06092a864886f70d010105050003818100092f7424d3f6da4b8553829d958ed1980b9270b42c0d3d5833509a28c66bb207df9f3c51d122065e00b87c08c2730d2745fe1c279d16fae4d53b4bf5bdfa3631fceeb2e772b6b08a3eca5a2e2c687aefd23b4b73bf77ac6099711342cf070b35c6f61333a7cbf613d8dd4bd73e9df34bcd4284b0b4df57c36c450613f11e5dac\":\"cert. version \\: 3\\nserial number \\: 4C\\:20\\:E3\\:BD\\nissuer name \\: C=US, ST=CA, O=Internet Widgits Pty Ltd, CN=Frankencert CA\\nsubject name \\: C=US, ST=Washington, ??=US, ??=Delaware, O=Authorize.Net LLC, ??=Private Organization, serialNumber=4369191 + CN=www.authorize.net, L=San Francisco\\nissued on \\: 2013-08-02 15\\:14\\:37\\nexpires on \\: 2015-08-17 05\\:54\\:31\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 1024 bits\\n\":0", "X509 Certificate ASN1 (Name with PKCS9 email)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30819f308189a0030201008204deadbeef300d06092a864886f70d010102050030153113301106092a864886f70d010901130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: emailAddress=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with unknown PKCS9 part)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30819f308189a0030201008204deadbeef300d06092a864886f70d010102050030153113301106092a864886f70d0109ab130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: ?\\?=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (ECDSA signature, RSA key)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C:MBEDTLS_ECDSA_C\nx509parse_crt:\"3081E630819E020103300906072A8648CE3D0401300F310D300B0603550403130454657374301E170D3133303731303039343631385A170D3233303730383039343631385A300F310D300B0603550403130454657374304C300D06092A864886F70D0101010500033B003038023100E8F546061D3B49BC2F6B7524B7EA4D73A8D5293EE8C64D9407B70B5D16BAEBC32B8205591EAB4E1EB57E9241883701250203010001300906072A8648CE3D0401033800303502186E18209AFBED14A0D9A796EFCAD68891E3CCD5F75815C833021900E92B4FD460B1994693243B9FFAD54729DE865381BDA41D25\":\"cert. version \\: 1\\nserial number \\: 03\\nissuer name \\: CN=Test\\nsubject name \\: CN=Test\\nissued on \\: 2013-07-10 09\\:46\\:18\\nexpires on \\: 2023-07-08 09\\:46\\:18\\nsigned using \\: ECDSA with SHA1\\nRSA key size \\: 384 bits\\n\":0", "X509 Certificate ASN1 (ECDSA signature, EC key)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP192R1_ENABLED:MBEDTLS_SHA1_C\nx509parse_crt:\"3081EB3081A3020900F41534662EC7E912300906072A8648CE3D0401300F310D300B0603550403130454657374301E170D3133303731303039343031395A170D3233303730383039343031395A300F310D300B06035504031304546573743049301306072A8648CE3D020106082A8648CE3D030101033200042137969FABD4E370624A0E1A33E379CAB950CCE00EF8C3C3E2ADAEB7271C8F07659D65D3D777DCF21614363AE4B6E617300906072A8648CE3D04010338003035021858CC0F957946FE6A303D92885A456AA74C743C7B708CBD37021900FE293CAC21AF352D16B82EB8EA54E9410B3ABAADD9F05DD6\":\"cert. version \\: 1\\nserial number \\: F4\\:15\\:34\\:66\\:2E\\:C7\\:E9\\:12\\nissuer name \\: CN=Test\\nsubject name \\: CN=Test\\nissued on \\: 2013-07-10 09\\:40\\:19\\nexpires on \\: 2023-07-08 09\\:40\\:19\\nsigned using \\: ECDSA with SHA1\\nEC key size \\: 192 bits\\n\":0", "X509 Certificate ASN1 (RSA signature, EC key)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP192R1_ENABLED:MBEDTLS_SHA1_C\nx509parse_crt:\"3081E430819F020104300D06092A864886F70D0101050500300F310D300B0603550403130454657374301E170D3133303731303135303233375A170D3233303730383135303233375A300F310D300B06035504031304546573743049301306072A8648CE3D020106082A8648CE3D03010103320004E962551A325B21B50CF6B990E33D4318FD16677130726357A196E3EFE7107BCB6BDC6D9DB2A4DF7C964ACFE81798433D300D06092A864886F70D01010505000331001A6C18CD1E457474B2D3912743F44B571341A7859A0122774A8E19A671680878936949F904C9255BDD6FFFDB33A7E6D8\":\"cert. version \\: 1\\nserial number \\: 04\\nissuer name \\: CN=Test\\nsubject name \\: CN=Test\\nissued on \\: 2013-07-10 15\\:02\\:37\\nexpires on \\: 2023-07-08 15\\:02\\:37\\nsigned using \\: RSA with SHA1\\nEC key size \\: 192 bits\\n\":0", "X509 CRL ASN1 (Incorrect first tag)\nx509parse_crl:\"\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT", "X509 CRL ASN1 (Correct first tag, data length does not match)\nx509parse_crl:\"300000\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 CRL ASN1 (TBSCertList, tag missing)\nx509parse_crl:\"3000\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CRL ASN1 (TBSCertList, version tag len missing)\nx509parse_crl:\"3003300102\":\"\":MBEDTLS_ERR_X509_INVALID_VERSION + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CRL ASN1 (TBSCertList, version correct, alg missing)\nx509parse_crl:\"30053003020100\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CRL ASN1 (TBSCertList, alg correct, incorrect version)\nx509parse_crl:\"300b3009020102300406000500\":\"\":MBEDTLS_ERR_X509_UNKNOWN_VERSION", "X509 CRL ASN1 (TBSCertList, correct version, sig_oid1 unknown)\nx509parse_crl:\"300b3009020100300406000500\":\"\":MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG", "X509 CRL ASN1 (TBSCertList, sig_oid1 id unknown)\nx509parse_crl:\"30143012020100300d06092a864886f70d01010f0500\":\"\":MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG", "X509 CRL ASN1 (TBSCertList, sig_oid1 correct, issuer missing)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"30143012020100300d06092a864886f70d01010e0500\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CRL ASN1 (TBSCertList, issuer set missing)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"30163014020100300d06092a864886f70d01010e05003000\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CRL ASN1 (TBSCertList, correct issuer, thisUpdate missing)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"30253023020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344\":\"\":MBEDTLS_ERR_X509_INVALID_DATE + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CRL ASN1 (TBSCertList, correct thisUpdate, nextUpdate missing, entries length missing)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"30343032020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c30393031303130303030303030\":\"\":MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CRL ASN1 (TBSCertList, entries present, invalid sig_alg)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"304a3047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd170c30383132333132333539353900\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CRL ASN1 (TBSCertList, entries present, date in entry invalid)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"304a3047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd190c30383132333132333539353900\":\"\":MBEDTLS_ERR_X509_INVALID_DATE + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CRL ASN1 (TBSCertList, sig_alg present, sig_alg does not match)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"30583047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd170c303831323331323335393539300d06092a864886f70d01010d0500\":\"\":MBEDTLS_ERR_X509_SIG_MISMATCH", "X509 CRL ASN1 (TBSCertList, sig present, len mismatch)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"305d3047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd170c303831323331323335393539300d06092a864886f70d01010e05000302000100\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 CRL ASN1 (TBSCertList, sig present)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"305c3047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd170c303831323331323335393539300d06092a864886f70d01010e050003020001\":\"CRL version \\: 1\\nissuer name \\: CN=ABCD\\nthis update \\: 2009-01-01 00\\:00\\:00\\nnext update \\: 0000-00-00 00\\:00\\:00\\nRevoked certificates\\:\\nserial number\\: AB\\:CD revocation date\\: 2008-12-31 23\\:59\\:59\\nsigned using \\: RSA with SHA-224\\n\":0", "X509 CRL ASN1 (TBSCertList, no entries)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"30463031020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030300d06092a864886f70d01010e050003020001\":\"CRL version \\: 1\\nissuer name \\: CN=ABCD\\nthis update \\: 2009-01-01 00\\:00\\:00\\nnext update \\: 0000-00-00 00\\:00\\:00\\nRevoked certificates\\:\\nsigned using \\: RSA with SHA-224\\n\":0", "X509 CRT parse path #2 (one cert)\ndepends_on:MBEDTLS_SHA1_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_parse_path:\"data_files/dir1\":0:1", "X509 CRT parse path #3 (two certs)\ndepends_on:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nmbedtls_x509_crt_parse_path:\"data_files/dir2\":0:2", "X509 CRT parse path #4 (two certs, one non-cert)\ndepends_on:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nmbedtls_x509_crt_parse_path:\"data_files/dir3\":1:2", "X509 CRT verify long chain (max intermediate CA, trusted)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_crt_verify_max:\"data_files/dir-maxpath/00.crt\":\"data_files/dir-maxpath\":MBEDTLS_X509_MAX_INTERMEDIATE_CA:0:0", "X509 CRT verify long chain (max intermediate CA, untrusted)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nmbedtls_x509_crt_verify_max:\"data_files/test-ca2.crt\":\"data_files/dir-maxpath\":MBEDTLS_X509_MAX_INTERMEDIATE_CA-1:MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED", "X509 CRT verify long chain (max intermediate CA + 1)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED", "mbedtls_x509_crt_verify_max:\"data_files/dir-maxpath/00.crt\":\"data_files/dir-maxpath\":MBEDTLS_X509_MAX_INTERMEDIATE_CA+1:MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:-1", "\nX509 CRT verify chain #1 (zero pathlen intermediate)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert14.crt data_files/dir4/cert13.crt data_files/dir4/cert12.crt\":\"data_files/dir4/cert11.crt\":MBEDTLS_X509_BADCERT_NOT_TRUSTED", "X509 CRT verify chain #2 (zero pathlen root)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert23.crt data_files/dir4/cert22.crt\":\"data_files/dir4/cert21.crt\":MBEDTLS_X509_BADCERT_NOT_TRUSTED", "X509 CRT verify chain #3 (nonzero pathlen root)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert34.crt data_files/dir4/cert33.crt data_files/dir4/cert32.crt\":\"data_files/dir4/cert31.crt\":MBEDTLS_X509_BADCERT_NOT_TRUSTED", "X509 CRT verify chain #4 (nonzero pathlen intermediate)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert45.crt data_files/dir4/cert44.crt data_files/dir4/cert43.crt data_files/dir4/cert42.crt\":\"data_files/dir4/cert41.crt\":MBEDTLS_X509_BADCERT_NOT_TRUSTED", "X509 CRT verify chain #5 (nonzero maxpathlen intermediate)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert54.crt data_files/dir4/cert53.crt data_files/dir4/cert52.crt\":\"data_files/dir4/cert51.crt\":0", "X509 CRT verify chain #6 (nonzero maxpathlen root)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert63.crt data_files/dir4/cert62.crt\":\"data_files/dir4/cert61.crt\":0", "X509 CRT verify chain #7 (maxpathlen root, self signed in path)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert74.crt data_files/dir4/cert73.crt data_files/dir4/cert72.crt\":\"data_files/dir4/cert71.crt\":0", "X509 CRT verify chain #8 (self signed maxpathlen root)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert61.crt data_files/dir4/cert63.crt data_files/dir4/cert62.crt\":\"data_files/dir4/cert61.crt\":0", "X509 CRT verify chain #9 (zero pathlen first intermediate, valid)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert83.crt data_files/dir4/cert82.crt\":\"data_files/dir4/cert81.crt\":0", "X509 CRT verify chain #10 (zero pathlen root, valid)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert92.crt\":\"data_files/dir4/cert91.crt\":0", "X509 OID description #1\nx509_oid_desc:\"2B06010505070301\":\"TLS Web Server Authentication\"", "X509 OID description #2\nx509_oid_desc:\"2B0601050507030f\":\"notfound\"", "X509 OID description #3\nx509_oid_desc:\"2B0601050507030100\":\"notfound\"", "X509 OID numstring #1 (wide buffer)\nx509_oid_numstr:\"2B06010505070301\":\"1.3.6.1.5.5.7.3.1\":20:17", "X509 OID numstring #2 (buffer just fits)\nx509_oid_numstr:\"2B06010505070301\":\"1.3.6.1.5.5.7.3.1\":18:17", "X509 OID numstring #3 (buffer too small)\nx509_oid_numstr:\"2B06010505070301\":\"1.3.6.1.5.5.7.3.1\":17:MBEDTLS_ERR_OID_BUF_TOO_SMALL", "X509 OID numstring #4 (larger number)\nx509_oid_numstr:\"2A864886F70D\":\"1.2.840.113549\":15:14", "X509 OID numstring #5 (arithmetic overflow)\nx509_oid_numstr:\"2A8648F9F8F7F6F5F4F3F2F1F001\":\"\":100:MBEDTLS_ERR_OID_BUF_TOO_SMALL", "X509 crt keyUsage #1 (no extension, expected KU)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.crt\":MBEDTLS_X509_KU_DIGITAL_SIGNATURE|MBEDTLS_X509_KU_KEY_ENCIPHERMENT:0", "X509 crt keyUsage #2 (no extension, surprising KU)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.crt\":MBEDTLS_X509_KU_KEY_CERT_SIGN:0", "X509 crt keyUsage #3 (extension present, no KU)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.key_usage.crt\":0:0", "X509 crt keyUsage #4 (extension present, single KU present)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.key_usage.crt\":MBEDTLS_X509_KU_DIGITAL_SIGNATURE:0", "X509 crt keyUsage #5 (extension present, single KU absent)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.key_usage.crt\":MBEDTLS_X509_KU_KEY_CERT_SIGN:MBEDTLS_ERR_X509_BAD_INPUT_DATA", "X509 crt keyUsage #6 (extension present, combined KU present)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.key_usage.crt\":MBEDTLS_X509_KU_DIGITAL_SIGNATURE|MBEDTLS_X509_KU_KEY_ENCIPHERMENT:0", "X509 crt keyUsage #7 (extension present, combined KU both absent)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.key_usage.crt\":MBEDTLS_X509_KU_KEY_CERT_SIGN|MBEDTLS_X509_KU_CRL_SIGN:MBEDTLS_ERR_X509_BAD_INPUT_DATA", "X509 crt keyUsage #8 (extension present, combined KU one absent)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.key_usage.crt\":MBEDTLS_X509_KU_KEY_ENCIPHERMENT|MBEDTLS_X509_KU_KEY_AGREEMENT:MBEDTLS_ERR_X509_BAD_INPUT_DATA", "X509 crt keyUsage #9 (extension present, decOnly allowed absent)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.key_usage.crt\":MBEDTLS_X509_KU_DIGITAL_SIGNATURE|MBEDTLS_X509_KU_KEY_ENCIPHERMENT|MBEDTLS_X509_KU_DECIPHER_ONLY:0", "X509 crt keyUsage #10 (extension present, decOnly non-allowed present)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/keyUsage.decipherOnly.crt\":MBEDTLS_X509_KU_DIGITAL_SIGNATURE|MBEDTLS_X509_KU_KEY_ENCIPHERMENT:MBEDTLS_ERR_X509_BAD_INPUT_DATA", "X509 crt keyUsage #11 (extension present, decOnly allowed present)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/keyUsage.decipherOnly.crt\":MBEDTLS_X509_KU_DIGITAL_SIGNATURE|MBEDTLS_X509_KU_KEY_ENCIPHERMENT|MBEDTLS_X509_KU_DECIPHER_ONLY:0", "X509 crt extendedKeyUsage #1 (no extension, serverAuth)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_check_extended_key_usage:\"data_files/server5.crt\":\"2B06010505070301\":0", "X509 crt extendedKeyUsage #2 (single value, present)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_check_extended_key_usage:\"data_files/server5.eku-srv.crt\":\"2B06010505070301\":0", "X509 crt extendedKeyUsage #3 (single value, absent)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_check_extended_key_usage:\"data_files/server5.eku-cli.crt\":\"2B06010505070301\":MBEDTLS_ERR_X509_BAD_INPUT_DATA", "X509 crt extendedKeyUsage #4 (two values, first)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_check_extended_key_usage:\"data_files/server5.eku-srv_cli.crt\":\"2B06010505070301\":0", "X509 crt extendedKeyUsage #5 (two values, second)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_check_extended_key_usage:\"data_files/server5.eku-srv_cli.crt\":\"2B06010505070302\":0", "X509 crt extendedKeyUsage #6 (two values, other)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_check_extended_key_usage:\"data_files/server5.eku-srv_cli.crt\":\"2B06010505070303\":MBEDTLS_ERR_X509_BAD_INPUT_DATA", "X509 crt extendedKeyUsage #7 (any, random)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_check_extended_key_usage:\"data_files/server5.eku-cs_any.crt\":\"2B060105050703FF\":0", "X509 RSASSA-PSS parameters ASN1 (good, all defaults)\nx509_parse_rsassa_pss_params:\"\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:0", "X509 RSASSA-PSS parameters ASN1 (wrong initial tag)\nx509_parse_rsassa_pss_params:\"\":MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 RSASSA-PSS parameters ASN1 (unknown tag in top-level sequence)\nx509_parse_rsassa_pss_params:\"A400\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 RSASSA-PSS parameters ASN1 (good, HashAlg SHA256)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_parse_rsassa_pss_params:\"A00D300B0609608648016503040201\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA256:MBEDTLS_MD_SHA1:20:0", "X509 RSASSA-PSS parameters ASN1 (good, explicit HashAlg = default)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_parse_rsassa_pss_params:\"A009300706052B0E03021A\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:0", "X509 RSASSA-PSS parameters ASN1 (HashAlg wrong len #1)\nx509_parse_rsassa_pss_params:\"A00A300706052B0E03021A\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 RSASSA-PSS parameters ASN1 (HashAlg wrong len #2)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_parse_rsassa_pss_params:\"A00A300706052B0E03021A00\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 RSASSA-PSS parameters ASN1 (HashAlg with parameters)\nx509_parse_rsassa_pss_params:\"A00F300D06096086480165030402013000\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA256:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_INVALID_DATA", "X509 RSASSA-PSS parameters ASN1 (HashAlg unknown OID)\nx509_parse_rsassa_pss_params:\"A00D300B06096086480165030402FF\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA256:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_OID_NOT_FOUND", "X509 RSASSA-PSS parameters ASN1 (good, MGAlg = MGF1-SHA256)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_parse_rsassa_pss_params:\"A11A301806092A864886F70D010108300B0609608648016503040201\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:0", "X509 RSASSA-PSS parameters ASN1 (good, explicit MGAlg = default)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_parse_rsassa_pss_params:\"A116301406092A864886F70D010108300706052B0E03021A\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:0", "X509 RSASSA-PSS parameters ASN1 (MGAlg wrong len #1)\nx509_parse_rsassa_pss_params:\"A11B301806092A864886F70D010108300B0609608648016503040201\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 RSASSA-PSS parameters ASN1 (MGAlg wrong len #2)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_parse_rsassa_pss_params:\"A11B301806092A864886F70D010108300B060960864801650304020100\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 RSASSA-PSS parameters ASN1 (MGAlg AlgId wrong len #1)\nx509_parse_rsassa_pss_params:\"A11A301906092A864886F70D010108300B0609608648016503040201\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 RSASSA-PSS parameters ASN1 (MGAlg OID != MGF1)\nx509_parse_rsassa_pss_params:\"A11A301806092A864886F70D010109300B0609608648016503040201\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE + MBEDTLS_ERR_OID_NOT_FOUND", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params wrong tag)\nx509_parse_rsassa_pss_params:\"A11A301806092A864886F70D010108310B0609608648016503040201\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params wrong len #1a)\nx509_parse_rsassa_pss_params:\"A10F300D06092A864886F70D0101083000\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params wrong len #1b)\nx509_parse_rsassa_pss_params:\"A11B301906092A864886F70D010108300C0609608648016503040201\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params.alg not an OID)\nx509_parse_rsassa_pss_params:\"A11A301806092A864886F70D010108300B0709608648016503040201\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params.alg unknown OID)\nx509_parse_rsassa_pss_params:\"A11A301806092A864886F70D010108300B06096086480165030402FF\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_OID_NOT_FOUND", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params.params NULL)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_parse_rsassa_pss_params:\"A11C301A06092A864886F70D010108300D06096086480165030402010500\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:0", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params.params wrong tag)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_parse_rsassa_pss_params:\"A11C301A06092A864886F70D010108300D06096086480165030402013000\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params wrong len #1c)\nx509_parse_rsassa_pss_params:\"A11D301B06092A864886F70D010108300E06096086480165030402010500\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params wrong len #2)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_parse_rsassa_pss_params:\"A11D301B06092A864886F70D010108300E0609608648016503040201050000\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 RSASSA-PSS parameters ASN1 (good, saltLen = 94)\nx509_parse_rsassa_pss_params:\"A20302015E\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:94:0", "X509 RSASSA-PSS parameters ASN1 (good, explicit saltLen = default)\nx509_parse_rsassa_pss_params:\"A203020114\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:0", "X509 RSASSA-PSS parameters ASN1 (saltLen wrong len #1)\nx509_parse_rsassa_pss_params:\"A20402015E\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:94:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 RSASSA-PSS parameters ASN1 (saltLen wrong len #2)\nx509_parse_rsassa_pss_params:\"A20402015E00\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:94:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 RSASSA-PSS parameters ASN1 (saltLen not an int)\nx509_parse_rsassa_pss_params:\"A2023000\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:94:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 RSASSA-PSS parameters ASN1 (good, explicit trailerField = default)\nx509_parse_rsassa_pss_params:\"A303020101\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:0", "X509 RSASSA-PSS parameters ASN1 (trailerField wrong len #1)\nx509_parse_rsassa_pss_params:\"A304020101\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 RSASSA-PSS parameters ASN1 (trailerField wrong len #2)\nx509_parse_rsassa_pss_params:\"A30402010100\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 RSASSA-PSS parameters ASN1 (trailerField not an int)\nx509_parse_rsassa_pss_params:\"A3023000\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 RSASSA-PSS parameters ASN1 (trailerField not 1)\nx509_parse_rsassa_pss_params:\"A303020102\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG", "X509 CSR ASN.1 (OK)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nmbedtls_x509_csr_parse:\"308201183081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E0300906072A8648CE3D04010349003046022100B49FD8C8F77ABFA871908DFBE684A08A793D0F490A43D86FCF2086E4F24BB0C2022100F829D5CCD3742369299E6294394717C4B723A0F68B44E831B6E6C3BCABF97243\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: ECDSA with SHA1\\nEC key size \\: 256 bits\\n\":0", "X509 CSR ASN.1 (bad first tag)\nmbedtls_x509_csr_parse:\"3100\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT", "X509 CSR ASN.1 (bad sequence: overlong)\nmbedtls_x509_csr_parse:\"3001\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT", "X509 CSR ASN.1 (total length mistmatch)\nmbedtls_x509_csr_parse:\"30010000\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 CSR ASN.1 (bad CRI: not a sequence)\nmbedtls_x509_csr_parse:\"30023100\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CSR ASN.1 (bad CRI: overlong)\nmbedtls_x509_csr_parse:\"30023001\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad CRI.Version: overlong)\nmbedtls_x509_csr_parse:\"30053002020100\":\"\":MBEDTLS_ERR_X509_INVALID_VERSION + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad CRI.Version: not v1)\nmbedtls_x509_csr_parse:\"30053003020101\":\"\":MBEDTLS_ERR_X509_UNKNOWN_VERSION", "X509 CSR ASN.1 (bad CRI.Name: not a sequence)\nmbedtls_x509_csr_parse:\"300730050201003100\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CSR ASN.1 (bad CRI.Name: overlong)\nmbedtls_x509_csr_parse:\"30083005020100300100\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad CRI.Name payload: not a set)\nmbedtls_x509_csr_parse:\"3009300702010030023000\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CSR ASN.1 (bad CRI.Name payload: overlong)\nmbedtls_x509_csr_parse:\"300A30080201003002310100\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad SubjectPublicKeyInfo: missing)\nmbedtls_x509_csr_parse:\"30143012020100300D310B3009060355040613024E4C\":\"\":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad SubjectPublicKeyInfo: not a sequence)\nmbedtls_x509_csr_parse:\"30163014020100300D310B3009060355040613024E4C3100\":\"\":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CSR ASN.1 (bad SubjectPublicKeyInfo: overlong)\nmbedtls_x509_csr_parse:\"30173014020100300D310B3009060355040613024E4C300100\":\"\":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad attributes: missing)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_csr_parse:\"3081973081940201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFF\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad attributes: bad tag)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_csr_parse:\"3081993081960201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFF0500\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CSR ASN.1 (bad attributes: overlong)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_csr_parse:\"30819A3081960201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA00100\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad sigAlg: missing)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_csr_parse:\"3081C23081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E0\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad sigAlg: not a sequence)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_csr_parse:\"3081C43081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E03100\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CSR ASN.1 (bad sigAlg: overlong)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_csr_parse:\"3081C43081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E03001\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad sigAlg: unknown)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_csr_parse:\"3081CD3081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E0300906072A8648CE3D04FF\":\"\":MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG", "X509 CSR ASN.1 (bad sig: missing)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nmbedtls_x509_csr_parse:\"3081CD3081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E0300906072A8648CE3D0401\":\"\":MBEDTLS_ERR_X509_INVALID_SIGNATURE + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad sig: not a bit string)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nmbedtls_x509_csr_parse:\"3081CF3081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E0300906072A8648CE3D04010400\":\"\":MBEDTLS_ERR_X509_INVALID_SIGNATURE + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CSR ASN.1 (bad sig: overlong)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nmbedtls_x509_csr_parse:\"3081CF3081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E0300906072A8648CE3D04010301\":\"\":MBEDTLS_ERR_X509_INVALID_SIGNATURE + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (extra data after signature)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nmbedtls_x509_csr_parse:\"308201193081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E0300906072A8648CE3D04010349003046022100B49FD8C8F77ABFA871908DFBE684A08A793D0F490A43D86FCF2086E4F24BB0C2022100F829D5CCD3742369299E6294394717C4B723A0F68B44E831B6E6C3BCABF9724300\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 File parse (no issues)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509parse_crt_file:\"data_files/server7_int-ca.crt\":0", "X509 File parse (extra space in one certificate)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_SHA256_C\nx509parse_crt_file:\"data_files/server7_pem_space.crt\":1", "X509 File parse (all certificates fail)\ndepends_on:MBEDTLS_ECP_C\nx509parse_crt_file:\"data_files/server7_all_space.crt\":MBEDTLS_ERR_PEM_INVALID_DATA + MBEDTLS_ERR_BASE64_INVALID_CHARACTER", "X509 File parse (trailing spaces, OK)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509parse_crt_file:\"data_files/server7_trailing_space.crt\":0", "X509 Get time (UTC no issues)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"500101000000Z\":0:1950:1:1:0:0:0", "X509 Get time (Generalized Time no issues)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_GENERALIZED_TIME:\"99991231235959Z\":0:9999:12:31:23:59:59", "X509 Get time (UTC year without leap day)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"490229121212Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC year with leap day)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"000229121212Z\":0:2000:2:29:12:12:12", "X509 Get time (UTC invalid day of month #1)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"000132121212Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid day of month #2)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"001131121212Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid hour)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"001130241212Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid min)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"001130236012Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid sec)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"001130235960Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC without time zone)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"000229121212\":0:2000:2:29:12:12:12", "X509 Get time (UTC with invalid time zone #1)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"000229121212J\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC with invalid time zone #2)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"000229121212+0300\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (Date with invalid tag)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_CONTEXT_SPECIFIC:\"000229121212\":MBEDTLS_ERR_X509_INVALID_DATE+MBEDTLS_ERR_ASN1_UNEXPECTED_TAG:0:0:0:0:0:0", "X509 Get time (UTC, truncated)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"000229121\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (Generalized Time, truncated)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_GENERALIZED_TIME:\"20000229121\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC without seconds)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"0002291212\":MBEDTLS_ERR_X509_INVALID_DATE:2000:2:29:12:12:0", "X509 Get time (UTC without seconds and with invalid time zone #1)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"0002291212J\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC without second and with invalid time zone #2)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"0002291212+0300\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid character in year)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"0\\1130231212Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid character in month)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"001%30231212Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid character in day)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"0011`0231212Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid character in hour)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"0011302h1212Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid character in min)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"00113023u012Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid character in sec)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"0011302359n0Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [8, 75, 1056, 78, 271, 482, 2312, 1208], "buggy_code_start_loc": [8, 74, 1055, 78, 270, 482, 2060, 1207], "filenames": ["ChangeLog", "include/mbedtls/error.h", "include/mbedtls/ssl.h", "include/mbedtls/x509.h", "include/mbedtls/x509_crt.h", "library/error.c", "library/x509_crt.c", "tests/suites/test_suite_x509parse.data"], "fixing_code_end_loc": [12, 75, 1056, 80, 277, 485, 2317, 1208], "fixing_code_start_loc": [9, 74, 1055, 79, 270, 483, 2060, 1207], "message": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.10:*:*:*:*:*:*:*", "matchCriteriaId": "28621156-2430-447B-8816-47B0FB58245B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.11:*:*:*:*:*:*:*", "matchCriteriaId": "E11BBB2C-0423-47B1-AE12-EB849E17BAF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.12:*:*:*:*:*:*:*", "matchCriteriaId": "4131CE76-6260-412C-A6A6-20B0E978E569", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.13:*:*:*:*:*:*:*", "matchCriteriaId": "DE92D8F7-5705-47B6-B2C2-9DE6C7880647", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.14:*:*:*:*:*:*:*", "matchCriteriaId": "EA50C256-2054-4661-9C42-D31D7D87BAF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.15:*:*:*:*:*:*:*", "matchCriteriaId": "7791D4E9-3FEE-42DA-B320-CF7188A10294", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.16:*:*:*:*:*:*:*", "matchCriteriaId": "BE415DAA-A89F-4204-AC2C-577FCB447E4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.17:*:*:*:*:*:*:*", "matchCriteriaId": "95F691DB-9552-4EBB-B29D-16658561FA4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.18:*:*:*:*:*:*:*", "matchCriteriaId": "F1547B2A-E0D5-41D1-9449-1CCF35022B0E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.19:*:*:*:*:*:*:*", "matchCriteriaId": "CF762122-64BC-4A1A-A26D-81C1270541A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.20:*:*:*:*:*:*:*", "matchCriteriaId": "59D6B559-5F99-4E38-A861-3AB8A7D2E6BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.21:*:*:*:*:*:*:*", "matchCriteriaId": "4A8956C8-6CF0-4C37-84F9-8A89726806C3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "0B395D81-876F-43FC-8DB9-44377647A37A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F92622F1-82DA-4819-8275-06DC9DBE1BA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5871FDE9-02D0-466C-BDB7-90A14C4F637E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE6B4875-3FC3-499F-A76B-2D04982F743A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "B3B67842-5AFA-459F-9CCF-772B9DC7139F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "AD0500EE-52C0-4896-B3D8-5BE731D66039", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "015739E9-C0E3-4A62-BB9D-FA836BFD4351", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "842B0D15-6A3D-4CEE-AD02-49B0436E78E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "3CF6E05C-E6E5-40B8-AFEA-A5ED937F5439", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "D4133C86-70E0-44FD-BBDB-D61EFB31F027", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "6F9D24F0-3892-417F-9C3A-CACEF00C2293", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "8911513E-968C-403E-9D00-2DC0AA82F99B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "48D98945-82BB-4954-AA6D-7D98E4CE1154", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "6378C1CC-7C8F-47E3-A1A7-CDEC76E4CBE4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "525190A3-2194-4E4E-9D34-0048583B9C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "70407352-624A-40E6-82E4-7B4FAFE0C0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "DD52988E-4B2F-41AF-BC25-F38F87D9B8C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "FD1F7803-31F3-40A9-A878-FDC757FCE83F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected."}, {"lang": "es", "value": "ARM mbed TLS en versiones anteriores a la 1.3.21 y en versiones 2.x anteriores a la 2.1.9, si se configura la autenticaci\u00f3n opcional, permite a los atacantes omitir la autenticaci\u00f3n Peer mediante una cadena de certificados X.509 con muchos intermediarios. NOTA: aunque mbed TLS se conoc\u00eda antes como PolarSSL, las versiones lanzadas con el nombre PolarSSL no est\u00e1n afectadas."}], "evaluatorComment": null, "id": "CVE-2017-14032", "lastModified": "2017-11-08T02:29:02.850", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-08-30T20:29:00.337", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.debian.org/security/2017/dsa-3967"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugs.debian.org/873557"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/d15795acd5074e0b44e71f7ede8bdfe1b48591fc"}, {"source": "cve@mitre.org", "tags": ["Vendor Advisory"], "url": "https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2017-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, "type": "CWE-287"}
351
Determine whether the {function_name} code is vulnerable or not.
[ "X509 Certificate information #1\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/server1.crt\":\"cert. version \\: 3\\nserial number \\: 01\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nissued on \\: 2011-02-12 14\\:44\\:06\\nexpires on \\: 2021-02-12 14\\:44\\:06\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information #2\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/server2.crt\":\"cert. version \\: 3\\nserial number \\: 02\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2011-02-12 14\\:44\\:06\\nexpires on \\: 2021-02-12 14\\:44\\:06\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information #3\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/test-ca.crt\":\"cert. version \\: 3\\nserial number \\: 00\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nissued on \\: 2011-02-12 14\\:44\\:00\\nexpires on \\: 2021-02-12 14\\:44\\:00\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=true\\n\"", "X509 Certificate information MD2 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509_cert_info:\"data_files/cert_md2.crt\":\"cert. version \\: 3\\nserial number \\: 09\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Cert MD2\\nissued on \\: 2009-07-12 10\\:56\\:59\\nexpires on \\: 2011-07-12 10\\:56\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information MD4 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_MD4_C\nx509_cert_info:\"data_files/cert_md4.crt\":\"cert. version \\: 3\\nserial number \\: 05\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Cert MD4\\nissued on \\: 2011-02-12 14\\:44\\:07\\nexpires on \\: 2021-02-12 14\\:44\\:07\\nsigned using \\: RSA with MD4\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information MD5 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_MD5_C\nx509_cert_info:\"data_files/cert_md5.crt\":\"cert. version \\: 3\\nserial number \\: 06\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Cert MD5\\nissued on \\: 2011-02-12 14\\:44\\:07\\nexpires on \\: 2021-02-12 14\\:44\\:07\\nsigned using \\: RSA with MD5\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information SHA1 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/cert_sha1.crt\":\"cert. version \\: 3\\nserial number \\: 07\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Cert SHA1\\nissued on \\: 2011-02-12 14\\:44\\:07\\nexpires on \\: 2021-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information SHA224 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_cert_info:\"data_files/cert_sha224.crt\":\"cert. version \\: 3\\nserial number \\: 08\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Cert SHA224\\nissued on \\: 2011-02-12 14\\:44\\:07\\nexpires on \\: 2021-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA-224\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information SHA256 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_cert_info:\"data_files/cert_sha256.crt\":\"cert. version \\: 3\\nserial number \\: 09\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Cert SHA256\\nissued on \\: 2011-02-12 14\\:44\\:07\\nexpires on \\: 2021-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA-256\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information SHA384 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA512_C\nx509_cert_info:\"data_files/cert_sha384.crt\":\"cert. version \\: 3\\nserial number \\: 0A\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Cert SHA384\\nissued on \\: 2011-02-12 14\\:44\\:07\\nexpires on \\: 2021-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA-384\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information SHA512 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA512_C\nx509_cert_info:\"data_files/cert_sha512.crt\":\"cert. version \\: 3\\nserial number \\: 0B\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Cert SHA512\\nissued on \\: 2011-02-12 14\\:44\\:07\\nexpires on \\: 2021-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA-512\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information RSA-PSS, SHA1 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/server9.crt\":\"cert. version \\: 3\\nserial number \\: 16\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2014-01-20 13\\:38\\:16\\nexpires on \\: 2024-01-18 13\\:38\\:16\\nsigned using \\: RSASSA-PSS (SHA1, MGF1-SHA1, 0xEA)\\nRSA key size \\: 1024 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information RSA-PSS, SHA224 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C\nx509_cert_info:\"data_files/server9-sha224.crt\":\"cert. version \\: 3\\nserial number \\: 17\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2014-01-20 13\\:57\\:36\\nexpires on \\: 2024-01-18 13\\:57\\:36\\nsigned using \\: RSASSA-PSS (SHA224, MGF1-SHA224, 0xE2)\\nRSA key size \\: 1024 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information RSA-PSS, SHA256 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C\nx509_cert_info:\"data_files/server9-sha256.crt\":\"cert. version \\: 3\\nserial number \\: 18\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2014-01-20 13\\:57\\:45\\nexpires on \\: 2024-01-18 13\\:57\\:45\\nsigned using \\: RSASSA-PSS (SHA256, MGF1-SHA256, 0xDE)\\nRSA key size \\: 1024 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information RSA-PSS, SHA384 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C\nx509_cert_info:\"data_files/server9-sha384.crt\":\"cert. version \\: 3\\nserial number \\: 19\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2014-01-20 13\\:57\\:58\\nexpires on \\: 2024-01-18 13\\:57\\:58\\nsigned using \\: RSASSA-PSS (SHA384, MGF1-SHA384, 0xCE)\\nRSA key size \\: 1024 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information RSA-PSS, SHA512 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C\nx509_cert_info:\"data_files/server9-sha512.crt\":\"cert. version \\: 3\\nserial number \\: 1A\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2014-01-20 13\\:58\\:12\\nexpires on \\: 2024-01-18 13\\:58\\:12\\nsigned using \\: RSASSA-PSS (SHA512, MGF1-SHA512, 0xBE)\\nRSA key size \\: 1024 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information EC, SHA1 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/server5-sha1.crt\":\"cert. version \\: 3\\nserial number \\: 12\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2013-09-24 16\\:21\\:27\\nexpires on \\: 2023-09-22 16\\:21\\:27\\nsigned using \\: ECDSA with SHA1\\nEC key size \\: 256 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information EC, SHA224 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_cert_info:\"data_files/server5-sha224.crt\":\"cert. version \\: 3\\nserial number \\: 13\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2013-09-24 16\\:21\\:27\\nexpires on \\: 2023-09-22 16\\:21\\:27\\nsigned using \\: ECDSA with SHA224\\nEC key size \\: 256 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information EC, SHA256 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_cert_info:\"data_files/server5.crt\":\"cert. version \\: 3\\nserial number \\: 09\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2013-09-24 15\\:52\\:04\\nexpires on \\: 2023-09-22 15\\:52\\:04\\nsigned using \\: ECDSA with SHA256\\nEC key size \\: 256 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information EC, SHA384 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA512_C\nx509_cert_info:\"data_files/server5-sha384.crt\":\"cert. version \\: 3\\nserial number \\: 14\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2013-09-24 16\\:21\\:27\\nexpires on \\: 2023-09-22 16\\:21\\:27\\nsigned using \\: ECDSA with SHA384\\nEC key size \\: 256 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information EC, SHA512 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA512_C\nx509_cert_info:\"data_files/server5-sha512.crt\":\"cert. version \\: 3\\nserial number \\: 15\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2013-09-24 16\\:21\\:27\\nexpires on \\: 2023-09-22 16\\:21\\:27\\nsigned using \\: ECDSA with SHA512\\nEC key size \\: 256 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information, NS Cert Type\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/server1.cert_type.crt\":\"cert. version \\: 3\\nserial number \\: 01\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nissued on \\: 2011-02-12 14\\:44\\:06\\nexpires on \\: 2021-02-12 14\\:44\\:06\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\ncert. type \\: SSL Server\\n\"", "X509 Certificate information, Key Usage\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/server1.key_usage.crt\":\"cert. version \\: 3\\nserial number \\: 01\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nissued on \\: 2011-02-12 14\\:44\\:06\\nexpires on \\: 2021-02-12 14\\:44\\:06\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\nkey usage \\: Digital Signature, Non Repudiation, Key Encipherment\\n\"", "X509 Certificate information, Key Usage with decipherOnly\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/keyUsage.decipherOnly.crt\":\"cert. version \\: 3\\nserial number \\: 9B\\:13\\:CE\\:4C\\:A5\\:6F\\:DE\\:52\\nissuer name \\: C=GB, L=Cambridge, O=Default Company Ltd\\nsubject name \\: C=GB, L=Cambridge, O=Default Company Ltd\\nissued on \\: 2015-05-12 10\\:36\\:55\\nexpires on \\: 2018-05-11 10\\:36\\:55\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 1024 bits\\nbasic constraints \\: CA=false\\nkey usage \\: Digital Signature, Non Repudiation, Key Encipherment, Decipher Only\\n\"", "X509 Certificate information, Subject Alt Name\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/cert_example_multi.crt\":\"cert. version \\: 3\\nserial number \\: 11\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=www.example.com\\nissued on \\: 2012-05-10 13\\:23\\:41\\nexpires on \\: 2022-05-11 13\\:23\\:41\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\nsubject alt name \\: example.com, example.net, *.example.org\\n\"", "X509 Certificate information, Subject Alt Name + Key Usage\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/cert_example_multi_nocn.crt\":\"cert. version \\: 3\\nserial number \\: F7\\:C6\\:7F\\:F8\\:E9\\:A9\\:63\\:F9\\nissuer name \\: C=NL\\nsubject name \\: C=NL\\nissued on \\: 2014-01-22 10\\:04\\:33\\nexpires on \\: 2024-01-22 10\\:04\\:33\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 1024 bits\\nbasic constraints \\: CA=false\\nsubject alt name \\: www.shotokan-braunschweig.de, www.massimo-abate.eu\\nkey usage \\: Digital Signature, Non Repudiation, Key Encipherment\\n\"", "X509 Certificate information, Key Usage + Extended Key Usage\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_cert_info:\"data_files/server1.ext_ku.crt\":\"cert. version \\: 3\\nserial number \\: 21\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nissued on \\: 2014-04-01 14\\:44\\:43\\nexpires on \\: 2024-03-29 14\\:44\\:43\\nsigned using \\: RSA with SHA-256\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\nkey usage \\: Digital Signature, Non Repudiation, Key Encipherment\\next key usage \\: TLS Web Server Authentication\\n\"", "X509 Certificate information RSA signed by EC\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECDSA_C\nx509_cert_info:\"data_files/server4.crt\":\"cert. version \\: 3\\nserial number \\: 08\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2013-09-24 15\\:52\\:04\\nexpires on \\: 2023-09-22 15\\:52\\:04\\nsigned using \\: ECDSA with SHA256\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information EC signed by RSA\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP192R1_ENABLED:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/server3.crt\":\"cert. version \\: 3\\nserial number \\: 0D\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nissued on \\: 2013-08-09 09\\:17\\:03\\nexpires on \\: 2023-08-07 09\\:17\\:03\\nsigned using \\: RSA with SHA1\\nEC key size \\: 192 bits\\nbasic constraints \\: CA=false\\n\"", "X509 Certificate information Bitstring in subject name\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/bitstring-in-dn.pem\":\"cert. version \\: 3\\nserial number \\: 02\\nissuer name \\: CN=Test CA 01, ST=Ecnivorp, C=XX, emailAddress=tca@example.com, O=Test CA Authority\\nsubject name \\: C=XX, O=tca, ST=Ecnivorp, OU=TCA, CN=Client, emailAddress=client@example.com, serialNumber=7101012255, uniqueIdentifier=?7101012255\\nissued on \\: 2015-03-11 12\\:06\\:51\\nexpires on \\: 2025-03-08 12\\:06\\:51\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nbasic constraints \\: CA=false\\nsubject alt name \\: \\next key usage \\: TLS Web Client Authentication\\n\"", "X509 certificate v1 with extension\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3:MBEDTLS_SHA1_C\nx509_cert_info:\"data_files/cert_v1_with_ext.crt\":\"cert. version \\: 1\\nserial number \\: BD\\:ED\\:44\\:C7\\:D2\\:3E\\:C2\\:A4\\nissuer name \\: C=XX, ST=XX, L=XX, O=XX, OU=XX, emailAddress=admin@identity-check.org, CN=identity-check.org\\nsubject name \\: C=XX, ST=XX, L=XX, O=XX, OU=XX, emailAddress=admin@identity-check.org, CN=identity-check.org\\nissued on \\: 2013-07-04 16\\:17\\:02\\nexpires on \\: 2014-07-04 16\\:17\\:02\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\nsubject alt name \\: identity-check.org, www.identity-check.org\\n\"", "X509 CRL information #1\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C\nmbedtls_x509_crl_info:\"data_files/crl_expired.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2011-02-20 10\\:24\\:19\\nnext update \\: 2011-02-20 11\\:24\\:19\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2011-02-12 14\\:44\\:07\\nserial number\\: 03 revocation date\\: 2011-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA1\\n\"", "X509 CRL Information MD2 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_MD2_C\nmbedtls_x509_crl_info:\"data_files/crl_md2.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2009-07-19 19\\:56\\:37\\nnext update \\: 2009-09-17 19\\:56\\:37\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2009-02-09 21\\:12\\:36\\nserial number\\: 03 revocation date\\: 2009-02-09 21\\:12\\:36\\nsigned using \\: RSA with MD2\\n\"", "X509 CRL Information MD4 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_MD4_C\nmbedtls_x509_crl_info:\"data_files/crl_md4.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2011-02-12 14\\:44\\:07\\nnext update \\: 2011-04-13 14\\:44\\:07\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2011-02-12 14\\:44\\:07\\nserial number\\: 03 revocation date\\: 2011-02-12 14\\:44\\:07\\nsigned using \\: RSA with MD4\\n\"", "X509 CRL Information MD5 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_MD5_C\nmbedtls_x509_crl_info:\"data_files/crl_md5.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2011-02-12 14\\:44\\:07\\nnext update \\: 2011-04-13 14\\:44\\:07\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2011-02-12 14\\:44\\:07\\nserial number\\: 03 revocation date\\: 2011-02-12 14\\:44\\:07\\nsigned using \\: RSA with MD5\\n\"", "X509 CRL Information SHA1 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C\nmbedtls_x509_crl_info:\"data_files/crl_sha1.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2011-02-12 14\\:44\\:07\\nnext update \\: 2011-04-13 14\\:44\\:07\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2011-02-12 14\\:44\\:07\\nserial number\\: 03 revocation date\\: 2011-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA1\\n\"", "X509 CRL Information SHA224 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C\nmbedtls_x509_crl_info:\"data_files/crl_sha224.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2011-02-12 14\\:44\\:07\\nnext update \\: 2011-04-13 14\\:44\\:07\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2011-02-12 14\\:44\\:07\\nserial number\\: 03 revocation date\\: 2011-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA-224\\n\"", "X509 CRL Information SHA256 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C\nmbedtls_x509_crl_info:\"data_files/crl_sha256.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2011-02-12 14\\:44\\:07\\nnext update \\: 2011-04-13 14\\:44\\:07\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2011-02-12 14\\:44\\:07\\nserial number\\: 03 revocation date\\: 2011-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA-256\\n\"", "X509 CRL Information SHA384 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA512_C\nmbedtls_x509_crl_info:\"data_files/crl_sha384.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2011-02-12 14\\:44\\:07\\nnext update \\: 2011-04-13 14\\:44\\:07\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2011-02-12 14\\:44\\:07\\nserial number\\: 03 revocation date\\: 2011-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA-384\\n\"", "X509 CRL Information SHA512 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA512_C\nmbedtls_x509_crl_info:\"data_files/crl_sha512.pem\":\"CRL version \\: 1\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2011-02-12 14\\:44\\:07\\nnext update \\: 2011-04-13 14\\:44\\:07\\nRevoked certificates\\:\\nserial number\\: 01 revocation date\\: 2011-02-12 14\\:44\\:07\\nserial number\\: 03 revocation date\\: 2011-02-12 14\\:44\\:07\\nsigned using \\: RSA with SHA-512\\n\"", "X509 CRL information RSA-PSS, SHA1 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nmbedtls_x509_crl_info:\"data_files/crl-rsa-pss-sha1.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2014-01-20 13\\:46\\:35\\nnext update \\: 2024-01-18 13\\:46\\:35\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nserial number\\: 16 revocation date\\: 2014-01-20 13\\:43\\:05\\nsigned using \\: RSASSA-PSS (SHA1, MGF1-SHA1, 0xEA)\\n\"", "X509 CRL information RSA-PSS, SHA224 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C\nmbedtls_x509_crl_info:\"data_files/crl-rsa-pss-sha224.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2014-01-20 13\\:56\\:06\\nnext update \\: 2024-01-18 13\\:56\\:06\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nserial number\\: 16 revocation date\\: 2014-01-20 13\\:43\\:05\\nsigned using \\: RSASSA-PSS (SHA224, MGF1-SHA224, 0xE2)\\n\"", "X509 CRL information RSA-PSS, SHA256 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C\nmbedtls_x509_crl_info:\"data_files/crl-rsa-pss-sha256.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2014-01-20 13\\:56\\:16\\nnext update \\: 2024-01-18 13\\:56\\:16\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nserial number\\: 16 revocation date\\: 2014-01-20 13\\:43\\:05\\nsigned using \\: RSASSA-PSS (SHA256, MGF1-SHA256, 0xDE)\\n\"", "X509 CRL information RSA-PSS, SHA384 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C\nmbedtls_x509_crl_info:\"data_files/crl-rsa-pss-sha384.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2014-01-20 13\\:56\\:28\\nnext update \\: 2024-01-18 13\\:56\\:28\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nserial number\\: 16 revocation date\\: 2014-01-20 13\\:43\\:05\\nsigned using \\: RSASSA-PSS (SHA384, MGF1-SHA384, 0xCE)\\n\"", "X509 CRL information RSA-PSS, SHA512 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C\nmbedtls_x509_crl_info:\"data_files/crl-rsa-pss-sha512.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=PolarSSL Test CA\\nthis update \\: 2014-01-20 13\\:56\\:38\\nnext update \\: 2024-01-18 13\\:56\\:38\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nserial number\\: 16 revocation date\\: 2014-01-20 13\\:43\\:05\\nsigned using \\: RSASSA-PSS (SHA512, MGF1-SHA512, 0xBE)\\n\"", "X509 CRL Information EC, SHA1 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C\nmbedtls_x509_crl_info:\"data_files/crl-ec-sha1.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nthis update \\: 2013-09-24 16\\:31\\:08\\nnext update \\: 2023-09-22 16\\:31\\:08\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nsigned using \\: ECDSA with SHA1\\n\"", "X509 CRL Information EC, SHA224 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C\nmbedtls_x509_crl_info:\"data_files/crl-ec-sha224.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nthis update \\: 2013-09-24 16\\:31\\:08\\nnext update \\: 2023-09-22 16\\:31\\:08\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nsigned using \\: ECDSA with SHA224\\n\"", "X509 CRL Information EC, SHA256 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C\nmbedtls_x509_crl_info:\"data_files/crl-ec-sha256.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nthis update \\: 2013-09-24 16\\:31\\:08\\nnext update \\: 2023-09-22 16\\:31\\:08\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nsigned using \\: ECDSA with SHA256\\n\"", "X509 CRL Information EC, SHA384 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA512_C\nmbedtls_x509_crl_info:\"data_files/crl-ec-sha384.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nthis update \\: 2013-09-24 16\\:31\\:08\\nnext update \\: 2023-09-22 16\\:31\\:08\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nsigned using \\: ECDSA with SHA384\\n\"", "X509 CRL Information EC, SHA512 Digest\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA512_C\nmbedtls_x509_crl_info:\"data_files/crl-ec-sha512.pem\":\"CRL version \\: 2\\nissuer name \\: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\nthis update \\: 2013-09-24 16\\:31\\:08\\nnext update \\: 2023-09-22 16\\:31\\:08\\nRevoked certificates\\:\\nserial number\\: 0A revocation date\\: 2013-09-24 16\\:28\\:38\\nsigned using \\: ECDSA with SHA512\\n\"", "X509 CRL Malformed Input (trailing spaces at end of file)\ndepends_on:MBEDTLS_PEM_PARSE_C\nmbedtls_x509_crl_parse:\"data_files/crl-malformed-trailing-spaces.pem\":MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT", "X509 CSR Information RSA with MD4\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_MD4_C\nmbedtls_x509_csr_info:\"data_files/server1.req.md4\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nsigned using \\: RSA with MD4\\nRSA key size \\: 2048 bits\\n\"", "X509 CSR Information RSA with MD5\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_MD5_C\nmbedtls_x509_csr_info:\"data_files/server1.req.md5\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nsigned using \\: RSA with MD5\\nRSA key size \\: 2048 bits\\n\"", "X509 CSR Information RSA with SHA1\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C\nmbedtls_x509_csr_info:\"data_files/server1.req.sha1\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 2048 bits\\n\"", "X509 CSR Information RSA with SHA224\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C\nmbedtls_x509_csr_info:\"data_files/server1.req.sha224\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nsigned using \\: RSA with SHA-224\\nRSA key size \\: 2048 bits\\n\"", "X509 CSR Information RSA with SHA256\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C\nmbedtls_x509_csr_info:\"data_files/server1.req.sha256\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nsigned using \\: RSA with SHA-256\\nRSA key size \\: 2048 bits\\n\"", "X509 CSR Information RSA with SHA384\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA512_C\nmbedtls_x509_csr_info:\"data_files/server1.req.sha384\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nsigned using \\: RSA with SHA-384\\nRSA key size \\: 2048 bits\\n\"", "X509 CSR Information RSA with SHA512\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA512_C\nmbedtls_x509_csr_info:\"data_files/server1.req.sha512\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=PolarSSL Server 1\\nsigned using \\: RSA with SHA-512\\nRSA key size \\: 2048 bits\\n\"", "X509 CSR Information EC with SHA1\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nmbedtls_x509_csr_info:\"data_files/server5.req.sha1\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: ECDSA with SHA1\\nEC key size \\: 256 bits\\n\"", "X509 CSR Information EC with SHA224\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nmbedtls_x509_csr_info:\"data_files/server5.req.sha224\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: ECDSA with SHA224\\nEC key size \\: 256 bits\\n\"", "X509 CSR Information EC with SHA256\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nmbedtls_x509_csr_info:\"data_files/server5.req.sha256\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: ECDSA with SHA256\\nEC key size \\: 256 bits\\n\"", "X509 CSR Information EC with SHA384\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA512_C\nmbedtls_x509_csr_info:\"data_files/server5.req.sha384\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: ECDSA with SHA384\\nEC key size \\: 256 bits\\n\"", "X509 CSR Information EC with SHA512\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA512_C\nmbedtls_x509_csr_info:\"data_files/server5.req.sha512\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: ECDSA with SHA512\\nEC key size \\: 256 bits\\n\"", "X509 CSR Information RSA-PSS with SHA1\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nmbedtls_x509_csr_info:\"data_files/server9.req.sha1\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: RSASSA-PSS (SHA1, MGF1-SHA1, 0x6A)\\nRSA key size \\: 1024 bits\\n\"", "X509 CSR Information RSA-PSS with SHA224\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C\nmbedtls_x509_csr_info:\"data_files/server9.req.sha224\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: RSASSA-PSS (SHA224, MGF1-SHA224, 0x62)\\nRSA key size \\: 1024 bits\\n\"", "X509 CSR Information RSA-PSS with SHA256\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C\nmbedtls_x509_csr_info:\"data_files/server9.req.sha256\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: RSASSA-PSS (SHA256, MGF1-SHA256, 0x5E)\\nRSA key size \\: 1024 bits\\n\"", "X509 CSR Information RSA-PSS with SHA384\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C\nmbedtls_x509_csr_info:\"data_files/server9.req.sha384\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: RSASSA-PSS (SHA384, MGF1-SHA384, 0x4E)\\nRSA key size \\: 1024 bits\\n\"", "X509 CSR Information RSA-PSS with SHA512\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C\nmbedtls_x509_csr_info:\"data_files/server9.req.sha512\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: RSASSA-PSS (SHA512, MGF1-SHA512, 0x3E)\\nRSA key size \\: 1024 bits\\n\"", "X509 Verify Information: empty\nx509_verify_info:0:\"\":\"\"", "X509 Verify Information: one issue\nx509_verify_info:MBEDTLS_X509_BADCERT_MISSING:\"\":\"Certificate was missing\\n\"", "X509 Verify Information: two issues\nx509_verify_info:MBEDTLS_X509_BADCERT_EXPIRED | MBEDTLS_X509_BADCRL_EXPIRED:\"\":\"The certificate validity has expired\\nThe CRL is expired\\n\"", "X509 Verify Information: two issues, one unknown\nx509_verify_info:MBEDTLS_X509_BADCERT_OTHER | 0x80000000:\"\":\"Other reason (can be used by verify callback)\\nUnknown reason (this should not happen)\\n\"", "X509 Verify Information: empty, with prefix\nx509_verify_info:0:\" ! \":\"\"", "X509 Verify Information: one issue, with prefix\nx509_verify_info:MBEDTLS_X509_BADCERT_MISSING:\" ! \":\" ! Certificate was missing\\n\"", "X509 Verify Information: two issues, with prefix\nx509_verify_info:MBEDTLS_X509_BADCERT_EXPIRED | MBEDTLS_X509_BADCRL_EXPIRED:\" ! \":\" ! The certificate validity has expired\\n ! The CRL is expired\\n\"", "X509 Get Distinguished Name #1\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nmbedtls_x509_dn_gets:\"data_files/server1.crt\":\"subject\":\"C=NL, O=PolarSSL, CN=PolarSSL Server 1\"", "X509 Get Distinguished Name #2\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nmbedtls_x509_dn_gets:\"data_files/server1.crt\":\"issuer\":\"C=NL, O=PolarSSL, CN=PolarSSL Test CA\"", "X509 Get Distinguished Name #3\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nmbedtls_x509_dn_gets:\"data_files/server2.crt\":\"subject\":\"C=NL, O=PolarSSL, CN=localhost\"", "X509 Get Distinguished Name #4\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nmbedtls_x509_dn_gets:\"data_files/server2.crt\":\"issuer\":\"C=NL, O=PolarSSL, CN=PolarSSL Test CA\"", "X509 Time Expired #1\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA1_C\nmbedtls_x509_time_is_past:\"data_files/server1.crt\":\"valid_from\":1", "X509 Time Expired #2\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA1_C\nmbedtls_x509_time_is_past:\"data_files/server1.crt\":\"valid_to\":0", "X509 Time Expired #3\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA1_C\nmbedtls_x509_time_is_past:\"data_files/server2.crt\":\"valid_from\":1", "X509 Time Expired #4\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA1_C\nmbedtls_x509_time_is_past:\"data_files/server2.crt\":\"valid_to\":0", "X509 Time Expired #5\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA1_C\nmbedtls_x509_time_is_past:\"data_files/test-ca.crt\":\"valid_from\":1", "X509 Time Expired #6\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA1_C\nmbedtls_x509_time_is_past:\"data_files/test-ca.crt\":\"valid_to\":0", "X509 Time Future #1\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA256_C\nmbedtls_x509_time_is_future:\"data_files/server5.crt\":\"valid_from\":0", "X509 Time Future #2\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA256_C\nmbedtls_x509_time_is_future:\"data_files/server5.crt\":\"valid_to\":1", "X509 Time Future #3\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA256_C\nmbedtls_x509_time_is_future:\"data_files/server5-future.crt\":\"valid_from\":1", "X509 Time Future #4\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA256_C\nmbedtls_x509_time_is_future:\"data_files/server5-future.crt\":\"valid_to\":1", "X509 Time Future #5\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA256_C\nmbedtls_x509_time_is_future:\"data_files/test-ca2.crt\":\"valid_from\":0", "X509 Time Future #6\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_HAVE_TIME_DATE:MBEDTLS_SHA256_C\nmbedtls_x509_time_is_future:\"data_files/test-ca2.crt\":\"valid_to\":1", "X509 Certificate verification #1 (Revoked Cert, Expired CRL, no CN)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/server1.crt\":\"data_files/test-ca.crt\":\"data_files/crl_expired.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED | MBEDTLS_X509_BADCRL_EXPIRED:\"compat\":\"NULL\"", "X509 Certificate verification #1a (Revoked Cert, Future CRL, no CN)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server6.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-future.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED | MBEDTLS_X509_BADCRL_FUTURE:\"compat\":\"NULL\"", "X509 Certificate verification #2 (Revoked Cert, Expired CRL)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/server1.crt\":\"data_files/test-ca.crt\":\"data_files/crl_expired.pem\":\"PolarSSL Server 1\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED | MBEDTLS_X509_BADCRL_EXPIRED:\"compat\":\"NULL\"", "X509 Certificate verification #2a (Revoked Cert, Future CRL)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server6.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-future.pem\":\"localhost\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED | MBEDTLS_X509_BADCRL_FUTURE:\"compat\":\"NULL\"", "X509 Certificate verification #3 (Revoked Cert, Future CRL, CN Mismatch)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/server1.crt\":\"data_files/test-ca.crt\":\"data_files/crl_expired.pem\":\"PolarSSL Wrong CN\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED | MBEDTLS_X509_BADCRL_EXPIRED | MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #3a (Revoked Cert, Expired CRL, CN Mismatch)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server6.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-future.pem\":\"Wrong CN\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED | MBEDTLS_X509_BADCRL_FUTURE | MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #4 (Valid Cert, Expired CRL)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/server2.crt\":\"data_files/test-ca.crt\":\"data_files/crl_expired.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCRL_EXPIRED:\"compat\":\"NULL\"", "X509 Certificate verification #4a (Revoked Cert, Future CRL)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-future.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCRL_FUTURE:\"compat\":\"NULL\"", "X509 Certificate verification #5 (Revoked Cert)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/server1.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED:\"compat\":\"NULL\"", "X509 Certificate verification #6 (Revoked Cert)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/server1.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"PolarSSL Server 1\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED:\"compat\":\"NULL\"", "X509 Certificate verification #7 (Revoked Cert, CN Mismatch)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/server1.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"PolarSSL Wrong CN\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED | MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #8 (Valid Cert)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #8a (Expired Cert)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server5-expired.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_EXPIRED:\"compat\":\"NULL\"", "X509 Certificate verification #8b (Future Cert)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server5-future.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_FUTURE:\"compat\":\"NULL\"", "X509 Certificate verification #9 (Not trusted Cert)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/server2.crt\":\"data_files/server1.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #10 (Not trusted Cert, Expired CRL)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server2.crt\":\"data_files/server1.crt\":\"data_files/crl_expired.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #12 (Valid Cert MD4 Digest)\ndepends_on:MBEDTLS_MD4_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_md4.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_BAD_MD:\"compat\":\"NULL\"", "X509 Certificate verification #13 (Valid Cert MD5 Digest)\ndepends_on:MBEDTLS_MD5_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_md5.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_BAD_MD:\"compat\":\"NULL\"", "X509 Certificate verification #14 (Valid Cert SHA1 Digest explicitly allowed in profile)\ndepends_on:MBEDTLS_SHA1_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_sha1.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #14 (Valid Cert SHA1 Digest allowed in compile-time default profile)\ndepends_on:MBEDTLS_SHA1_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES\nx509_verify:\"data_files/cert_sha1.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"default\":\"NULL\"", "X509 Certificate verification #14 (Valid Cert SHA1 Digest forbidden in default profile)\ndepends_on:MBEDTLS_SHA1_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:!MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES\nx509_verify:\"data_files/cert_sha1.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCRL_BAD_MD | MBEDTLS_X509_BADCERT_BAD_MD:\"default\":\"NULL\"", "X509 Certificate verification #15 (Valid Cert SHA224 Digest)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_sha224.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #16 (Valid Cert SHA256 Digest)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_sha256.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #17 (Valid Cert SHA384 Digest)\ndepends_on:MBEDTLS_SHA512_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_sha384.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #18 (Valid Cert SHA512 Digest)\ndepends_on:MBEDTLS_SHA512_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_sha512.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #19 (Valid Cert, denying callback)\ndepends_on:MBEDTLS_SHA512_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_sha512.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_OTHER:\"compat\":\"verify_none\"", "X509 Certificate verification #19 (Not trusted Cert, allowing callback)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server2.crt\":\"data_files/server1.crt\":\"data_files/crl_expired.pem\":\"NULL\":0:0:\"compat\":\"verify_all\"", "X509 Certificate verification #21 (domain matching wildcard certificate, case insensitive)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_wildcard.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"mail.ExAmPlE.com\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #22 (domain not matching wildcard certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_wildcard.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"mail.example.net\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #23 (domain not matching wildcard certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_wildcard.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"example.com\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #24 (domain matching CN of multi certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"www.example.com\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #25 (domain matching multi certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"example.net\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #26 (domain not matching multi certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"www.example.net\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #27 (domain not matching multi certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"xample.net\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #27 (domain not matching multi certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"bexample.net\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #28 (domain not matching wildcard in multi certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"example.org\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH:\"compat\":\"NULL\"", "X509 Certificate verification #29 (domain matching wildcard in multi certificate)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"mail.example.org\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #30 (domain matching multi certificate without CN)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi_nocn.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"www.shotokan-braunschweig.de\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #31 (domain not matching multi certificate without CN)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify:\"data_files/cert_example_multi_nocn.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"www.example.net\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH + MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #32 (Valid, EC cert, RSA CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP192R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server3.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #33 (Valid, RSA cert, EC CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_ECP_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server4.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #34 (Valid, EC cert, EC CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #35 (Revoked, EC CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server6.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED:\"compat\":\"NULL\"", "X509 Certificate verification #36 (Valid, EC CA, SHA1 Digest)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server5-sha1.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #37 (Valid, EC CA, SHA224 Digest)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server5-sha224.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #38 (Valid, EC CA, SHA384 Digest)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_SHA256_C:MBEDTLS_SHA512_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server5-sha384.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #39 (Valid, EC CA, SHA512 Digest)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_SHA256_C:MBEDTLS_SHA512_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server5-sha512.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #40 (Valid, depth 0, RSA, CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/test-ca.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #41 (Valid, depth 0, EC, CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA256_C\nx509_verify:\"data_files/test-ca2.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #42 (Depth 0, not CA, RSA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server2.crt\":\"data_files/server2.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #43 (Depth 0, not CA, EC)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server5.crt\":\"data_files/server5.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #44 (Corrupted signature, EC)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server5-badsign.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #45 (Corrupted signature, RSA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server2-badsign.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #46 (Valid, depth 2, EC-RSA-EC)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server7_int-ca.crt\":\"data_files/test-ca2.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #47 (Untrusted, depth 2, EC-RSA-EC)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server7_int-ca.crt\":\"data_files/test-ca.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #48 (Missing intermediate CA, EC-RSA-EC)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server7.crt\":\"data_files/test-ca.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #49 (Valid, depth 2, RSA-EC-RSA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server8_int-ca2.crt\":\"data_files/test-ca.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #50 (Valid, multiple CAs)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server2.crt\":\"data_files/test-ca_cat12.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #51 (Valid, multiple CAs, reverse order)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server2.crt\":\"data_files/test-ca_cat21.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #52 (CA keyUsage valid)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2.ku-crt_crl.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #53 (CA keyUsage missing cRLSign)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_X509_CHECK_KEY_USAGE:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2.ku-crt.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCRL_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #54 (CA keyUsage missing cRLSign, no CRL)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2.ku-crt.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #55 (CA keyUsage missing keyCertSign)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_X509_CHECK_KEY_USAGE:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2.ku-crl.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #56 (CA keyUsage plain wrong)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_X509_CHECK_KEY_USAGE:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2.ku-ds.crt\":\"data_files/crl-ec-sha256.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #57 (Valid, RSASSA-PSS, SHA-1)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #58 (Valid, RSASSA-PSS, SHA-224)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-sha224.crt\":\"data_files/test-ca.crt\":\"data_files/crl-rsa-pss-sha224.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #59 (Valid, RSASSA-PSS, SHA-256)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-sha256.crt\":\"data_files/test-ca.crt\":\"data_files/crl-rsa-pss-sha256.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #60 (Valid, RSASSA-PSS, SHA-384)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-sha384.crt\":\"data_files/test-ca.crt\":\"data_files/crl-rsa-pss-sha384.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #61 (Valid, RSASSA-PSS, SHA-512)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA512_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-sha512.crt\":\"data_files/test-ca.crt\":\"data_files/crl-rsa-pss-sha512.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #62 (Revoked, RSASSA-PSS, SHA-1)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9.crt\":\"data_files/test-ca.crt\":\"data_files/crl-rsa-pss-sha1.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED:\"compat\":\"NULL\"", "X509 Certificate verification #63 (Revoked, RSASSA-PSS, SHA-1, CRL badsign)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9.crt\":\"data_files/test-ca.crt\":\"data_files/crl-rsa-pss-sha1-badsign.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCRL_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #64 (Valid, RSASSA-PSS, SHA-1, not top)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-with-ca.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #65 (RSASSA-PSS, SHA1, bad cert signature)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-badsign.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #66 (RSASSA-PSS, SHA1, no RSA CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server9.crt\":\"data_files/test-ca2.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #67 (Valid, RSASSA-PSS, all defaults)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-defaults.crt\":\"data_files/test-ca.crt\":\"data_files/crl-rsa-pss-sha1.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #68 (RSASSA-PSS, wrong salt_len)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-bad-saltlen.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #69 (RSASSA-PSS, wrong mgf_hash)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server9-bad-mgfhash.crt\":\"data_files/test-ca.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #70 (v1 trusted CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server1-v1.crt\":\"data_files/test-ca-v1.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #71 (v1 trusted CA, other)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server2-v1.crt\":\"data_files/server1-v1.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #72 (v1 chain)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server2-v1-chain.crt\":\"data_files/test-ca-v1.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #73 (selfsigned trusted without CA bit)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server5-selfsigned.crt\":\"data_files/server5-selfsigned.crt\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #74 (signed by selfsigned trusted without CA bit)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server6-ss-child.crt\":\"data_files/server5-selfsigned.crt\":\"data_files/crl.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED:\"compat\":\"NULL\"", "X509 Certificate verification #75 (encoding mismatch)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/enco-cert-utf8str.pem\":\"data_files/enco-ca-prstr.pem\":\"data_files/crl.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #76 (multiple CRLs, not revoked)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca_cat12.crt\":\"data_files/crl_cat_ec-rsa.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #77 (multiple CRLs, revoked)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server6.crt\":\"data_files/test-ca_cat12.crt\":\"data_files/crl_cat_ec-rsa.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED:\"compat\":\"NULL\"", "X509 Certificate verification #78 (multiple CRLs, revoked by second)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server6.crt\":\"data_files/test-ca_cat12.crt\":\"data_files/crl_cat_rsa-ec.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED:\"compat\":\"NULL\"", "X509 Certificate verification #79 (multiple CRLs, revoked by future)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server6.crt\":\"data_files/test-ca_cat12.crt\":\"data_files/crl_cat_ecfut-rsa.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED|MBEDTLS_X509_BADCRL_FUTURE:\"compat\":\"NULL\"", "X509 Certificate verification #80 (multiple CRLs, first future, revoked by second)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/server1.crt\":\"data_files/test-ca_cat12.crt\":\"data_files/crl_cat_ecfut-rsa.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_REVOKED:\"compat\":\"NULL\"", "X509 Certificate verification #81 (multiple CRLs, none relevant)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_verify:\"data_files/enco-cert-utf8str.pem\":\"data_files/enco-ca-prstr.pem\":\"data_files/crl_cat_rsa-ec.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #82 (Not yet valid CA and valid CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2_cat-future-present.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #83 (valid CA and Not yet valid CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2_cat-present-future.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #84 (valid CA and Not yet valid CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2_cat-present-past.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #85 (Not yet valid CA and valid CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2_cat-past-present.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":0:0:\"compat\":\"NULL\"", "X509 Certificate verification #86 (Not yet valid CA and invalid CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2_cat-future-invalid.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_FUTURE:\"compat\":\"NULL\"", "X509 Certificate verification #87 (Expired CA and invalid CA)\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA1_C:MBEDTLS_SHA256_C\nx509_verify:\"data_files/server5.crt\":\"data_files/test-ca2_cat-past-invalid.crt\":\"data_files/crl-ec-sha1.pem\":\"NULL\":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_EXPIRED:\"compat\":\"NULL\"", "X509 Certificate verification callback: trusted EE cert\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nx509_verify_callback:\"data_files/server5-selfsigned.crt\":\"data_files/server5-selfsigned.crt\":0:\"depth 0 - serial 53\\:A2\\:CB\\:4B\\:12\\:4E\\:AD\\:83\\:7D\\:A8\\:94\\:B2 - subject CN=selfsigned, OU=testing, O=PolarSSL, C=NL\\n\"", "X509 Certificate verification callback: simple\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15\nx509_verify_callback:\"data_files/server1.crt\":\"data_files/test-ca.crt\":0:\"depth 1 - serial 00 - subject C=NL, O=PolarSSL, CN=PolarSSL Test CA\\ndepth 0 - serial 01 - subject C=NL, O=PolarSSL, CN=PolarSSL Server 1\\n\"", "X509 Certificate verification callback: two trusted roots\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA256_C\nx509_verify_callback:\"data_files/server1.crt\":\"data_files/test-ca_cat12.crt\":0:\"depth 1 - serial 00 - subject C=NL, O=PolarSSL, CN=PolarSSL Test CA\\ndepth 0 - serial 01 - subject C=NL, O=PolarSSL, CN=PolarSSL Server 1\\n\"", "X509 Certificate verification callback: two trusted roots, reversed order\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA256_C\nx509_verify_callback:\"data_files/server1.crt\":\"data_files/test-ca_cat21.crt\":0:\"depth 1 - serial 00 - subject C=NL, O=PolarSSL, CN=PolarSSL Test CA\\ndepth 0 - serial 01 - subject C=NL, O=PolarSSL, CN=PolarSSL Server 1\\n\"", "X509 Certificate verification callback: root included\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SHA256_C\nx509_verify_callback:\"data_files/server1_ca.crt\":\"data_files/test-ca_cat21.crt\":0:\"depth 1 - serial 00 - subject C=NL, O=PolarSSL, CN=PolarSSL Test CA\\ndepth 0 - serial 01 - subject C=NL, O=PolarSSL, CN=PolarSSL Server 1\\n\"", "X509 Certificate verification callback: intermediate ca\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify_callback:\"data_files/server7_int-ca.crt\":\"data_files/test-ca_cat12.crt\":0:\"depth 2 - serial C1\\:43\\:E2\\:7E\\:62\\:43\\:CC\\:E8 - subject C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\ndepth 1 - serial 0E - subject C=NL, O=PolarSSL, CN=PolarSSL Test Intermediate CA\\ndepth 0 - serial 10 - subject C=NL, O=PolarSSL, CN=localhost\\n\"", "X509 Certificate verification callback: intermediate ca, root included\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify_callback:\"data_files/server7_int-ca_ca2.crt\":\"data_files/test-ca_cat12.crt\":0:\"depth 2 - serial C1\\:43\\:E2\\:7E\\:62\\:43\\:CC\\:E8 - subject C=NL, O=PolarSSL, CN=Polarssl Test EC CA\\ndepth 1 - serial 0E - subject C=NL, O=PolarSSL, CN=PolarSSL Test Intermediate CA\\ndepth 0 - serial 10 - subject C=NL, O=PolarSSL, CN=localhost\\n\"", "X509 Certificate verification callback: intermediate ca trusted\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C\nx509_verify_callback:\"data_files/server7_int-ca_ca2.crt\":\"data_files/test-int-ca.crt\":0:\"depth 1 - serial 0E - subject C=NL, O=PolarSSL, CN=PolarSSL Test Intermediate CA\\ndepth 0 - serial 10 - subject C=NL, O=PolarSSL, CN=localhost\\n\"", "X509 Certificate verification callback: two intermediates\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify_callback:\"data_files/server10_int3_int-ca2.crt\":\"data_files/test-ca_cat21.crt\":0:\"depth 3 - serial 00 - subject C=NL, O=PolarSSL, CN=PolarSSL Test CA\\ndepth 2 - serial 0F - subject C=NL, O=PolarSSL, CN=PolarSSL Test Intermediate EC CA\\ndepth 1 - serial 4D - subject C=UK, O=mbed TLS, CN=mbed TLS Test intermediate CA 3\\ndepth 0 - serial 4B - subject CN=localhost\\n\"", "X509 Certificate verification callback: two intermediates, root included\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify_callback:\"data_files/server10_int3_int-ca2_ca.crt\":\"data_files/test-ca_cat21.crt\":0:\"depth 3 - serial 00 - subject C=NL, O=PolarSSL, CN=PolarSSL Test CA\\ndepth 2 - serial 0F - subject C=NL, O=PolarSSL, CN=PolarSSL Test Intermediate EC CA\\ndepth 1 - serial 4D - subject C=UK, O=mbed TLS, CN=mbed TLS Test intermediate CA 3\\ndepth 0 - serial 4B - subject CN=localhost\\n\"", "X509 Certificate verification callback: two intermediates, top int trusted\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C\nx509_verify_callback:\"data_files/server10_int3_int-ca2.crt\":\"data_files/test-int-ca2.crt\":0:\"depth 2 - serial 0F - subject C=NL, O=PolarSSL, CN=PolarSSL Test Intermediate EC CA\\ndepth 1 - serial 4D - subject C=UK, O=mbed TLS, CN=mbed TLS Test intermediate CA 3\\ndepth 0 - serial 4B - subject CN=localhost\\n\"", "X509 Certificate verification callback: two intermediates, low int trusted\ndepends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_PKCS1_V15:MBEDTLS_SHA256_C:MBEDTLS_SHA1_C\nx509_verify_callback:\"data_files/server10_int3_int-ca2_ca.crt\":\"data_files/test-int-ca3.crt\":0:\"depth 1 - serial 4D - subject C=UK, O=mbed TLS, CN=mbed TLS Test intermediate CA 3\\ndepth 0 - serial 4B - subject CN=localhost\\n\"", "X509 Parse Selftest\ndepends_on:MBEDTLS_SHA1_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_CERTS_C\nx509_selftest:", "X509 Certificate ASN1 (Incorrect first tag)\nx509parse_crt:\"\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT", "X509 Certificate ASN1 (Correct first tag, data length does not match)\nx509parse_crt:\"300000\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (Correct first tag, no more data)\nx509parse_crt:\"3000\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (Correct first tag, length data incorrect)\nx509parse_crt:\"30023085\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_INVALID_LENGTH", "X509 Certificate ASN1 (Correct first tag, length data incomplete)\nx509parse_crt:\"30023083\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (Correct first tag, length data incomplete)\nx509parse_crt:\"30023081\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (Correct first tag, length data incomplete)\nx509parse_crt:\"3003308200\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (Correct first tag, second tag no TBSCertificate)\nx509parse_crt:\"300100\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, no version tag, serial missing)\nx509parse_crt:\"3003300100\":\"\":MBEDTLS_ERR_X509_INVALID_SERIAL + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, invalid version tag)\nx509parse_crt:\"30053003a00101\":\"\":MBEDTLS_ERR_X509_INVALID_VERSION + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, valid version tag, no length)\nx509parse_crt:\"30053003a00102\":\"\":MBEDTLS_ERR_X509_INVALID_VERSION + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, valid version tag, invalid length)\nx509parse_crt:\"30163014a012021000000000000000000000000000000000\":\"\":MBEDTLS_ERR_X509_INVALID_VERSION + MBEDTLS_ERR_ASN1_INVALID_LENGTH", "X509 Certificate ASN1 (TBSCertificate, valid version tag, no serial)\nx509parse_crt:\"30073005a003020104\":\"\":MBEDTLS_ERR_X509_INVALID_SERIAL + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, invalid length version tag)\nx509parse_crt:\"30083006a00402010400\":\"\":MBEDTLS_ERR_X509_INVALID_VERSION + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (TBSCertificate, incorrect serial tag)\nx509parse_crt:\"30083006a00302010400\":\"\":MBEDTLS_ERR_X509_INVALID_SERIAL + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, incorrect serial length)\nx509parse_crt:\"30083006a00302010482\":\"\":MBEDTLS_ERR_X509_INVALID_SERIAL + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, correct serial, no alg)\nx509parse_crt:\"300d300ba0030201048204deadbeef\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, correct serial, no alg oid)\nx509parse_crt:\"300e300ca0030201048204deadbeef00\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, alg oid no data in sequence)\nx509parse_crt:\"300f300da0030201048204deadbeef3000\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, alg with params)\nx509parse_crt:\"30163014a0030201048204deadbeef30070604cafed00d01\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, correct alg data, no params unknown version)\nx509parse_crt:\"30153013a0030201048204deadbeef30060604cafed00d\":\"\":MBEDTLS_ERR_X509_UNKNOWN_VERSION", "X509 Certificate ASN1 (TBSCertificate, correct alg data, unknown version)\nx509parse_crt:\"30173015a0030201048204deadbeef30080604cafed00d0500\":\"\":MBEDTLS_ERR_X509_UNKNOWN_VERSION", "X509 Certificate ASN1 (TBSCertificate, correct alg data, length mismatch)\nx509parse_crt:\"30183016a0030201048204deadbeef30090604cafed00d050000\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (TBSCertificate, correct alg, unknown alg_id)\nx509parse_crt:\"30173015a0030201028204deadbeef30080604cafed00d0500\":\"\":MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG + MBEDTLS_ERR_OID_NOT_FOUND", "X509 Certificate ASN1 (TBSCertificate, correct alg, specific alg_id)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"301c301aa0030201028204deadbeef300d06092a864886f70d0101020500\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, correct alg, unknown specific alg_id)\nx509parse_crt:\"301c301aa0030201028204deadbeef300d06092a864886f70d0101010500\":\"\":MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG + MBEDTLS_ERR_OID_NOT_FOUND", "X509 Certificate ASN1 (TBSCertificate, correct alg, bad RSASSA-PSS params)\ndepends_on:MBEDTLS_X509_RSASSA_PSS_SUPPORT\nx509parse_crt:\"30193017A003020102020118300D06092A864886F70D01010A3100\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, issuer no set data)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"301e301ca0030201028204deadbeef300d06092a864886f70d01010205003000\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, issuer no inner seq data)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"3020301ea0030201028204deadbeef300d06092a864886f70d010102050030023100\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, issuer no inner set data)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30223020a0030201028204deadbeef300d06092a864886f70d0101020500300431023000\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, issuer two inner set datas)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30243022a0030201028204deadbeef300d06092a864886f70d01010205003006310430003000\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, issuer no oid data)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30243022a0030201028204deadbeef300d06092a864886f70d01010205003006310430020600\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, issuer invalid tag)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"302a3028a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600060454657374\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, issuer, no string data)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30253023a0030201028204deadbeef300d06092a864886f70d0101020500300731053003060013\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, issuer, no full following string)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"302b3029a0030201028204deadbeef300d06092a864886f70d0101020500300d310b3009060013045465737400\":\"\":MBEDTLS_ERR_X509_INVALID_NAME+MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, valid issuer, no validity)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"302a3028a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374\":\"\":MBEDTLS_ERR_X509_INVALID_DATE + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, too much date data)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30493047a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301d170c303930313031303030303030170c30393132333132333539353900\":\"\":MBEDTLS_ERR_X509_INVALID_DATE + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (TBSCertificate, invalid from date)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30483046a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303000000000170c303931323331323300000000\":\"\":MBEDTLS_ERR_X509_INVALID_DATE", "X509 Certificate ASN1 (TBSCertificate, invalid to date)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30483046a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323300000000\":\"\":MBEDTLS_ERR_X509_INVALID_DATE", "X509 Certificate ASN1 (TBSCertificate, valid validity, no subject)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30493047a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c30393132333132333539353930\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, valid subject, no pubkeyinfo)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30563054a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374\":\"\":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, pubkey, no alg)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30583056a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743000\":\"\":MBEDTLS_ERR_PK_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, valid subject, unknown pk alg)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30673065a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374300f300d06092A864886F70D0101000500\":\"\":MBEDTLS_ERR_PK_UNKNOWN_PK_ALG", "X509 Certificate ASN1 (TBSCertificate, pubkey, no bitstring)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30673065a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374300f300d06092A864886F70D0101010500\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate, pubkey, no bitstring data)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30693067a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743011300d06092A864886F70D01010105000300\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_INVALID_DATA", "X509 Certificate ASN1 (TBSCertificate, pubkey, invalid bitstring start)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"306a3068a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743012300d06092A864886F70D0101010500030101\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_INVALID_DATA", "X509 Certificate ASN1 (TBSCertificate, pubkey, invalid internal bitstring length)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"306d306ba0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743015300d06092A864886F70D0101010500030400300000\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (TBSCertificate, pubkey, invalid internal bitstring tag)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"306d306ba0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743015300d06092A864886F70D0101010500030400310000\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, pubkey, invalid mbedtls_mpi)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30743072a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374301c300d06092A864886F70D0101010500030b0030080202ffff0302ffff\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate, pubkey, total length mismatch)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30753073a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374301d300d06092A864886F70D0101010500030b0030080202ffff0202ffff00\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (TBSCertificate, pubkey, check failed)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30743072a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374301c300d06092A864886F70D0101010500030b0030080202ffff0202ffff\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY", "X509 Certificate ASN1 (TBSCertificate, pubkey, check failed, expanded length notation)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308183308180a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210fffffffffffffffffffffffffffffffe0202ffff\":\"\":MBEDTLS_ERR_PK_INVALID_PUBKEY", "X509 Certificate ASN1 (TBSCertificate v3, Optional UIDs, Extensions not present)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308183308180a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate v3, issuerID wrong tag)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308184308181a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff00\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (TBSCertificate v3, UIDs, no ext)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308189308186a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bb\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate v3, UIDs, invalid length)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308189308186a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa185aaa201bb\":\"\":MBEDTLS_ERR_ASN1_INVALID_LENGTH", "X509 Certificate ASN1 (TBSCertificate v3, ext empty)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30818b308188a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba300\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate v3, ext length mismatch)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30818e30818ba0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba303300000\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (TBSCertificate v3, first ext invalid)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30818f30818ca0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba30330023000\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate v3, first ext invalid tag)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30819030818da0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba3043002310000\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate v3, ext BasicContraint tag, bool len missing)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308198308195a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba30c300a30060603551d1301010100\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate v3, ext BasicContraint tag, data missing)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308198308195a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba30c300a30080603551d1301010100\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate v3, ext BasicContraint tag, no octet present)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308198308195a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba30d300b30090603551d1301010100\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate v3, ext BasicContraint tag, octet data missing)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30819c308199a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba311300f300d0603551d130101010403300100\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (TBSCertificate v3, ext BasicContraint tag, no pathlen)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30819f30819ca0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba314301230100603551d130101010406300402010102\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (TBSCertificate v3, ext BasicContraint tag, octet len mismatch)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"3081a230819fa0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba317301530130603551d130101010409300702010102010100\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (ExtKeyUsage, bad second tag)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nx509parse_crt:\"3081de3081dba003020102020900ebdbcd14105e1839300906072a8648ce3d0401300f310d300b0603550403130454657374301e170d3134313131313230353935345a170d3234313130383230353935345a300f310d300b06035504031304546573743059301306072a8648ce3d020106082a8648ce3d0301070342000437cc56d976091e5a723ec7592dff206eee7cf9069174d0ad14b5f768225962924ee500d82311ffea2fd2345d5d16bd8a88c26b770d55cd8a2a0efa01c8b4edffa321301f301d0603551d250416301406082b0601050507030107082b06010505070302\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 Certificate ASN1 (SubjectAltName repeated)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nx509parse_crt:\"3081fd3081faa003020102020900a8b31ff37d09a37f300906072a8648ce3d0401300f310d300b0603550403130454657374301e170d3134313131313231333731365a170d3234313130383231333731365a300f310d300b06035504031304546573743059301306072a8648ce3d020106082a8648ce3d0301070342000437cc56d976091e5a723ec7592dff206eee7cf9069174d0ad14b5f768225962924ee500d82311ffea2fd2345d5d16bd8a88c26b770d55cd8a2a0efa01c8b4edffa321301f301d0603551d11041630148208666f6f2e7465737482086261722e74657374301d0603551d11041630148208666f6f2e7465737482086261722e74657374\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS", "X509 Certificate ASN1 (ExtKeyUsage repeated)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nx509parse_crt:\"3081fd3081faa003020102020900ebdbcd14105e1839300906072a8648ce3d0401300f310d300b0603550403130454657374301e170d3134313131313230353935345a170d3234313130383230353935345a300f310d300b06035504031304546573743059301306072a8648ce3d020106082a8648ce3d0301070342000437cc56d976091e5a723ec7592dff206eee7cf9069174d0ad14b5f768225962924ee500d82311ffea2fd2345d5d16bd8a88c26b770d55cd8a2a0efa01c8b4edffa340303e301d0603551d250416301406082b0601050507030106082b06010505070302301d0603551d250416301406082b0601050507030106082b06010505070302\":\"\":MBEDTLS_ERR_X509_INVALID_EXTENSIONS", "X509 Certificate ASN1 (correct pubkey, no sig_alg)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308183308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (sig_alg mismatch)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308192308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0102020500\":\"\":MBEDTLS_ERR_X509_SIG_MISMATCH", "X509 Certificate ASN1 (sig_alg, no sig)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308192308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500\":\"\":MBEDTLS_ERR_X509_INVALID_SIGNATURE + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 Certificate ASN1 (signature, invalid sig data)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308195308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030100\":\"\":MBEDTLS_ERR_X509_INVALID_SIGNATURE + MBEDTLS_ERR_ASN1_INVALID_DATA", "X509 Certificate ASN1 (signature, data left)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308197308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff00\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 Certificate ASN1 (correct)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308196308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: ?\\?=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (GeneralizedTime instead of UTCTime)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308198308182a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301e180e3230313030313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: ?\\?=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2010-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with X520 CN)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b0603550403130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: CN=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with X520 C)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b0603550406130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: C=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with X520 L)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b0603550407130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: L=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with X520 ST)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b0603550408130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: ST=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with X520 O)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b060355040a130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: O=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with X520 OU)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b060355040b130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: OU=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with unknown X520 part)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b06035504de130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: ?\\?=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with composite RDN)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509parse_crt:\"3082029f30820208a00302010202044c20e3bd300d06092a864886f70d01010505003056310b3009060355040613025553310b300906035504080c0243413121301f060355040a0c18496e7465726e6574205769646769747320507479204c74643117301506035504030c0e4672616e6b656e63657274204341301e170d3133303830323135313433375a170d3135303831373035353433315a3081d1310b3009060355040613025553311330110603550408130a57617368696e67746f6e31133011060b2b0601040182373c0201031302555331193017060b2b0601040182373c020102130844656c6177617265311a3018060355040a1311417574686f72697a652e4e6574204c4c43311d301b060355040f131450726976617465204f7267616e697a6174696f6e312a300e06035504051307343336393139313018060355040313117777772e617574686f72697a652e6e6574311630140603550407130d53616e204672616e636973636f30819f300d06092a864886f70d010101050003818d0030818902818100d885c62e209b6ac005c64f0bcfdaac1f2b67a18802f75b08851ff933deed888b7b68a62fcabdb21d4a8914becfeaaa1b7e08a09ffaf9916563586dc95e2877262b0b5f5ec27eb4d754aa6facd1d39d25b38a2372891bacdd3e919f791ed25704e8920e380e5623a38e6a23935978a3aec7a8e761e211d42effa2713e44e7de0b0203010001300d06092a864886f70d010105050003818100092f7424d3f6da4b8553829d958ed1980b9270b42c0d3d5833509a28c66bb207df9f3c51d122065e00b87c08c2730d2745fe1c279d16fae4d53b4bf5bdfa3631fceeb2e772b6b08a3eca5a2e2c687aefd23b4b73bf77ac6099711342cf070b35c6f61333a7cbf613d8dd4bd73e9df34bcd4284b0b4df57c36c450613f11e5dac\":\"cert. version \\: 3\\nserial number \\: 4C\\:20\\:E3\\:BD\\nissuer name \\: C=US, ST=CA, O=Internet Widgits Pty Ltd, CN=Frankencert CA\\nsubject name \\: C=US, ST=Washington, ??=US, ??=Delaware, O=Authorize.Net LLC, ??=Private Organization, serialNumber=4369191 + CN=www.authorize.net, L=San Francisco\\nissued on \\: 2013-08-02 15\\:14\\:37\\nexpires on \\: 2015-08-17 05\\:54\\:31\\nsigned using \\: RSA with SHA1\\nRSA key size \\: 1024 bits\\n\":0", "X509 Certificate ASN1 (Name with PKCS9 email)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30819f308189a0030201008204deadbeef300d06092a864886f70d010102050030153113301106092a864886f70d010901130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: emailAddress=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (Name with unknown PKCS9 part)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_MD2_C\nx509parse_crt:\"30819f308189a0030201008204deadbeef300d06092a864886f70d010102050030153113301106092a864886f70d0109ab130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff\":\"cert. version \\: 1\\nserial number \\: DE\\:AD\\:BE\\:EF\\nissuer name \\: ?\\?=Test\\nsubject name \\: ?\\?=Test\\nissued on \\: 2009-01-01 00\\:00\\:00\\nexpires on \\: 2009-12-31 23\\:59\\:59\\nsigned using \\: RSA with MD2\\nRSA key size \\: 128 bits\\n\":0", "X509 Certificate ASN1 (ECDSA signature, RSA key)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C:MBEDTLS_ECDSA_C\nx509parse_crt:\"3081E630819E020103300906072A8648CE3D0401300F310D300B0603550403130454657374301E170D3133303731303039343631385A170D3233303730383039343631385A300F310D300B0603550403130454657374304C300D06092A864886F70D0101010500033B003038023100E8F546061D3B49BC2F6B7524B7EA4D73A8D5293EE8C64D9407B70B5D16BAEBC32B8205591EAB4E1EB57E9241883701250203010001300906072A8648CE3D0401033800303502186E18209AFBED14A0D9A796EFCAD68891E3CCD5F75815C833021900E92B4FD460B1994693243B9FFAD54729DE865381BDA41D25\":\"cert. version \\: 1\\nserial number \\: 03\\nissuer name \\: CN=Test\\nsubject name \\: CN=Test\\nissued on \\: 2013-07-10 09\\:46\\:18\\nexpires on \\: 2023-07-08 09\\:46\\:18\\nsigned using \\: ECDSA with SHA1\\nRSA key size \\: 384 bits\\n\":0", "X509 Certificate ASN1 (ECDSA signature, EC key)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP192R1_ENABLED:MBEDTLS_SHA1_C\nx509parse_crt:\"3081EB3081A3020900F41534662EC7E912300906072A8648CE3D0401300F310D300B0603550403130454657374301E170D3133303731303039343031395A170D3233303730383039343031395A300F310D300B06035504031304546573743049301306072A8648CE3D020106082A8648CE3D030101033200042137969FABD4E370624A0E1A33E379CAB950CCE00EF8C3C3E2ADAEB7271C8F07659D65D3D777DCF21614363AE4B6E617300906072A8648CE3D04010338003035021858CC0F957946FE6A303D92885A456AA74C743C7B708CBD37021900FE293CAC21AF352D16B82EB8EA54E9410B3ABAADD9F05DD6\":\"cert. version \\: 1\\nserial number \\: F4\\:15\\:34\\:66\\:2E\\:C7\\:E9\\:12\\nissuer name \\: CN=Test\\nsubject name \\: CN=Test\\nissued on \\: 2013-07-10 09\\:40\\:19\\nexpires on \\: 2023-07-08 09\\:40\\:19\\nsigned using \\: ECDSA with SHA1\\nEC key size \\: 192 bits\\n\":0", "X509 Certificate ASN1 (RSA signature, EC key)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP192R1_ENABLED:MBEDTLS_SHA1_C\nx509parse_crt:\"3081E430819F020104300D06092A864886F70D0101050500300F310D300B0603550403130454657374301E170D3133303731303135303233375A170D3233303730383135303233375A300F310D300B06035504031304546573743049301306072A8648CE3D020106082A8648CE3D03010103320004E962551A325B21B50CF6B990E33D4318FD16677130726357A196E3EFE7107BCB6BDC6D9DB2A4DF7C964ACFE81798433D300D06092A864886F70D01010505000331001A6C18CD1E457474B2D3912743F44B571341A7859A0122774A8E19A671680878936949F904C9255BDD6FFFDB33A7E6D8\":\"cert. version \\: 1\\nserial number \\: 04\\nissuer name \\: CN=Test\\nsubject name \\: CN=Test\\nissued on \\: 2013-07-10 15\\:02\\:37\\nexpires on \\: 2023-07-08 15\\:02\\:37\\nsigned using \\: RSA with SHA1\\nEC key size \\: 192 bits\\n\":0", "X509 CRL ASN1 (Incorrect first tag)\nx509parse_crl:\"\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT", "X509 CRL ASN1 (Correct first tag, data length does not match)\nx509parse_crl:\"300000\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 CRL ASN1 (TBSCertList, tag missing)\nx509parse_crl:\"3000\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CRL ASN1 (TBSCertList, version tag len missing)\nx509parse_crl:\"3003300102\":\"\":MBEDTLS_ERR_X509_INVALID_VERSION + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CRL ASN1 (TBSCertList, version correct, alg missing)\nx509parse_crl:\"30053003020100\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CRL ASN1 (TBSCertList, alg correct, incorrect version)\nx509parse_crl:\"300b3009020102300406000500\":\"\":MBEDTLS_ERR_X509_UNKNOWN_VERSION", "X509 CRL ASN1 (TBSCertList, correct version, sig_oid1 unknown)\nx509parse_crl:\"300b3009020100300406000500\":\"\":MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG", "X509 CRL ASN1 (TBSCertList, sig_oid1 id unknown)\nx509parse_crl:\"30143012020100300d06092a864886f70d01010f0500\":\"\":MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG", "X509 CRL ASN1 (TBSCertList, sig_oid1 correct, issuer missing)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"30143012020100300d06092a864886f70d01010e0500\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CRL ASN1 (TBSCertList, issuer set missing)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"30163014020100300d06092a864886f70d01010e05003000\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CRL ASN1 (TBSCertList, correct issuer, thisUpdate missing)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"30253023020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344\":\"\":MBEDTLS_ERR_X509_INVALID_DATE + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CRL ASN1 (TBSCertList, correct thisUpdate, nextUpdate missing, entries length missing)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"30343032020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c30393031303130303030303030\":\"\":MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CRL ASN1 (TBSCertList, entries present, invalid sig_alg)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"304a3047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd170c30383132333132333539353900\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CRL ASN1 (TBSCertList, entries present, date in entry invalid)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"304a3047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd190c30383132333132333539353900\":\"\":MBEDTLS_ERR_X509_INVALID_DATE + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CRL ASN1 (TBSCertList, sig_alg present, sig_alg does not match)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"30583047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd170c303831323331323335393539300d06092a864886f70d01010d0500\":\"\":MBEDTLS_ERR_X509_SIG_MISMATCH", "X509 CRL ASN1 (TBSCertList, sig present, len mismatch)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"305d3047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd170c303831323331323335393539300d06092a864886f70d01010e05000302000100\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 CRL ASN1 (TBSCertList, sig present)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"305c3047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd170c303831323331323335393539300d06092a864886f70d01010e050003020001\":\"CRL version \\: 1\\nissuer name \\: CN=ABCD\\nthis update \\: 2009-01-01 00\\:00\\:00\\nnext update \\: 0000-00-00 00\\:00\\:00\\nRevoked certificates\\:\\nserial number\\: AB\\:CD revocation date\\: 2008-12-31 23\\:59\\:59\\nsigned using \\: RSA with SHA-224\\n\":0", "X509 CRL ASN1 (TBSCertList, no entries)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509parse_crl:\"30463031020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030300d06092a864886f70d01010e050003020001\":\"CRL version \\: 1\\nissuer name \\: CN=ABCD\\nthis update \\: 2009-01-01 00\\:00\\:00\\nnext update \\: 0000-00-00 00\\:00\\:00\\nRevoked certificates\\:\\nsigned using \\: RSA with SHA-224\\n\":0", "X509 CRT parse path #2 (one cert)\ndepends_on:MBEDTLS_SHA1_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_parse_path:\"data_files/dir1\":0:1", "X509 CRT parse path #3 (two certs)\ndepends_on:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nmbedtls_x509_crt_parse_path:\"data_files/dir2\":0:2", "X509 CRT parse path #4 (two certs, one non-cert)\ndepends_on:MBEDTLS_SHA1_C:MBEDTLS_RSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nmbedtls_x509_crt_parse_path:\"data_files/dir3\":1:2", "X509 CRT verify long chain (max intermediate CA, trusted)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_crt_verify_max:\"data_files/dir-maxpath/00.crt\":\"data_files/dir-maxpath\":MBEDTLS_X509_MAX_INTERMEDIATE_CA:0:0", "X509 CRT verify long chain (max intermediate CA, untrusted)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED\nmbedtls_x509_crt_verify_max:\"data_files/test-ca2.crt\":\"data_files/dir-maxpath\":MBEDTLS_X509_MAX_INTERMEDIATE_CA-1:MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_NOT_TRUSTED", "X509 CRT verify long chain (max intermediate CA + 1)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED", "mbedtls_x509_crt_verify_max:\"data_files/dir-maxpath/00.crt\":\"data_files/dir-maxpath\":MBEDTLS_X509_MAX_INTERMEDIATE_CA+1:MBEDTLS_ERR_X509_FATAL_ERROR:-1", "\nX509 CRT verify chain #1 (zero pathlen intermediate)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert14.crt data_files/dir4/cert13.crt data_files/dir4/cert12.crt\":\"data_files/dir4/cert11.crt\":MBEDTLS_X509_BADCERT_NOT_TRUSTED", "X509 CRT verify chain #2 (zero pathlen root)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert23.crt data_files/dir4/cert22.crt\":\"data_files/dir4/cert21.crt\":MBEDTLS_X509_BADCERT_NOT_TRUSTED", "X509 CRT verify chain #3 (nonzero pathlen root)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert34.crt data_files/dir4/cert33.crt data_files/dir4/cert32.crt\":\"data_files/dir4/cert31.crt\":MBEDTLS_X509_BADCERT_NOT_TRUSTED", "X509 CRT verify chain #4 (nonzero pathlen intermediate)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert45.crt data_files/dir4/cert44.crt data_files/dir4/cert43.crt data_files/dir4/cert42.crt\":\"data_files/dir4/cert41.crt\":MBEDTLS_X509_BADCERT_NOT_TRUSTED", "X509 CRT verify chain #5 (nonzero maxpathlen intermediate)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert54.crt data_files/dir4/cert53.crt data_files/dir4/cert52.crt\":\"data_files/dir4/cert51.crt\":0", "X509 CRT verify chain #6 (nonzero maxpathlen root)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert63.crt data_files/dir4/cert62.crt\":\"data_files/dir4/cert61.crt\":0", "X509 CRT verify chain #7 (maxpathlen root, self signed in path)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert74.crt data_files/dir4/cert73.crt data_files/dir4/cert72.crt\":\"data_files/dir4/cert71.crt\":0", "X509 CRT verify chain #8 (self signed maxpathlen root)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_RSA_C\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert61.crt data_files/dir4/cert63.crt data_files/dir4/cert62.crt\":\"data_files/dir4/cert61.crt\":0", "X509 CRT verify chain #9 (zero pathlen first intermediate, valid)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert83.crt data_files/dir4/cert82.crt\":\"data_files/dir4/cert81.crt\":0", "X509 CRT verify chain #10 (zero pathlen root, valid)\ndepends_on:MBEDTLS_SHA256_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_crt_verify_chain:\"data_files/dir4/cert92.crt\":\"data_files/dir4/cert91.crt\":0", "X509 OID description #1\nx509_oid_desc:\"2B06010505070301\":\"TLS Web Server Authentication\"", "X509 OID description #2\nx509_oid_desc:\"2B0601050507030f\":\"notfound\"", "X509 OID description #3\nx509_oid_desc:\"2B0601050507030100\":\"notfound\"", "X509 OID numstring #1 (wide buffer)\nx509_oid_numstr:\"2B06010505070301\":\"1.3.6.1.5.5.7.3.1\":20:17", "X509 OID numstring #2 (buffer just fits)\nx509_oid_numstr:\"2B06010505070301\":\"1.3.6.1.5.5.7.3.1\":18:17", "X509 OID numstring #3 (buffer too small)\nx509_oid_numstr:\"2B06010505070301\":\"1.3.6.1.5.5.7.3.1\":17:MBEDTLS_ERR_OID_BUF_TOO_SMALL", "X509 OID numstring #4 (larger number)\nx509_oid_numstr:\"2A864886F70D\":\"1.2.840.113549\":15:14", "X509 OID numstring #5 (arithmetic overflow)\nx509_oid_numstr:\"2A8648F9F8F7F6F5F4F3F2F1F001\":\"\":100:MBEDTLS_ERR_OID_BUF_TOO_SMALL", "X509 crt keyUsage #1 (no extension, expected KU)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.crt\":MBEDTLS_X509_KU_DIGITAL_SIGNATURE|MBEDTLS_X509_KU_KEY_ENCIPHERMENT:0", "X509 crt keyUsage #2 (no extension, surprising KU)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.crt\":MBEDTLS_X509_KU_KEY_CERT_SIGN:0", "X509 crt keyUsage #3 (extension present, no KU)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.key_usage.crt\":0:0", "X509 crt keyUsage #4 (extension present, single KU present)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.key_usage.crt\":MBEDTLS_X509_KU_DIGITAL_SIGNATURE:0", "X509 crt keyUsage #5 (extension present, single KU absent)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.key_usage.crt\":MBEDTLS_X509_KU_KEY_CERT_SIGN:MBEDTLS_ERR_X509_BAD_INPUT_DATA", "X509 crt keyUsage #6 (extension present, combined KU present)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.key_usage.crt\":MBEDTLS_X509_KU_DIGITAL_SIGNATURE|MBEDTLS_X509_KU_KEY_ENCIPHERMENT:0", "X509 crt keyUsage #7 (extension present, combined KU both absent)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.key_usage.crt\":MBEDTLS_X509_KU_KEY_CERT_SIGN|MBEDTLS_X509_KU_CRL_SIGN:MBEDTLS_ERR_X509_BAD_INPUT_DATA", "X509 crt keyUsage #8 (extension present, combined KU one absent)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.key_usage.crt\":MBEDTLS_X509_KU_KEY_ENCIPHERMENT|MBEDTLS_X509_KU_KEY_AGREEMENT:MBEDTLS_ERR_X509_BAD_INPUT_DATA", "X509 crt keyUsage #9 (extension present, decOnly allowed absent)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/server1.key_usage.crt\":MBEDTLS_X509_KU_DIGITAL_SIGNATURE|MBEDTLS_X509_KU_KEY_ENCIPHERMENT|MBEDTLS_X509_KU_DECIPHER_ONLY:0", "X509 crt keyUsage #10 (extension present, decOnly non-allowed present)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/keyUsage.decipherOnly.crt\":MBEDTLS_X509_KU_DIGITAL_SIGNATURE|MBEDTLS_X509_KU_KEY_ENCIPHERMENT:MBEDTLS_ERR_X509_BAD_INPUT_DATA", "X509 crt keyUsage #11 (extension present, decOnly allowed present)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_check_key_usage:\"data_files/keyUsage.decipherOnly.crt\":MBEDTLS_X509_KU_DIGITAL_SIGNATURE|MBEDTLS_X509_KU_KEY_ENCIPHERMENT|MBEDTLS_X509_KU_DECIPHER_ONLY:0", "X509 crt extendedKeyUsage #1 (no extension, serverAuth)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_check_extended_key_usage:\"data_files/server5.crt\":\"2B06010505070301\":0", "X509 crt extendedKeyUsage #2 (single value, present)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_check_extended_key_usage:\"data_files/server5.eku-srv.crt\":\"2B06010505070301\":0", "X509 crt extendedKeyUsage #3 (single value, absent)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_check_extended_key_usage:\"data_files/server5.eku-cli.crt\":\"2B06010505070301\":MBEDTLS_ERR_X509_BAD_INPUT_DATA", "X509 crt extendedKeyUsage #4 (two values, first)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_check_extended_key_usage:\"data_files/server5.eku-srv_cli.crt\":\"2B06010505070301\":0", "X509 crt extendedKeyUsage #5 (two values, second)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_check_extended_key_usage:\"data_files/server5.eku-srv_cli.crt\":\"2B06010505070302\":0", "X509 crt extendedKeyUsage #6 (two values, other)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_check_extended_key_usage:\"data_files/server5.eku-srv_cli.crt\":\"2B06010505070303\":MBEDTLS_ERR_X509_BAD_INPUT_DATA", "X509 crt extendedKeyUsage #7 (any, random)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509_check_extended_key_usage:\"data_files/server5.eku-cs_any.crt\":\"2B060105050703FF\":0", "X509 RSASSA-PSS parameters ASN1 (good, all defaults)\nx509_parse_rsassa_pss_params:\"\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:0", "X509 RSASSA-PSS parameters ASN1 (wrong initial tag)\nx509_parse_rsassa_pss_params:\"\":MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 RSASSA-PSS parameters ASN1 (unknown tag in top-level sequence)\nx509_parse_rsassa_pss_params:\"A400\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 RSASSA-PSS parameters ASN1 (good, HashAlg SHA256)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_parse_rsassa_pss_params:\"A00D300B0609608648016503040201\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA256:MBEDTLS_MD_SHA1:20:0", "X509 RSASSA-PSS parameters ASN1 (good, explicit HashAlg = default)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_parse_rsassa_pss_params:\"A009300706052B0E03021A\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:0", "X509 RSASSA-PSS parameters ASN1 (HashAlg wrong len #1)\nx509_parse_rsassa_pss_params:\"A00A300706052B0E03021A\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 RSASSA-PSS parameters ASN1 (HashAlg wrong len #2)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_parse_rsassa_pss_params:\"A00A300706052B0E03021A00\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 RSASSA-PSS parameters ASN1 (HashAlg with parameters)\nx509_parse_rsassa_pss_params:\"A00F300D06096086480165030402013000\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA256:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_INVALID_DATA", "X509 RSASSA-PSS parameters ASN1 (HashAlg unknown OID)\nx509_parse_rsassa_pss_params:\"A00D300B06096086480165030402FF\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA256:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_OID_NOT_FOUND", "X509 RSASSA-PSS parameters ASN1 (good, MGAlg = MGF1-SHA256)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_parse_rsassa_pss_params:\"A11A301806092A864886F70D010108300B0609608648016503040201\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:0", "X509 RSASSA-PSS parameters ASN1 (good, explicit MGAlg = default)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA1_C\nx509_parse_rsassa_pss_params:\"A116301406092A864886F70D010108300706052B0E03021A\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:0", "X509 RSASSA-PSS parameters ASN1 (MGAlg wrong len #1)\nx509_parse_rsassa_pss_params:\"A11B301806092A864886F70D010108300B0609608648016503040201\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 RSASSA-PSS parameters ASN1 (MGAlg wrong len #2)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_parse_rsassa_pss_params:\"A11B301806092A864886F70D010108300B060960864801650304020100\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 RSASSA-PSS parameters ASN1 (MGAlg AlgId wrong len #1)\nx509_parse_rsassa_pss_params:\"A11A301906092A864886F70D010108300B0609608648016503040201\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 RSASSA-PSS parameters ASN1 (MGAlg OID != MGF1)\nx509_parse_rsassa_pss_params:\"A11A301806092A864886F70D010109300B0609608648016503040201\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE + MBEDTLS_ERR_OID_NOT_FOUND", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params wrong tag)\nx509_parse_rsassa_pss_params:\"A11A301806092A864886F70D010108310B0609608648016503040201\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params wrong len #1a)\nx509_parse_rsassa_pss_params:\"A10F300D06092A864886F70D0101083000\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params wrong len #1b)\nx509_parse_rsassa_pss_params:\"A11B301906092A864886F70D010108300C0609608648016503040201\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params.alg not an OID)\nx509_parse_rsassa_pss_params:\"A11A301806092A864886F70D010108300B0709608648016503040201\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params.alg unknown OID)\nx509_parse_rsassa_pss_params:\"A11A301806092A864886F70D010108300B06096086480165030402FF\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_OID_NOT_FOUND", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params.params NULL)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_parse_rsassa_pss_params:\"A11C301A06092A864886F70D010108300D06096086480165030402010500\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:0", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params.params wrong tag)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_parse_rsassa_pss_params:\"A11C301A06092A864886F70D010108300D06096086480165030402013000\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params wrong len #1c)\nx509_parse_rsassa_pss_params:\"A11D301B06092A864886F70D010108300E06096086480165030402010500\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 RSASSA-PSS parameters ASN1 (MGAlg.params wrong len #2)\ndepends_on:MBEDTLS_RSA_C:MBEDTLS_SHA256_C\nx509_parse_rsassa_pss_params:\"A11D301B06092A864886F70D010108300E0609608648016503040201050000\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA256:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 RSASSA-PSS parameters ASN1 (good, saltLen = 94)\nx509_parse_rsassa_pss_params:\"A20302015E\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:94:0", "X509 RSASSA-PSS parameters ASN1 (good, explicit saltLen = default)\nx509_parse_rsassa_pss_params:\"A203020114\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:0", "X509 RSASSA-PSS parameters ASN1 (saltLen wrong len #1)\nx509_parse_rsassa_pss_params:\"A20402015E\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:94:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 RSASSA-PSS parameters ASN1 (saltLen wrong len #2)\nx509_parse_rsassa_pss_params:\"A20402015E00\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:94:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 RSASSA-PSS parameters ASN1 (saltLen not an int)\nx509_parse_rsassa_pss_params:\"A2023000\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:94:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 RSASSA-PSS parameters ASN1 (good, explicit trailerField = default)\nx509_parse_rsassa_pss_params:\"A303020101\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:0", "X509 RSASSA-PSS parameters ASN1 (trailerField wrong len #1)\nx509_parse_rsassa_pss_params:\"A304020101\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 RSASSA-PSS parameters ASN1 (trailerField wrong len #2)\nx509_parse_rsassa_pss_params:\"A30402010100\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 RSASSA-PSS parameters ASN1 (trailerField not an int)\nx509_parse_rsassa_pss_params:\"A3023000\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 RSASSA-PSS parameters ASN1 (trailerField not 1)\nx509_parse_rsassa_pss_params:\"A303020102\":MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE:MBEDTLS_MD_SHA1:MBEDTLS_MD_SHA1:20:MBEDTLS_ERR_X509_INVALID_ALG", "X509 CSR ASN.1 (OK)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nmbedtls_x509_csr_parse:\"308201183081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E0300906072A8648CE3D04010349003046022100B49FD8C8F77ABFA871908DFBE684A08A793D0F490A43D86FCF2086E4F24BB0C2022100F829D5CCD3742369299E6294394717C4B723A0F68B44E831B6E6C3BCABF97243\":\"CSR version \\: 1\\nsubject name \\: C=NL, O=PolarSSL, CN=localhost\\nsigned using \\: ECDSA with SHA1\\nEC key size \\: 256 bits\\n\":0", "X509 CSR ASN.1 (bad first tag)\nmbedtls_x509_csr_parse:\"3100\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT", "X509 CSR ASN.1 (bad sequence: overlong)\nmbedtls_x509_csr_parse:\"3001\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT", "X509 CSR ASN.1 (total length mistmatch)\nmbedtls_x509_csr_parse:\"30010000\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 CSR ASN.1 (bad CRI: not a sequence)\nmbedtls_x509_csr_parse:\"30023100\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CSR ASN.1 (bad CRI: overlong)\nmbedtls_x509_csr_parse:\"30023001\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad CRI.Version: overlong)\nmbedtls_x509_csr_parse:\"30053002020100\":\"\":MBEDTLS_ERR_X509_INVALID_VERSION + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad CRI.Version: not v1)\nmbedtls_x509_csr_parse:\"30053003020101\":\"\":MBEDTLS_ERR_X509_UNKNOWN_VERSION", "X509 CSR ASN.1 (bad CRI.Name: not a sequence)\nmbedtls_x509_csr_parse:\"300730050201003100\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CSR ASN.1 (bad CRI.Name: overlong)\nmbedtls_x509_csr_parse:\"30083005020100300100\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad CRI.Name payload: not a set)\nmbedtls_x509_csr_parse:\"3009300702010030023000\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CSR ASN.1 (bad CRI.Name payload: overlong)\nmbedtls_x509_csr_parse:\"300A30080201003002310100\":\"\":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad SubjectPublicKeyInfo: missing)\nmbedtls_x509_csr_parse:\"30143012020100300D310B3009060355040613024E4C\":\"\":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad SubjectPublicKeyInfo: not a sequence)\nmbedtls_x509_csr_parse:\"30163014020100300D310B3009060355040613024E4C3100\":\"\":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CSR ASN.1 (bad SubjectPublicKeyInfo: overlong)\nmbedtls_x509_csr_parse:\"30173014020100300D310B3009060355040613024E4C300100\":\"\":MBEDTLS_ERR_PK_KEY_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad attributes: missing)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_csr_parse:\"3081973081940201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFF\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad attributes: bad tag)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_csr_parse:\"3081993081960201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFF0500\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CSR ASN.1 (bad attributes: overlong)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_csr_parse:\"30819A3081960201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA00100\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad sigAlg: missing)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_csr_parse:\"3081C23081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E0\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad sigAlg: not a sequence)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_csr_parse:\"3081C43081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E03100\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CSR ASN.1 (bad sigAlg: overlong)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_csr_parse:\"3081C43081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E03001\":\"\":MBEDTLS_ERR_X509_INVALID_ALG + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad sigAlg: unknown)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED\nmbedtls_x509_csr_parse:\"3081CD3081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E0300906072A8648CE3D04FF\":\"\":MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG", "X509 CSR ASN.1 (bad sig: missing)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nmbedtls_x509_csr_parse:\"3081CD3081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E0300906072A8648CE3D0401\":\"\":MBEDTLS_ERR_X509_INVALID_SIGNATURE + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (bad sig: not a bit string)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nmbedtls_x509_csr_parse:\"3081CF3081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E0300906072A8648CE3D04010400\":\"\":MBEDTLS_ERR_X509_INVALID_SIGNATURE + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG", "X509 CSR ASN.1 (bad sig: overlong)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nmbedtls_x509_csr_parse:\"3081CF3081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E0300906072A8648CE3D04010301\":\"\":MBEDTLS_ERR_X509_INVALID_SIGNATURE + MBEDTLS_ERR_ASN1_OUT_OF_DATA", "X509 CSR ASN.1 (extra data after signature)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA1_C\nmbedtls_x509_csr_parse:\"308201193081BF0201003034310B3009060355040613024E4C3111300F060355040A1308506F6C617253534C31123010060355040313096C6F63616C686F73743059301306072A8648CE3D020106082A8648CE3D0301070342000437CC56D976091E5A723EC7592DFF206EEE7CF9069174D0AD14B5F768225962924EE500D82311FFEA2FD2345D5D16BD8A88C26B770D55CD8A2A0EFA01C8B4EDFFA029302706092A864886F70D01090E311A301830090603551D1304023000300B0603551D0F0404030205E0300906072A8648CE3D04010349003046022100B49FD8C8F77ABFA871908DFBE684A08A793D0F490A43D86FCF2086E4F24BB0C2022100F829D5CCD3742369299E6294394717C4B723A0F68B44E831B6E6C3BCABF9724300\":\"\":MBEDTLS_ERR_X509_INVALID_FORMAT + MBEDTLS_ERR_ASN1_LENGTH_MISMATCH", "X509 File parse (no issues)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509parse_crt_file:\"data_files/server7_int-ca.crt\":0", "X509 File parse (extra space in one certificate)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_SHA256_C\nx509parse_crt_file:\"data_files/server7_pem_space.crt\":1", "X509 File parse (all certificates fail)\ndepends_on:MBEDTLS_ECP_C\nx509parse_crt_file:\"data_files/server7_all_space.crt\":MBEDTLS_ERR_PEM_INVALID_DATA + MBEDTLS_ERR_BASE64_INVALID_CHARACTER", "X509 File parse (trailing spaces, OK)\ndepends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C\nx509parse_crt_file:\"data_files/server7_trailing_space.crt\":0", "X509 Get time (UTC no issues)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"500101000000Z\":0:1950:1:1:0:0:0", "X509 Get time (Generalized Time no issues)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_GENERALIZED_TIME:\"99991231235959Z\":0:9999:12:31:23:59:59", "X509 Get time (UTC year without leap day)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"490229121212Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC year with leap day)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"000229121212Z\":0:2000:2:29:12:12:12", "X509 Get time (UTC invalid day of month #1)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"000132121212Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid day of month #2)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"001131121212Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid hour)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"001130241212Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid min)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"001130236012Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid sec)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"001130235960Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC without time zone)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"000229121212\":0:2000:2:29:12:12:12", "X509 Get time (UTC with invalid time zone #1)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"000229121212J\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC with invalid time zone #2)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"000229121212+0300\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (Date with invalid tag)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_CONTEXT_SPECIFIC:\"000229121212\":MBEDTLS_ERR_X509_INVALID_DATE+MBEDTLS_ERR_ASN1_UNEXPECTED_TAG:0:0:0:0:0:0", "X509 Get time (UTC, truncated)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"000229121\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (Generalized Time, truncated)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_GENERALIZED_TIME:\"20000229121\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC without seconds)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"0002291212\":MBEDTLS_ERR_X509_INVALID_DATE:2000:2:29:12:12:0", "X509 Get time (UTC without seconds and with invalid time zone #1)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"0002291212J\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC without second and with invalid time zone #2)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"0002291212+0300\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid character in year)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"0\\1130231212Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid character in month)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"001%30231212Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid character in day)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"0011`0231212Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid character in hour)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"0011302h1212Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid character in min)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"00113023u012Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0", "X509 Get time (UTC invalid character in sec)\ndepends_on:MBEDTLS_X509_USE_C\nx509_get_time:MBEDTLS_ASN1_UTC_TIME:\"0011302359n0Z\":MBEDTLS_ERR_X509_INVALID_DATE:0:0:0:0:0:0" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [8, 75, 1056, 78, 271, 482, 2312, 1208], "buggy_code_start_loc": [8, 74, 1055, 78, 270, 482, 2060, 1207], "filenames": ["ChangeLog", "include/mbedtls/error.h", "include/mbedtls/ssl.h", "include/mbedtls/x509.h", "include/mbedtls/x509_crt.h", "library/error.c", "library/x509_crt.c", "tests/suites/test_suite_x509parse.data"], "fixing_code_end_loc": [12, 75, 1056, 80, 277, 485, 2317, 1208], "fixing_code_start_loc": [9, 74, 1055, 79, 270, 483, 2060, 1207], "message": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.10:*:*:*:*:*:*:*", "matchCriteriaId": "28621156-2430-447B-8816-47B0FB58245B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.11:*:*:*:*:*:*:*", "matchCriteriaId": "E11BBB2C-0423-47B1-AE12-EB849E17BAF6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.12:*:*:*:*:*:*:*", "matchCriteriaId": "4131CE76-6260-412C-A6A6-20B0E978E569", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.13:*:*:*:*:*:*:*", "matchCriteriaId": "DE92D8F7-5705-47B6-B2C2-9DE6C7880647", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.14:*:*:*:*:*:*:*", "matchCriteriaId": "EA50C256-2054-4661-9C42-D31D7D87BAF7", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.15:*:*:*:*:*:*:*", "matchCriteriaId": "7791D4E9-3FEE-42DA-B320-CF7188A10294", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.16:*:*:*:*:*:*:*", "matchCriteriaId": "BE415DAA-A89F-4204-AC2C-577FCB447E4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.17:*:*:*:*:*:*:*", "matchCriteriaId": "95F691DB-9552-4EBB-B29D-16658561FA4B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.18:*:*:*:*:*:*:*", "matchCriteriaId": "F1547B2A-E0D5-41D1-9449-1CCF35022B0E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.19:*:*:*:*:*:*:*", "matchCriteriaId": "CF762122-64BC-4A1A-A26D-81C1270541A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.20:*:*:*:*:*:*:*", "matchCriteriaId": "59D6B559-5F99-4E38-A861-3AB8A7D2E6BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:1.3.21:*:*:*:*:*:*:*", "matchCriteriaId": "4A8956C8-6CF0-4C37-84F9-8A89726806C3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "0B395D81-876F-43FC-8DB9-44377647A37A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "F92622F1-82DA-4819-8275-06DC9DBE1BA1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "5871FDE9-02D0-466C-BDB7-90A14C4F637E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE6B4875-3FC3-499F-A76B-2D04982F743A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "B3B67842-5AFA-459F-9CCF-772B9DC7139F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "AD0500EE-52C0-4896-B3D8-5BE731D66039", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "015739E9-C0E3-4A62-BB9D-FA836BFD4351", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "842B0D15-6A3D-4CEE-AD02-49B0436E78E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "3CF6E05C-E6E5-40B8-AFEA-A5ED937F5439", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "D4133C86-70E0-44FD-BBDB-D61EFB31F027", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "6F9D24F0-3892-417F-9C3A-CACEF00C2293", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "8911513E-968C-403E-9D00-2DC0AA82F99B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "48D98945-82BB-4954-AA6D-7D98E4CE1154", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "6378C1CC-7C8F-47E3-A1A7-CDEC76E4CBE4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "525190A3-2194-4E4E-9D34-0048583B9C42", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "70407352-624A-40E6-82E4-7B4FAFE0C0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "DD52988E-4B2F-41AF-BC25-F38F87D9B8C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:arm:mbed_tls:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "FD1F7803-31F3-40A9-A878-FDC757FCE83F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ARM mbed TLS before 1.3.21 and 2.x before 2.1.9, if optional authentication is configured, allows remote attackers to bypass peer authentication via an X.509 certificate chain with many intermediates. NOTE: although mbed TLS was formerly known as PolarSSL, the releases shipped with the PolarSSL name are not affected."}, {"lang": "es", "value": "ARM mbed TLS en versiones anteriores a la 1.3.21 y en versiones 2.x anteriores a la 2.1.9, si se configura la autenticaci\u00f3n opcional, permite a los atacantes omitir la autenticaci\u00f3n Peer mediante una cadena de certificados X.509 con muchos intermediarios. NOTA: aunque mbed TLS se conoc\u00eda antes como PolarSSL, las versiones lanzadas con el nombre PolarSSL no est\u00e1n afectadas."}], "evaluatorComment": null, "id": "CVE-2017-14032", "lastModified": "2017-11-08T02:29:02.850", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-08-30T20:29:00.337", "references": [{"source": "cve@mitre.org", "tags": null, "url": "http://www.debian.org/security/2017/dsa-3967"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://bugs.debian.org/873557"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ARMmbed/mbedtls/commit/d15795acd5074e0b44e71f7ede8bdfe1b48591fc"}, {"source": "cve@mitre.org", "tags": ["Vendor Advisory"], "url": "https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2017-02"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ARMmbed/mbedtls/commit/31458a18788b0cf0b722acda9bb2f2fe13a3fb32"}, "type": "CWE-287"}
351
Determine whether the {function_name} code is vulnerable or not.
[ "\" Tests for autocommands", "source shared.vim\nsource check.vim\nsource term_util.vim", "func s:cleanup_buffers() abort\n for bnr in range(1, bufnr('$'))\n if bufloaded(bnr) && bufnr('%') != bnr\n execute 'bd! ' . bnr\n endif\n endfor\nendfunc", "func Test_vim_did_enter()\n call assert_false(v:vim_did_enter)", " \" This script will never reach the main loop, can't check if v:vim_did_enter\n \" becomes one.\nendfunc", "if has('timers')", " func ExitInsertMode(id)\n call feedkeys(\"\\<Esc>\")\n endfunc", " func Test_cursorhold_insert()\n \" Need to move the cursor.\n call feedkeys(\"ggG\", \"xt\")", " let g:triggered = 0\n au CursorHoldI * let g:triggered += 1\n set updatetime=20\n call timer_start(100, 'ExitInsertMode')\n call feedkeys('a', 'x!')\n call assert_equal(1, g:triggered)\n unlet g:triggered\n au! CursorHoldI\n set updatetime&\n endfunc", " func Test_cursorhold_insert_with_timer_interrupt()\n if !has('job')\n return\n endif\n \" Need to move the cursor.\n call feedkeys(\"ggG\", \"xt\")", " \" Confirm the timer invoked in exit_cb of the job doesn't disturb\n \" CursorHoldI event.\n let g:triggered = 0\n au CursorHoldI * let g:triggered += 1\n set updatetime=500\n call job_start(has('win32') ? 'cmd /c echo:' : 'echo',\n \\ {'exit_cb': {-> timer_start(1000, 'ExitInsertMode')}})\n call feedkeys('a', 'x!')\n call assert_equal(1, g:triggered)\n unlet g:triggered\n au! CursorHoldI\n set updatetime&\n endfunc", " func Test_cursorhold_insert_ctrl_x()\n let g:triggered = 0\n au CursorHoldI * let g:triggered += 1\n set updatetime=20\n call timer_start(100, 'ExitInsertMode')\n \" CursorHoldI does not trigger after CTRL-X\n call feedkeys(\"a\\<C-X>\", 'x!')\n call assert_equal(0, g:triggered)\n unlet g:triggered\n au! CursorHoldI\n set updatetime&\n endfunc", " func Test_OptionSet_modeline()\n call test_override('starting', 1)\n au! OptionSet\n augroup set_tabstop\n au OptionSet tabstop call timer_start(1, {-> execute(\"echo 'Handler called'\", \"\")})\n augroup END\n call writefile(['vim: set ts=7 sw=5 :', 'something'], 'XoptionsetModeline')\n set modeline\n let v:errmsg = ''\n call assert_fails('split XoptionsetModeline', 'E12:')\n call assert_equal(7, &ts)\n call assert_equal('', v:errmsg)", " augroup set_tabstop\n au!\n augroup END\n bwipe!\n set ts&\n call delete('XoptionsetModeline')\n call test_override('starting', 0)\n endfunc", "endif \"has('timers')", "func Test_bufunload()\n augroup test_bufunload_group\n autocmd!\n autocmd BufUnload * call add(s:li, \"bufunload\")\n autocmd BufDelete * call add(s:li, \"bufdelete\")\n autocmd BufWipeout * call add(s:li, \"bufwipeout\")\n augroup END", " let s:li=[]\n new\n setlocal bufhidden=\n bunload\n call assert_equal([\"bufunload\", \"bufdelete\"], s:li)", " let s:li=[]\n new\n setlocal bufhidden=delete\n bunload\n call assert_equal([\"bufunload\", \"bufdelete\"], s:li)", " let s:li=[]\n new\n setlocal bufhidden=unload\n bwipeout\n call assert_equal([\"bufunload\", \"bufdelete\", \"bufwipeout\"], s:li)", " au! test_bufunload_group\n augroup! test_bufunload_group\nendfunc", "\" SEGV occurs in older versions. (At least 7.4.2005 or older)\nfunc Test_autocmd_bufunload_with_tabnext()\n tabedit\n tabfirst", " augroup test_autocmd_bufunload_with_tabnext_group\n autocmd!\n autocmd BufUnload <buffer> tabnext\n augroup END", " quit\n call assert_equal(2, tabpagenr('$'))", " autocmd! test_autocmd_bufunload_with_tabnext_group\n augroup! test_autocmd_bufunload_with_tabnext_group\n tablast\n quit\nendfunc", "func Test_autocmd_bufwinleave_with_tabfirst()\n tabedit\n augroup sample\n autocmd!\n autocmd BufWinLeave <buffer> tabfirst\n augroup END\n call setline(1, ['a', 'b', 'c'])\n edit! a.txt\n tabclose\nendfunc", "\" SEGV occurs in older versions. (At least 7.4.2321 or older)\nfunc Test_autocmd_bufunload_avoiding_SEGV_01()\n split aa.txt\n let lastbuf = bufnr('$')", " augroup test_autocmd_bufunload\n autocmd!\n exe 'autocmd BufUnload <buffer> ' . (lastbuf + 1) . 'bwipeout!'\n augroup END", " \" Todo: check for E937 generated first\n \" call assert_fails('edit bb.txt', 'E937:')\n call assert_fails('edit bb.txt', 'E517:')", " autocmd! test_autocmd_bufunload\n augroup! test_autocmd_bufunload\n bwipe! aa.txt\n bwipe! bb.txt\nendfunc", "\" SEGV occurs in older versions. (At least 7.4.2321 or older)\nfunc Test_autocmd_bufunload_avoiding_SEGV_02()\n setlocal buftype=nowrite\n let lastbuf = bufnr('$')", " augroup test_autocmd_bufunload\n autocmd!\n exe 'autocmd BufUnload <buffer> ' . (lastbuf + 1) . 'bwipeout!'\n augroup END", " normal! i1\n call assert_fails('edit a.txt', 'E517:')\n call feedkeys(\"\\<CR>\")", " autocmd! test_autocmd_bufunload\n augroup! test_autocmd_bufunload\n bwipe! a.txt\nendfunc", "func Test_win_tab_autocmd()\n let g:record = []", " augroup testing\n au WinNew * call add(g:record, 'WinNew')\n au WinEnter * call add(g:record, 'WinEnter') \n au WinLeave * call add(g:record, 'WinLeave') \n au TabNew * call add(g:record, 'TabNew')\n au TabClosed * call add(g:record, 'TabClosed')\n au TabEnter * call add(g:record, 'TabEnter')\n au TabLeave * call add(g:record, 'TabLeave')\n augroup END", " split\n tabnew\n close\n close", " call assert_equal([\n\t\\ 'WinLeave', 'WinNew', 'WinEnter',\n\t\\ 'WinLeave', 'TabLeave', 'WinNew', 'WinEnter', 'TabNew', 'TabEnter',\n\t\\ 'WinLeave', 'TabLeave', 'TabClosed', 'WinEnter', 'TabEnter',\n\t\\ 'WinLeave', 'WinEnter'\n\t\\ ], g:record)", " let g:record = []\n tabnew somefile\n tabnext\n bwipe somefile", " call assert_equal([\n\t\\ 'WinLeave', 'TabLeave', 'WinNew', 'WinEnter', 'TabNew', 'TabEnter',\n\t\\ 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter',\n\t\\ 'TabClosed'\n\t\\ ], g:record)", " augroup testing\n au!\n augroup END\n unlet g:record\nendfunc", "func s:AddAnAutocmd()\n augroup vimBarTest\n au BufReadCmd * echo 'hello'\n augroup END\n call assert_equal(3, len(split(execute('au vimBarTest'), \"\\n\")))\nendfunc", "func Test_early_bar()\n \" test that a bar is recognized before the {event}\n call s:AddAnAutocmd()\n augroup vimBarTest | au! | augroup END\n call assert_equal(1, len(split(execute('au vimBarTest'), \"\\n\")))", " call s:AddAnAutocmd()\n augroup vimBarTest| au!| augroup END\n call assert_equal(1, len(split(execute('au vimBarTest'), \"\\n\")))", " \" test that a bar is recognized after the {event}\n call s:AddAnAutocmd()\n augroup vimBarTest| au!BufReadCmd| augroup END\n call assert_equal(1, len(split(execute('au vimBarTest'), \"\\n\")))", " \" test that a bar is recognized after the {group}\n call s:AddAnAutocmd()\n au! vimBarTest|echo 'hello'\n call assert_equal(1, len(split(execute('au vimBarTest'), \"\\n\")))\nendfunc", "func RemoveGroup()\n autocmd! StartOK\n augroup! StartOK\nendfunc", "func Test_augroup_warning()\n augroup TheWarning\n au VimEnter * echo 'entering'\n augroup END\n call assert_true(match(execute('au VimEnter'), \"TheWarning.*VimEnter\") >= 0)\n redir => res\n augroup! TheWarning\n redir END\n call assert_true(match(res, \"W19:\") >= 0)\n call assert_true(match(execute('au VimEnter'), \"-Deleted-.*VimEnter\") >= 0)", " \" check \"Another\" does not take the pace of the deleted entry\n augroup Another\n augroup END\n call assert_true(match(execute('au VimEnter'), \"-Deleted-.*VimEnter\") >= 0)\n augroup! Another", " \" no warning for postpone aucmd delete\n augroup StartOK\n au VimEnter * call RemoveGroup()\n augroup END\n call assert_true(match(execute('au VimEnter'), \"StartOK.*VimEnter\") >= 0)\n redir => res\n doautocmd VimEnter\n redir END\n call assert_true(match(res, \"W19:\") < 0)\n au! VimEnter\nendfunc", "func Test_BufReadCmdHelp()\n \" This used to cause access to free memory\n au BufReadCmd * e +h\n help", " au! BufReadCmd\nendfunc", "func Test_BufReadCmdHelpJump()\n \" This used to cause access to free memory\n au BufReadCmd * e +h{\n \" } to fix highlighting\n call assert_fails('help', 'E434:')", " au! BufReadCmd\nendfunc", "func Test_augroup_deleted()\n \" This caused a crash before E936 was introduced\n augroup x\n call assert_fails('augroup! x', 'E936:')\n au VimEnter * echo\n augroup end\n augroup! x\n call assert_true(match(execute('au VimEnter'), \"-Deleted-.*VimEnter\") >= 0)\n au! VimEnter\nendfunc", "\" Tests for autocommands on :close command.\n\" This used to be in test13.\nfunc Test_three_windows()\n \" Clean up buffers, because in some cases this function fails.\n call s:cleanup_buffers()", " \" Write three files and open them, each in a window.\n \" Then go to next window, with autocommand that deletes the previous one.\n \" Do this twice, writing the file.\n e! Xtestje1\n call setline(1, 'testje1')\n w\n sp Xtestje2\n call setline(1, 'testje2')\n w\n sp Xtestje3\n call setline(1, 'testje3')\n w\n wincmd w\n au WinLeave Xtestje2 bwipe\n wincmd w\n call assert_equal('Xtestje1', expand('%'))", " au WinLeave Xtestje1 bwipe Xtestje3\n close\n call assert_equal('Xtestje1', expand('%'))", " \" Test deleting the buffer on a Unload event. If this goes wrong there\n \" will be the ATTENTION prompt.\n e Xtestje1\n au!\n au! BufUnload Xtestje1 bwipe\n call assert_fails('e Xtestje3', 'E937:')\n call assert_equal('Xtestje3', expand('%'))", " e Xtestje2\n sp Xtestje1\n call assert_fails('e', 'E937:')\n call assert_equal('Xtestje1', expand('%'))", " \" Test changing buffers in a BufWipeout autocommand. If this goes wrong\n \" there are ml_line errors and/or a Crash.\n au!\n only\n e Xanother\n e Xtestje1\n bwipe Xtestje2\n bwipe Xtestje3\n au BufWipeout Xtestje1 buf Xtestje1\n bwipe\n call assert_equal('Xanother', expand('%'))", " only\n help\n wincmd w\n 1quit\n call assert_equal('Xanother', expand('%'))", " au!\n enew\n call delete('Xtestje1')\n call delete('Xtestje2')\n call delete('Xtestje3')\nendfunc", "func Test_BufEnter()\n au! BufEnter\n au Bufenter * let val = val . '+'\n let g:val = ''\n split NewFile\n call assert_equal('+', g:val)\n bwipe!\n call assert_equal('++', g:val)", " \" Also get BufEnter when editing a directory\n call mkdir('Xdir')\n split Xdir\n call assert_equal('+++', g:val)", " \" On MS-Windows we can't edit the directory, make sure we wipe the right\n \" buffer.\n bwipe! Xdir", " call delete('Xdir', 'd')\n au! BufEnter\nendfunc", "\" Closing a window might cause an endless loop\n\" E814 for older Vims\nfunc Test_autocmd_bufwipe_in_SessLoadPost()\n edit Xtest\n tabnew\n file Xsomething\n set noswapfile\n mksession!", " let content =<< trim [CODE]\n set nocp noswapfile\n let v:swapchoice=\"e\"\n augroup test_autocmd_sessionload\n autocmd!\n autocmd SessionLoadPost * exe bufnr(\"Xsomething\") . \"bw!\"\n augroup END", " func WriteErrors()\n call writefile([execute(\"messages\")], \"Xerrors\")\n endfunc\n au VimLeave * call WriteErrors()\n [CODE]", " call writefile(content, 'Xvimrc')\n call system(GetVimCommand('Xvimrc') .. ' --not-a-term --noplugins -S Session.vim -c cq')\n let errors = join(readfile('Xerrors'))\n call assert_match('E814', errors)", " set swapfile\n for file in ['Session.vim', 'Xvimrc', 'Xerrors']\n call delete(file)\n endfor\nendfunc", "\" SEGV occurs in older versions.\nfunc Test_autocmd_bufwipe_in_SessLoadPost2()\n tabnew\n set noswapfile\n mksession!", " let content =<< trim [CODE]\n set nocp noswapfile\n function! DeleteInactiveBufs()\n tabfirst\n let tabblist = []\n for i in range(1, tabpagenr(''$''))\n call extend(tabblist, tabpagebuflist(i))\n endfor\n for b in range(1, bufnr(''$''))\n if bufexists(b) && buflisted(b) && (index(tabblist, b) == -1 || bufname(b) =~# ''^$'')\n exec ''bwipeout '' . b\n endif\n endfor\n echomsg \"SessionLoadPost DONE\"\n endfunction\n au SessionLoadPost * call DeleteInactiveBufs()", " func WriteErrors()\n call writefile([execute(\"messages\")], \"Xerrors\")\n endfunc\n au VimLeave * call WriteErrors()\n [CODE]", " call writefile(content, 'Xvimrc')\n call system(GetVimCommand('Xvimrc') .. ' --not-a-term --noplugins -S Session.vim -c cq')\n let errors = join(readfile('Xerrors'))\n \" This probably only ever matches on unix.\n call assert_notmatch('Caught deadly signal SEGV', errors)\n call assert_match('SessionLoadPost DONE', errors)", " set swapfile\n for file in ['Session.vim', 'Xvimrc', 'Xerrors']\n call delete(file)\n endfor\nendfunc", "func Test_empty_doau()\n doau \\|\nendfunc", "func s:AutoCommandOptionSet(match)\n let template = \"Option: <%s>, OldVal: <%s>, OldValLocal: <%s>, OldValGlobal: <%s>, NewVal: <%s>, Scope: <%s>, Command: <%s>\\n\"\n let item = remove(g:options, 0)\n let expected = printf(template, item[0], item[1], item[2], item[3], item[4], item[5], item[6])\n let actual = printf(template, a:match, v:option_old, v:option_oldlocal, v:option_oldglobal, v:option_new, v:option_type, v:option_command)\n let g:opt = [expected, actual]\n \"call assert_equal(expected, actual)\nendfunc", "func Test_OptionSet()\n if !has(\"eval\") || !exists(\"+autochdir\")\n return\n endif", " badd test_autocmd.vim", " call test_override('starting', 1)\n set nocp\n au OptionSet * :call s:AutoCommandOptionSet(expand(\"<amatch>\"))", " \" 1: Setting number option\"\n let g:options=[['number', 0, 0, 0, 1, 'global', 'set']]\n set nu\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 2: Setting local number option\"\n let g:options=[['number', 1, 1, '', 0, 'local', 'setlocal']]\n setlocal nonu\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 3: Setting global number option\"\n let g:options=[['number', 1, '', 1, 0, 'global', 'setglobal']]\n setglobal nonu\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 4: Setting local autoindent option\"\n let g:options=[['autoindent', 0, 0, '', 1, 'local', 'setlocal']]\n setlocal ai\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 5: Setting global autoindent option\"\n let g:options=[['autoindent', 0, '', 0, 1, 'global', 'setglobal']]\n setglobal ai\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 6: Setting global autoindent option\"\n let g:options=[['autoindent', 1, 1, 1, 0, 'global', 'set']]\n set ai!\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 6a: Setting global autoindent option\"\n let g:options=[['autoindent', 1, 1, 0, 0, 'global', 'set']]\n noa setlocal ai\n noa setglobal noai\n set ai!\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" Should not print anything, use :noa\n \" 7: don't trigger OptionSet\"\n let g:options=[['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid']]\n noa set nonu\n call assert_equal([['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid']], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 8: Setting several global list and number option\"\n let g:options=[['list', 0, 0, 0, 1, 'global', 'set'], ['number', 0, 0, 0, 1, 'global', 'set']]\n set list nu\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 9: don't trigger OptionSet\"\n let g:options=[['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid'], ['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid']]\n noa set nolist nonu\n call assert_equal([['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid'], ['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid']], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 10: Setting global acd\"\n let g:options=[['autochdir', 0, 0, '', 1, 'local', 'setlocal']]\n setlocal acd\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 11: Setting global autoread (also sets local value)\"\n let g:options=[['autoread', 0, 0, 0, 1, 'global', 'set']]\n set ar\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 12: Setting local autoread\"\n let g:options=[['autoread', 1, 1, '', 1, 'local', 'setlocal']]\n setlocal ar\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 13: Setting global autoread\"\n let g:options=[['autoread', 1, '', 1, 0, 'global', 'setglobal']]\n setglobal invar\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 14: Setting option backspace through :let\"\n let g:options=[['backspace', '', '', '', 'eol,indent,start', 'global', 'set']]\n let &bs=\"eol,indent,start\"\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 15: Setting option backspace through setbufvar()\"\n let g:options=[['backup', 0, 0, '', 1, 'local', 'setlocal']]\n \" try twice, first time, shouldn't trigger because option name is invalid,\n \" second time, it should trigger\n let bnum = bufnr('%')\n call assert_fails(\"call setbufvar(bnum, '&l:bk', 1)\", \"E355\")\n \" should trigger, use correct option name\n call setbufvar(bnum, '&backup', 1)\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 16: Setting number option using setwinvar\"\n let g:options=[['number', 0, 0, '', 1, 'local', 'setlocal']]\n call setwinvar(0, '&number', 1)\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 17: Setting key option, shouldn't trigger\"\n let g:options=[['key', 'invalid', 'invalid1', 'invalid2', 'invalid3', 'invalid4', 'invalid5']]\n setlocal key=blah\n setlocal key=\n call assert_equal([['key', 'invalid', 'invalid1', 'invalid2', 'invalid3', 'invalid4', 'invalid5']], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 18a: Setting string global option\"\n let oldval = &backupext\n let g:options=[['backupext', oldval, oldval, oldval, 'foo', 'global', 'set']]\n set backupext=foo\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 18b: Resetting string global option\"\n let g:options=[['backupext', 'foo', 'foo', 'foo', oldval, 'global', 'set']]\n set backupext&\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 18c: Setting global string global option\"\n let g:options=[['backupext', oldval, '', oldval, 'bar', 'global', 'setglobal']]\n setglobal backupext=bar\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 18d: Setting local string global option\"\n \" As this is a global option this sets the global value even though\n \" :setlocal is used!\n noa set backupext& \" Reset global and local value (without triggering autocmd)\n let g:options=[['backupext', oldval, oldval, '', 'baz', 'local', 'setlocal']]\n setlocal backupext=baz\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 18e: Setting again string global option\"\n noa setglobal backupext=ext_global \" Reset global and local value (without triggering autocmd)\n noa setlocal backupext=ext_local \" Sets the global(!) value!\n let g:options=[['backupext', 'ext_local', 'ext_local', 'ext_local', 'fuu', 'global', 'set']]\n set backupext=fuu\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 19a: Setting string local-global (to buffer) option\"\n let oldval = &tags\n let g:options=[['tags', oldval, oldval, oldval, 'tagpath', 'global', 'set']]\n set tags=tagpath\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 19b: Resetting string local-global (to buffer) option\"\n let g:options=[['tags', 'tagpath', 'tagpath', 'tagpath', oldval, 'global', 'set']]\n set tags&\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 19c: Setting global string local-global (to buffer) option \"\n let g:options=[['tags', oldval, '', oldval, 'tagpath1', 'global', 'setglobal']]\n setglobal tags=tagpath1\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 19d: Setting local string local-global (to buffer) option\"\n let g:options=[['tags', 'tagpath1', 'tagpath1', '', 'tagpath2', 'local', 'setlocal']]\n setlocal tags=tagpath2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 19e: Setting again string local-global (to buffer) option\"\n \" Note: v:option_old is the old global value for local-global string options\n \" but the old local value for all other kinds of options.\n noa setglobal tags=tag_global \" Reset global and local value (without triggering autocmd)\n noa setlocal tags=tag_local\n let g:options=[['tags', 'tag_global', 'tag_local', 'tag_global', 'tagpath', 'global', 'set']]\n set tags=tagpath\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 19f: Setting string local-global (to buffer) option to an empty string\"\n \" Note: v:option_old is the old global value for local-global string options\n \" but the old local value for all other kinds of options.\n noa set tags=tag_global \" Reset global and local value (without triggering autocmd)\n noa setlocal tags= \" empty string\n let g:options=[['tags', 'tag_global', '', 'tag_global', 'tagpath', 'global', 'set']]\n set tags=tagpath\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 20a: Setting string local (to buffer) option\"\n let oldval = &spelllang\n let g:options=[['spelllang', oldval, oldval, oldval, 'elvish,klingon', 'global', 'set']]\n set spelllang=elvish,klingon\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 20b: Resetting string local (to buffer) option\"\n let g:options=[['spelllang', 'elvish,klingon', 'elvish,klingon', 'elvish,klingon', oldval, 'global', 'set']]\n set spelllang&\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 20c: Setting global string local (to buffer) option\"\n let g:options=[['spelllang', oldval, '', oldval, 'elvish', 'global', 'setglobal']]\n setglobal spelllang=elvish\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 20d: Setting local string local (to buffer) option\"\n noa set spelllang& \" Reset global and local value (without triggering autocmd)\n let g:options=[['spelllang', oldval, oldval, '', 'klingon', 'local', 'setlocal']]\n setlocal spelllang=klingon\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 20e: Setting again string local (to buffer) option\"\n \" Note: v:option_old is the old global value for local-global string options\n \" but the old local value for all other kinds of options.\n noa setglobal spelllang=spellglobal \" Reset global and local value (without triggering autocmd)\n noa setlocal spelllang=spelllocal\n let g:options=[['spelllang', 'spelllocal', 'spelllocal', 'spellglobal', 'foo', 'global', 'set']]\n set spelllang=foo\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 21a: Setting string local-global (to window) option\"\n let oldval = &statusline\n let g:options=[['statusline', oldval, oldval, oldval, 'foo', 'global', 'set']]\n set statusline=foo\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 21b: Resetting string local-global (to window) option\"\n \" Note: v:option_old is the old global value for local-global string options\n \" but the old local value for all other kinds of options.\n let g:options=[['statusline', 'foo', 'foo', 'foo', oldval, 'global', 'set']]\n set statusline&\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 21c: Setting global string local-global (to window) option\"\n let g:options=[['statusline', oldval, '', oldval, 'bar', 'global', 'setglobal']]\n setglobal statusline=bar\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 21d: Setting local string local-global (to window) option\"\n noa set statusline& \" Reset global and local value (without triggering autocmd)\n let g:options=[['statusline', oldval, oldval, '', 'baz', 'local', 'setlocal']]\n setlocal statusline=baz\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 21e: Setting again string local-global (to window) option\"\n \" Note: v:option_old is the old global value for local-global string options\n \" but the old local value for all other kinds of options.\n noa setglobal statusline=bar \" Reset global and local value (without triggering autocmd)\n noa setlocal statusline=baz\n let g:options=[['statusline', 'bar', 'baz', 'bar', 'foo', 'global', 'set']]\n set statusline=foo\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 22a: Setting string local (to window) option\"\n let oldval = &foldignore\n let g:options=[['foldignore', oldval, oldval, oldval, 'fo', 'global', 'set']]\n set foldignore=fo\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 22b: Resetting string local (to window) option\"\n let g:options=[['foldignore', 'fo', 'fo', 'fo', oldval, 'global', 'set']]\n set foldignore&\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 22c: Setting global string local (to window) option\"\n let g:options=[['foldignore', oldval, '', oldval, 'bar', 'global', 'setglobal']]\n setglobal foldignore=bar\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 22d: Setting local string local (to window) option\"\n noa set foldignore& \" Reset global and local value (without triggering autocmd)\n let g:options=[['foldignore', oldval, oldval, '', 'baz', 'local', 'setlocal']]\n setlocal foldignore=baz\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 22e: Setting again string local (to window) option\"\n noa setglobal foldignore=glob \" Reset global and local value (without triggering autocmd)\n noa setlocal foldignore=loc\n let g:options=[['foldignore', 'loc', 'loc', 'glob', 'fo', 'global', 'set']]\n set foldignore=fo\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 23a: Setting global number local option\"\n noa setglobal cmdheight=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal cmdheight=1 \" Sets the global(!) value!\n let g:options=[['cmdheight', '1', '', '1', '2', 'global', 'setglobal']]\n setglobal cmdheight=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 23b: Setting local number global option\"\n noa setglobal cmdheight=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal cmdheight=1 \" Sets the global(!) value!\n let g:options=[['cmdheight', '1', '1', '', '2', 'local', 'setlocal']]\n setlocal cmdheight=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 23c: Setting again number global option\"\n noa setglobal cmdheight=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal cmdheight=1 \" Sets the global(!) value!\n let g:options=[['cmdheight', '1', '1', '1', '2', 'global', 'set']]\n set cmdheight=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 23d: Setting again number global option\"\n noa set cmdheight=8 \" Reset global and local value (without triggering autocmd)\n let g:options=[['cmdheight', '8', '8', '8', '2', 'global', 'set']]\n set cmdheight=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 24a: Setting global number global-local (to buffer) option\"\n noa setglobal undolevels=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal undolevels=1\n let g:options=[['undolevels', '8', '', '8', '2', 'global', 'setglobal']]\n setglobal undolevels=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 24b: Setting local number global-local (to buffer) option\"\n noa setglobal undolevels=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal undolevels=1\n let g:options=[['undolevels', '1', '1', '', '2', 'local', 'setlocal']]\n setlocal undolevels=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 24c: Setting again number global-local (to buffer) option\"\n noa setglobal undolevels=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal undolevels=1\n let g:options=[['undolevels', '1', '1', '8', '2', 'global', 'set']]\n set undolevels=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 24d: Setting again global number global-local (to buffer) option\"\n noa set undolevels=8 \" Reset global and local value (without triggering autocmd)\n let g:options=[['undolevels', '8', '8', '8', '2', 'global', 'set']]\n set undolevels=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 25a: Setting global number local (to buffer) option\"\n noa setglobal wrapmargin=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal wrapmargin=1\n let g:options=[['wrapmargin', '8', '', '8', '2', 'global', 'setglobal']]\n setglobal wrapmargin=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 25b: Setting local number local (to buffer) option\"\n noa setglobal wrapmargin=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal wrapmargin=1\n let g:options=[['wrapmargin', '1', '1', '', '2', 'local', 'setlocal']]\n setlocal wrapmargin=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 25c: Setting again number local (to buffer) option\"\n noa setglobal wrapmargin=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal wrapmargin=1\n let g:options=[['wrapmargin', '1', '1', '8', '2', 'global', 'set']]\n set wrapmargin=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 25d: Setting again global number local (to buffer) option\"\n noa set wrapmargin=8 \" Reset global and local value (without triggering autocmd)\n let g:options=[['wrapmargin', '8', '8', '8', '2', 'global', 'set']]\n set wrapmargin=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 26: Setting number global-local (to window) option.\n \" Such option does currently not exist.", "\n \" 27a: Setting global number local (to window) option\"\n noa setglobal foldcolumn=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal foldcolumn=1\n let g:options=[['foldcolumn', '8', '', '8', '2', 'global', 'setglobal']]\n setglobal foldcolumn=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 27b: Setting local number local (to window) option\"\n noa setglobal foldcolumn=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal foldcolumn=1\n let g:options=[['foldcolumn', '1', '1', '', '2', 'local', 'setlocal']]\n setlocal foldcolumn=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 27c: Setting again number local (to window) option\"\n noa setglobal foldcolumn=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal foldcolumn=1\n let g:options=[['foldcolumn', '1', '1', '8', '2', 'global', 'set']]\n set foldcolumn=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 27d: Ssettin again global number local (to window) option\"\n noa set foldcolumn=8 \" Reset global and local value (without triggering autocmd)\n let g:options=[['foldcolumn', '8', '8', '8', '2', 'global', 'set']]\n set foldcolumn=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 28a: Setting global boolean global option\"\n noa setglobal nowrapscan \" Reset global and local value (without triggering autocmd)\n noa setlocal wrapscan \" Sets the global(!) value!\n let g:options=[['wrapscan', '1', '', '1', '0', 'global', 'setglobal']]\n setglobal nowrapscan\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 28b: Setting local boolean global option\"\n noa setglobal nowrapscan \" Reset global and local value (without triggering autocmd)\n noa setlocal wrapscan \" Sets the global(!) value!\n let g:options=[['wrapscan', '1', '1', '', '0', 'local', 'setlocal']]\n setlocal nowrapscan\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 28c: Setting again boolean global option\"\n noa setglobal nowrapscan \" Reset global and local value (without triggering autocmd)\n noa setlocal wrapscan \" Sets the global(!) value!\n let g:options=[['wrapscan', '1', '1', '1', '0', 'global', 'set']]\n set nowrapscan\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 28d: Setting again global boolean global option\"\n noa set nowrapscan \" Reset global and local value (without triggering autocmd)\n let g:options=[['wrapscan', '0', '0', '0', '1', 'global', 'set']]\n set wrapscan\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 29a: Setting global boolean global-local (to buffer) option\"\n noa setglobal noautoread \" Reset global and local value (without triggering autocmd)\n noa setlocal autoread\n let g:options=[['autoread', '0', '', '0', '1', 'global', 'setglobal']]\n setglobal autoread\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 29b: Setting local boolean global-local (to buffer) option\"\n noa setglobal noautoread \" Reset global and local value (without triggering autocmd)\n noa setlocal autoread\n let g:options=[['autoread', '1', '1', '', '0', 'local', 'setlocal']]\n setlocal noautoread\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 29c: Setting again boolean global-local (to buffer) option\"\n noa setglobal noautoread \" Reset global and local value (without triggering autocmd)\n noa setlocal autoread\n let g:options=[['autoread', '1', '1', '0', '1', 'global', 'set']]\n set autoread\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 29d: Setting again global boolean global-local (to buffer) option\"\n noa set noautoread \" Reset global and local value (without triggering autocmd)\n let g:options=[['autoread', '0', '0', '0', '1', 'global', 'set']]\n set autoread\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 30a: Setting global boolean local (to buffer) option\"\n noa setglobal nocindent \" Reset global and local value (without triggering autocmd)\n noa setlocal cindent\n let g:options=[['cindent', '0', '', '0', '1', 'global', 'setglobal']]\n setglobal cindent\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 30b: Setting local boolean local (to buffer) option\"\n noa setglobal nocindent \" Reset global and local value (without triggering autocmd)\n noa setlocal cindent\n let g:options=[['cindent', '1', '1', '', '0', 'local', 'setlocal']]\n setlocal nocindent\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 30c: Setting again boolean local (to buffer) option\"\n noa setglobal nocindent \" Reset global and local value (without triggering autocmd)\n noa setlocal cindent\n let g:options=[['cindent', '1', '1', '0', '1', 'global', 'set']]\n set cindent\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 30d: Setting again global boolean local (to buffer) option\"\n noa set nocindent \" Reset global and local value (without triggering autocmd)\n let g:options=[['cindent', '0', '0', '0', '1', 'global', 'set']]\n set cindent\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 31: Setting boolean global-local (to window) option\n \" Currently no such option exists.", "\n \" 32a: Setting global boolean local (to window) option\"\n noa setglobal nocursorcolumn \" Reset global and local value (without triggering autocmd)\n noa setlocal cursorcolumn\n let g:options=[['cursorcolumn', '0', '', '0', '1', 'global', 'setglobal']]\n setglobal cursorcolumn\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 32b: Setting local boolean local (to window) option\"\n noa setglobal nocursorcolumn \" Reset global and local value (without triggering autocmd)\n noa setlocal cursorcolumn\n let g:options=[['cursorcolumn', '1', '1', '', '0', 'local', 'setlocal']]\n setlocal nocursorcolumn\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 32c: Setting again boolean local (to window) option\"\n noa setglobal nocursorcolumn \" Reset global and local value (without triggering autocmd)\n noa setlocal cursorcolumn\n let g:options=[['cursorcolumn', '1', '1', '0', '1', 'global', 'set']]\n set cursorcolumn\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 32d: Setting again global boolean local (to window) option\"\n noa set nocursorcolumn \" Reset global and local value (without triggering autocmd)\n let g:options=[['cursorcolumn', '0', '0', '0', '1', 'global', 'set']]\n set cursorcolumn\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 33: Test autocommands when an option value is converted internally.\n noa set backspace=1 \" Reset global and local value (without triggering autocmd)\n let g:options=[['backspace', 'indent,eol', 'indent,eol', 'indent,eol', '2', 'global', 'set']]\n set backspace=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" Cleanup\n au! OptionSet\n \" set tags&\n for opt in ['nu', 'ai', 'acd', 'ar', 'bs', 'backup', 'cul', 'cp', 'backupext', 'tags', 'spelllang', 'statusline', 'foldignore', 'cmdheight', 'undolevels', 'wrapmargin', 'foldcolumn', 'wrapscan', 'autoread', 'cindent', 'cursorcolumn']\n exe printf(\":set %s&vim\", opt)\n endfor\n call test_override('starting', 0)\n delfunc! AutoCommandOptionSet\nendfunc", "func Test_OptionSet_diffmode()\n call test_override('starting', 1)\n \" 18: Changing an option when entering diff mode\n new\n au OptionSet diff :let &l:cul=v:option_new", " call setline(1, ['buffer 1', 'line2', 'line3', 'line4'])\n call assert_equal(0, &l:cul)\n diffthis\n call assert_equal(1, &l:cul)", " vnew\n call setline(1, ['buffer 2', 'line 2', 'line 3', 'line4'])\n call assert_equal(0, &l:cul)\n diffthis\n call assert_equal(1, &l:cul)", " diffoff\n call assert_equal(0, &l:cul)\n call assert_equal(1, getwinvar(2, '&l:cul'))\n bw!", " call assert_equal(1, &l:cul)\n diffoff!\n call assert_equal(0, &l:cul)\n call assert_equal(0, getwinvar(1, '&l:cul'))\n bw!", " \" Cleanup\n au! OptionSet\n call test_override('starting', 0)\nendfunc", "func Test_OptionSet_diffmode_close()\n call test_override('starting', 1)\n \" 19: Try to close the current window when entering diff mode\n \" should not segfault\n new\n au OptionSet diff close", " call setline(1, ['buffer 1', 'line2', 'line3', 'line4'])\n call assert_fails(':diffthis', 'E788')\n call assert_equal(1, &diff)\n vnew\n call setline(1, ['buffer 2', 'line 2', 'line 3', 'line4'])\n call assert_fails(':diffthis', 'E788')\n call assert_equal(1, &diff)\n bw!\n call assert_fails(':diffoff!', 'E788')\n bw!", " \" Cleanup\n au! OptionSet\n call test_override('starting', 0)\n \"delfunc! AutoCommandOptionSet\nendfunc", "\" Test for Bufleave autocommand that deletes the buffer we are about to edit.\nfunc Test_BufleaveWithDelete()\n new | edit Xfile1", " augroup test_bufleavewithdelete\n autocmd!\n autocmd BufLeave Xfile1 bwipe Xfile2\n augroup END", " call assert_fails('edit Xfile2', 'E143:')\n call assert_equal('Xfile1', bufname('%'))", " autocmd! test_bufleavewithdelete BufLeave Xfile1\n augroup! test_bufleavewithdelete", " new\n bwipe! Xfile1\nendfunc", "\" Test for autocommand that changes the buffer list, when doing \":ball\".\nfunc Test_Acmd_BufAll()\n enew!\n %bwipe!\n call writefile(['Test file Xxx1'], 'Xxx1')\n call writefile(['Test file Xxx2'], 'Xxx2')\n call writefile(['Test file Xxx3'], 'Xxx3')", " \" Add three files to the buffer list\n split Xxx1\n close\n split Xxx2\n close\n split Xxx3\n close", " \" Wipe the buffer when the buffer is opened\n au BufReadPost Xxx2 bwipe", " call append(0, 'Test file Xxx4')\n ball", " call assert_equal(2, winnr('$'))\n call assert_equal('Xxx1', bufname(winbufnr(winnr('$'))))\n wincmd t", " au! BufReadPost\n %bwipe!\n call delete('Xxx1')\n call delete('Xxx2')\n call delete('Xxx3')\n enew! | only\nendfunc", "\" Test for autocommand that changes current buffer on BufEnter event.\n\" Check if modelines are interpreted for the correct buffer.\nfunc Test_Acmd_BufEnter()\n %bwipe!\n call writefile(['start of test file Xxx1',\n\t \\ \"\\<Tab>this is a test\",\n\t \\ 'end of test file Xxx1'], 'Xxx1')\n call writefile(['start of test file Xxx2',\n\t \\ 'vim: set noai :',\n\t \\ \"\\<Tab>this is a test\",\n\t \\ 'end of test file Xxx2'], 'Xxx2')", " au BufEnter Xxx2 brew\n set ai modeline modelines=3\n edit Xxx1\n \" edit Xxx2, autocmd will do :brew\n edit Xxx2\n exe \"normal G?this is a\\<CR>\"\n \" Append text with autoindent to this file\n normal othis should be auto-indented\n call assert_equal(\"\\<Tab>this should be auto-indented\", getline('.'))\n call assert_equal(3, line('.'))\n \" Remove autocmd and edit Xxx2 again\n au! BufEnter Xxx2\n buf! Xxx2\n exe \"normal G?this is a\\<CR>\"\n \" append text without autoindent to Xxx\n normal othis should be in column 1\n call assert_equal(\"this should be in column 1\", getline('.'))\n call assert_equal(4, line('.'))", " %bwipe!\n call delete('Xxx1')\n call delete('Xxx2')\n set ai&vim modeline&vim modelines&vim\nendfunc", "\" Test for issue #57\n\" do not move cursor on <c-o> when autoindent is set\nfunc Test_ai_CTRL_O()\n enew!\n set ai\n let save_fo = &fo\n set fo+=r\n exe \"normal o# abcdef\\<Esc>2hi\\<CR>\\<C-O>d0\\<Esc>\"\n exe \"normal o# abcdef\\<Esc>2hi\\<C-O>d0\\<Esc>\"\n call assert_equal(['# abc', 'def', 'def'], getline(2, 4))", " set ai&vim\n let &fo = save_fo\n enew!\nendfunc", "\" Test for autocommand that deletes the current buffer on BufLeave event.\n\" Also test deleting the last buffer, should give a new, empty buffer.\nfunc Test_BufLeave_Wipe()\n %bwipe!\n let content = ['start of test file Xxx',\n\t \\ 'this is a test',\n\t \\ 'end of test file Xxx']\n call writefile(content, 'Xxx1')\n call writefile(content, 'Xxx2')", " au BufLeave Xxx2 bwipe\n edit Xxx1\n split Xxx2\n \" delete buffer Xxx2, we should be back to Xxx1\n bwipe\n call assert_equal('Xxx1', bufname('%'))\n call assert_equal(1, winnr('$'))", " \" Create an alternate buffer\n %write! test.out\n call assert_equal('test.out', bufname('#'))\n \" delete alternate buffer\n bwipe test.out\n call assert_equal('Xxx1', bufname('%'))\n call assert_equal('', bufname('#'))", " au BufLeave Xxx1 bwipe\n \" delete current buffer, get an empty one\n bwipe!\n call assert_equal(1, line('$'))\n call assert_equal('', bufname('%'))\n let g:bufinfo = getbufinfo()\n call assert_equal(1, len(g:bufinfo))", " call delete('Xxx1')\n call delete('Xxx2')\n call delete('test.out')\n %bwipe\n au! BufLeave", " \" check that bufinfo doesn't contain a pointer to freed memory\n call test_garbagecollect_now()\nendfunc", "func Test_QuitPre()\n edit Xfoo\n let winid = win_getid(winnr())\n split Xbar\n au! QuitPre * let g:afile = expand('<afile>')\n \" Close the other window, <afile> should be correct.\n exe win_id2win(winid) . 'q'\n call assert_equal('Xfoo', g:afile)\n \n unlet g:afile\n bwipe Xfoo\n bwipe Xbar\nendfunc", "func Test_Cmdline()\n au! CmdlineChanged : let g:text = getcmdline()\n let g:text = 0\n call feedkeys(\":echom 'hello'\\<CR>\", 'xt')\n call assert_equal(\"echom 'hello'\", g:text)\n au! CmdlineChanged", " au! CmdlineChanged : let g:entered = expand('<afile>')\n let g:entered = 0\n call feedkeys(\":echom 'hello'\\<CR>\", 'xt')\n call assert_equal(':', g:entered)\n au! CmdlineChanged", " au! CmdlineEnter : let g:entered = expand('<afile>')\n au! CmdlineLeave : let g:left = expand('<afile>')\n let g:entered = 0\n let g:left = 0\n call feedkeys(\":echo 'hello'\\<CR>\", 'xt')\n call assert_equal(':', g:entered)\n call assert_equal(':', g:left)\n au! CmdlineEnter\n au! CmdlineLeave", " let save_shellslash = &shellslash\n set noshellslash\n au! CmdlineEnter / let g:entered = expand('<afile>')\n au! CmdlineLeave / let g:left = expand('<afile>')\n let g:entered = 0\n let g:left = 0\n new\n call setline(1, 'hello')\n call feedkeys(\"/hello\\<CR>\", 'xt')\n call assert_equal('/', g:entered)\n call assert_equal('/', g:left)\n bwipe!\n au! CmdlineEnter\n au! CmdlineLeave\n let &shellslash = save_shellslash\nendfunc", "\" Test for BufWritePre autocommand that deletes or unloads the buffer.\nfunc Test_BufWritePre()\n %bwipe\n au BufWritePre Xxx1 bunload\n au BufWritePre Xxx2 bwipe", " call writefile(['start of Xxx1', 'test', 'end of Xxx1'], 'Xxx1')\n call writefile(['start of Xxx2', 'test', 'end of Xxx2'], 'Xxx2')", " edit Xtest\n e! Xxx2\n bdel Xtest\n e Xxx1\n \" write it, will unload it and give an error msg\n call assert_fails('w', 'E203')\n call assert_equal('Xxx2', bufname('%'))\n edit Xtest\n e! Xxx2\n bwipe Xtest\n \" write it, will delete the buffer and give an error msg\n call assert_fails('w', 'E203')\n call assert_equal('Xxx1', bufname('%'))\n au! BufWritePre\n call delete('Xxx1')\n call delete('Xxx2')\nendfunc", "\" Test for BufUnload autocommand that unloads all the other buffers\nfunc Test_bufunload_all()\n call writefile(['Test file Xxx1'], 'Xxx1')\"\n call writefile(['Test file Xxx2'], 'Xxx2')\"", " let content =<< trim [CODE]\n func UnloadAllBufs()\n let i = 1\n while i <= bufnr('$')\n if i != bufnr('%') && bufloaded(i)\n exe i . 'bunload'\n endif\n let i += 1\n endwhile\n endfunc\n au BufUnload * call UnloadAllBufs()\n au VimLeave * call writefile(['Test Finished'], 'Xout')\n edit Xxx1\n split Xxx2\n q\n [CODE]", " call writefile(content, 'Xtest')", " call delete('Xout')\n call system(GetVimCommandClean() .. ' -N --not-a-term -S Xtest')\n call assert_true(filereadable('Xout'))", " call delete('Xxx1')\n call delete('Xxx2')\n call delete('Xtest')\n call delete('Xout')\nendfunc", "\" Some tests for buffer-local autocommands\nfunc Test_buflocal_autocmd()\n let g:bname = ''\n edit xx\n au BufLeave <buffer> let g:bname = expand(\"%\")\n \" here, autocommand for xx should trigger.\n \" but autocommand shall not apply to buffer named <buffer>.\n edit somefile\n call assert_equal('xx', g:bname)\n let g:bname = ''\n \" here, autocommand shall be auto-deleted\n bwipe xx\n \" autocmd should not trigger\n edit xx\n call assert_equal('', g:bname)\n \" autocmd should not trigger\n edit somefile\n call assert_equal('', g:bname)\n enew\n unlet g:bname\nendfunc", "\" Test for \"*Cmd\" autocommands\nfunc Test_Cmd_Autocmds()\n call writefile(['start of Xxx', \"\\tabc2\", 'end of Xxx'], 'Xxx')", " enew!\n au BufReadCmd XtestA 0r Xxx|$del\n edit XtestA\t\t\t\" will read text of Xxd instead\n call assert_equal('start of Xxx', getline(1))", " au BufWriteCmd XtestA call append(line(\"$\"), \"write\")\n write\t\t\t\t\" will append a line to the file\n call assert_equal('write', getline('$'))\n call assert_fails('read XtestA', 'E484')\t\" should not read anything\n call assert_equal('write', getline(4))", " \" now we have:\n \" 1\tstart of Xxx\n \" 2\t\tabc2\n \" 3\tend of Xxx\n \" 4\twrite", " au FileReadCmd XtestB '[r Xxx\n 2r XtestB\t\t\t\" will read Xxx below line 2 instead\n call assert_equal('start of Xxx', getline(3))", " \" now we have:\n \" 1\tstart of Xxx\n \" 2\t\tabc2\n \" 3\tstart of Xxx\n \" 4\t\tabc2\n \" 5\tend of Xxx\n \" 6\tend of Xxx\n \" 7\twrite", " au FileWriteCmd XtestC '[,']copy $\n normal 4GA1\n 4,5w XtestC\t\t\t\" will copy lines 4 and 5 to the end\n call assert_equal(\"\\tabc21\", getline(8))\n call assert_fails('r XtestC', 'E484')\t\" should not read anything\n call assert_equal(\"end of Xxx\", getline(9))", " \" now we have:\n \" 1\tstart of Xxx\n \" 2\t\tabc2\n \" 3\tstart of Xxx\n \" 4\t\tabc21\n \" 5\tend of Xxx\n \" 6\tend of Xxx\n \" 7\twrite\n \" 8\t\tabc21\n \" 9\tend of Xxx", " let g:lines = []\n au FileAppendCmd XtestD call extend(g:lines, getline(line(\"'[\"), line(\"']\")))\n w >>XtestD\t\t\t\" will add lines to 'lines'\n call assert_equal(9, len(g:lines))\n call assert_fails('$r XtestD', 'E484')\t\" should not read anything\n call assert_equal(9, line('$'))\n call assert_equal('end of Xxx', getline('$'))", " au BufReadCmd XtestE 0r Xxx|$del\n sp XtestE\t\t\t\" split window with test.out\n call assert_equal('end of Xxx', getline(3))", " let g:lines = []\n exe \"normal 2Goasdf\\<Esc>\\<C-W>\\<C-W>\"\n au BufWriteCmd XtestE call extend(g:lines, getline(0, '$'))\n wall\t\t\t\t\" will write other window to 'lines'\n call assert_equal(4, len(g:lines), g:lines)\n call assert_equal('asdf', g:lines[2])", " au! BufReadCmd\n au! BufWriteCmd\n au! FileReadCmd\n au! FileWriteCmd\n au! FileAppendCmd\n %bwipe!\n call delete('Xxx')\n enew!\nendfunc", "func SetChangeMarks(start, end)\n exe a:start. 'mark ['\n exe a:end. 'mark ]'\nendfunc", "\" Verify the effects of autocmds on '[ and ']\nfunc Test_change_mark_in_autocmds()\n edit! Xtest\n call feedkeys(\"ia\\<CR>b\\<CR>c\\<CR>d\\<C-g>u\", 'xtn')", " call SetChangeMarks(2, 3)\n write\n call assert_equal([1, 4], [line(\"'[\"), line(\"']\")])", " call SetChangeMarks(2, 3)\n au BufWritePre * call assert_equal([1, 4], [line(\"'[\"), line(\"']\")])\n write\n au! BufWritePre", " if executable('cat')\n write XtestFilter\n write >> XtestFilter", " call SetChangeMarks(2, 3)\n \" Marks are set to the entire range of the write\n au FilterWritePre * call assert_equal([1, 4], [line(\"'[\"), line(\"']\")])\n \" '[ is adjusted to just before the line that will receive the filtered\n \" data\n au FilterReadPre * call assert_equal([4, 4], [line(\"'[\"), line(\"']\")])\n \" The filtered data is read into the buffer, and the source lines are\n \" still present, so the range is after the source lines\n au FilterReadPost * call assert_equal([5, 12], [line(\"'[\"), line(\"']\")])\n %!cat XtestFilter\n \" After the filtered data is read, the original lines are deleted\n call assert_equal([1, 8], [line(\"'[\"), line(\"']\")])\n au! FilterWritePre,FilterReadPre,FilterReadPost\n undo", " call SetChangeMarks(1, 4)\n au FilterWritePre * call assert_equal([2, 3], [line(\"'[\"), line(\"']\")])\n au FilterReadPre * call assert_equal([3, 3], [line(\"'[\"), line(\"']\")])\n au FilterReadPost * call assert_equal([4, 11], [line(\"'[\"), line(\"']\")])\n 2,3!cat XtestFilter\n call assert_equal([2, 9], [line(\"'[\"), line(\"']\")])\n au! FilterWritePre,FilterReadPre,FilterReadPost\n undo", " call delete('XtestFilter')\n endif", " call SetChangeMarks(1, 4)\n au FileWritePre * call assert_equal([2, 3], [line(\"'[\"), line(\"']\")])\n 2,3write Xtest2\n au! FileWritePre", " call SetChangeMarks(2, 3)\n au FileAppendPre * call assert_equal([1, 4], [line(\"'[\"), line(\"']\")])\n write >> Xtest2\n au! FileAppendPre", " call SetChangeMarks(1, 4)\n au FileAppendPre * call assert_equal([2, 3], [line(\"'[\"), line(\"']\")])\n 2,3write >> Xtest2\n au! FileAppendPre", " call SetChangeMarks(1, 1)\n au FileReadPre * call assert_equal([3, 1], [line(\"'[\"), line(\"']\")])\n au FileReadPost * call assert_equal([4, 11], [line(\"'[\"), line(\"']\")])\n 3read Xtest2\n au! FileReadPre,FileReadPost\n undo", " call SetChangeMarks(4, 4)\n \" When the line is 0, it's adjusted to 1\n au FileReadPre * call assert_equal([1, 4], [line(\"'[\"), line(\"']\")])\n au FileReadPost * call assert_equal([1, 8], [line(\"'[\"), line(\"']\")])\n 0read Xtest2\n au! FileReadPre,FileReadPost\n undo", " call SetChangeMarks(4, 4)\n \" When the line is 0, it's adjusted to 1\n au FileReadPre * call assert_equal([1, 4], [line(\"'[\"), line(\"']\")])\n au FileReadPost * call assert_equal([2, 9], [line(\"'[\"), line(\"']\")])\n 1read Xtest2\n au! FileReadPre,FileReadPost\n undo", " bwipe!\n call delete('Xtest')\n call delete('Xtest2')\nendfunc", "func Test_Filter_noshelltemp()\n if !executable('cat')\n return\n endif", " enew!\n call setline(1, ['a', 'b', 'c', 'd'])", " let shelltemp = &shelltemp\n set shelltemp", " let g:filter_au = 0\n au FilterWritePre * let g:filter_au += 1\n au FilterReadPre * let g:filter_au += 1\n au FilterReadPost * let g:filter_au += 1\n %!cat\n call assert_equal(3, g:filter_au)", " if has('filterpipe')\n set noshelltemp", " let g:filter_au = 0\n au FilterWritePre * let g:filter_au += 1\n au FilterReadPre * let g:filter_au += 1\n au FilterReadPost * let g:filter_au += 1\n %!cat\n call assert_equal(0, g:filter_au)\n endif", " au! FilterWritePre,FilterReadPre,FilterReadPost\n let &shelltemp = shelltemp\n bwipe!\nendfunc", "func Test_TextYankPost()\n enew!\n call setline(1, ['foo'])", " let g:event = []\n au TextYankPost * let g:event = copy(v:event)", " call assert_equal({}, v:event)\n call assert_fails('let v:event = {}', 'E46:')\n call assert_fails('let v:event.mykey = 0', 'E742:')", " norm \"ayiw\n call assert_equal(\n \\{'regcontents': ['foo'], 'regname': 'a', 'operator': 'y', 'regtype': 'v'},\n \\g:event)\n norm y_\n call assert_equal(\n \\{'regcontents': ['foo'], 'regname': '', 'operator': 'y', 'regtype': 'V'},\n \\g:event)\n call feedkeys(\"\\<C-V>y\", 'x')\n call assert_equal(\n \\{'regcontents': ['f'], 'regname': '', 'operator': 'y', 'regtype': \"\\x161\"},\n \\g:event)\n norm \"xciwbar\n call assert_equal(\n \\{'regcontents': ['foo'], 'regname': 'x', 'operator': 'c', 'regtype': 'v'},\n \\g:event)\n norm \"bdiw\n call assert_equal(\n \\{'regcontents': ['bar'], 'regname': 'b', 'operator': 'd', 'regtype': 'v'},\n \\g:event)", " call assert_equal({}, v:event)", " au! TextYankPost\n unlet g:event\n bwipe!\nendfunc", "func Test_nocatch_wipe_all_buffers()\n \" Real nasty autocommand: wipe all buffers on any event.\n au * * bwipe *\n \" Get E93 first?\n \" call assert_fails('next x', 'E93:')\n call assert_fails('next x', 'E517:')\n bwipe\n au!\nendfunc", "func Test_nocatch_wipe_dummy_buffer()\n \" Nasty autocommand: wipe buffer on any event.\n au * x bwipe\n call assert_fails('lv½ /x', 'E480')\n au!\nendfunc", "function s:Before_test_dirchanged()\n augroup test_dirchanged\n autocmd!\n augroup END\n let s:li = []\n let s:dir_this = getcwd()\n let s:dir_foo = s:dir_this . '/foo'\n call mkdir(s:dir_foo)\n let s:dir_bar = s:dir_this . '/bar'\n call mkdir(s:dir_bar)\nendfunc", "function s:After_test_dirchanged()\n exe 'cd' s:dir_this\n call delete(s:dir_foo, 'd')\n call delete(s:dir_bar, 'd')\n augroup test_dirchanged\n autocmd!\n augroup END\nendfunc", "function Test_dirchanged_global()\n call s:Before_test_dirchanged()\n autocmd test_dirchanged DirChanged global call add(s:li, \"cd:\")\n autocmd test_dirchanged DirChanged global call add(s:li, expand(\"<afile>\"))\n exe 'cd' s:dir_foo\n call assert_equal([\"cd:\", s:dir_foo], s:li)\n exe 'cd' s:dir_foo\n call assert_equal([\"cd:\", s:dir_foo], s:li)\n exe 'lcd' s:dir_bar\n call assert_equal([\"cd:\", s:dir_foo], s:li)\n call s:After_test_dirchanged()\nendfunc", "function Test_dirchanged_local()\n call s:Before_test_dirchanged()\n autocmd test_dirchanged DirChanged window call add(s:li, \"lcd:\")\n autocmd test_dirchanged DirChanged window call add(s:li, expand(\"<afile>\"))\n exe 'cd' s:dir_foo\n call assert_equal([], s:li)\n exe 'lcd' s:dir_bar\n call assert_equal([\"lcd:\", s:dir_bar], s:li)\n exe 'lcd' s:dir_bar\n call assert_equal([\"lcd:\", s:dir_bar], s:li)\n call s:After_test_dirchanged()\nendfunc", "function Test_dirchanged_auto()\n if !exists('+autochdir')\n return\n endif\n call s:Before_test_dirchanged()\n call test_autochdir()\n autocmd test_dirchanged DirChanged auto call add(s:li, \"auto:\")\n autocmd test_dirchanged DirChanged auto call add(s:li, expand(\"<afile>\"))\n set acd\n exe 'cd ..'\n call assert_equal([], s:li)\n exe 'edit ' . s:dir_foo . '/Xfile'\n call assert_equal(s:dir_foo, getcwd())\n call assert_equal([\"auto:\", s:dir_foo], s:li)\n set noacd\n bwipe!\n call s:After_test_dirchanged()\nendfunc", "\" Test TextChangedI and TextChangedP\nfunc Test_ChangedP()\n new\n call setline(1, ['foo', 'bar', 'foobar'])\n call test_override(\"char_avail\", 1)\n set complete=. completeopt=menuone", " func! TextChangedAutocmd(char)\n let g:autocmd .= a:char\n endfunc", " au! TextChanged <buffer> :call TextChangedAutocmd('N')\n au! TextChangedI <buffer> :call TextChangedAutocmd('I')\n au! TextChangedP <buffer> :call TextChangedAutocmd('P')", " call cursor(3, 1)\n let g:autocmd = ''\n call feedkeys(\"o\\<esc>\", 'tnix')\n call assert_equal('I', g:autocmd)", " let g:autocmd = ''\n call feedkeys(\"Sf\", 'tnix')\n call assert_equal('II', g:autocmd)", " let g:autocmd = ''\n call feedkeys(\"Sf\\<C-N>\", 'tnix')\n call assert_equal('IIP', g:autocmd)", " let g:autocmd = ''\n call feedkeys(\"Sf\\<C-N>\\<C-N>\", 'tnix')\n call assert_equal('IIPP', g:autocmd)", " let g:autocmd = ''\n call feedkeys(\"Sf\\<C-N>\\<C-N>\\<C-N>\", 'tnix')\n call assert_equal('IIPPP', g:autocmd)", " let g:autocmd = ''\n call feedkeys(\"Sf\\<C-N>\\<C-N>\\<C-N>\\<C-N>\", 'tnix')\n call assert_equal('IIPPPP', g:autocmd)", " call assert_equal(['foo', 'bar', 'foobar', 'foo'], getline(1, '$'))\n \" TODO: how should it handle completeopt=noinsert,noselect?", " \" CleanUp\n call test_override(\"char_avail\", 0)\n au! TextChanged\n au! TextChangedI\n au! TextChangedP\n delfu TextChangedAutocmd\n unlet! g:autocmd\n set complete&vim completeopt&vim", " bw!\nendfunc", "let g:setline_handled = v:false\nfunc SetLineOne()\n if !g:setline_handled\n call setline(1, \"(x)\")\n let g:setline_handled = v:true\n endif\nendfunc", "func Test_TextChangedI_with_setline()\n new\n call test_override('char_avail', 1)\n autocmd TextChangedI <buffer> call SetLineOne()\n call feedkeys(\"i(\\<CR>\\<Esc>\", 'tx')\n call assert_equal('(', getline(1))\n call assert_equal('x)', getline(2))\n undo\n call assert_equal('', getline(1))\n call assert_equal('', getline(2))", " call test_override('starting', 0)\n bwipe!\nendfunc", "func Test_Changed_FirstTime()\n CheckFeature terminal\n CheckNotGui", " \" Prepare file for TextChanged event.\n call writefile([''], 'Xchanged.txt')\n let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3})\n call assert_equal('running', term_getstatus(buf))\n \" Wait for the ruler (in the status line) to be shown.\n \" In ConPTY, there is additional character which is drawn up to the width of\n \" the screen.\n if has('conpty')\n call WaitForAssert({-> assert_match('\\<All.*$', term_getline(buf, 3))})\n else\n call WaitForAssert({-> assert_match('\\<All$', term_getline(buf, 3))})\n endif\n \" It's only adding autocmd, so that no event occurs.\n call term_sendkeys(buf, \":au! TextChanged <buffer> call writefile(['No'], 'Xchanged.txt')\\<cr>\")\n call term_sendkeys(buf, \"\\<C-\\\\>\\<C-N>:qa!\\<cr>\")\n call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))})\n call assert_equal([''], readfile('Xchanged.txt'))", " \" clean up\n call delete('Xchanged.txt')\n bwipe!\nendfunc", "func Test_autocmd_nested()\n let g:did_nested = 0\n augroup Testing\n au WinNew * edit somefile\n au BufNew * let g:did_nested = 1\n augroup END\n split\n call assert_equal(0, g:did_nested)\n close\n bwipe! somefile", " \" old nested argument still works\n augroup Testing\n au!\n au WinNew * nested edit somefile\n au BufNew * let g:did_nested = 1\n augroup END\n split\n call assert_equal(1, g:did_nested)\n close\n bwipe! somefile", " \" New ++nested argument works\n augroup Testing\n au!\n au WinNew * ++nested edit somefile\n au BufNew * let g:did_nested = 1\n augroup END\n split\n call assert_equal(1, g:did_nested)\n close\n bwipe! somefile", " augroup Testing\n au!\n augroup END", " call assert_fails('au WinNew * ++nested ++nested echo bad', 'E983:')\n call assert_fails('au WinNew * nested nested echo bad', 'E983:')\nendfunc", "func Test_autocmd_once()\n \" Without ++once WinNew triggers twice\n let g:did_split = 0\n augroup Testing\n au WinNew * let g:did_split += 1\n augroup END\n split\n split\n call assert_equal(2, g:did_split)\n call assert_true(exists('#WinNew'))\n close\n close", " \" With ++once WinNew triggers once\n let g:did_split = 0\n augroup Testing\n au!\n au WinNew * ++once let g:did_split += 1\n augroup END\n split\n split\n call assert_equal(1, g:did_split)\n call assert_false(exists('#WinNew'))\n close\n close", " call assert_fails('au WinNew * ++once ++once echo bad', 'E983:')\nendfunc", "func Test_autocmd_bufreadpre()\n new\n let b:bufreadpre = 1\n call append(0, range(100))\n w! XAutocmdBufReadPre.txt\n autocmd BufReadPre <buffer> :let b:bufreadpre += 1\n norm! 50gg\n sp\n norm! 100gg\n wincmd p\n let g:wsv1 = winsaveview()\n wincmd p\n let g:wsv2 = winsaveview()\n \" triggers BufReadPre, should not move the cursor in either window\n \" The topline may change one line in a large window.\n edit\n call assert_inrange(g:wsv2.topline - 1, g:wsv2.topline + 1, winsaveview().topline)\n call assert_equal(g:wsv2.lnum, winsaveview().lnum)\n call assert_equal(2, b:bufreadpre)\n wincmd p\n call assert_equal(g:wsv1.topline, winsaveview().topline)\n call assert_equal(g:wsv1.lnum, winsaveview().lnum)\n call assert_equal(2, b:bufreadpre)\n \" Now set the cursor position in an BufReadPre autocommand\n \" (even though the position will be invalid, this should make Vim reset the\n \" cursor position in the other window.\n wincmd p\n set cpo+=g\n \" won't do anything, but try to set the cursor on an invalid lnum\n autocmd BufReadPre <buffer> :norm! 70gg\n \" triggers BufReadPre, should not move the cursor in either window\n e\n call assert_equal(1, winsaveview().topline)\n call assert_equal(1, winsaveview().lnum)\n call assert_equal(3, b:bufreadpre)\n wincmd p\n call assert_equal(g:wsv1.topline, winsaveview().topline)\n call assert_equal(g:wsv1.lnum, winsaveview().lnum)\n call assert_equal(3, b:bufreadpre)\n close\n close\n call delete('XAutocmdBufReadPre.txt')\n set cpo-=g\nendfunc", "\" FileChangedShell tested in test_filechanged.vim", "\" Tests for the following autocommands:\n\" - FileWritePre\twriting a compressed file\n\" - FileReadPost\treading a compressed file\n\" - BufNewFile\t\treading a file template\n\" - BufReadPre\t\tdecompressing the file to be read\n\" - FilterReadPre\tsubstituting characters in the temp file\n\" - FilterReadPost\tsubstituting characters after filtering\n\" - FileReadPre\t\tset options for decompression\n\" - FileReadPost\tdecompress the file\nfunc Test_ReadWrite_Autocmds()\n \" Run this test only on Unix-like systems and if gzip is available\n if !has('unix') || !executable(\"gzip\")\n return\n endif", " \" Make $GZIP empty, \"-v\" would cause trouble.\n let $GZIP = \"\"", " \" Use a FileChangedShell autocommand to avoid a prompt for 'Xtestfile.gz'\n \" being modified outside of Vim (noticed on Solaris).\n au FileChangedShell * echo 'caught FileChangedShell'", " \" Test for the FileReadPost, FileWritePre and FileWritePost autocmds\n augroup Test1\n au!\n au FileWritePre *.gz '[,']!gzip\n au FileWritePost *.gz undo\n au FileReadPost *.gz '[,']!gzip -d\n augroup END", " new\n set bin\n call append(0, [\n\t \\ 'line 2\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 3\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 4\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 5\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 6\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 7\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 8\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 9\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 10 Abcdefghijklmnopqrstuvwxyz'\n\t \\ ])\n 1,9write! Xtestfile.gz\n enew! | close", " new\n \" Read and decompress the testfile\n 0read Xtestfile.gz\n call assert_equal([\n\t \\ 'line 2\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 3\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 4\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 5\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 6\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 7\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 8\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 9\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 10 Abcdefghijklmnopqrstuvwxyz'\n\t \\ ], getline(1, 9))\n enew! | close", " augroup Test1\n au!\n augroup END", " \" Test for the FileAppendPre and FileAppendPost autocmds\n augroup Test2\n au!\n au BufNewFile *.c read Xtest.c\n au FileAppendPre *.out '[,']s/new/NEW/\n au FileAppendPost *.out !cat Xtest.c >> test.out\n augroup END", " call writefile(['/*', ' * Here is a new .c file', ' */'], 'Xtest.c')\n new foo.c\t\t\t\" should load Xtest.c\n call assert_equal(['/*', ' * Here is a new .c file', ' */'], getline(2, 4))\n w! >> test.out\t\t\" append it to the output file", " let contents = readfile('test.out')\n call assert_equal(' * Here is a NEW .c file', contents[2])\n call assert_equal(' * Here is a new .c file', contents[5])", " call delete('test.out')\n enew! | close\n augroup Test2\n au!\n augroup END", " \" Test for the BufReadPre and BufReadPost autocmds\n augroup Test3\n au!\n \" setup autocommands to decompress before reading and re-compress\n \" afterwards\n au BufReadPre *.gz exe '!gzip -d ' . shellescape(expand(\"<afile>\"))\n au BufReadPre *.gz call rename(expand(\"<afile>:r\"), expand(\"<afile>\"))\n au BufReadPost *.gz call rename(expand(\"<afile>\"), expand(\"<afile>:r\"))\n au BufReadPost *.gz exe '!gzip ' . shellescape(expand(\"<afile>:r\"))\n augroup END", " e! Xtestfile.gz\t\t\" Edit compressed file\n call assert_equal([\n\t \\ 'line 2\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 3\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 4\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 5\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 6\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 7\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 8\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 9\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 10 Abcdefghijklmnopqrstuvwxyz'\n\t \\ ], getline(1, 9))", " w! >> test.out\t\t\" Append it to the output file", " augroup Test3\n au!\n augroup END", " \" Test for the FilterReadPre and FilterReadPost autocmds.\n set shelltemp\t\t\t\" need temp files here\n augroup Test4\n au!\n au FilterReadPre *.out call rename(expand(\"<afile>\"), expand(\"<afile>\") . \".t\")\n au FilterReadPre *.out exe 'silent !sed s/e/E/ ' . shellescape(expand(\"<afile>\")) . \".t >\" . shellescape(expand(\"<afile>\"))\n au FilterReadPre *.out exe 'silent !rm ' . shellescape(expand(\"<afile>\")) . '.t'\n au FilterReadPost *.out '[,']s/x/X/g\n augroup END", " e! test.out\t\t\t\" Edit the output file\n 1,$!cat\n call assert_equal([\n\t \\ 'linE 2\tAbcdefghijklmnopqrstuvwXyz',\n\t \\ 'linE 3\tXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n\t \\ 'linE 4\tAbcdefghijklmnopqrstuvwXyz',\n\t \\ 'linE 5\tXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n\t \\ 'linE 6\tAbcdefghijklmnopqrstuvwXyz',\n\t \\ 'linE 7\tXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n\t \\ 'linE 8\tAbcdefghijklmnopqrstuvwXyz',\n\t \\ 'linE 9\tXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n\t \\ 'linE 10 AbcdefghijklmnopqrstuvwXyz'\n\t \\ ], getline(1, 9))\n call assert_equal([\n\t \\ 'line 2\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 3\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 4\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 5\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 6\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 7\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 8\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 9\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 10 Abcdefghijklmnopqrstuvwxyz'\n\t \\ ], readfile('test.out'))", " augroup Test4\n au!\n augroup END\n set shelltemp&vim", " \" Test for the FileReadPre and FileReadPost autocmds.\n augroup Test5\n au!\n au FileReadPre *.gz exe 'silent !gzip -d ' . shellescape(expand(\"<afile>\"))\n au FileReadPre *.gz call rename(expand(\"<afile>:r\"), expand(\"<afile>\"))\n au FileReadPost *.gz '[,']s/l/L/\n augroup END", " new\n 0r Xtestfile.gz\t\t\" Read compressed file\n call assert_equal([\n\t \\ 'Line 2\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'Line 3\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'Line 4\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'Line 5\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'Line 6\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'Line 7\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'Line 8\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'Line 9\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'Line 10 Abcdefghijklmnopqrstuvwxyz'\n\t \\ ], getline(1, 9))\n call assert_equal([\n\t \\ 'line 2\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 3\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 4\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 5\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 6\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 7\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 8\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 9\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 10 Abcdefghijklmnopqrstuvwxyz'\n\t \\ ], readfile('Xtestfile.gz'))", " augroup Test5\n au!\n augroup END", " au! FileChangedShell\n call delete('Xtestfile.gz')\n call delete('Xtest.c')\n call delete('test.out')\nendfunc", "func Test_throw_in_BufWritePre()\n new\n call setline(1, ['one', 'two', 'three'])\n call assert_false(filereadable('Xthefile'))\n augroup throwing\n au BufWritePre X* throw 'do not write'\n augroup END\n try\n w Xthefile\n catch\n let caught = 1\n endtry\n call assert_equal(1, caught)\n call assert_false(filereadable('Xthefile'))", " bwipe!\n au! throwing\nendfunc", "func Test_autocmd_SafeState()\n CheckRunVimInTerminal", " let lines =<< trim END\n\tlet g:safe = 0\n\tlet g:again = ''\n\tau SafeState * let g:safe += 1\n\tau SafeStateAgain * let g:again ..= 'x'\n\tfunc CallTimer()\n\t call timer_start(10, {id -> execute('let g:again ..= \"t\"')})\n\tendfunc\n END\n call writefile(lines, 'XSafeState')\n let buf = RunVimInTerminal('-S XSafeState', #{rows: 6})", " \" Sometimes we loop to handle an K_IGNORE\n call term_sendkeys(buf, \":echo g:safe\\<CR>\")\n call WaitForAssert({-> assert_match('^[12] ', term_getline(buf, 6))}, 1000)", " call term_sendkeys(buf, \":echo g:again\\<CR>\")\n call WaitForAssert({-> assert_match('^xxxx', term_getline(buf, 6))}, 1000)", " call term_sendkeys(buf, \":let g:again = ''\\<CR>:call CallTimer()\\<CR>\")\n call term_wait(buf)\n call term_sendkeys(buf, \":\\<CR>\")\n call term_wait(buf)\n call term_sendkeys(buf, \":echo g:again\\<CR>\")\n call WaitForAssert({-> assert_match('xtx', term_getline(buf, 6))}, 1000)", " call StopVimInTerminal(buf)\n call delete('XSafeState')\nendfunc", "func Test_autocmd_CmdWinEnter()\n CheckRunVimInTerminal\n \" There is not cmdwin switch, so\n \" test for cmdline_hist\n \" (both are available with small builds)\n CheckFeature cmdline_hist\n let lines =<< trim END\n let b:dummy_var = 'This is a dummy'\n autocmd CmdWinEnter * quit\n let winnr = winnr('$')\n END\n let filename='XCmdWinEnter'\n call writefile(lines, filename)\n let buf = RunVimInTerminal('-S '.filename, #{rows: 6})", " call term_sendkeys(buf, \"q:\")\n call term_wait(buf)\n call term_sendkeys(buf, \":echo b:dummy_var\\<cr>\")\n call WaitForAssert({-> assert_match('^This is a dummy', term_getline(buf, 6))}, 1000)\n call term_sendkeys(buf, \":echo &buftype\\<cr>\")\n call WaitForAssert({-> assert_notmatch('^nofile', term_getline(buf, 6))}, 1000)\n call term_sendkeys(buf, \":echo winnr\\<cr>\")\n call WaitForAssert({-> assert_match('^1', term_getline(buf, 6))}, 1000)", " \" clean up\n call StopVimInTerminal(buf)\n call delete(filename)\nendfunc", "" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 ]
PreciseBugs
{"buggy_code_end_loc": [2290, 755, 4659], "buggy_code_start_loc": [2290, 755, 4643], "filenames": ["src/testdir/test_autocmd.vim", "src/version.c", "src/window.c"], "fixing_code_end_loc": [2299, 758, 4660], "fixing_code_start_loc": [2291, 756, 4644], "message": "The autocmd feature in window.c in Vim before 8.1.2136 accesses freed memory.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:vim:vim:*:*:*:*:*:*:*:*", "matchCriteriaId": "8BA1A77F-AC6C-4A51-A1C0-873DE3A2BF19", "versionEndExcluding": "8.1.2136", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "8.1.2121", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:12.04:*:*:*:esm:*:*:*", "matchCriteriaId": "8D305F7A-D159-4716-AB26-5E38BB5CD991", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:14.04:*:*:*:esm:*:*:*", "matchCriteriaId": "815D70A8-47D3-459C-A32C-9FEACA0659D1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:lts:*:*:*", "matchCriteriaId": "F7016A2A-8365-4F1A-89A2-7A19F2BCAE5B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:19.10:*:*:*:*:*:*:*", "matchCriteriaId": "A31C8344-3E02-4EB8-8BD8-4C84B7959624", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The autocmd feature in window.c in Vim before 8.1.2136 accesses freed memory."}, {"lang": "es", "value": "La funcionalidad autocmd en el archivo window.c en Vim versiones anteriores a la versi\u00f3n 8.1.2136, accede a la memoria liberada."}], "evaluatorComment": null, "id": "CVE-2019-20079", "lastModified": "2020-10-20T16:04:08.370", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-12-30T01:15:12.290", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/commit/ec66c41d84e574baf8009dbc0bd088d2bc5b2421"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/compare/v8.1.2135...v8.1.2136"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "https://packetstormsecurity.com/files/154898"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4309-1/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-416"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/vim/vim/commit/ec66c41d84e574baf8009dbc0bd088d2bc5b2421"}, "type": "CWE-416"}
352
Determine whether the {function_name} code is vulnerable or not.
[ "\" Tests for autocommands", "source shared.vim\nsource check.vim\nsource term_util.vim", "func s:cleanup_buffers() abort\n for bnr in range(1, bufnr('$'))\n if bufloaded(bnr) && bufnr('%') != bnr\n execute 'bd! ' . bnr\n endif\n endfor\nendfunc", "func Test_vim_did_enter()\n call assert_false(v:vim_did_enter)", " \" This script will never reach the main loop, can't check if v:vim_did_enter\n \" becomes one.\nendfunc", "if has('timers')", " func ExitInsertMode(id)\n call feedkeys(\"\\<Esc>\")\n endfunc", " func Test_cursorhold_insert()\n \" Need to move the cursor.\n call feedkeys(\"ggG\", \"xt\")", " let g:triggered = 0\n au CursorHoldI * let g:triggered += 1\n set updatetime=20\n call timer_start(100, 'ExitInsertMode')\n call feedkeys('a', 'x!')\n call assert_equal(1, g:triggered)\n unlet g:triggered\n au! CursorHoldI\n set updatetime&\n endfunc", " func Test_cursorhold_insert_with_timer_interrupt()\n if !has('job')\n return\n endif\n \" Need to move the cursor.\n call feedkeys(\"ggG\", \"xt\")", " \" Confirm the timer invoked in exit_cb of the job doesn't disturb\n \" CursorHoldI event.\n let g:triggered = 0\n au CursorHoldI * let g:triggered += 1\n set updatetime=500\n call job_start(has('win32') ? 'cmd /c echo:' : 'echo',\n \\ {'exit_cb': {-> timer_start(1000, 'ExitInsertMode')}})\n call feedkeys('a', 'x!')\n call assert_equal(1, g:triggered)\n unlet g:triggered\n au! CursorHoldI\n set updatetime&\n endfunc", " func Test_cursorhold_insert_ctrl_x()\n let g:triggered = 0\n au CursorHoldI * let g:triggered += 1\n set updatetime=20\n call timer_start(100, 'ExitInsertMode')\n \" CursorHoldI does not trigger after CTRL-X\n call feedkeys(\"a\\<C-X>\", 'x!')\n call assert_equal(0, g:triggered)\n unlet g:triggered\n au! CursorHoldI\n set updatetime&\n endfunc", " func Test_OptionSet_modeline()\n call test_override('starting', 1)\n au! OptionSet\n augroup set_tabstop\n au OptionSet tabstop call timer_start(1, {-> execute(\"echo 'Handler called'\", \"\")})\n augroup END\n call writefile(['vim: set ts=7 sw=5 :', 'something'], 'XoptionsetModeline')\n set modeline\n let v:errmsg = ''\n call assert_fails('split XoptionsetModeline', 'E12:')\n call assert_equal(7, &ts)\n call assert_equal('', v:errmsg)", " augroup set_tabstop\n au!\n augroup END\n bwipe!\n set ts&\n call delete('XoptionsetModeline')\n call test_override('starting', 0)\n endfunc", "endif \"has('timers')", "func Test_bufunload()\n augroup test_bufunload_group\n autocmd!\n autocmd BufUnload * call add(s:li, \"bufunload\")\n autocmd BufDelete * call add(s:li, \"bufdelete\")\n autocmd BufWipeout * call add(s:li, \"bufwipeout\")\n augroup END", " let s:li=[]\n new\n setlocal bufhidden=\n bunload\n call assert_equal([\"bufunload\", \"bufdelete\"], s:li)", " let s:li=[]\n new\n setlocal bufhidden=delete\n bunload\n call assert_equal([\"bufunload\", \"bufdelete\"], s:li)", " let s:li=[]\n new\n setlocal bufhidden=unload\n bwipeout\n call assert_equal([\"bufunload\", \"bufdelete\", \"bufwipeout\"], s:li)", " au! test_bufunload_group\n augroup! test_bufunload_group\nendfunc", "\" SEGV occurs in older versions. (At least 7.4.2005 or older)\nfunc Test_autocmd_bufunload_with_tabnext()\n tabedit\n tabfirst", " augroup test_autocmd_bufunload_with_tabnext_group\n autocmd!\n autocmd BufUnload <buffer> tabnext\n augroup END", " quit\n call assert_equal(2, tabpagenr('$'))", " autocmd! test_autocmd_bufunload_with_tabnext_group\n augroup! test_autocmd_bufunload_with_tabnext_group\n tablast\n quit\nendfunc", "func Test_autocmd_bufwinleave_with_tabfirst()\n tabedit\n augroup sample\n autocmd!\n autocmd BufWinLeave <buffer> tabfirst\n augroup END\n call setline(1, ['a', 'b', 'c'])\n edit! a.txt\n tabclose\nendfunc", "\" SEGV occurs in older versions. (At least 7.4.2321 or older)\nfunc Test_autocmd_bufunload_avoiding_SEGV_01()\n split aa.txt\n let lastbuf = bufnr('$')", " augroup test_autocmd_bufunload\n autocmd!\n exe 'autocmd BufUnload <buffer> ' . (lastbuf + 1) . 'bwipeout!'\n augroup END", " \" Todo: check for E937 generated first\n \" call assert_fails('edit bb.txt', 'E937:')\n call assert_fails('edit bb.txt', 'E517:')", " autocmd! test_autocmd_bufunload\n augroup! test_autocmd_bufunload\n bwipe! aa.txt\n bwipe! bb.txt\nendfunc", "\" SEGV occurs in older versions. (At least 7.4.2321 or older)\nfunc Test_autocmd_bufunload_avoiding_SEGV_02()\n setlocal buftype=nowrite\n let lastbuf = bufnr('$')", " augroup test_autocmd_bufunload\n autocmd!\n exe 'autocmd BufUnload <buffer> ' . (lastbuf + 1) . 'bwipeout!'\n augroup END", " normal! i1\n call assert_fails('edit a.txt', 'E517:')\n call feedkeys(\"\\<CR>\")", " autocmd! test_autocmd_bufunload\n augroup! test_autocmd_bufunload\n bwipe! a.txt\nendfunc", "func Test_win_tab_autocmd()\n let g:record = []", " augroup testing\n au WinNew * call add(g:record, 'WinNew')\n au WinEnter * call add(g:record, 'WinEnter') \n au WinLeave * call add(g:record, 'WinLeave') \n au TabNew * call add(g:record, 'TabNew')\n au TabClosed * call add(g:record, 'TabClosed')\n au TabEnter * call add(g:record, 'TabEnter')\n au TabLeave * call add(g:record, 'TabLeave')\n augroup END", " split\n tabnew\n close\n close", " call assert_equal([\n\t\\ 'WinLeave', 'WinNew', 'WinEnter',\n\t\\ 'WinLeave', 'TabLeave', 'WinNew', 'WinEnter', 'TabNew', 'TabEnter',\n\t\\ 'WinLeave', 'TabLeave', 'TabClosed', 'WinEnter', 'TabEnter',\n\t\\ 'WinLeave', 'WinEnter'\n\t\\ ], g:record)", " let g:record = []\n tabnew somefile\n tabnext\n bwipe somefile", " call assert_equal([\n\t\\ 'WinLeave', 'TabLeave', 'WinNew', 'WinEnter', 'TabNew', 'TabEnter',\n\t\\ 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter',\n\t\\ 'TabClosed'\n\t\\ ], g:record)", " augroup testing\n au!\n augroup END\n unlet g:record\nendfunc", "func s:AddAnAutocmd()\n augroup vimBarTest\n au BufReadCmd * echo 'hello'\n augroup END\n call assert_equal(3, len(split(execute('au vimBarTest'), \"\\n\")))\nendfunc", "func Test_early_bar()\n \" test that a bar is recognized before the {event}\n call s:AddAnAutocmd()\n augroup vimBarTest | au! | augroup END\n call assert_equal(1, len(split(execute('au vimBarTest'), \"\\n\")))", " call s:AddAnAutocmd()\n augroup vimBarTest| au!| augroup END\n call assert_equal(1, len(split(execute('au vimBarTest'), \"\\n\")))", " \" test that a bar is recognized after the {event}\n call s:AddAnAutocmd()\n augroup vimBarTest| au!BufReadCmd| augroup END\n call assert_equal(1, len(split(execute('au vimBarTest'), \"\\n\")))", " \" test that a bar is recognized after the {group}\n call s:AddAnAutocmd()\n au! vimBarTest|echo 'hello'\n call assert_equal(1, len(split(execute('au vimBarTest'), \"\\n\")))\nendfunc", "func RemoveGroup()\n autocmd! StartOK\n augroup! StartOK\nendfunc", "func Test_augroup_warning()\n augroup TheWarning\n au VimEnter * echo 'entering'\n augroup END\n call assert_true(match(execute('au VimEnter'), \"TheWarning.*VimEnter\") >= 0)\n redir => res\n augroup! TheWarning\n redir END\n call assert_true(match(res, \"W19:\") >= 0)\n call assert_true(match(execute('au VimEnter'), \"-Deleted-.*VimEnter\") >= 0)", " \" check \"Another\" does not take the pace of the deleted entry\n augroup Another\n augroup END\n call assert_true(match(execute('au VimEnter'), \"-Deleted-.*VimEnter\") >= 0)\n augroup! Another", " \" no warning for postpone aucmd delete\n augroup StartOK\n au VimEnter * call RemoveGroup()\n augroup END\n call assert_true(match(execute('au VimEnter'), \"StartOK.*VimEnter\") >= 0)\n redir => res\n doautocmd VimEnter\n redir END\n call assert_true(match(res, \"W19:\") < 0)\n au! VimEnter\nendfunc", "func Test_BufReadCmdHelp()\n \" This used to cause access to free memory\n au BufReadCmd * e +h\n help", " au! BufReadCmd\nendfunc", "func Test_BufReadCmdHelpJump()\n \" This used to cause access to free memory\n au BufReadCmd * e +h{\n \" } to fix highlighting\n call assert_fails('help', 'E434:')", " au! BufReadCmd\nendfunc", "func Test_augroup_deleted()\n \" This caused a crash before E936 was introduced\n augroup x\n call assert_fails('augroup! x', 'E936:')\n au VimEnter * echo\n augroup end\n augroup! x\n call assert_true(match(execute('au VimEnter'), \"-Deleted-.*VimEnter\") >= 0)\n au! VimEnter\nendfunc", "\" Tests for autocommands on :close command.\n\" This used to be in test13.\nfunc Test_three_windows()\n \" Clean up buffers, because in some cases this function fails.\n call s:cleanup_buffers()", " \" Write three files and open them, each in a window.\n \" Then go to next window, with autocommand that deletes the previous one.\n \" Do this twice, writing the file.\n e! Xtestje1\n call setline(1, 'testje1')\n w\n sp Xtestje2\n call setline(1, 'testje2')\n w\n sp Xtestje3\n call setline(1, 'testje3')\n w\n wincmd w\n au WinLeave Xtestje2 bwipe\n wincmd w\n call assert_equal('Xtestje1', expand('%'))", " au WinLeave Xtestje1 bwipe Xtestje3\n close\n call assert_equal('Xtestje1', expand('%'))", " \" Test deleting the buffer on a Unload event. If this goes wrong there\n \" will be the ATTENTION prompt.\n e Xtestje1\n au!\n au! BufUnload Xtestje1 bwipe\n call assert_fails('e Xtestje3', 'E937:')\n call assert_equal('Xtestje3', expand('%'))", " e Xtestje2\n sp Xtestje1\n call assert_fails('e', 'E937:')\n call assert_equal('Xtestje1', expand('%'))", " \" Test changing buffers in a BufWipeout autocommand. If this goes wrong\n \" there are ml_line errors and/or a Crash.\n au!\n only\n e Xanother\n e Xtestje1\n bwipe Xtestje2\n bwipe Xtestje3\n au BufWipeout Xtestje1 buf Xtestje1\n bwipe\n call assert_equal('Xanother', expand('%'))", " only\n help\n wincmd w\n 1quit\n call assert_equal('Xanother', expand('%'))", " au!\n enew\n call delete('Xtestje1')\n call delete('Xtestje2')\n call delete('Xtestje3')\nendfunc", "func Test_BufEnter()\n au! BufEnter\n au Bufenter * let val = val . '+'\n let g:val = ''\n split NewFile\n call assert_equal('+', g:val)\n bwipe!\n call assert_equal('++', g:val)", " \" Also get BufEnter when editing a directory\n call mkdir('Xdir')\n split Xdir\n call assert_equal('+++', g:val)", " \" On MS-Windows we can't edit the directory, make sure we wipe the right\n \" buffer.\n bwipe! Xdir", " call delete('Xdir', 'd')\n au! BufEnter\nendfunc", "\" Closing a window might cause an endless loop\n\" E814 for older Vims\nfunc Test_autocmd_bufwipe_in_SessLoadPost()\n edit Xtest\n tabnew\n file Xsomething\n set noswapfile\n mksession!", " let content =<< trim [CODE]\n set nocp noswapfile\n let v:swapchoice=\"e\"\n augroup test_autocmd_sessionload\n autocmd!\n autocmd SessionLoadPost * exe bufnr(\"Xsomething\") . \"bw!\"\n augroup END", " func WriteErrors()\n call writefile([execute(\"messages\")], \"Xerrors\")\n endfunc\n au VimLeave * call WriteErrors()\n [CODE]", " call writefile(content, 'Xvimrc')\n call system(GetVimCommand('Xvimrc') .. ' --not-a-term --noplugins -S Session.vim -c cq')\n let errors = join(readfile('Xerrors'))\n call assert_match('E814', errors)", " set swapfile\n for file in ['Session.vim', 'Xvimrc', 'Xerrors']\n call delete(file)\n endfor\nendfunc", "\" SEGV occurs in older versions.\nfunc Test_autocmd_bufwipe_in_SessLoadPost2()\n tabnew\n set noswapfile\n mksession!", " let content =<< trim [CODE]\n set nocp noswapfile\n function! DeleteInactiveBufs()\n tabfirst\n let tabblist = []\n for i in range(1, tabpagenr(''$''))\n call extend(tabblist, tabpagebuflist(i))\n endfor\n for b in range(1, bufnr(''$''))\n if bufexists(b) && buflisted(b) && (index(tabblist, b) == -1 || bufname(b) =~# ''^$'')\n exec ''bwipeout '' . b\n endif\n endfor\n echomsg \"SessionLoadPost DONE\"\n endfunction\n au SessionLoadPost * call DeleteInactiveBufs()", " func WriteErrors()\n call writefile([execute(\"messages\")], \"Xerrors\")\n endfunc\n au VimLeave * call WriteErrors()\n [CODE]", " call writefile(content, 'Xvimrc')\n call system(GetVimCommand('Xvimrc') .. ' --not-a-term --noplugins -S Session.vim -c cq')\n let errors = join(readfile('Xerrors'))\n \" This probably only ever matches on unix.\n call assert_notmatch('Caught deadly signal SEGV', errors)\n call assert_match('SessionLoadPost DONE', errors)", " set swapfile\n for file in ['Session.vim', 'Xvimrc', 'Xerrors']\n call delete(file)\n endfor\nendfunc", "func Test_empty_doau()\n doau \\|\nendfunc", "func s:AutoCommandOptionSet(match)\n let template = \"Option: <%s>, OldVal: <%s>, OldValLocal: <%s>, OldValGlobal: <%s>, NewVal: <%s>, Scope: <%s>, Command: <%s>\\n\"\n let item = remove(g:options, 0)\n let expected = printf(template, item[0], item[1], item[2], item[3], item[4], item[5], item[6])\n let actual = printf(template, a:match, v:option_old, v:option_oldlocal, v:option_oldglobal, v:option_new, v:option_type, v:option_command)\n let g:opt = [expected, actual]\n \"call assert_equal(expected, actual)\nendfunc", "func Test_OptionSet()\n if !has(\"eval\") || !exists(\"+autochdir\")\n return\n endif", " badd test_autocmd.vim", " call test_override('starting', 1)\n set nocp\n au OptionSet * :call s:AutoCommandOptionSet(expand(\"<amatch>\"))", " \" 1: Setting number option\"\n let g:options=[['number', 0, 0, 0, 1, 'global', 'set']]\n set nu\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 2: Setting local number option\"\n let g:options=[['number', 1, 1, '', 0, 'local', 'setlocal']]\n setlocal nonu\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 3: Setting global number option\"\n let g:options=[['number', 1, '', 1, 0, 'global', 'setglobal']]\n setglobal nonu\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 4: Setting local autoindent option\"\n let g:options=[['autoindent', 0, 0, '', 1, 'local', 'setlocal']]\n setlocal ai\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 5: Setting global autoindent option\"\n let g:options=[['autoindent', 0, '', 0, 1, 'global', 'setglobal']]\n setglobal ai\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 6: Setting global autoindent option\"\n let g:options=[['autoindent', 1, 1, 1, 0, 'global', 'set']]\n set ai!\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 6a: Setting global autoindent option\"\n let g:options=[['autoindent', 1, 1, 0, 0, 'global', 'set']]\n noa setlocal ai\n noa setglobal noai\n set ai!\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" Should not print anything, use :noa\n \" 7: don't trigger OptionSet\"\n let g:options=[['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid']]\n noa set nonu\n call assert_equal([['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid']], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 8: Setting several global list and number option\"\n let g:options=[['list', 0, 0, 0, 1, 'global', 'set'], ['number', 0, 0, 0, 1, 'global', 'set']]\n set list nu\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 9: don't trigger OptionSet\"\n let g:options=[['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid'], ['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid']]\n noa set nolist nonu\n call assert_equal([['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid'], ['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid']], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 10: Setting global acd\"\n let g:options=[['autochdir', 0, 0, '', 1, 'local', 'setlocal']]\n setlocal acd\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 11: Setting global autoread (also sets local value)\"\n let g:options=[['autoread', 0, 0, 0, 1, 'global', 'set']]\n set ar\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 12: Setting local autoread\"\n let g:options=[['autoread', 1, 1, '', 1, 'local', 'setlocal']]\n setlocal ar\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 13: Setting global autoread\"\n let g:options=[['autoread', 1, '', 1, 0, 'global', 'setglobal']]\n setglobal invar\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 14: Setting option backspace through :let\"\n let g:options=[['backspace', '', '', '', 'eol,indent,start', 'global', 'set']]\n let &bs=\"eol,indent,start\"\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 15: Setting option backspace through setbufvar()\"\n let g:options=[['backup', 0, 0, '', 1, 'local', 'setlocal']]\n \" try twice, first time, shouldn't trigger because option name is invalid,\n \" second time, it should trigger\n let bnum = bufnr('%')\n call assert_fails(\"call setbufvar(bnum, '&l:bk', 1)\", \"E355\")\n \" should trigger, use correct option name\n call setbufvar(bnum, '&backup', 1)\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 16: Setting number option using setwinvar\"\n let g:options=[['number', 0, 0, '', 1, 'local', 'setlocal']]\n call setwinvar(0, '&number', 1)\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 17: Setting key option, shouldn't trigger\"\n let g:options=[['key', 'invalid', 'invalid1', 'invalid2', 'invalid3', 'invalid4', 'invalid5']]\n setlocal key=blah\n setlocal key=\n call assert_equal([['key', 'invalid', 'invalid1', 'invalid2', 'invalid3', 'invalid4', 'invalid5']], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 18a: Setting string global option\"\n let oldval = &backupext\n let g:options=[['backupext', oldval, oldval, oldval, 'foo', 'global', 'set']]\n set backupext=foo\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 18b: Resetting string global option\"\n let g:options=[['backupext', 'foo', 'foo', 'foo', oldval, 'global', 'set']]\n set backupext&\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 18c: Setting global string global option\"\n let g:options=[['backupext', oldval, '', oldval, 'bar', 'global', 'setglobal']]\n setglobal backupext=bar\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 18d: Setting local string global option\"\n \" As this is a global option this sets the global value even though\n \" :setlocal is used!\n noa set backupext& \" Reset global and local value (without triggering autocmd)\n let g:options=[['backupext', oldval, oldval, '', 'baz', 'local', 'setlocal']]\n setlocal backupext=baz\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 18e: Setting again string global option\"\n noa setglobal backupext=ext_global \" Reset global and local value (without triggering autocmd)\n noa setlocal backupext=ext_local \" Sets the global(!) value!\n let g:options=[['backupext', 'ext_local', 'ext_local', 'ext_local', 'fuu', 'global', 'set']]\n set backupext=fuu\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 19a: Setting string local-global (to buffer) option\"\n let oldval = &tags\n let g:options=[['tags', oldval, oldval, oldval, 'tagpath', 'global', 'set']]\n set tags=tagpath\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 19b: Resetting string local-global (to buffer) option\"\n let g:options=[['tags', 'tagpath', 'tagpath', 'tagpath', oldval, 'global', 'set']]\n set tags&\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 19c: Setting global string local-global (to buffer) option \"\n let g:options=[['tags', oldval, '', oldval, 'tagpath1', 'global', 'setglobal']]\n setglobal tags=tagpath1\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 19d: Setting local string local-global (to buffer) option\"\n let g:options=[['tags', 'tagpath1', 'tagpath1', '', 'tagpath2', 'local', 'setlocal']]\n setlocal tags=tagpath2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 19e: Setting again string local-global (to buffer) option\"\n \" Note: v:option_old is the old global value for local-global string options\n \" but the old local value for all other kinds of options.\n noa setglobal tags=tag_global \" Reset global and local value (without triggering autocmd)\n noa setlocal tags=tag_local\n let g:options=[['tags', 'tag_global', 'tag_local', 'tag_global', 'tagpath', 'global', 'set']]\n set tags=tagpath\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 19f: Setting string local-global (to buffer) option to an empty string\"\n \" Note: v:option_old is the old global value for local-global string options\n \" but the old local value for all other kinds of options.\n noa set tags=tag_global \" Reset global and local value (without triggering autocmd)\n noa setlocal tags= \" empty string\n let g:options=[['tags', 'tag_global', '', 'tag_global', 'tagpath', 'global', 'set']]\n set tags=tagpath\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 20a: Setting string local (to buffer) option\"\n let oldval = &spelllang\n let g:options=[['spelllang', oldval, oldval, oldval, 'elvish,klingon', 'global', 'set']]\n set spelllang=elvish,klingon\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 20b: Resetting string local (to buffer) option\"\n let g:options=[['spelllang', 'elvish,klingon', 'elvish,klingon', 'elvish,klingon', oldval, 'global', 'set']]\n set spelllang&\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 20c: Setting global string local (to buffer) option\"\n let g:options=[['spelllang', oldval, '', oldval, 'elvish', 'global', 'setglobal']]\n setglobal spelllang=elvish\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 20d: Setting local string local (to buffer) option\"\n noa set spelllang& \" Reset global and local value (without triggering autocmd)\n let g:options=[['spelllang', oldval, oldval, '', 'klingon', 'local', 'setlocal']]\n setlocal spelllang=klingon\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 20e: Setting again string local (to buffer) option\"\n \" Note: v:option_old is the old global value for local-global string options\n \" but the old local value for all other kinds of options.\n noa setglobal spelllang=spellglobal \" Reset global and local value (without triggering autocmd)\n noa setlocal spelllang=spelllocal\n let g:options=[['spelllang', 'spelllocal', 'spelllocal', 'spellglobal', 'foo', 'global', 'set']]\n set spelllang=foo\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 21a: Setting string local-global (to window) option\"\n let oldval = &statusline\n let g:options=[['statusline', oldval, oldval, oldval, 'foo', 'global', 'set']]\n set statusline=foo\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 21b: Resetting string local-global (to window) option\"\n \" Note: v:option_old is the old global value for local-global string options\n \" but the old local value for all other kinds of options.\n let g:options=[['statusline', 'foo', 'foo', 'foo', oldval, 'global', 'set']]\n set statusline&\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 21c: Setting global string local-global (to window) option\"\n let g:options=[['statusline', oldval, '', oldval, 'bar', 'global', 'setglobal']]\n setglobal statusline=bar\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 21d: Setting local string local-global (to window) option\"\n noa set statusline& \" Reset global and local value (without triggering autocmd)\n let g:options=[['statusline', oldval, oldval, '', 'baz', 'local', 'setlocal']]\n setlocal statusline=baz\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 21e: Setting again string local-global (to window) option\"\n \" Note: v:option_old is the old global value for local-global string options\n \" but the old local value for all other kinds of options.\n noa setglobal statusline=bar \" Reset global and local value (without triggering autocmd)\n noa setlocal statusline=baz\n let g:options=[['statusline', 'bar', 'baz', 'bar', 'foo', 'global', 'set']]\n set statusline=foo\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 22a: Setting string local (to window) option\"\n let oldval = &foldignore\n let g:options=[['foldignore', oldval, oldval, oldval, 'fo', 'global', 'set']]\n set foldignore=fo\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 22b: Resetting string local (to window) option\"\n let g:options=[['foldignore', 'fo', 'fo', 'fo', oldval, 'global', 'set']]\n set foldignore&\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 22c: Setting global string local (to window) option\"\n let g:options=[['foldignore', oldval, '', oldval, 'bar', 'global', 'setglobal']]\n setglobal foldignore=bar\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 22d: Setting local string local (to window) option\"\n noa set foldignore& \" Reset global and local value (without triggering autocmd)\n let g:options=[['foldignore', oldval, oldval, '', 'baz', 'local', 'setlocal']]\n setlocal foldignore=baz\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 22e: Setting again string local (to window) option\"\n noa setglobal foldignore=glob \" Reset global and local value (without triggering autocmd)\n noa setlocal foldignore=loc\n let g:options=[['foldignore', 'loc', 'loc', 'glob', 'fo', 'global', 'set']]\n set foldignore=fo\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 23a: Setting global number local option\"\n noa setglobal cmdheight=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal cmdheight=1 \" Sets the global(!) value!\n let g:options=[['cmdheight', '1', '', '1', '2', 'global', 'setglobal']]\n setglobal cmdheight=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 23b: Setting local number global option\"\n noa setglobal cmdheight=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal cmdheight=1 \" Sets the global(!) value!\n let g:options=[['cmdheight', '1', '1', '', '2', 'local', 'setlocal']]\n setlocal cmdheight=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 23c: Setting again number global option\"\n noa setglobal cmdheight=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal cmdheight=1 \" Sets the global(!) value!\n let g:options=[['cmdheight', '1', '1', '1', '2', 'global', 'set']]\n set cmdheight=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 23d: Setting again number global option\"\n noa set cmdheight=8 \" Reset global and local value (without triggering autocmd)\n let g:options=[['cmdheight', '8', '8', '8', '2', 'global', 'set']]\n set cmdheight=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 24a: Setting global number global-local (to buffer) option\"\n noa setglobal undolevels=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal undolevels=1\n let g:options=[['undolevels', '8', '', '8', '2', 'global', 'setglobal']]\n setglobal undolevels=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 24b: Setting local number global-local (to buffer) option\"\n noa setglobal undolevels=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal undolevels=1\n let g:options=[['undolevels', '1', '1', '', '2', 'local', 'setlocal']]\n setlocal undolevels=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 24c: Setting again number global-local (to buffer) option\"\n noa setglobal undolevels=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal undolevels=1\n let g:options=[['undolevels', '1', '1', '8', '2', 'global', 'set']]\n set undolevels=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 24d: Setting again global number global-local (to buffer) option\"\n noa set undolevels=8 \" Reset global and local value (without triggering autocmd)\n let g:options=[['undolevels', '8', '8', '8', '2', 'global', 'set']]\n set undolevels=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 25a: Setting global number local (to buffer) option\"\n noa setglobal wrapmargin=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal wrapmargin=1\n let g:options=[['wrapmargin', '8', '', '8', '2', 'global', 'setglobal']]\n setglobal wrapmargin=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 25b: Setting local number local (to buffer) option\"\n noa setglobal wrapmargin=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal wrapmargin=1\n let g:options=[['wrapmargin', '1', '1', '', '2', 'local', 'setlocal']]\n setlocal wrapmargin=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 25c: Setting again number local (to buffer) option\"\n noa setglobal wrapmargin=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal wrapmargin=1\n let g:options=[['wrapmargin', '1', '1', '8', '2', 'global', 'set']]\n set wrapmargin=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 25d: Setting again global number local (to buffer) option\"\n noa set wrapmargin=8 \" Reset global and local value (without triggering autocmd)\n let g:options=[['wrapmargin', '8', '8', '8', '2', 'global', 'set']]\n set wrapmargin=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 26: Setting number global-local (to window) option.\n \" Such option does currently not exist.", "\n \" 27a: Setting global number local (to window) option\"\n noa setglobal foldcolumn=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal foldcolumn=1\n let g:options=[['foldcolumn', '8', '', '8', '2', 'global', 'setglobal']]\n setglobal foldcolumn=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 27b: Setting local number local (to window) option\"\n noa setglobal foldcolumn=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal foldcolumn=1\n let g:options=[['foldcolumn', '1', '1', '', '2', 'local', 'setlocal']]\n setlocal foldcolumn=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 27c: Setting again number local (to window) option\"\n noa setglobal foldcolumn=8 \" Reset global and local value (without triggering autocmd)\n noa setlocal foldcolumn=1\n let g:options=[['foldcolumn', '1', '1', '8', '2', 'global', 'set']]\n set foldcolumn=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 27d: Ssettin again global number local (to window) option\"\n noa set foldcolumn=8 \" Reset global and local value (without triggering autocmd)\n let g:options=[['foldcolumn', '8', '8', '8', '2', 'global', 'set']]\n set foldcolumn=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 28a: Setting global boolean global option\"\n noa setglobal nowrapscan \" Reset global and local value (without triggering autocmd)\n noa setlocal wrapscan \" Sets the global(!) value!\n let g:options=[['wrapscan', '1', '', '1', '0', 'global', 'setglobal']]\n setglobal nowrapscan\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 28b: Setting local boolean global option\"\n noa setglobal nowrapscan \" Reset global and local value (without triggering autocmd)\n noa setlocal wrapscan \" Sets the global(!) value!\n let g:options=[['wrapscan', '1', '1', '', '0', 'local', 'setlocal']]\n setlocal nowrapscan\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 28c: Setting again boolean global option\"\n noa setglobal nowrapscan \" Reset global and local value (without triggering autocmd)\n noa setlocal wrapscan \" Sets the global(!) value!\n let g:options=[['wrapscan', '1', '1', '1', '0', 'global', 'set']]\n set nowrapscan\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 28d: Setting again global boolean global option\"\n noa set nowrapscan \" Reset global and local value (without triggering autocmd)\n let g:options=[['wrapscan', '0', '0', '0', '1', 'global', 'set']]\n set wrapscan\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 29a: Setting global boolean global-local (to buffer) option\"\n noa setglobal noautoread \" Reset global and local value (without triggering autocmd)\n noa setlocal autoread\n let g:options=[['autoread', '0', '', '0', '1', 'global', 'setglobal']]\n setglobal autoread\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 29b: Setting local boolean global-local (to buffer) option\"\n noa setglobal noautoread \" Reset global and local value (without triggering autocmd)\n noa setlocal autoread\n let g:options=[['autoread', '1', '1', '', '0', 'local', 'setlocal']]\n setlocal noautoread\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 29c: Setting again boolean global-local (to buffer) option\"\n noa setglobal noautoread \" Reset global and local value (without triggering autocmd)\n noa setlocal autoread\n let g:options=[['autoread', '1', '1', '0', '1', 'global', 'set']]\n set autoread\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 29d: Setting again global boolean global-local (to buffer) option\"\n noa set noautoread \" Reset global and local value (without triggering autocmd)\n let g:options=[['autoread', '0', '0', '0', '1', 'global', 'set']]\n set autoread\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 30a: Setting global boolean local (to buffer) option\"\n noa setglobal nocindent \" Reset global and local value (without triggering autocmd)\n noa setlocal cindent\n let g:options=[['cindent', '0', '', '0', '1', 'global', 'setglobal']]\n setglobal cindent\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 30b: Setting local boolean local (to buffer) option\"\n noa setglobal nocindent \" Reset global and local value (without triggering autocmd)\n noa setlocal cindent\n let g:options=[['cindent', '1', '1', '', '0', 'local', 'setlocal']]\n setlocal nocindent\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 30c: Setting again boolean local (to buffer) option\"\n noa setglobal nocindent \" Reset global and local value (without triggering autocmd)\n noa setlocal cindent\n let g:options=[['cindent', '1', '1', '0', '1', 'global', 'set']]\n set cindent\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 30d: Setting again global boolean local (to buffer) option\"\n noa set nocindent \" Reset global and local value (without triggering autocmd)\n let g:options=[['cindent', '0', '0', '0', '1', 'global', 'set']]\n set cindent\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 31: Setting boolean global-local (to window) option\n \" Currently no such option exists.", "\n \" 32a: Setting global boolean local (to window) option\"\n noa setglobal nocursorcolumn \" Reset global and local value (without triggering autocmd)\n noa setlocal cursorcolumn\n let g:options=[['cursorcolumn', '0', '', '0', '1', 'global', 'setglobal']]\n setglobal cursorcolumn\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 32b: Setting local boolean local (to window) option\"\n noa setglobal nocursorcolumn \" Reset global and local value (without triggering autocmd)\n noa setlocal cursorcolumn\n let g:options=[['cursorcolumn', '1', '1', '', '0', 'local', 'setlocal']]\n setlocal nocursorcolumn\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 32c: Setting again boolean local (to window) option\"\n noa setglobal nocursorcolumn \" Reset global and local value (without triggering autocmd)\n noa setlocal cursorcolumn\n let g:options=[['cursorcolumn', '1', '1', '0', '1', 'global', 'set']]\n set cursorcolumn\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", " \" 32d: Setting again global boolean local (to window) option\"\n noa set nocursorcolumn \" Reset global and local value (without triggering autocmd)\n let g:options=[['cursorcolumn', '0', '0', '0', '1', 'global', 'set']]\n set cursorcolumn\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" 33: Test autocommands when an option value is converted internally.\n noa set backspace=1 \" Reset global and local value (without triggering autocmd)\n let g:options=[['backspace', 'indent,eol', 'indent,eol', 'indent,eol', '2', 'global', 'set']]\n set backspace=2\n call assert_equal([], g:options)\n call assert_equal(g:opt[0], g:opt[1])", "\n \" Cleanup\n au! OptionSet\n \" set tags&\n for opt in ['nu', 'ai', 'acd', 'ar', 'bs', 'backup', 'cul', 'cp', 'backupext', 'tags', 'spelllang', 'statusline', 'foldignore', 'cmdheight', 'undolevels', 'wrapmargin', 'foldcolumn', 'wrapscan', 'autoread', 'cindent', 'cursorcolumn']\n exe printf(\":set %s&vim\", opt)\n endfor\n call test_override('starting', 0)\n delfunc! AutoCommandOptionSet\nendfunc", "func Test_OptionSet_diffmode()\n call test_override('starting', 1)\n \" 18: Changing an option when entering diff mode\n new\n au OptionSet diff :let &l:cul=v:option_new", " call setline(1, ['buffer 1', 'line2', 'line3', 'line4'])\n call assert_equal(0, &l:cul)\n diffthis\n call assert_equal(1, &l:cul)", " vnew\n call setline(1, ['buffer 2', 'line 2', 'line 3', 'line4'])\n call assert_equal(0, &l:cul)\n diffthis\n call assert_equal(1, &l:cul)", " diffoff\n call assert_equal(0, &l:cul)\n call assert_equal(1, getwinvar(2, '&l:cul'))\n bw!", " call assert_equal(1, &l:cul)\n diffoff!\n call assert_equal(0, &l:cul)\n call assert_equal(0, getwinvar(1, '&l:cul'))\n bw!", " \" Cleanup\n au! OptionSet\n call test_override('starting', 0)\nendfunc", "func Test_OptionSet_diffmode_close()\n call test_override('starting', 1)\n \" 19: Try to close the current window when entering diff mode\n \" should not segfault\n new\n au OptionSet diff close", " call setline(1, ['buffer 1', 'line2', 'line3', 'line4'])\n call assert_fails(':diffthis', 'E788')\n call assert_equal(1, &diff)\n vnew\n call setline(1, ['buffer 2', 'line 2', 'line 3', 'line4'])\n call assert_fails(':diffthis', 'E788')\n call assert_equal(1, &diff)\n bw!\n call assert_fails(':diffoff!', 'E788')\n bw!", " \" Cleanup\n au! OptionSet\n call test_override('starting', 0)\n \"delfunc! AutoCommandOptionSet\nendfunc", "\" Test for Bufleave autocommand that deletes the buffer we are about to edit.\nfunc Test_BufleaveWithDelete()\n new | edit Xfile1", " augroup test_bufleavewithdelete\n autocmd!\n autocmd BufLeave Xfile1 bwipe Xfile2\n augroup END", " call assert_fails('edit Xfile2', 'E143:')\n call assert_equal('Xfile1', bufname('%'))", " autocmd! test_bufleavewithdelete BufLeave Xfile1\n augroup! test_bufleavewithdelete", " new\n bwipe! Xfile1\nendfunc", "\" Test for autocommand that changes the buffer list, when doing \":ball\".\nfunc Test_Acmd_BufAll()\n enew!\n %bwipe!\n call writefile(['Test file Xxx1'], 'Xxx1')\n call writefile(['Test file Xxx2'], 'Xxx2')\n call writefile(['Test file Xxx3'], 'Xxx3')", " \" Add three files to the buffer list\n split Xxx1\n close\n split Xxx2\n close\n split Xxx3\n close", " \" Wipe the buffer when the buffer is opened\n au BufReadPost Xxx2 bwipe", " call append(0, 'Test file Xxx4')\n ball", " call assert_equal(2, winnr('$'))\n call assert_equal('Xxx1', bufname(winbufnr(winnr('$'))))\n wincmd t", " au! BufReadPost\n %bwipe!\n call delete('Xxx1')\n call delete('Xxx2')\n call delete('Xxx3')\n enew! | only\nendfunc", "\" Test for autocommand that changes current buffer on BufEnter event.\n\" Check if modelines are interpreted for the correct buffer.\nfunc Test_Acmd_BufEnter()\n %bwipe!\n call writefile(['start of test file Xxx1',\n\t \\ \"\\<Tab>this is a test\",\n\t \\ 'end of test file Xxx1'], 'Xxx1')\n call writefile(['start of test file Xxx2',\n\t \\ 'vim: set noai :',\n\t \\ \"\\<Tab>this is a test\",\n\t \\ 'end of test file Xxx2'], 'Xxx2')", " au BufEnter Xxx2 brew\n set ai modeline modelines=3\n edit Xxx1\n \" edit Xxx2, autocmd will do :brew\n edit Xxx2\n exe \"normal G?this is a\\<CR>\"\n \" Append text with autoindent to this file\n normal othis should be auto-indented\n call assert_equal(\"\\<Tab>this should be auto-indented\", getline('.'))\n call assert_equal(3, line('.'))\n \" Remove autocmd and edit Xxx2 again\n au! BufEnter Xxx2\n buf! Xxx2\n exe \"normal G?this is a\\<CR>\"\n \" append text without autoindent to Xxx\n normal othis should be in column 1\n call assert_equal(\"this should be in column 1\", getline('.'))\n call assert_equal(4, line('.'))", " %bwipe!\n call delete('Xxx1')\n call delete('Xxx2')\n set ai&vim modeline&vim modelines&vim\nendfunc", "\" Test for issue #57\n\" do not move cursor on <c-o> when autoindent is set\nfunc Test_ai_CTRL_O()\n enew!\n set ai\n let save_fo = &fo\n set fo+=r\n exe \"normal o# abcdef\\<Esc>2hi\\<CR>\\<C-O>d0\\<Esc>\"\n exe \"normal o# abcdef\\<Esc>2hi\\<C-O>d0\\<Esc>\"\n call assert_equal(['# abc', 'def', 'def'], getline(2, 4))", " set ai&vim\n let &fo = save_fo\n enew!\nendfunc", "\" Test for autocommand that deletes the current buffer on BufLeave event.\n\" Also test deleting the last buffer, should give a new, empty buffer.\nfunc Test_BufLeave_Wipe()\n %bwipe!\n let content = ['start of test file Xxx',\n\t \\ 'this is a test',\n\t \\ 'end of test file Xxx']\n call writefile(content, 'Xxx1')\n call writefile(content, 'Xxx2')", " au BufLeave Xxx2 bwipe\n edit Xxx1\n split Xxx2\n \" delete buffer Xxx2, we should be back to Xxx1\n bwipe\n call assert_equal('Xxx1', bufname('%'))\n call assert_equal(1, winnr('$'))", " \" Create an alternate buffer\n %write! test.out\n call assert_equal('test.out', bufname('#'))\n \" delete alternate buffer\n bwipe test.out\n call assert_equal('Xxx1', bufname('%'))\n call assert_equal('', bufname('#'))", " au BufLeave Xxx1 bwipe\n \" delete current buffer, get an empty one\n bwipe!\n call assert_equal(1, line('$'))\n call assert_equal('', bufname('%'))\n let g:bufinfo = getbufinfo()\n call assert_equal(1, len(g:bufinfo))", " call delete('Xxx1')\n call delete('Xxx2')\n call delete('test.out')\n %bwipe\n au! BufLeave", " \" check that bufinfo doesn't contain a pointer to freed memory\n call test_garbagecollect_now()\nendfunc", "func Test_QuitPre()\n edit Xfoo\n let winid = win_getid(winnr())\n split Xbar\n au! QuitPre * let g:afile = expand('<afile>')\n \" Close the other window, <afile> should be correct.\n exe win_id2win(winid) . 'q'\n call assert_equal('Xfoo', g:afile)\n \n unlet g:afile\n bwipe Xfoo\n bwipe Xbar\nendfunc", "func Test_Cmdline()\n au! CmdlineChanged : let g:text = getcmdline()\n let g:text = 0\n call feedkeys(\":echom 'hello'\\<CR>\", 'xt')\n call assert_equal(\"echom 'hello'\", g:text)\n au! CmdlineChanged", " au! CmdlineChanged : let g:entered = expand('<afile>')\n let g:entered = 0\n call feedkeys(\":echom 'hello'\\<CR>\", 'xt')\n call assert_equal(':', g:entered)\n au! CmdlineChanged", " au! CmdlineEnter : let g:entered = expand('<afile>')\n au! CmdlineLeave : let g:left = expand('<afile>')\n let g:entered = 0\n let g:left = 0\n call feedkeys(\":echo 'hello'\\<CR>\", 'xt')\n call assert_equal(':', g:entered)\n call assert_equal(':', g:left)\n au! CmdlineEnter\n au! CmdlineLeave", " let save_shellslash = &shellslash\n set noshellslash\n au! CmdlineEnter / let g:entered = expand('<afile>')\n au! CmdlineLeave / let g:left = expand('<afile>')\n let g:entered = 0\n let g:left = 0\n new\n call setline(1, 'hello')\n call feedkeys(\"/hello\\<CR>\", 'xt')\n call assert_equal('/', g:entered)\n call assert_equal('/', g:left)\n bwipe!\n au! CmdlineEnter\n au! CmdlineLeave\n let &shellslash = save_shellslash\nendfunc", "\" Test for BufWritePre autocommand that deletes or unloads the buffer.\nfunc Test_BufWritePre()\n %bwipe\n au BufWritePre Xxx1 bunload\n au BufWritePre Xxx2 bwipe", " call writefile(['start of Xxx1', 'test', 'end of Xxx1'], 'Xxx1')\n call writefile(['start of Xxx2', 'test', 'end of Xxx2'], 'Xxx2')", " edit Xtest\n e! Xxx2\n bdel Xtest\n e Xxx1\n \" write it, will unload it and give an error msg\n call assert_fails('w', 'E203')\n call assert_equal('Xxx2', bufname('%'))\n edit Xtest\n e! Xxx2\n bwipe Xtest\n \" write it, will delete the buffer and give an error msg\n call assert_fails('w', 'E203')\n call assert_equal('Xxx1', bufname('%'))\n au! BufWritePre\n call delete('Xxx1')\n call delete('Xxx2')\nendfunc", "\" Test for BufUnload autocommand that unloads all the other buffers\nfunc Test_bufunload_all()\n call writefile(['Test file Xxx1'], 'Xxx1')\"\n call writefile(['Test file Xxx2'], 'Xxx2')\"", " let content =<< trim [CODE]\n func UnloadAllBufs()\n let i = 1\n while i <= bufnr('$')\n if i != bufnr('%') && bufloaded(i)\n exe i . 'bunload'\n endif\n let i += 1\n endwhile\n endfunc\n au BufUnload * call UnloadAllBufs()\n au VimLeave * call writefile(['Test Finished'], 'Xout')\n edit Xxx1\n split Xxx2\n q\n [CODE]", " call writefile(content, 'Xtest')", " call delete('Xout')\n call system(GetVimCommandClean() .. ' -N --not-a-term -S Xtest')\n call assert_true(filereadable('Xout'))", " call delete('Xxx1')\n call delete('Xxx2')\n call delete('Xtest')\n call delete('Xout')\nendfunc", "\" Some tests for buffer-local autocommands\nfunc Test_buflocal_autocmd()\n let g:bname = ''\n edit xx\n au BufLeave <buffer> let g:bname = expand(\"%\")\n \" here, autocommand for xx should trigger.\n \" but autocommand shall not apply to buffer named <buffer>.\n edit somefile\n call assert_equal('xx', g:bname)\n let g:bname = ''\n \" here, autocommand shall be auto-deleted\n bwipe xx\n \" autocmd should not trigger\n edit xx\n call assert_equal('', g:bname)\n \" autocmd should not trigger\n edit somefile\n call assert_equal('', g:bname)\n enew\n unlet g:bname\nendfunc", "\" Test for \"*Cmd\" autocommands\nfunc Test_Cmd_Autocmds()\n call writefile(['start of Xxx', \"\\tabc2\", 'end of Xxx'], 'Xxx')", " enew!\n au BufReadCmd XtestA 0r Xxx|$del\n edit XtestA\t\t\t\" will read text of Xxd instead\n call assert_equal('start of Xxx', getline(1))", " au BufWriteCmd XtestA call append(line(\"$\"), \"write\")\n write\t\t\t\t\" will append a line to the file\n call assert_equal('write', getline('$'))\n call assert_fails('read XtestA', 'E484')\t\" should not read anything\n call assert_equal('write', getline(4))", " \" now we have:\n \" 1\tstart of Xxx\n \" 2\t\tabc2\n \" 3\tend of Xxx\n \" 4\twrite", " au FileReadCmd XtestB '[r Xxx\n 2r XtestB\t\t\t\" will read Xxx below line 2 instead\n call assert_equal('start of Xxx', getline(3))", " \" now we have:\n \" 1\tstart of Xxx\n \" 2\t\tabc2\n \" 3\tstart of Xxx\n \" 4\t\tabc2\n \" 5\tend of Xxx\n \" 6\tend of Xxx\n \" 7\twrite", " au FileWriteCmd XtestC '[,']copy $\n normal 4GA1\n 4,5w XtestC\t\t\t\" will copy lines 4 and 5 to the end\n call assert_equal(\"\\tabc21\", getline(8))\n call assert_fails('r XtestC', 'E484')\t\" should not read anything\n call assert_equal(\"end of Xxx\", getline(9))", " \" now we have:\n \" 1\tstart of Xxx\n \" 2\t\tabc2\n \" 3\tstart of Xxx\n \" 4\t\tabc21\n \" 5\tend of Xxx\n \" 6\tend of Xxx\n \" 7\twrite\n \" 8\t\tabc21\n \" 9\tend of Xxx", " let g:lines = []\n au FileAppendCmd XtestD call extend(g:lines, getline(line(\"'[\"), line(\"']\")))\n w >>XtestD\t\t\t\" will add lines to 'lines'\n call assert_equal(9, len(g:lines))\n call assert_fails('$r XtestD', 'E484')\t\" should not read anything\n call assert_equal(9, line('$'))\n call assert_equal('end of Xxx', getline('$'))", " au BufReadCmd XtestE 0r Xxx|$del\n sp XtestE\t\t\t\" split window with test.out\n call assert_equal('end of Xxx', getline(3))", " let g:lines = []\n exe \"normal 2Goasdf\\<Esc>\\<C-W>\\<C-W>\"\n au BufWriteCmd XtestE call extend(g:lines, getline(0, '$'))\n wall\t\t\t\t\" will write other window to 'lines'\n call assert_equal(4, len(g:lines), g:lines)\n call assert_equal('asdf', g:lines[2])", " au! BufReadCmd\n au! BufWriteCmd\n au! FileReadCmd\n au! FileWriteCmd\n au! FileAppendCmd\n %bwipe!\n call delete('Xxx')\n enew!\nendfunc", "func SetChangeMarks(start, end)\n exe a:start. 'mark ['\n exe a:end. 'mark ]'\nendfunc", "\" Verify the effects of autocmds on '[ and ']\nfunc Test_change_mark_in_autocmds()\n edit! Xtest\n call feedkeys(\"ia\\<CR>b\\<CR>c\\<CR>d\\<C-g>u\", 'xtn')", " call SetChangeMarks(2, 3)\n write\n call assert_equal([1, 4], [line(\"'[\"), line(\"']\")])", " call SetChangeMarks(2, 3)\n au BufWritePre * call assert_equal([1, 4], [line(\"'[\"), line(\"']\")])\n write\n au! BufWritePre", " if executable('cat')\n write XtestFilter\n write >> XtestFilter", " call SetChangeMarks(2, 3)\n \" Marks are set to the entire range of the write\n au FilterWritePre * call assert_equal([1, 4], [line(\"'[\"), line(\"']\")])\n \" '[ is adjusted to just before the line that will receive the filtered\n \" data\n au FilterReadPre * call assert_equal([4, 4], [line(\"'[\"), line(\"']\")])\n \" The filtered data is read into the buffer, and the source lines are\n \" still present, so the range is after the source lines\n au FilterReadPost * call assert_equal([5, 12], [line(\"'[\"), line(\"']\")])\n %!cat XtestFilter\n \" After the filtered data is read, the original lines are deleted\n call assert_equal([1, 8], [line(\"'[\"), line(\"']\")])\n au! FilterWritePre,FilterReadPre,FilterReadPost\n undo", " call SetChangeMarks(1, 4)\n au FilterWritePre * call assert_equal([2, 3], [line(\"'[\"), line(\"']\")])\n au FilterReadPre * call assert_equal([3, 3], [line(\"'[\"), line(\"']\")])\n au FilterReadPost * call assert_equal([4, 11], [line(\"'[\"), line(\"']\")])\n 2,3!cat XtestFilter\n call assert_equal([2, 9], [line(\"'[\"), line(\"']\")])\n au! FilterWritePre,FilterReadPre,FilterReadPost\n undo", " call delete('XtestFilter')\n endif", " call SetChangeMarks(1, 4)\n au FileWritePre * call assert_equal([2, 3], [line(\"'[\"), line(\"']\")])\n 2,3write Xtest2\n au! FileWritePre", " call SetChangeMarks(2, 3)\n au FileAppendPre * call assert_equal([1, 4], [line(\"'[\"), line(\"']\")])\n write >> Xtest2\n au! FileAppendPre", " call SetChangeMarks(1, 4)\n au FileAppendPre * call assert_equal([2, 3], [line(\"'[\"), line(\"']\")])\n 2,3write >> Xtest2\n au! FileAppendPre", " call SetChangeMarks(1, 1)\n au FileReadPre * call assert_equal([3, 1], [line(\"'[\"), line(\"']\")])\n au FileReadPost * call assert_equal([4, 11], [line(\"'[\"), line(\"']\")])\n 3read Xtest2\n au! FileReadPre,FileReadPost\n undo", " call SetChangeMarks(4, 4)\n \" When the line is 0, it's adjusted to 1\n au FileReadPre * call assert_equal([1, 4], [line(\"'[\"), line(\"']\")])\n au FileReadPost * call assert_equal([1, 8], [line(\"'[\"), line(\"']\")])\n 0read Xtest2\n au! FileReadPre,FileReadPost\n undo", " call SetChangeMarks(4, 4)\n \" When the line is 0, it's adjusted to 1\n au FileReadPre * call assert_equal([1, 4], [line(\"'[\"), line(\"']\")])\n au FileReadPost * call assert_equal([2, 9], [line(\"'[\"), line(\"']\")])\n 1read Xtest2\n au! FileReadPre,FileReadPost\n undo", " bwipe!\n call delete('Xtest')\n call delete('Xtest2')\nendfunc", "func Test_Filter_noshelltemp()\n if !executable('cat')\n return\n endif", " enew!\n call setline(1, ['a', 'b', 'c', 'd'])", " let shelltemp = &shelltemp\n set shelltemp", " let g:filter_au = 0\n au FilterWritePre * let g:filter_au += 1\n au FilterReadPre * let g:filter_au += 1\n au FilterReadPost * let g:filter_au += 1\n %!cat\n call assert_equal(3, g:filter_au)", " if has('filterpipe')\n set noshelltemp", " let g:filter_au = 0\n au FilterWritePre * let g:filter_au += 1\n au FilterReadPre * let g:filter_au += 1\n au FilterReadPost * let g:filter_au += 1\n %!cat\n call assert_equal(0, g:filter_au)\n endif", " au! FilterWritePre,FilterReadPre,FilterReadPost\n let &shelltemp = shelltemp\n bwipe!\nendfunc", "func Test_TextYankPost()\n enew!\n call setline(1, ['foo'])", " let g:event = []\n au TextYankPost * let g:event = copy(v:event)", " call assert_equal({}, v:event)\n call assert_fails('let v:event = {}', 'E46:')\n call assert_fails('let v:event.mykey = 0', 'E742:')", " norm \"ayiw\n call assert_equal(\n \\{'regcontents': ['foo'], 'regname': 'a', 'operator': 'y', 'regtype': 'v'},\n \\g:event)\n norm y_\n call assert_equal(\n \\{'regcontents': ['foo'], 'regname': '', 'operator': 'y', 'regtype': 'V'},\n \\g:event)\n call feedkeys(\"\\<C-V>y\", 'x')\n call assert_equal(\n \\{'regcontents': ['f'], 'regname': '', 'operator': 'y', 'regtype': \"\\x161\"},\n \\g:event)\n norm \"xciwbar\n call assert_equal(\n \\{'regcontents': ['foo'], 'regname': 'x', 'operator': 'c', 'regtype': 'v'},\n \\g:event)\n norm \"bdiw\n call assert_equal(\n \\{'regcontents': ['bar'], 'regname': 'b', 'operator': 'd', 'regtype': 'v'},\n \\g:event)", " call assert_equal({}, v:event)", " au! TextYankPost\n unlet g:event\n bwipe!\nendfunc", "func Test_nocatch_wipe_all_buffers()\n \" Real nasty autocommand: wipe all buffers on any event.\n au * * bwipe *\n \" Get E93 first?\n \" call assert_fails('next x', 'E93:')\n call assert_fails('next x', 'E517:')\n bwipe\n au!\nendfunc", "func Test_nocatch_wipe_dummy_buffer()\n \" Nasty autocommand: wipe buffer on any event.\n au * x bwipe\n call assert_fails('lv½ /x', 'E480')\n au!\nendfunc", "function s:Before_test_dirchanged()\n augroup test_dirchanged\n autocmd!\n augroup END\n let s:li = []\n let s:dir_this = getcwd()\n let s:dir_foo = s:dir_this . '/foo'\n call mkdir(s:dir_foo)\n let s:dir_bar = s:dir_this . '/bar'\n call mkdir(s:dir_bar)\nendfunc", "function s:After_test_dirchanged()\n exe 'cd' s:dir_this\n call delete(s:dir_foo, 'd')\n call delete(s:dir_bar, 'd')\n augroup test_dirchanged\n autocmd!\n augroup END\nendfunc", "function Test_dirchanged_global()\n call s:Before_test_dirchanged()\n autocmd test_dirchanged DirChanged global call add(s:li, \"cd:\")\n autocmd test_dirchanged DirChanged global call add(s:li, expand(\"<afile>\"))\n exe 'cd' s:dir_foo\n call assert_equal([\"cd:\", s:dir_foo], s:li)\n exe 'cd' s:dir_foo\n call assert_equal([\"cd:\", s:dir_foo], s:li)\n exe 'lcd' s:dir_bar\n call assert_equal([\"cd:\", s:dir_foo], s:li)\n call s:After_test_dirchanged()\nendfunc", "function Test_dirchanged_local()\n call s:Before_test_dirchanged()\n autocmd test_dirchanged DirChanged window call add(s:li, \"lcd:\")\n autocmd test_dirchanged DirChanged window call add(s:li, expand(\"<afile>\"))\n exe 'cd' s:dir_foo\n call assert_equal([], s:li)\n exe 'lcd' s:dir_bar\n call assert_equal([\"lcd:\", s:dir_bar], s:li)\n exe 'lcd' s:dir_bar\n call assert_equal([\"lcd:\", s:dir_bar], s:li)\n call s:After_test_dirchanged()\nendfunc", "function Test_dirchanged_auto()\n if !exists('+autochdir')\n return\n endif\n call s:Before_test_dirchanged()\n call test_autochdir()\n autocmd test_dirchanged DirChanged auto call add(s:li, \"auto:\")\n autocmd test_dirchanged DirChanged auto call add(s:li, expand(\"<afile>\"))\n set acd\n exe 'cd ..'\n call assert_equal([], s:li)\n exe 'edit ' . s:dir_foo . '/Xfile'\n call assert_equal(s:dir_foo, getcwd())\n call assert_equal([\"auto:\", s:dir_foo], s:li)\n set noacd\n bwipe!\n call s:After_test_dirchanged()\nendfunc", "\" Test TextChangedI and TextChangedP\nfunc Test_ChangedP()\n new\n call setline(1, ['foo', 'bar', 'foobar'])\n call test_override(\"char_avail\", 1)\n set complete=. completeopt=menuone", " func! TextChangedAutocmd(char)\n let g:autocmd .= a:char\n endfunc", " au! TextChanged <buffer> :call TextChangedAutocmd('N')\n au! TextChangedI <buffer> :call TextChangedAutocmd('I')\n au! TextChangedP <buffer> :call TextChangedAutocmd('P')", " call cursor(3, 1)\n let g:autocmd = ''\n call feedkeys(\"o\\<esc>\", 'tnix')\n call assert_equal('I', g:autocmd)", " let g:autocmd = ''\n call feedkeys(\"Sf\", 'tnix')\n call assert_equal('II', g:autocmd)", " let g:autocmd = ''\n call feedkeys(\"Sf\\<C-N>\", 'tnix')\n call assert_equal('IIP', g:autocmd)", " let g:autocmd = ''\n call feedkeys(\"Sf\\<C-N>\\<C-N>\", 'tnix')\n call assert_equal('IIPP', g:autocmd)", " let g:autocmd = ''\n call feedkeys(\"Sf\\<C-N>\\<C-N>\\<C-N>\", 'tnix')\n call assert_equal('IIPPP', g:autocmd)", " let g:autocmd = ''\n call feedkeys(\"Sf\\<C-N>\\<C-N>\\<C-N>\\<C-N>\", 'tnix')\n call assert_equal('IIPPPP', g:autocmd)", " call assert_equal(['foo', 'bar', 'foobar', 'foo'], getline(1, '$'))\n \" TODO: how should it handle completeopt=noinsert,noselect?", " \" CleanUp\n call test_override(\"char_avail\", 0)\n au! TextChanged\n au! TextChangedI\n au! TextChangedP\n delfu TextChangedAutocmd\n unlet! g:autocmd\n set complete&vim completeopt&vim", " bw!\nendfunc", "let g:setline_handled = v:false\nfunc SetLineOne()\n if !g:setline_handled\n call setline(1, \"(x)\")\n let g:setline_handled = v:true\n endif\nendfunc", "func Test_TextChangedI_with_setline()\n new\n call test_override('char_avail', 1)\n autocmd TextChangedI <buffer> call SetLineOne()\n call feedkeys(\"i(\\<CR>\\<Esc>\", 'tx')\n call assert_equal('(', getline(1))\n call assert_equal('x)', getline(2))\n undo\n call assert_equal('', getline(1))\n call assert_equal('', getline(2))", " call test_override('starting', 0)\n bwipe!\nendfunc", "func Test_Changed_FirstTime()\n CheckFeature terminal\n CheckNotGui", " \" Prepare file for TextChanged event.\n call writefile([''], 'Xchanged.txt')\n let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3})\n call assert_equal('running', term_getstatus(buf))\n \" Wait for the ruler (in the status line) to be shown.\n \" In ConPTY, there is additional character which is drawn up to the width of\n \" the screen.\n if has('conpty')\n call WaitForAssert({-> assert_match('\\<All.*$', term_getline(buf, 3))})\n else\n call WaitForAssert({-> assert_match('\\<All$', term_getline(buf, 3))})\n endif\n \" It's only adding autocmd, so that no event occurs.\n call term_sendkeys(buf, \":au! TextChanged <buffer> call writefile(['No'], 'Xchanged.txt')\\<cr>\")\n call term_sendkeys(buf, \"\\<C-\\\\>\\<C-N>:qa!\\<cr>\")\n call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))})\n call assert_equal([''], readfile('Xchanged.txt'))", " \" clean up\n call delete('Xchanged.txt')\n bwipe!\nendfunc", "func Test_autocmd_nested()\n let g:did_nested = 0\n augroup Testing\n au WinNew * edit somefile\n au BufNew * let g:did_nested = 1\n augroup END\n split\n call assert_equal(0, g:did_nested)\n close\n bwipe! somefile", " \" old nested argument still works\n augroup Testing\n au!\n au WinNew * nested edit somefile\n au BufNew * let g:did_nested = 1\n augroup END\n split\n call assert_equal(1, g:did_nested)\n close\n bwipe! somefile", " \" New ++nested argument works\n augroup Testing\n au!\n au WinNew * ++nested edit somefile\n au BufNew * let g:did_nested = 1\n augroup END\n split\n call assert_equal(1, g:did_nested)\n close\n bwipe! somefile", " augroup Testing\n au!\n augroup END", " call assert_fails('au WinNew * ++nested ++nested echo bad', 'E983:')\n call assert_fails('au WinNew * nested nested echo bad', 'E983:')\nendfunc", "func Test_autocmd_once()\n \" Without ++once WinNew triggers twice\n let g:did_split = 0\n augroup Testing\n au WinNew * let g:did_split += 1\n augroup END\n split\n split\n call assert_equal(2, g:did_split)\n call assert_true(exists('#WinNew'))\n close\n close", " \" With ++once WinNew triggers once\n let g:did_split = 0\n augroup Testing\n au!\n au WinNew * ++once let g:did_split += 1\n augroup END\n split\n split\n call assert_equal(1, g:did_split)\n call assert_false(exists('#WinNew'))\n close\n close", " call assert_fails('au WinNew * ++once ++once echo bad', 'E983:')\nendfunc", "func Test_autocmd_bufreadpre()\n new\n let b:bufreadpre = 1\n call append(0, range(100))\n w! XAutocmdBufReadPre.txt\n autocmd BufReadPre <buffer> :let b:bufreadpre += 1\n norm! 50gg\n sp\n norm! 100gg\n wincmd p\n let g:wsv1 = winsaveview()\n wincmd p\n let g:wsv2 = winsaveview()\n \" triggers BufReadPre, should not move the cursor in either window\n \" The topline may change one line in a large window.\n edit\n call assert_inrange(g:wsv2.topline - 1, g:wsv2.topline + 1, winsaveview().topline)\n call assert_equal(g:wsv2.lnum, winsaveview().lnum)\n call assert_equal(2, b:bufreadpre)\n wincmd p\n call assert_equal(g:wsv1.topline, winsaveview().topline)\n call assert_equal(g:wsv1.lnum, winsaveview().lnum)\n call assert_equal(2, b:bufreadpre)\n \" Now set the cursor position in an BufReadPre autocommand\n \" (even though the position will be invalid, this should make Vim reset the\n \" cursor position in the other window.\n wincmd p\n set cpo+=g\n \" won't do anything, but try to set the cursor on an invalid lnum\n autocmd BufReadPre <buffer> :norm! 70gg\n \" triggers BufReadPre, should not move the cursor in either window\n e\n call assert_equal(1, winsaveview().topline)\n call assert_equal(1, winsaveview().lnum)\n call assert_equal(3, b:bufreadpre)\n wincmd p\n call assert_equal(g:wsv1.topline, winsaveview().topline)\n call assert_equal(g:wsv1.lnum, winsaveview().lnum)\n call assert_equal(3, b:bufreadpre)\n close\n close\n call delete('XAutocmdBufReadPre.txt')\n set cpo-=g\nendfunc", "\" FileChangedShell tested in test_filechanged.vim", "\" Tests for the following autocommands:\n\" - FileWritePre\twriting a compressed file\n\" - FileReadPost\treading a compressed file\n\" - BufNewFile\t\treading a file template\n\" - BufReadPre\t\tdecompressing the file to be read\n\" - FilterReadPre\tsubstituting characters in the temp file\n\" - FilterReadPost\tsubstituting characters after filtering\n\" - FileReadPre\t\tset options for decompression\n\" - FileReadPost\tdecompress the file\nfunc Test_ReadWrite_Autocmds()\n \" Run this test only on Unix-like systems and if gzip is available\n if !has('unix') || !executable(\"gzip\")\n return\n endif", " \" Make $GZIP empty, \"-v\" would cause trouble.\n let $GZIP = \"\"", " \" Use a FileChangedShell autocommand to avoid a prompt for 'Xtestfile.gz'\n \" being modified outside of Vim (noticed on Solaris).\n au FileChangedShell * echo 'caught FileChangedShell'", " \" Test for the FileReadPost, FileWritePre and FileWritePost autocmds\n augroup Test1\n au!\n au FileWritePre *.gz '[,']!gzip\n au FileWritePost *.gz undo\n au FileReadPost *.gz '[,']!gzip -d\n augroup END", " new\n set bin\n call append(0, [\n\t \\ 'line 2\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 3\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 4\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 5\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 6\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 7\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 8\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 9\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 10 Abcdefghijklmnopqrstuvwxyz'\n\t \\ ])\n 1,9write! Xtestfile.gz\n enew! | close", " new\n \" Read and decompress the testfile\n 0read Xtestfile.gz\n call assert_equal([\n\t \\ 'line 2\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 3\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 4\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 5\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 6\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 7\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 8\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 9\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 10 Abcdefghijklmnopqrstuvwxyz'\n\t \\ ], getline(1, 9))\n enew! | close", " augroup Test1\n au!\n augroup END", " \" Test for the FileAppendPre and FileAppendPost autocmds\n augroup Test2\n au!\n au BufNewFile *.c read Xtest.c\n au FileAppendPre *.out '[,']s/new/NEW/\n au FileAppendPost *.out !cat Xtest.c >> test.out\n augroup END", " call writefile(['/*', ' * Here is a new .c file', ' */'], 'Xtest.c')\n new foo.c\t\t\t\" should load Xtest.c\n call assert_equal(['/*', ' * Here is a new .c file', ' */'], getline(2, 4))\n w! >> test.out\t\t\" append it to the output file", " let contents = readfile('test.out')\n call assert_equal(' * Here is a NEW .c file', contents[2])\n call assert_equal(' * Here is a new .c file', contents[5])", " call delete('test.out')\n enew! | close\n augroup Test2\n au!\n augroup END", " \" Test for the BufReadPre and BufReadPost autocmds\n augroup Test3\n au!\n \" setup autocommands to decompress before reading and re-compress\n \" afterwards\n au BufReadPre *.gz exe '!gzip -d ' . shellescape(expand(\"<afile>\"))\n au BufReadPre *.gz call rename(expand(\"<afile>:r\"), expand(\"<afile>\"))\n au BufReadPost *.gz call rename(expand(\"<afile>\"), expand(\"<afile>:r\"))\n au BufReadPost *.gz exe '!gzip ' . shellescape(expand(\"<afile>:r\"))\n augroup END", " e! Xtestfile.gz\t\t\" Edit compressed file\n call assert_equal([\n\t \\ 'line 2\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 3\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 4\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 5\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 6\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 7\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 8\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 9\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 10 Abcdefghijklmnopqrstuvwxyz'\n\t \\ ], getline(1, 9))", " w! >> test.out\t\t\" Append it to the output file", " augroup Test3\n au!\n augroup END", " \" Test for the FilterReadPre and FilterReadPost autocmds.\n set shelltemp\t\t\t\" need temp files here\n augroup Test4\n au!\n au FilterReadPre *.out call rename(expand(\"<afile>\"), expand(\"<afile>\") . \".t\")\n au FilterReadPre *.out exe 'silent !sed s/e/E/ ' . shellescape(expand(\"<afile>\")) . \".t >\" . shellescape(expand(\"<afile>\"))\n au FilterReadPre *.out exe 'silent !rm ' . shellescape(expand(\"<afile>\")) . '.t'\n au FilterReadPost *.out '[,']s/x/X/g\n augroup END", " e! test.out\t\t\t\" Edit the output file\n 1,$!cat\n call assert_equal([\n\t \\ 'linE 2\tAbcdefghijklmnopqrstuvwXyz',\n\t \\ 'linE 3\tXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n\t \\ 'linE 4\tAbcdefghijklmnopqrstuvwXyz',\n\t \\ 'linE 5\tXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n\t \\ 'linE 6\tAbcdefghijklmnopqrstuvwXyz',\n\t \\ 'linE 7\tXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n\t \\ 'linE 8\tAbcdefghijklmnopqrstuvwXyz',\n\t \\ 'linE 9\tXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n\t \\ 'linE 10 AbcdefghijklmnopqrstuvwXyz'\n\t \\ ], getline(1, 9))\n call assert_equal([\n\t \\ 'line 2\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 3\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 4\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 5\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 6\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 7\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 8\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 9\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 10 Abcdefghijklmnopqrstuvwxyz'\n\t \\ ], readfile('test.out'))", " augroup Test4\n au!\n augroup END\n set shelltemp&vim", " \" Test for the FileReadPre and FileReadPost autocmds.\n augroup Test5\n au!\n au FileReadPre *.gz exe 'silent !gzip -d ' . shellescape(expand(\"<afile>\"))\n au FileReadPre *.gz call rename(expand(\"<afile>:r\"), expand(\"<afile>\"))\n au FileReadPost *.gz '[,']s/l/L/\n augroup END", " new\n 0r Xtestfile.gz\t\t\" Read compressed file\n call assert_equal([\n\t \\ 'Line 2\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'Line 3\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'Line 4\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'Line 5\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'Line 6\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'Line 7\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'Line 8\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'Line 9\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'Line 10 Abcdefghijklmnopqrstuvwxyz'\n\t \\ ], getline(1, 9))\n call assert_equal([\n\t \\ 'line 2\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 3\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 4\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 5\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 6\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 7\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 8\tAbcdefghijklmnopqrstuvwxyz',\n\t \\ 'line 9\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n\t \\ 'line 10 Abcdefghijklmnopqrstuvwxyz'\n\t \\ ], readfile('Xtestfile.gz'))", " augroup Test5\n au!\n augroup END", " au! FileChangedShell\n call delete('Xtestfile.gz')\n call delete('Xtest.c')\n call delete('test.out')\nendfunc", "func Test_throw_in_BufWritePre()\n new\n call setline(1, ['one', 'two', 'three'])\n call assert_false(filereadable('Xthefile'))\n augroup throwing\n au BufWritePre X* throw 'do not write'\n augroup END\n try\n w Xthefile\n catch\n let caught = 1\n endtry\n call assert_equal(1, caught)\n call assert_false(filereadable('Xthefile'))", " bwipe!\n au! throwing\nendfunc", "func Test_autocmd_SafeState()\n CheckRunVimInTerminal", " let lines =<< trim END\n\tlet g:safe = 0\n\tlet g:again = ''\n\tau SafeState * let g:safe += 1\n\tau SafeStateAgain * let g:again ..= 'x'\n\tfunc CallTimer()\n\t call timer_start(10, {id -> execute('let g:again ..= \"t\"')})\n\tendfunc\n END\n call writefile(lines, 'XSafeState')\n let buf = RunVimInTerminal('-S XSafeState', #{rows: 6})", " \" Sometimes we loop to handle an K_IGNORE\n call term_sendkeys(buf, \":echo g:safe\\<CR>\")\n call WaitForAssert({-> assert_match('^[12] ', term_getline(buf, 6))}, 1000)", " call term_sendkeys(buf, \":echo g:again\\<CR>\")\n call WaitForAssert({-> assert_match('^xxxx', term_getline(buf, 6))}, 1000)", " call term_sendkeys(buf, \":let g:again = ''\\<CR>:call CallTimer()\\<CR>\")\n call term_wait(buf)\n call term_sendkeys(buf, \":\\<CR>\")\n call term_wait(buf)\n call term_sendkeys(buf, \":echo g:again\\<CR>\")\n call WaitForAssert({-> assert_match('xtx', term_getline(buf, 6))}, 1000)", " call StopVimInTerminal(buf)\n call delete('XSafeState')\nendfunc", "func Test_autocmd_CmdWinEnter()\n CheckRunVimInTerminal\n \" There is not cmdwin switch, so\n \" test for cmdline_hist\n \" (both are available with small builds)\n CheckFeature cmdline_hist\n let lines =<< trim END\n let b:dummy_var = 'This is a dummy'\n autocmd CmdWinEnter * quit\n let winnr = winnr('$')\n END\n let filename='XCmdWinEnter'\n call writefile(lines, filename)\n let buf = RunVimInTerminal('-S '.filename, #{rows: 6})", " call term_sendkeys(buf, \"q:\")\n call term_wait(buf)\n call term_sendkeys(buf, \":echo b:dummy_var\\<cr>\")\n call WaitForAssert({-> assert_match('^This is a dummy', term_getline(buf, 6))}, 1000)\n call term_sendkeys(buf, \":echo &buftype\\<cr>\")\n call WaitForAssert({-> assert_notmatch('^nofile', term_getline(buf, 6))}, 1000)\n call term_sendkeys(buf, \":echo winnr\\<cr>\")\n call WaitForAssert({-> assert_match('^1', term_getline(buf, 6))}, 1000)", " \" clean up\n call StopVimInTerminal(buf)\n call delete(filename)\nendfunc", "\nfunc Test_autocmd_was_using_freed_memory()\n pedit xx\n n x\n au WinEnter * quit\n split\n au! WinEnter\nendfunc" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [2290, 755, 4659], "buggy_code_start_loc": [2290, 755, 4643], "filenames": ["src/testdir/test_autocmd.vim", "src/version.c", "src/window.c"], "fixing_code_end_loc": [2299, 758, 4660], "fixing_code_start_loc": [2291, 756, 4644], "message": "The autocmd feature in window.c in Vim before 8.1.2136 accesses freed memory.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:vim:vim:*:*:*:*:*:*:*:*", "matchCriteriaId": "8BA1A77F-AC6C-4A51-A1C0-873DE3A2BF19", "versionEndExcluding": "8.1.2136", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "8.1.2121", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:12.04:*:*:*:esm:*:*:*", "matchCriteriaId": "8D305F7A-D159-4716-AB26-5E38BB5CD991", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:14.04:*:*:*:esm:*:*:*", "matchCriteriaId": "815D70A8-47D3-459C-A32C-9FEACA0659D1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:lts:*:*:*", "matchCriteriaId": "F7016A2A-8365-4F1A-89A2-7A19F2BCAE5B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:19.10:*:*:*:*:*:*:*", "matchCriteriaId": "A31C8344-3E02-4EB8-8BD8-4C84B7959624", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The autocmd feature in window.c in Vim before 8.1.2136 accesses freed memory."}, {"lang": "es", "value": "La funcionalidad autocmd en el archivo window.c en Vim versiones anteriores a la versi\u00f3n 8.1.2136, accede a la memoria liberada."}], "evaluatorComment": null, "id": "CVE-2019-20079", "lastModified": "2020-10-20T16:04:08.370", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-12-30T01:15:12.290", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/commit/ec66c41d84e574baf8009dbc0bd088d2bc5b2421"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/compare/v8.1.2135...v8.1.2136"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "https://packetstormsecurity.com/files/154898"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4309-1/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-416"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/vim/vim/commit/ec66c41d84e574baf8009dbc0bd088d2bc5b2421"}, "type": "CWE-416"}
352
Determine whether the {function_name} code is vulnerable or not.
[ "/* vi:set ts=8 sts=4 sw=4 noet:\n *\n * VIM - Vi IMproved\t\tby Bram Moolenaar\n *\n * Do \":help uganda\" in Vim to read copying and usage conditions.\n * Do \":help credits\" in Vim to see a list of people who contributed.\n * See README.txt for an overview of the Vim source code.\n */", "#include \"vim.h\"", "#ifdef AMIGA\n# include <time.h>\t/* for time() */\n#endif", "/*\n * Vim originated from Stevie version 3.6 (Fish disk 217) by GRWalter (Fred)\n * It has been changed beyond recognition since then.\n *\n * Differences between version 7.4 and 8.x can be found with \":help version8\".\n * Differences between version 6.4 and 7.x can be found with \":help version7\".\n * Differences between version 5.8 and 6.x can be found with \":help version6\".\n * Differences between version 4.x and 5.x can be found with \":help version5\".\n * Differences between version 3.0 and 4.x can be found with \":help version4\".\n * All the remarks about older versions have been removed, they are not very\n * interesting.\n */", "#include \"version.h\"", "char\t\t*Version = VIM_VERSION_SHORT;\nstatic char\t*mediumVersion = VIM_VERSION_MEDIUM;", "#if defined(HAVE_DATE_TIME) || defined(PROTO)\n# if (defined(VMS) && defined(VAXC)) || defined(PROTO)\nchar\tlongVersion[sizeof(VIM_VERSION_LONG_DATE) + sizeof(__DATE__)\n\t\t\t\t\t\t + sizeof(__TIME__) + 3];", " void\ninit_longVersion(void)\n{\n /*\n * Construct the long version string. Necessary because\n * VAX C can't concatenate strings in the preprocessor.\n */\n strcpy(longVersion, VIM_VERSION_LONG_DATE);\n strcat(longVersion, __DATE__);\n strcat(longVersion, \" \");\n strcat(longVersion, __TIME__);\n strcat(longVersion, \")\");\n}", "# else\n void\ninit_longVersion(void)\n{\n char *date_time = __DATE__ \" \" __TIME__;\n char *msg = _(\"%s (%s, compiled %s)\");\n size_t len = strlen(msg)\n\t\t+ strlen(VIM_VERSION_LONG_ONLY)\n\t\t+ strlen(VIM_VERSION_DATE_ONLY)\n\t\t+ strlen(date_time);", " longVersion = alloc(len);\n if (longVersion == NULL)\n\tlongVersion = VIM_VERSION_LONG;\n else\n\tvim_snprintf(longVersion, len, msg,\n\t\t VIM_VERSION_LONG_ONLY, VIM_VERSION_DATE_ONLY, date_time);\n}\n# endif\n#else\nchar\t*longVersion = VIM_VERSION_LONG;", " void\ninit_longVersion(void)\n{\n // nothing to do\n}\n#endif", "static char *(features[]) =\n{\n#ifdef HAVE_ACL\n\t\"+acl\",\n#else\n\t\"-acl\",\n#endif\n#ifdef AMIGA\t\t/* only for Amiga systems */\n# ifdef FEAT_ARP\n\t\"+ARP\",\n# else\n\t\"-ARP\",\n# endif\n#endif\n#ifdef FEAT_ARABIC\n\t\"+arabic\",\n#else\n\t\"-arabic\",\n#endif\n\t\"+autocmd\",\n#ifdef FEAT_AUTOCHDIR\n \"+autochdir\",\n#else\n \"-autochdir\",\n#endif\n#ifdef FEAT_AUTOSERVERNAME\n\t\"+autoservername\",\n#else\n\t\"-autoservername\",\n#endif\n#ifdef FEAT_BEVAL_GUI\n\t\"+balloon_eval\",\n#else\n\t\"-balloon_eval\",\n#endif\n#ifdef FEAT_BEVAL_TERM\n\t\"+balloon_eval_term\",\n#else\n\t\"-balloon_eval_term\",\n#endif\n#ifdef FEAT_BROWSE\n\t\"+browse\",\n#else\n\t\"-browse\",\n#endif\n#ifdef NO_BUILTIN_TCAPS\n\t\"-builtin_terms\",\n#endif\n#ifdef SOME_BUILTIN_TCAPS\n\t\"+builtin_terms\",\n#endif\n#ifdef ALL_BUILTIN_TCAPS\n\t\"++builtin_terms\",\n#endif\n#ifdef FEAT_BYTEOFF\n\t\"+byte_offset\",\n#else\n\t\"-byte_offset\",\n#endif\n#ifdef FEAT_JOB_CHANNEL\n\t\"+channel\",\n#else\n\t\"-channel\",\n#endif\n#ifdef FEAT_CINDENT\n\t\"+cindent\",\n#else\n\t\"-cindent\",\n#endif\n#ifdef FEAT_CLIENTSERVER\n\t\"+clientserver\",\n#else\n\t\"-clientserver\",\n#endif\n#ifdef FEAT_CLIPBOARD\n\t\"+clipboard\",\n#else\n\t\"-clipboard\",\n#endif\n\t\"+cmdline_compl\",\n\t\"+cmdline_hist\",\n#ifdef FEAT_CMDL_INFO\n\t\"+cmdline_info\",\n#else\n\t\"-cmdline_info\",\n#endif\n\t\"+comments\",\n#ifdef FEAT_CONCEAL\n\t\"+conceal\",\n#else\n\t\"-conceal\",\n#endif\n#ifdef FEAT_CRYPT\n\t\"+cryptv\",\n#else\n\t\"-cryptv\",\n#endif\n#ifdef FEAT_CSCOPE\n\t\"+cscope\",\n#else\n\t\"-cscope\",\n#endif\n\t\"+cursorbind\",\n#ifdef CURSOR_SHAPE\n\t\"+cursorshape\",\n#else\n\t\"-cursorshape\",\n#endif\n#if defined(FEAT_CON_DIALOG) && defined(FEAT_GUI_DIALOG)\n\t\"+dialog_con_gui\",\n#else\n# if defined(FEAT_CON_DIALOG)\n\t\"+dialog_con\",\n# else\n# if defined(FEAT_GUI_DIALOG)\n\t\"+dialog_gui\",\n# else\n\t\"-dialog\",\n# endif\n# endif\n#endif\n#ifdef FEAT_DIFF\n\t\"+diff\",\n#else\n\t\"-diff\",\n#endif\n#ifdef FEAT_DIGRAPHS\n\t\"+digraphs\",\n#else\n\t\"-digraphs\",\n#endif\n#ifdef FEAT_GUI_MSWIN\n# ifdef FEAT_DIRECTX\n\t\"+directx\",\n# else\n\t\"-directx\",\n# endif\n#endif\n#ifdef FEAT_DND\n\t\"+dnd\",\n#else\n\t\"-dnd\",\n#endif\n#ifdef EBCDIC\n\t\"+ebcdic\",\n#else\n\t\"-ebcdic\",\n#endif\n#ifdef FEAT_EMACS_TAGS\n\t\"+emacs_tags\",\n#else\n\t\"-emacs_tags\",\n#endif\n#ifdef FEAT_EVAL\n\t\"+eval\",\n#else\n\t\"-eval\",\n#endif\n\t\"+ex_extra\",\n#ifdef FEAT_SEARCH_EXTRA\n\t\"+extra_search\",\n#else\n\t\"-extra_search\",\n#endif\n\t\"-farsi\",\n#ifdef FEAT_SEARCHPATH\n\t\"+file_in_path\",\n#else\n\t\"-file_in_path\",\n#endif\n#ifdef FEAT_FIND_ID\n\t\"+find_in_path\",\n#else\n\t\"-find_in_path\",\n#endif\n#ifdef FEAT_FLOAT\n\t\"+float\",\n#else\n\t\"-float\",\n#endif\n#ifdef FEAT_FOLDING\n\t\"+folding\",\n#else\n\t\"-folding\",\n#endif\n#ifdef FEAT_FOOTER\n\t\"+footer\",\n#else\n\t\"-footer\",\n#endif\n\t /* only interesting on Unix systems */\n#if !defined(USE_SYSTEM) && defined(UNIX)\n\t\"+fork()\",\n#endif\n#ifdef FEAT_GETTEXT\n# ifdef DYNAMIC_GETTEXT\n\t\"+gettext/dyn\",\n# else\n\t\"+gettext\",\n# endif\n#else\n\t\"-gettext\",\n#endif\n#ifdef FEAT_HANGULIN\n\t\"+hangul_input\",\n#else\n\t\"-hangul_input\",\n#endif\n#if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV)\n# ifdef DYNAMIC_ICONV\n\t\"+iconv/dyn\",\n# else\n\t\"+iconv\",\n# endif\n#else\n\t\"-iconv\",\n#endif\n\t\"+insert_expand\",\n#ifdef FEAT_JOB_CHANNEL\n\t\"+job\",\n#else\n\t\"-job\",\n#endif\n#ifdef FEAT_JUMPLIST\n\t\"+jumplist\",\n#else\n\t\"-jumplist\",\n#endif\n#ifdef FEAT_KEYMAP\n\t\"+keymap\",\n#else\n\t\"-keymap\",\n#endif\n#ifdef FEAT_EVAL\n\t\"+lambda\",\n#else\n\t\"-lambda\",\n#endif\n#ifdef FEAT_LANGMAP\n\t\"+langmap\",\n#else\n\t\"-langmap\",\n#endif\n#ifdef FEAT_LIBCALL\n\t\"+libcall\",\n#else\n\t\"-libcall\",\n#endif\n#ifdef FEAT_LINEBREAK\n\t\"+linebreak\",\n#else\n\t\"-linebreak\",\n#endif\n#ifdef FEAT_LISP\n\t\"+lispindent\",\n#else\n\t\"-lispindent\",\n#endif\n\t\"+listcmds\",\n\t\"+localmap\",\n#ifdef FEAT_LUA\n# ifdef DYNAMIC_LUA\n\t\"+lua/dyn\",\n# else\n\t\"+lua\",\n# endif\n#else\n\t\"-lua\",\n#endif\n#ifdef FEAT_MENU\n\t\"+menu\",\n#else\n\t\"-menu\",\n#endif\n#ifdef FEAT_SESSION\n\t\"+mksession\",\n#else\n\t\"-mksession\",\n#endif\n\t\"+modify_fname\",\n#ifdef FEAT_MOUSE\n\t\"+mouse\",\n# ifdef FEAT_MOUSESHAPE\n\t\"+mouseshape\",\n# else\n\t\"-mouseshape\",\n# endif\n# else\n\t\"-mouse\",\n#endif", "#if defined(UNIX) || defined(VMS)\n# ifdef FEAT_MOUSE_DEC\n\t\"+mouse_dec\",\n# else\n\t\"-mouse_dec\",\n# endif\n# ifdef FEAT_MOUSE_GPM\n\t\"+mouse_gpm\",\n# else\n\t\"-mouse_gpm\",\n# endif\n# ifdef FEAT_MOUSE_JSB\n\t\"+mouse_jsbterm\",\n# else\n\t\"-mouse_jsbterm\",\n# endif\n# ifdef FEAT_MOUSE_NET\n\t\"+mouse_netterm\",\n# else\n\t\"-mouse_netterm\",\n# endif\n#endif", "#ifdef __QNX__\n# ifdef FEAT_MOUSE_PTERM\n\t\"+mouse_pterm\",\n# else\n\t\"-mouse_pterm\",\n# endif\n#endif", "#if defined(UNIX) || defined(VMS)\n# ifdef FEAT_MOUSE_XTERM\n\t\"+mouse_sgr\",\n# else\n\t\"-mouse_sgr\",\n# endif\n# ifdef FEAT_SYSMOUSE\n\t\"+mouse_sysmouse\",\n# else\n\t\"-mouse_sysmouse\",\n# endif\n# ifdef FEAT_MOUSE_URXVT\n\t\"+mouse_urxvt\",\n# else\n\t\"-mouse_urxvt\",\n# endif\n# ifdef FEAT_MOUSE_XTERM\n\t\"+mouse_xterm\",\n# else\n\t\"-mouse_xterm\",\n# endif\n#endif", "#ifdef FEAT_MBYTE_IME\n# ifdef DYNAMIC_IME\n\t\"+multi_byte_ime/dyn\",\n# else\n\t\"+multi_byte_ime\",\n# endif\n#else\n\t\"+multi_byte\",\n#endif\n#ifdef FEAT_MULTI_LANG\n\t\"+multi_lang\",\n#else\n\t\"-multi_lang\",\n#endif\n#ifdef FEAT_MZSCHEME\n# ifdef DYNAMIC_MZSCHEME\n\t\"+mzscheme/dyn\",\n# else\n\t\"+mzscheme\",\n# endif\n#else\n\t\"-mzscheme\",\n#endif\n#ifdef FEAT_NETBEANS_INTG\n\t\"+netbeans_intg\",\n#else\n\t\"-netbeans_intg\",\n#endif\n#ifdef FEAT_NUM64\n\t\"+num64\",\n#else\n\t\"-num64\",\n#endif\n#ifdef FEAT_GUI_MSWIN\n# ifdef FEAT_OLE\n\t\"+ole\",\n# else\n\t\"-ole\",\n# endif\n#endif\n#ifdef FEAT_EVAL\n\t\"+packages\",\n#else\n\t\"-packages\",\n#endif\n#ifdef FEAT_PATH_EXTRA\n\t\"+path_extra\",\n#else\n\t\"-path_extra\",\n#endif\n#ifdef FEAT_PERL\n# ifdef DYNAMIC_PERL\n\t\"+perl/dyn\",\n# else\n\t\"+perl\",\n# endif\n#else\n\t\"-perl\",\n#endif\n#ifdef FEAT_PERSISTENT_UNDO\n\t\"+persistent_undo\",\n#else\n\t\"-persistent_undo\",\n#endif\n#ifdef FEAT_PRINTER\n# ifdef FEAT_POSTSCRIPT\n\t\"+postscript\",\n# else\n\t\"-postscript\",\n# endif\n\t\"+printer\",\n#else\n\t\"-printer\",\n#endif\n#ifdef FEAT_PROFILE\n\t\"+profile\",\n#else\n\t\"-profile\",\n#endif\n#ifdef FEAT_PYTHON\n# ifdef DYNAMIC_PYTHON\n\t\"+python/dyn\",\n# else\n\t\"+python\",\n# endif\n#else\n\t\"-python\",\n#endif\n#ifdef FEAT_PYTHON3\n# ifdef DYNAMIC_PYTHON3\n\t\"+python3/dyn\",\n# else\n\t\"+python3\",\n# endif\n#else\n\t\"-python3\",\n#endif\n#ifdef FEAT_QUICKFIX\n\t\"+quickfix\",\n#else\n\t\"-quickfix\",\n#endif\n#ifdef FEAT_RELTIME\n\t\"+reltime\",\n#else\n\t\"-reltime\",\n#endif\n#ifdef FEAT_RIGHTLEFT\n\t\"+rightleft\",\n#else\n\t\"-rightleft\",\n#endif\n#ifdef FEAT_RUBY\n# ifdef DYNAMIC_RUBY\n\t\"+ruby/dyn\",\n# else\n\t\"+ruby\",\n# endif\n#else\n\t\"-ruby\",\n#endif\n\t\"+scrollbind\",\n#ifdef FEAT_SIGNS\n\t\"+signs\",\n#else\n\t\"-signs\",\n#endif\n#ifdef FEAT_SMARTINDENT\n\t\"+smartindent\",\n#else\n\t\"-smartindent\",\n#endif\n#ifdef FEAT_SOUND\n\t\"+sound\",\n#else\n\t\"-sound\",\n#endif\n#ifdef FEAT_SPELL\n\t\"+spell\",\n#else\n\t\"-spell\",\n#endif\n#ifdef STARTUPTIME\n\t\"+startuptime\",\n#else\n\t\"-startuptime\",\n#endif\n#ifdef FEAT_STL_OPT\n\t\"+statusline\",\n#else\n\t\"-statusline\",\n#endif\n\t\"-sun_workshop\",\n#ifdef FEAT_SYN_HL\n\t\"+syntax\",\n#else\n\t\"-syntax\",\n#endif\n\t /* only interesting on Unix systems */\n#if defined(USE_SYSTEM) && defined(UNIX)\n\t\"+system()\",\n#endif\n#ifdef FEAT_TAG_BINS\n\t\"+tag_binary\",\n#else\n\t\"-tag_binary\",\n#endif\n\t\"-tag_old_static\",\n\t\"-tag_any_white\",\n#ifdef FEAT_TCL\n# ifdef DYNAMIC_TCL\n\t\"+tcl/dyn\",\n# else\n\t\"+tcl\",\n# endif\n#else\n\t\"-tcl\",\n#endif\n#ifdef FEAT_TERMGUICOLORS\n\t\"+termguicolors\",\n#else\n\t\"-termguicolors\",\n#endif\n#ifdef FEAT_TERMINAL\n\t\"+terminal\",\n#else\n\t\"-terminal\",\n#endif\n#if defined(UNIX)\n/* only Unix can have terminfo instead of termcap */\n# ifdef TERMINFO\n\t\"+terminfo\",\n# else\n\t\"-terminfo\",\n# endif\n#endif\n#ifdef FEAT_TERMRESPONSE\n\t\"+termresponse\",\n#else\n\t\"-termresponse\",\n#endif\n#ifdef FEAT_TEXTOBJ\n\t\"+textobjects\",\n#else\n\t\"-textobjects\",\n#endif\n#ifdef FEAT_TEXT_PROP\n\t\"+textprop\",\n#else\n\t\"-textprop\",\n#endif\n#if !defined(UNIX)\n/* unix always includes termcap support */\n# ifdef HAVE_TGETENT\n\t\"+tgetent\",\n# else\n\t\"-tgetent\",\n# endif\n#endif\n#ifdef FEAT_TIMERS\n\t\"+timers\",\n#else\n\t\"-timers\",\n#endif\n#ifdef FEAT_TITLE\n\t\"+title\",\n#else\n\t\"-title\",\n#endif\n#ifdef FEAT_TOOLBAR\n\t\"+toolbar\",\n#else\n\t\"-toolbar\",\n#endif\n\t\"+user_commands\",\n#ifdef FEAT_VARTABS\n\t\"+vartabs\",\n#else\n\t\"-vartabs\",\n#endif\n\t\"+vertsplit\",\n\t\"+virtualedit\",\n\t\"+visual\",\n\t\"+visualextra\",\n#ifdef FEAT_VIMINFO\n\t\"+viminfo\",\n#else\n\t\"-viminfo\",\n#endif\n\t\"+vreplace\",\n#ifdef MSWIN\n# ifdef FEAT_VTP\n\t\"+vtp\",\n# else\n\t\"-vtp\",\n# endif\n#endif\n#ifdef FEAT_WILDIGN\n\t\"+wildignore\",\n#else\n\t\"-wildignore\",\n#endif\n#ifdef FEAT_WILDMENU\n\t\"+wildmenu\",\n#else\n\t\"-wildmenu\",\n#endif\n\t\"+windows\",\n#ifdef FEAT_WRITEBACKUP\n\t\"+writebackup\",\n#else\n\t\"-writebackup\",\n#endif\n#if defined(UNIX) || defined(VMS)\n# ifdef FEAT_X11\n\t\"+X11\",\n# else\n\t\"-X11\",\n# endif\n#endif\n#ifdef FEAT_XFONTSET\n\t\"+xfontset\",\n#else\n\t\"-xfontset\",\n#endif\n#ifdef FEAT_XIM\n\t\"+xim\",\n#else\n\t\"-xim\",\n#endif\n#ifdef MSWIN\n# ifdef FEAT_XPM_W32\n\t\"+xpm_w32\",\n# else\n\t\"-xpm_w32\",\n# endif\n#else\n# ifdef HAVE_XPM\n\t\"+xpm\",\n# else\n\t\"-xpm\",\n# endif\n#endif\n#if defined(UNIX) || defined(VMS)\n# ifdef USE_XSMP_INTERACT\n\t\"+xsmp_interact\",\n# else\n# ifdef USE_XSMP\n\t\"+xsmp\",\n# else\n\t\"-xsmp\",\n# endif\n# endif\n# ifdef FEAT_XCLIPBOARD\n\t\"+xterm_clipboard\",\n# else\n\t\"-xterm_clipboard\",\n# endif\n#endif\n#ifdef FEAT_XTERM_SAVE\n\t\"+xterm_save\",\n#else\n\t\"-xterm_save\",\n#endif\n\tNULL\n};", "static int included_patches[] =\n{ /* Add new patch number below this line */", "", "/**/\n 2135,\n/**/\n 2134,\n/**/\n 2133,\n/**/\n 2132,\n/**/\n 2131,\n/**/\n 2130,\n/**/\n 2129,\n/**/\n 2128,\n/**/\n 2127,\n/**/\n 2126,\n/**/\n 2125,\n/**/\n 2124,\n/**/\n 2123,\n/**/\n 2122,\n/**/\n 2121,\n/**/\n 2120,\n/**/\n 2119,\n/**/\n 2118,\n/**/\n 2117,\n/**/\n 2116,\n/**/\n 2115,\n/**/\n 2114,\n/**/\n 2113,\n/**/\n 2112,\n/**/\n 2111,\n/**/\n 2110,\n/**/\n 2109,\n/**/\n 2108,\n/**/\n 2107,\n/**/\n 2106,\n/**/\n 2105,\n/**/\n 2104,\n/**/\n 2103,\n/**/\n 2102,\n/**/\n 2101,\n/**/\n 2100,\n/**/\n 2099,\n/**/\n 2098,\n/**/\n 2097,\n/**/\n 2096,\n/**/\n 2095,\n/**/\n 2094,\n/**/\n 2093,\n/**/\n 2092,\n/**/\n 2091,\n/**/\n 2090,\n/**/\n 2089,\n/**/\n 2088,\n/**/\n 2087,\n/**/\n 2086,\n/**/\n 2085,\n/**/\n 2084,\n/**/\n 2083,\n/**/\n 2082,\n/**/\n 2081,\n/**/\n 2080,\n/**/\n 2079,\n/**/\n 2078,\n/**/\n 2077,\n/**/\n 2076,\n/**/\n 2075,\n/**/\n 2074,\n/**/\n 2073,\n/**/\n 2072,\n/**/\n 2071,\n/**/\n 2070,\n/**/\n 2069,\n/**/\n 2068,\n/**/\n 2067,\n/**/\n 2066,\n/**/\n 2065,\n/**/\n 2064,\n/**/\n 2063,\n/**/\n 2062,\n/**/\n 2061,\n/**/\n 2060,\n/**/\n 2059,\n/**/\n 2058,\n/**/\n 2057,\n/**/\n 2056,\n/**/\n 2055,\n/**/\n 2054,\n/**/\n 2053,\n/**/\n 2052,\n/**/\n 2051,\n/**/\n 2050,\n/**/\n 2049,\n/**/\n 2048,\n/**/\n 2047,\n/**/\n 2046,\n/**/\n 2045,\n/**/\n 2044,\n/**/\n 2043,\n/**/\n 2042,\n/**/\n 2041,\n/**/\n 2040,\n/**/\n 2039,\n/**/\n 2038,\n/**/\n 2037,\n/**/\n 2036,\n/**/\n 2035,\n/**/\n 2034,\n/**/\n 2033,\n/**/\n 2032,\n/**/\n 2031,\n/**/\n 2030,\n/**/\n 2029,\n/**/\n 2028,\n/**/\n 2027,\n/**/\n 2026,\n/**/\n 2025,\n/**/\n 2024,\n/**/\n 2023,\n/**/\n 2022,\n/**/\n 2021,\n/**/\n 2020,\n/**/\n 2019,\n/**/\n 2018,\n/**/\n 2017,\n/**/\n 2016,\n/**/\n 2015,\n/**/\n 2014,\n/**/\n 2013,\n/**/\n 2012,\n/**/\n 2011,\n/**/\n 2010,\n/**/\n 2009,\n/**/\n 2008,\n/**/\n 2007,\n/**/\n 2006,\n/**/\n 2005,\n/**/\n 2004,\n/**/\n 2003,\n/**/\n 2002,\n/**/\n 2001,\n/**/\n 2000,\n/**/\n 1999,\n/**/\n 1998,\n/**/\n 1997,\n/**/\n 1996,\n/**/\n 1995,\n/**/\n 1994,\n/**/\n 1993,\n/**/\n 1992,\n/**/\n 1991,\n/**/\n 1990,\n/**/\n 1989,\n/**/\n 1988,\n/**/\n 1987,\n/**/\n 1986,\n/**/\n 1985,\n/**/\n 1984,\n/**/\n 1983,\n/**/\n 1982,\n/**/\n 1981,\n/**/\n 1980,\n/**/\n 1979,\n/**/\n 1978,\n/**/\n 1977,\n/**/\n 1976,\n/**/\n 1975,\n/**/\n 1974,\n/**/\n 1973,\n/**/\n 1972,\n/**/\n 1971,\n/**/\n 1970,\n/**/\n 1969,\n/**/\n 1968,\n/**/\n 1967,\n/**/\n 1966,\n/**/\n 1965,\n/**/\n 1964,\n/**/\n 1963,\n/**/\n 1962,\n/**/\n 1961,\n/**/\n 1960,\n/**/\n 1959,\n/**/\n 1958,\n/**/\n 1957,\n/**/\n 1956,\n/**/\n 1955,\n/**/\n 1954,\n/**/\n 1953,\n/**/\n 1952,\n/**/\n 1951,\n/**/\n 1950,\n/**/\n 1949,\n/**/\n 1948,\n/**/\n 1947,\n/**/\n 1946,\n/**/\n 1945,\n/**/\n 1944,\n/**/\n 1943,\n/**/\n 1942,\n/**/\n 1941,\n/**/\n 1940,\n/**/\n 1939,\n/**/\n 1938,\n/**/\n 1937,\n/**/\n 1936,\n/**/\n 1935,\n/**/\n 1934,\n/**/\n 1933,\n/**/\n 1932,\n/**/\n 1931,\n/**/\n 1930,\n/**/\n 1929,\n/**/\n 1928,\n/**/\n 1927,\n/**/\n 1926,\n/**/\n 1925,\n/**/\n 1924,\n/**/\n 1923,\n/**/\n 1922,\n/**/\n 1921,\n/**/\n 1920,\n/**/\n 1919,\n/**/\n 1918,\n/**/\n 1917,\n/**/\n 1916,\n/**/\n 1915,\n/**/\n 1914,\n/**/\n 1913,\n/**/\n 1912,\n/**/\n 1911,\n/**/\n 1910,\n/**/\n 1909,\n/**/\n 1908,\n/**/\n 1907,\n/**/\n 1906,\n/**/\n 1905,\n/**/\n 1904,\n/**/\n 1903,\n/**/\n 1902,\n/**/\n 1901,\n/**/\n 1900,\n/**/\n 1899,\n/**/\n 1898,\n/**/\n 1897,\n/**/\n 1896,\n/**/\n 1895,\n/**/\n 1894,\n/**/\n 1893,\n/**/\n 1892,\n/**/\n 1891,\n/**/\n 1890,\n/**/\n 1889,\n/**/\n 1888,\n/**/\n 1887,\n/**/\n 1886,\n/**/\n 1885,\n/**/\n 1884,\n/**/\n 1883,\n/**/\n 1882,\n/**/\n 1881,\n/**/\n 1880,\n/**/\n 1879,\n/**/\n 1878,\n/**/\n 1877,\n/**/\n 1876,\n/**/\n 1875,\n/**/\n 1874,\n/**/\n 1873,\n/**/\n 1872,\n/**/\n 1871,\n/**/\n 1870,\n/**/\n 1869,\n/**/\n 1868,\n/**/\n 1867,\n/**/\n 1866,\n/**/\n 1865,\n/**/\n 1864,\n/**/\n 1863,\n/**/\n 1862,\n/**/\n 1861,\n/**/\n 1860,\n/**/\n 1859,\n/**/\n 1858,\n/**/\n 1857,\n/**/\n 1856,\n/**/\n 1855,\n/**/\n 1854,\n/**/\n 1853,\n/**/\n 1852,\n/**/\n 1851,\n/**/\n 1850,\n/**/\n 1849,\n/**/\n 1848,\n/**/\n 1847,\n/**/\n 1846,\n/**/\n 1845,\n/**/\n 1844,\n/**/\n 1843,\n/**/\n 1842,\n/**/\n 1841,\n/**/\n 1840,\n/**/\n 1839,\n/**/\n 1838,\n/**/\n 1837,\n/**/\n 1836,\n/**/\n 1835,\n/**/\n 1834,\n/**/\n 1833,\n/**/\n 1832,\n/**/\n 1831,\n/**/\n 1830,\n/**/\n 1829,\n/**/\n 1828,\n/**/\n 1827,\n/**/\n 1826,\n/**/\n 1825,\n/**/\n 1824,\n/**/\n 1823,\n/**/\n 1822,\n/**/\n 1821,\n/**/\n 1820,\n/**/\n 1819,\n/**/\n 1818,\n/**/\n 1817,\n/**/\n 1816,\n/**/\n 1815,\n/**/\n 1814,\n/**/\n 1813,\n/**/\n 1812,\n/**/\n 1811,\n/**/\n 1810,\n/**/\n 1809,\n/**/\n 1808,\n/**/\n 1807,\n/**/\n 1806,\n/**/\n 1805,\n/**/\n 1804,\n/**/\n 1803,\n/**/\n 1802,\n/**/\n 1801,\n/**/\n 1800,\n/**/\n 1799,\n/**/\n 1798,\n/**/\n 1797,\n/**/\n 1796,\n/**/\n 1795,\n/**/\n 1794,\n/**/\n 1793,\n/**/\n 1792,\n/**/\n 1791,\n/**/\n 1790,\n/**/\n 1789,\n/**/\n 1788,\n/**/\n 1787,\n/**/\n 1786,\n/**/\n 1785,\n/**/\n 1784,\n/**/\n 1783,\n/**/\n 1782,\n/**/\n 1781,\n/**/\n 1780,\n/**/\n 1779,\n/**/\n 1778,\n/**/\n 1777,\n/**/\n 1776,\n/**/\n 1775,\n/**/\n 1774,\n/**/\n 1773,\n/**/\n 1772,\n/**/\n 1771,\n/**/\n 1770,\n/**/\n 1769,\n/**/\n 1768,\n/**/\n 1767,\n/**/\n 1766,\n/**/\n 1765,\n/**/\n 1764,\n/**/\n 1763,\n/**/\n 1762,\n/**/\n 1761,\n/**/\n 1760,\n/**/\n 1759,\n/**/\n 1758,\n/**/\n 1757,\n/**/\n 1756,\n/**/\n 1755,\n/**/\n 1754,\n/**/\n 1753,\n/**/\n 1752,\n/**/\n 1751,\n/**/\n 1750,\n/**/\n 1749,\n/**/\n 1748,\n/**/\n 1747,\n/**/\n 1746,\n/**/\n 1745,\n/**/\n 1744,\n/**/\n 1743,\n/**/\n 1742,\n/**/\n 1741,\n/**/\n 1740,\n/**/\n 1739,\n/**/\n 1738,\n/**/\n 1737,\n/**/\n 1736,\n/**/\n 1735,\n/**/\n 1734,\n/**/\n 1733,\n/**/\n 1732,\n/**/\n 1731,\n/**/\n 1730,\n/**/\n 1729,\n/**/\n 1728,\n/**/\n 1727,\n/**/\n 1726,\n/**/\n 1725,\n/**/\n 1724,\n/**/\n 1723,\n/**/\n 1722,\n/**/\n 1721,\n/**/\n 1720,\n/**/\n 1719,\n/**/\n 1718,\n/**/\n 1717,\n/**/\n 1716,\n/**/\n 1715,\n/**/\n 1714,\n/**/\n 1713,\n/**/\n 1712,\n/**/\n 1711,\n/**/\n 1710,\n/**/\n 1709,\n/**/\n 1708,\n/**/\n 1707,\n/**/\n 1706,\n/**/\n 1705,\n/**/\n 1704,\n/**/\n 1703,\n/**/\n 1702,\n/**/\n 1701,\n/**/\n 1700,\n/**/\n 1699,\n/**/\n 1698,\n/**/\n 1697,\n/**/\n 1696,\n/**/\n 1695,\n/**/\n 1694,\n/**/\n 1693,\n/**/\n 1692,\n/**/\n 1691,\n/**/\n 1690,\n/**/\n 1689,\n/**/\n 1688,\n/**/\n 1687,\n/**/\n 1686,\n/**/\n 1685,\n/**/\n 1684,\n/**/\n 1683,\n/**/\n 1682,\n/**/\n 1681,\n/**/\n 1680,\n/**/\n 1679,\n/**/\n 1678,\n/**/\n 1677,\n/**/\n 1676,\n/**/\n 1675,\n/**/\n 1674,\n/**/\n 1673,\n/**/\n 1672,\n/**/\n 1671,\n/**/\n 1670,\n/**/\n 1669,\n/**/\n 1668,\n/**/\n 1667,\n/**/\n 1666,\n/**/\n 1665,\n/**/\n 1664,\n/**/\n 1663,\n/**/\n 1662,\n/**/\n 1661,\n/**/\n 1660,\n/**/\n 1659,\n/**/\n 1658,\n/**/\n 1657,\n/**/\n 1656,\n/**/\n 1655,\n/**/\n 1654,\n/**/\n 1653,\n/**/\n 1652,\n/**/\n 1651,\n/**/\n 1650,\n/**/\n 1649,\n/**/\n 1648,\n/**/\n 1647,\n/**/\n 1646,\n/**/\n 1645,\n/**/\n 1644,\n/**/\n 1643,\n/**/\n 1642,\n/**/\n 1641,\n/**/\n 1640,\n/**/\n 1639,\n/**/\n 1638,\n/**/\n 1637,\n/**/\n 1636,\n/**/\n 1635,\n/**/\n 1634,\n/**/\n 1633,\n/**/\n 1632,\n/**/\n 1631,\n/**/\n 1630,\n/**/\n 1629,\n/**/\n 1628,\n/**/\n 1627,\n/**/\n 1626,\n/**/\n 1625,\n/**/\n 1624,\n/**/\n 1623,\n/**/\n 1622,\n/**/\n 1621,\n/**/\n 1620,\n/**/\n 1619,\n/**/\n 1618,\n/**/\n 1617,\n/**/\n 1616,\n/**/\n 1615,\n/**/\n 1614,\n/**/\n 1613,\n/**/\n 1612,\n/**/\n 1611,\n/**/\n 1610,\n/**/\n 1609,\n/**/\n 1608,\n/**/\n 1607,\n/**/\n 1606,\n/**/\n 1605,\n/**/\n 1604,\n/**/\n 1603,\n/**/\n 1602,\n/**/\n 1601,\n/**/\n 1600,\n/**/\n 1599,\n/**/\n 1598,\n/**/\n 1597,\n/**/\n 1596,\n/**/\n 1595,\n/**/\n 1594,\n/**/\n 1593,\n/**/\n 1592,\n/**/\n 1591,\n/**/\n 1590,\n/**/\n 1589,\n/**/\n 1588,\n/**/\n 1587,\n/**/\n 1586,\n/**/\n 1585,\n/**/\n 1584,\n/**/\n 1583,\n/**/\n 1582,\n/**/\n 1581,\n/**/\n 1580,\n/**/\n 1579,\n/**/\n 1578,\n/**/\n 1577,\n/**/\n 1576,\n/**/\n 1575,\n/**/\n 1574,\n/**/\n 1573,\n/**/\n 1572,\n/**/\n 1571,\n/**/\n 1570,\n/**/\n 1569,\n/**/\n 1568,\n/**/\n 1567,\n/**/\n 1566,\n/**/\n 1565,\n/**/\n 1564,\n/**/\n 1563,\n/**/\n 1562,\n/**/\n 1561,\n/**/\n 1560,\n/**/\n 1559,\n/**/\n 1558,\n/**/\n 1557,\n/**/\n 1556,\n/**/\n 1555,\n/**/\n 1554,\n/**/\n 1553,\n/**/\n 1552,\n/**/\n 1551,\n/**/\n 1550,\n/**/\n 1549,\n/**/\n 1548,\n/**/\n 1547,\n/**/\n 1546,\n/**/\n 1545,\n/**/\n 1544,\n/**/\n 1543,\n/**/\n 1542,\n/**/\n 1541,\n/**/\n 1540,\n/**/\n 1539,\n/**/\n 1538,\n/**/\n 1537,\n/**/\n 1536,\n/**/\n 1535,\n/**/\n 1534,\n/**/\n 1533,\n/**/\n 1532,\n/**/\n 1531,\n/**/\n 1530,\n/**/\n 1529,\n/**/\n 1528,\n/**/\n 1527,\n/**/\n 1526,\n/**/\n 1525,\n/**/\n 1524,\n/**/\n 1523,\n/**/\n 1522,\n/**/\n 1521,\n/**/\n 1520,\n/**/\n 1519,\n/**/\n 1518,\n/**/\n 1517,\n/**/\n 1516,\n/**/\n 1515,\n/**/\n 1514,\n/**/\n 1513,\n/**/\n 1512,\n/**/\n 1511,\n/**/\n 1510,\n/**/\n 1509,\n/**/\n 1508,\n/**/\n 1507,\n/**/\n 1506,\n/**/\n 1505,\n/**/\n 1504,\n/**/\n 1503,\n/**/\n 1502,\n/**/\n 1501,\n/**/\n 1500,\n/**/\n 1499,\n/**/\n 1498,\n/**/\n 1497,\n/**/\n 1496,\n/**/\n 1495,\n/**/\n 1494,\n/**/\n 1493,\n/**/\n 1492,\n/**/\n 1491,\n/**/\n 1490,\n/**/\n 1489,\n/**/\n 1488,\n/**/\n 1487,\n/**/\n 1486,\n/**/\n 1485,\n/**/\n 1484,\n/**/\n 1483,\n/**/\n 1482,\n/**/\n 1481,\n/**/\n 1480,\n/**/\n 1479,\n/**/\n 1478,\n/**/\n 1477,\n/**/\n 1476,\n/**/\n 1475,\n/**/\n 1474,\n/**/\n 1473,\n/**/\n 1472,\n/**/\n 1471,\n/**/\n 1470,\n/**/\n 1469,\n/**/\n 1468,\n/**/\n 1467,\n/**/\n 1466,\n/**/\n 1465,\n/**/\n 1464,\n/**/\n 1463,\n/**/\n 1462,\n/**/\n 1461,\n/**/\n 1460,\n/**/\n 1459,\n/**/\n 1458,\n/**/\n 1457,\n/**/\n 1456,\n/**/\n 1455,\n/**/\n 1454,\n/**/\n 1453,\n/**/\n 1452,\n/**/\n 1451,\n/**/\n 1450,\n/**/\n 1449,\n/**/\n 1448,\n/**/\n 1447,\n/**/\n 1446,\n/**/\n 1445,\n/**/\n 1444,\n/**/\n 1443,\n/**/\n 1442,\n/**/\n 1441,\n/**/\n 1440,\n/**/\n 1439,\n/**/\n 1438,\n/**/\n 1437,\n/**/\n 1436,\n/**/\n 1435,\n/**/\n 1434,\n/**/\n 1433,\n/**/\n 1432,\n/**/\n 1431,\n/**/\n 1430,\n/**/\n 1429,\n/**/\n 1428,\n/**/\n 1427,\n/**/\n 1426,\n/**/\n 1425,\n/**/\n 1424,\n/**/\n 1423,\n/**/\n 1422,\n/**/\n 1421,\n/**/\n 1420,\n/**/\n 1419,\n/**/\n 1418,\n/**/\n 1417,\n/**/\n 1416,\n/**/\n 1415,\n/**/\n 1414,\n/**/\n 1413,\n/**/\n 1412,\n/**/\n 1411,\n/**/\n 1410,\n/**/\n 1409,\n/**/\n 1408,\n/**/\n 1407,\n/**/\n 1406,\n/**/\n 1405,\n/**/\n 1404,\n/**/\n 1403,\n/**/\n 1402,\n/**/\n 1401,\n/**/\n 1400,\n/**/\n 1399,\n/**/\n 1398,\n/**/\n 1397,\n/**/\n 1396,\n/**/\n 1395,\n/**/\n 1394,\n/**/\n 1393,\n/**/\n 1392,\n/**/\n 1391,\n/**/\n 1390,\n/**/\n 1389,\n/**/\n 1388,\n/**/\n 1387,\n/**/\n 1386,\n/**/\n 1385,\n/**/\n 1384,\n/**/\n 1383,\n/**/\n 1382,\n/**/\n 1381,\n/**/\n 1380,\n/**/\n 1379,\n/**/\n 1378,\n/**/\n 1377,\n/**/\n 1376,\n/**/\n 1375,\n/**/\n 1374,\n/**/\n 1373,\n/**/\n 1372,\n/**/\n 1371,\n/**/\n 1370,\n/**/\n 1369,\n/**/\n 1368,\n/**/\n 1367,\n/**/\n 1366,\n/**/\n 1365,\n/**/\n 1364,\n/**/\n 1363,\n/**/\n 1362,\n/**/\n 1361,\n/**/\n 1360,\n/**/\n 1359,\n/**/\n 1358,\n/**/\n 1357,\n/**/\n 1356,\n/**/\n 1355,\n/**/\n 1354,\n/**/\n 1353,\n/**/\n 1352,\n/**/\n 1351,\n/**/\n 1350,\n/**/\n 1349,\n/**/\n 1348,\n/**/\n 1347,\n/**/\n 1346,\n/**/\n 1345,\n/**/\n 1344,\n/**/\n 1343,\n/**/\n 1342,\n/**/\n 1341,\n/**/\n 1340,\n/**/\n 1339,\n/**/\n 1338,\n/**/\n 1337,\n/**/\n 1336,\n/**/\n 1335,\n/**/\n 1334,\n/**/\n 1333,\n/**/\n 1332,\n/**/\n 1331,\n/**/\n 1330,\n/**/\n 1329,\n/**/\n 1328,\n/**/\n 1327,\n/**/\n 1326,\n/**/\n 1325,\n/**/\n 1324,\n/**/\n 1323,\n/**/\n 1322,\n/**/\n 1321,\n/**/\n 1320,\n/**/\n 1319,\n/**/\n 1318,\n/**/\n 1317,\n/**/\n 1316,\n/**/\n 1315,\n/**/\n 1314,\n/**/\n 1313,\n/**/\n 1312,\n/**/\n 1311,\n/**/\n 1310,\n/**/\n 1309,\n/**/\n 1308,\n/**/\n 1307,\n/**/\n 1306,\n/**/\n 1305,\n/**/\n 1304,\n/**/\n 1303,\n/**/\n 1302,\n/**/\n 1301,\n/**/\n 1300,\n/**/\n 1299,\n/**/\n 1298,\n/**/\n 1297,\n/**/\n 1296,\n/**/\n 1295,\n/**/\n 1294,\n/**/\n 1293,\n/**/\n 1292,\n/**/\n 1291,\n/**/\n 1290,\n/**/\n 1289,\n/**/\n 1288,\n/**/\n 1287,\n/**/\n 1286,\n/**/\n 1285,\n/**/\n 1284,\n/**/\n 1283,\n/**/\n 1282,\n/**/\n 1281,\n/**/\n 1280,\n/**/\n 1279,\n/**/\n 1278,\n/**/\n 1277,\n/**/\n 1276,\n/**/\n 1275,\n/**/\n 1274,\n/**/\n 1273,\n/**/\n 1272,\n/**/\n 1271,\n/**/\n 1270,\n/**/\n 1269,\n/**/\n 1268,\n/**/\n 1267,\n/**/\n 1266,\n/**/\n 1265,\n/**/\n 1264,\n/**/\n 1263,\n/**/\n 1262,\n/**/\n 1261,\n/**/\n 1260,\n/**/\n 1259,\n/**/\n 1258,\n/**/\n 1257,\n/**/\n 1256,\n/**/\n 1255,\n/**/\n 1254,\n/**/\n 1253,\n/**/\n 1252,\n/**/\n 1251,\n/**/\n 1250,\n/**/\n 1249,\n/**/\n 1248,\n/**/\n 1247,\n/**/\n 1246,\n/**/\n 1245,\n/**/\n 1244,\n/**/\n 1243,\n/**/\n 1242,\n/**/\n 1241,\n/**/\n 1240,\n/**/\n 1239,\n/**/\n 1238,\n/**/\n 1237,\n/**/\n 1236,\n/**/\n 1235,\n/**/\n 1234,\n/**/\n 1233,\n/**/\n 1232,\n/**/\n 1231,\n/**/\n 1230,\n/**/\n 1229,\n/**/\n 1228,\n/**/\n 1227,\n/**/\n 1226,\n/**/\n 1225,\n/**/\n 1224,\n/**/\n 1223,\n/**/\n 1222,\n/**/\n 1221,\n/**/\n 1220,\n/**/\n 1219,\n/**/\n 1218,\n/**/\n 1217,\n/**/\n 1216,\n/**/\n 1215,\n/**/\n 1214,\n/**/\n 1213,\n/**/\n 1212,\n/**/\n 1211,\n/**/\n 1210,\n/**/\n 1209,\n/**/\n 1208,\n/**/\n 1207,\n/**/\n 1206,\n/**/\n 1205,\n/**/\n 1204,\n/**/\n 1203,\n/**/\n 1202,\n/**/\n 1201,\n/**/\n 1200,\n/**/\n 1199,\n/**/\n 1198,\n/**/\n 1197,\n/**/\n 1196,\n/**/\n 1195,\n/**/\n 1194,\n/**/\n 1193,\n/**/\n 1192,\n/**/\n 1191,\n/**/\n 1190,\n/**/\n 1189,\n/**/\n 1188,\n/**/\n 1187,\n/**/\n 1186,\n/**/\n 1185,\n/**/\n 1184,\n/**/\n 1183,\n/**/\n 1182,\n/**/\n 1181,\n/**/\n 1180,\n/**/\n 1179,\n/**/\n 1178,\n/**/\n 1177,\n/**/\n 1176,\n/**/\n 1175,\n/**/\n 1174,\n/**/\n 1173,\n/**/\n 1172,\n/**/\n 1171,\n/**/\n 1170,\n/**/\n 1169,\n/**/\n 1168,\n/**/\n 1167,\n/**/\n 1166,\n/**/\n 1165,\n/**/\n 1164,\n/**/\n 1163,\n/**/\n 1162,\n/**/\n 1161,\n/**/\n 1160,\n/**/\n 1159,\n/**/\n 1158,\n/**/\n 1157,\n/**/\n 1156,\n/**/\n 1155,\n/**/\n 1154,\n/**/\n 1153,\n/**/\n 1152,\n/**/\n 1151,\n/**/\n 1150,\n/**/\n 1149,\n/**/\n 1148,\n/**/\n 1147,\n/**/\n 1146,\n/**/\n 1145,\n/**/\n 1144,\n/**/\n 1143,\n/**/\n 1142,\n/**/\n 1141,\n/**/\n 1140,\n/**/\n 1139,\n/**/\n 1138,\n/**/\n 1137,\n/**/\n 1136,\n/**/\n 1135,\n/**/\n 1134,\n/**/\n 1133,\n/**/\n 1132,\n/**/\n 1131,\n/**/\n 1130,\n/**/\n 1129,\n/**/\n 1128,\n/**/\n 1127,\n/**/\n 1126,\n/**/\n 1125,\n/**/\n 1124,\n/**/\n 1123,\n/**/\n 1122,\n/**/\n 1121,\n/**/\n 1120,\n/**/\n 1119,\n/**/\n 1118,\n/**/\n 1117,\n/**/\n 1116,\n/**/\n 1115,\n/**/\n 1114,\n/**/\n 1113,\n/**/\n 1112,\n/**/\n 1111,\n/**/\n 1110,\n/**/\n 1109,\n/**/\n 1108,\n/**/\n 1107,\n/**/\n 1106,\n/**/\n 1105,\n/**/\n 1104,\n/**/\n 1103,\n/**/\n 1102,\n/**/\n 1101,\n/**/\n 1100,\n/**/\n 1099,\n/**/\n 1098,\n/**/\n 1097,\n/**/\n 1096,\n/**/\n 1095,\n/**/\n 1094,\n/**/\n 1093,\n/**/\n 1092,\n/**/\n 1091,\n/**/\n 1090,\n/**/\n 1089,\n/**/\n 1088,\n/**/\n 1087,\n/**/\n 1086,\n/**/\n 1085,\n/**/\n 1084,\n/**/\n 1083,\n/**/\n 1082,\n/**/\n 1081,\n/**/\n 1080,\n/**/\n 1079,\n/**/\n 1078,\n/**/\n 1077,\n/**/\n 1076,\n/**/\n 1075,\n/**/\n 1074,\n/**/\n 1073,\n/**/\n 1072,\n/**/\n 1071,\n/**/\n 1070,\n/**/\n 1069,\n/**/\n 1068,\n/**/\n 1067,\n/**/\n 1066,\n/**/\n 1065,\n/**/\n 1064,\n/**/\n 1063,\n/**/\n 1062,\n/**/\n 1061,\n/**/\n 1060,\n/**/\n 1059,\n/**/\n 1058,\n/**/\n 1057,\n/**/\n 1056,\n/**/\n 1055,\n/**/\n 1054,\n/**/\n 1053,\n/**/\n 1052,\n/**/\n 1051,\n/**/\n 1050,\n/**/\n 1049,\n/**/\n 1048,\n/**/\n 1047,\n/**/\n 1046,\n/**/\n 1045,\n/**/\n 1044,\n/**/\n 1043,\n/**/\n 1042,\n/**/\n 1041,\n/**/\n 1040,\n/**/\n 1039,\n/**/\n 1038,\n/**/\n 1037,\n/**/\n 1036,\n/**/\n 1035,\n/**/\n 1034,\n/**/\n 1033,\n/**/\n 1032,\n/**/\n 1031,\n/**/\n 1030,\n/**/\n 1029,\n/**/\n 1028,\n/**/\n 1027,\n/**/\n 1026,\n/**/\n 1025,\n/**/\n 1024,\n/**/\n 1023,\n/**/\n 1022,\n/**/\n 1021,\n/**/\n 1020,\n/**/\n 1019,\n/**/\n 1018,\n/**/\n 1017,\n/**/\n 1016,\n/**/\n 1015,\n/**/\n 1014,\n/**/\n 1013,\n/**/\n 1012,\n/**/\n 1011,\n/**/\n 1010,\n/**/\n 1009,\n/**/\n 1008,\n/**/\n 1007,\n/**/\n 1006,\n/**/\n 1005,\n/**/\n 1004,\n/**/\n 1003,\n/**/\n 1002,\n/**/\n 1001,\n/**/\n 1000,\n/**/\n 999,\n/**/\n 998,\n/**/\n 997,\n/**/\n 996,\n/**/\n 995,\n/**/\n 994,\n/**/\n 993,\n/**/\n 992,\n/**/\n 991,\n/**/\n 990,\n/**/\n 989,\n/**/\n 988,\n/**/\n 987,\n/**/\n 986,\n/**/\n 985,\n/**/\n 984,\n/**/\n 983,\n/**/\n 982,\n/**/\n 981,\n/**/\n 980,\n/**/\n 979,\n/**/\n 978,\n/**/\n 977,\n/**/\n 976,\n/**/\n 975,\n/**/\n 974,\n/**/\n 973,\n/**/\n 972,\n/**/\n 971,\n/**/\n 970,\n/**/\n 969,\n/**/\n 968,\n/**/\n 967,\n/**/\n 966,\n/**/\n 965,\n/**/\n 964,\n/**/\n 963,\n/**/\n 962,\n/**/\n 961,\n/**/\n 960,\n/**/\n 959,\n/**/\n 958,\n/**/\n 957,\n/**/\n 956,\n/**/\n 955,\n/**/\n 954,\n/**/\n 953,\n/**/\n 952,\n/**/\n 951,\n/**/\n 950,\n/**/\n 949,\n/**/\n 948,\n/**/\n 947,\n/**/\n 946,\n/**/\n 945,\n/**/\n 944,\n/**/\n 943,\n/**/\n 942,\n/**/\n 941,\n/**/\n 940,\n/**/\n 939,\n/**/\n 938,\n/**/\n 937,\n/**/\n 936,\n/**/\n 935,\n/**/\n 934,\n/**/\n 933,\n/**/\n 932,\n/**/\n 931,\n/**/\n 930,\n/**/\n 929,\n/**/\n 928,\n/**/\n 927,\n/**/\n 926,\n/**/\n 925,\n/**/\n 924,\n/**/\n 923,\n/**/\n 922,\n/**/\n 921,\n/**/\n 920,\n/**/\n 919,\n/**/\n 918,\n/**/\n 917,\n/**/\n 916,\n/**/\n 915,\n/**/\n 914,\n/**/\n 913,\n/**/\n 912,\n/**/\n 911,\n/**/\n 910,\n/**/\n 909,\n/**/\n 908,\n/**/\n 907,\n/**/\n 906,\n/**/\n 905,\n/**/\n 904,\n/**/\n 903,\n/**/\n 902,\n/**/\n 901,\n/**/\n 900,\n/**/\n 899,\n/**/\n 898,\n/**/\n 897,\n/**/\n 896,\n/**/\n 895,\n/**/\n 894,\n/**/\n 893,\n/**/\n 892,\n/**/\n 891,\n/**/\n 890,\n/**/\n 889,\n/**/\n 888,\n/**/\n 887,\n/**/\n 886,\n/**/\n 885,\n/**/\n 884,\n/**/\n 883,\n/**/\n 882,\n/**/\n 881,\n/**/\n 880,\n/**/\n 879,\n/**/\n 878,\n/**/\n 877,\n/**/\n 876,\n/**/\n 875,\n/**/\n 874,\n/**/\n 873,\n/**/\n 872,\n/**/\n 871,\n/**/\n 870,\n/**/\n 869,\n/**/\n 868,\n/**/\n 867,\n/**/\n 866,\n/**/\n 865,\n/**/\n 864,\n/**/\n 863,\n/**/\n 862,\n/**/\n 861,\n/**/\n 860,\n/**/\n 859,\n/**/\n 858,\n/**/\n 857,\n/**/\n 856,\n/**/\n 855,\n/**/\n 854,\n/**/\n 853,\n/**/\n 852,\n/**/\n 851,\n/**/\n 850,\n/**/\n 849,\n/**/\n 848,\n/**/\n 847,\n/**/\n 846,\n/**/\n 845,\n/**/\n 844,\n/**/\n 843,\n/**/\n 842,\n/**/\n 841,\n/**/\n 840,\n/**/\n 839,\n/**/\n 838,\n/**/\n 837,\n/**/\n 836,\n/**/\n 835,\n/**/\n 834,\n/**/\n 833,\n/**/\n 832,\n/**/\n 831,\n/**/\n 830,\n/**/\n 829,\n/**/\n 828,\n/**/\n 827,\n/**/\n 826,\n/**/\n 825,\n/**/\n 824,\n/**/\n 823,\n/**/\n 822,\n/**/\n 821,\n/**/\n 820,\n/**/\n 819,\n/**/\n 818,\n/**/\n 817,\n/**/\n 816,\n/**/\n 815,\n/**/\n 814,\n/**/\n 813,\n/**/\n 812,\n/**/\n 811,\n/**/\n 810,\n/**/\n 809,\n/**/\n 808,\n/**/\n 807,\n/**/\n 806,\n/**/\n 805,\n/**/\n 804,\n/**/\n 803,\n/**/\n 802,\n/**/\n 801,\n/**/\n 800,\n/**/\n 799,\n/**/\n 798,\n/**/\n 797,\n/**/\n 796,\n/**/\n 795,\n/**/\n 794,\n/**/\n 793,\n/**/\n 792,\n/**/\n 791,\n/**/\n 790,\n/**/\n 789,\n/**/\n 788,\n/**/\n 787,\n/**/\n 786,\n/**/\n 785,\n/**/\n 784,\n/**/\n 783,\n/**/\n 782,\n/**/\n 781,\n/**/\n 780,\n/**/\n 779,\n/**/\n 778,\n/**/\n 777,\n/**/\n 776,\n/**/\n 775,\n/**/\n 774,\n/**/\n 773,\n/**/\n 772,\n/**/\n 771,\n/**/\n 770,\n/**/\n 769,\n/**/\n 768,\n/**/\n 767,\n/**/\n 766,\n/**/\n 765,\n/**/\n 764,\n/**/\n 763,\n/**/\n 762,\n/**/\n 761,\n/**/\n 760,\n/**/\n 759,\n/**/\n 758,\n/**/\n 757,\n/**/\n 756,\n/**/\n 755,\n/**/\n 754,\n/**/\n 753,\n/**/\n 752,\n/**/\n 751,\n/**/\n 750,\n/**/\n 749,\n/**/\n 748,\n/**/\n 747,\n/**/\n 746,\n/**/\n 745,\n/**/\n 744,\n/**/\n 743,\n/**/\n 742,\n/**/\n 741,\n/**/\n 740,\n/**/\n 739,\n/**/\n 738,\n/**/\n 737,\n/**/\n 736,\n/**/\n 735,\n/**/\n 734,\n/**/\n 733,\n/**/\n 732,\n/**/\n 731,\n/**/\n 730,\n/**/\n 729,\n/**/\n 728,\n/**/\n 727,\n/**/\n 726,\n/**/\n 725,\n/**/\n 724,\n/**/\n 723,\n/**/\n 722,\n/**/\n 721,\n/**/\n 720,\n/**/\n 719,\n/**/\n 718,\n/**/\n 717,\n/**/\n 716,\n/**/\n 715,\n/**/\n 714,\n/**/\n 713,\n/**/\n 712,\n/**/\n 711,\n/**/\n 710,\n/**/\n 709,\n/**/\n 708,\n/**/\n 707,\n/**/\n 706,\n/**/\n 705,\n/**/\n 704,\n/**/\n 703,\n/**/\n 702,\n/**/\n 701,\n/**/\n 700,\n/**/\n 699,\n/**/\n 698,\n/**/\n 697,\n/**/\n 696,\n/**/\n 695,\n/**/\n 694,\n/**/\n 693,\n/**/\n 692,\n/**/\n 691,\n/**/\n 690,\n/**/\n 689,\n/**/\n 688,\n/**/\n 687,\n/**/\n 686,\n/**/\n 685,\n/**/\n 684,\n/**/\n 683,\n/**/\n 682,\n/**/\n 681,\n/**/\n 680,\n/**/\n 679,\n/**/\n 678,\n/**/\n 677,\n/**/\n 676,\n/**/\n 675,\n/**/\n 674,\n/**/\n 673,\n/**/\n 672,\n/**/\n 671,\n/**/\n 670,\n/**/\n 669,\n/**/\n 668,\n/**/\n 667,\n/**/\n 666,\n/**/\n 665,\n/**/\n 664,\n/**/\n 663,\n/**/\n 662,\n/**/\n 661,\n/**/\n 660,\n/**/\n 659,\n/**/\n 658,\n/**/\n 657,\n/**/\n 656,\n/**/\n 655,\n/**/\n 654,\n/**/\n 653,\n/**/\n 652,\n/**/\n 651,\n/**/\n 650,\n/**/\n 649,\n/**/\n 648,\n/**/\n 647,\n/**/\n 646,\n/**/\n 645,\n/**/\n 644,\n/**/\n 643,\n/**/\n 642,\n/**/\n 641,\n/**/\n 640,\n/**/\n 639,\n/**/\n 638,\n/**/\n 637,\n/**/\n 636,\n/**/\n 635,\n/**/\n 634,\n/**/\n 633,\n/**/\n 632,\n/**/\n 631,\n/**/\n 630,\n/**/\n 629,\n/**/\n 628,\n/**/\n 627,\n/**/\n 626,\n/**/\n 625,\n/**/\n 624,\n/**/\n 623,\n/**/\n 622,\n/**/\n 621,\n/**/\n 620,\n/**/\n 619,\n/**/\n 618,\n/**/\n 617,\n/**/\n 616,\n/**/\n 615,\n/**/\n 614,\n/**/\n 613,\n/**/\n 612,\n/**/\n 611,\n/**/\n 610,\n/**/\n 609,\n/**/\n 608,\n/**/\n 607,\n/**/\n 606,\n/**/\n 605,\n/**/\n 604,\n/**/\n 603,\n/**/\n 602,\n/**/\n 601,\n/**/\n 600,\n/**/\n 599,\n/**/\n 598,\n/**/\n 597,\n/**/\n 596,\n/**/\n 595,\n/**/\n 594,\n/**/\n 593,\n/**/\n 592,\n/**/\n 591,\n/**/\n 590,\n/**/\n 589,\n/**/\n 588,\n/**/\n 587,\n/**/\n 586,\n/**/\n 585,\n/**/\n 584,\n/**/\n 583,\n/**/\n 582,\n/**/\n 581,\n/**/\n 580,\n/**/\n 579,\n/**/\n 578,\n/**/\n 577,\n/**/\n 576,\n/**/\n 575,\n/**/\n 574,\n/**/\n 573,\n/**/\n 572,\n/**/\n 571,\n/**/\n 570,\n/**/\n 569,\n/**/\n 568,\n/**/\n 567,\n/**/\n 566,\n/**/\n 565,\n/**/\n 564,\n/**/\n 563,\n/**/\n 562,\n/**/\n 561,\n/**/\n 560,\n/**/\n 559,\n/**/\n 558,\n/**/\n 557,\n/**/\n 556,\n/**/\n 555,\n/**/\n 554,\n/**/\n 553,\n/**/\n 552,\n/**/\n 551,\n/**/\n 550,\n/**/\n 549,\n/**/\n 548,\n/**/\n 547,\n/**/\n 546,\n/**/\n 545,\n/**/\n 544,\n/**/\n 543,\n/**/\n 542,\n/**/\n 541,\n/**/\n 540,\n/**/\n 539,\n/**/\n 538,\n/**/\n 537,\n/**/\n 536,\n/**/\n 535,\n/**/\n 534,\n/**/\n 533,\n/**/\n 532,\n/**/\n 531,\n/**/\n 530,\n/**/\n 529,\n/**/\n 528,\n/**/\n 527,\n/**/\n 526,\n/**/\n 525,\n/**/\n 524,\n/**/\n 523,\n/**/\n 522,\n/**/\n 521,\n/**/\n 520,\n/**/\n 519,\n/**/\n 518,\n/**/\n 517,\n/**/\n 516,\n/**/\n 515,\n/**/\n 514,\n/**/\n 513,\n/**/\n 512,\n/**/\n 511,\n/**/\n 510,\n/**/\n 509,\n/**/\n 508,\n/**/\n 507,\n/**/\n 506,\n/**/\n 505,\n/**/\n 504,\n/**/\n 503,\n/**/\n 502,\n/**/\n 501,\n/**/\n 500,\n/**/\n 499,\n/**/\n 498,\n/**/\n 497,\n/**/\n 496,\n/**/\n 495,\n/**/\n 494,\n/**/\n 493,\n/**/\n 492,\n/**/\n 491,\n/**/\n 490,\n/**/\n 489,\n/**/\n 488,\n/**/\n 487,\n/**/\n 486,\n/**/\n 485,\n/**/\n 484,\n/**/\n 483,\n/**/\n 482,\n/**/\n 481,\n/**/\n 480,\n/**/\n 479,\n/**/\n 478,\n/**/\n 477,\n/**/\n 476,\n/**/\n 475,\n/**/\n 474,\n/**/\n 473,\n/**/\n 472,\n/**/\n 471,\n/**/\n 470,\n/**/\n 469,\n/**/\n 468,\n/**/\n 467,\n/**/\n 466,\n/**/\n 465,\n/**/\n 464,\n/**/\n 463,\n/**/\n 462,\n/**/\n 461,\n/**/\n 460,\n/**/\n 459,\n/**/\n 458,\n/**/\n 457,\n/**/\n 456,\n/**/\n 455,\n/**/\n 454,\n/**/\n 453,\n/**/\n 452,\n/**/\n 451,\n/**/\n 450,\n/**/\n 449,\n/**/\n 448,\n/**/\n 447,\n/**/\n 446,\n/**/\n 445,\n/**/\n 444,\n/**/\n 443,\n/**/\n 442,\n/**/\n 441,\n/**/\n 440,\n/**/\n 439,\n/**/\n 438,\n/**/\n 437,\n/**/\n 436,\n/**/\n 435,\n/**/\n 434,\n/**/\n 433,\n/**/\n 432,\n/**/\n 431,\n/**/\n 430,\n/**/\n 429,\n/**/\n 428,\n/**/\n 427,\n/**/\n 426,\n/**/\n 425,\n/**/\n 424,\n/**/\n 423,\n/**/\n 422,\n/**/\n 421,\n/**/\n 420,\n/**/\n 419,\n/**/\n 418,\n/**/\n 417,\n/**/\n 416,\n/**/\n 415,\n/**/\n 414,\n/**/\n 413,\n/**/\n 412,\n/**/\n 411,\n/**/\n 410,\n/**/\n 409,\n/**/\n 408,\n/**/\n 407,\n/**/\n 406,\n/**/\n 405,\n/**/\n 404,\n/**/\n 403,\n/**/\n 402,\n/**/\n 401,\n/**/\n 400,\n/**/\n 399,\n/**/\n 398,\n/**/\n 397,\n/**/\n 396,\n/**/\n 395,\n/**/\n 394,\n/**/\n 393,\n/**/\n 392,\n/**/\n 391,\n/**/\n 390,\n/**/\n 389,\n/**/\n 388,\n/**/\n 387,\n/**/\n 386,\n/**/\n 385,\n/**/\n 384,\n/**/\n 383,\n/**/\n 382,\n/**/\n 381,\n/**/\n 380,\n/**/\n 379,\n/**/\n 378,\n/**/\n 377,\n/**/\n 376,\n/**/\n 375,\n/**/\n 374,\n/**/\n 373,\n/**/\n 372,\n/**/\n 371,\n/**/\n 370,\n/**/\n 369,\n/**/\n 368,\n/**/\n 367,\n/**/\n 366,\n/**/\n 365,\n/**/\n 364,\n/**/\n 363,\n/**/\n 362,\n/**/\n 361,\n/**/\n 360,\n/**/\n 359,\n/**/\n 358,\n/**/\n 357,\n/**/\n 356,\n/**/\n 355,\n/**/\n 354,\n/**/\n 353,\n/**/\n 352,\n/**/\n 351,\n/**/\n 350,\n/**/\n 349,\n/**/\n 348,\n/**/\n 347,\n/**/\n 346,\n/**/\n 345,\n/**/\n 344,\n/**/\n 343,\n/**/\n 342,\n/**/\n 341,\n/**/\n 340,\n/**/\n 339,\n/**/\n 338,\n/**/\n 337,\n/**/\n 336,\n/**/\n 335,\n/**/\n 334,\n/**/\n 333,\n/**/\n 332,\n/**/\n 331,\n/**/\n 330,\n/**/\n 329,\n/**/\n 328,\n/**/\n 327,\n/**/\n 326,\n/**/\n 325,\n/**/\n 324,\n/**/\n 323,\n/**/\n 322,\n/**/\n 321,\n/**/\n 320,\n/**/\n 319,\n/**/\n 318,\n/**/\n 317,\n/**/\n 316,\n/**/\n 315,\n/**/\n 314,\n/**/\n 313,\n/**/\n 312,\n/**/\n 311,\n/**/\n 310,\n/**/\n 309,\n/**/\n 308,\n/**/\n 307,\n/**/\n 306,\n/**/\n 305,\n/**/\n 304,\n/**/\n 303,\n/**/\n 302,\n/**/\n 301,\n/**/\n 300,\n/**/\n 299,\n/**/\n 298,\n/**/\n 297,\n/**/\n 296,\n/**/\n 295,\n/**/\n 294,\n/**/\n 293,\n/**/\n 292,\n/**/\n 291,\n/**/\n 290,\n/**/\n 289,\n/**/\n 288,\n/**/\n 287,\n/**/\n 286,\n/**/\n 285,\n/**/\n 284,\n/**/\n 283,\n/**/\n 282,\n/**/\n 281,\n/**/\n 280,\n/**/\n 279,\n/**/\n 278,\n/**/\n 277,\n/**/\n 276,\n/**/\n 275,\n/**/\n 274,\n/**/\n 273,\n/**/\n 272,\n/**/\n 271,\n/**/\n 270,\n/**/\n 269,\n/**/\n 268,\n/**/\n 267,\n/**/\n 266,\n/**/\n 265,\n/**/\n 264,\n/**/\n 263,\n/**/\n 262,\n/**/\n 261,\n/**/\n 260,\n/**/\n 259,\n/**/\n 258,\n/**/\n 257,\n/**/\n 256,\n/**/\n 255,\n/**/\n 254,\n/**/\n 253,\n/**/\n 252,\n/**/\n 251,\n/**/\n 250,\n/**/\n 249,\n/**/\n 248,\n/**/\n 247,\n/**/\n 246,\n/**/\n 245,\n/**/\n 244,\n/**/\n 243,\n/**/\n 242,\n/**/\n 241,\n/**/\n 240,\n/**/\n 239,\n/**/\n 238,\n/**/\n 237,\n/**/\n 236,\n/**/\n 235,\n/**/\n 234,\n/**/\n 233,\n/**/\n 232,\n/**/\n 231,\n/**/\n 230,\n/**/\n 229,\n/**/\n 228,\n/**/\n 227,\n/**/\n 226,\n/**/\n 225,\n/**/\n 224,\n/**/\n 223,\n/**/\n 222,\n/**/\n 221,\n/**/\n 220,\n/**/\n 219,\n/**/\n 218,\n/**/\n 217,\n/**/\n 216,\n/**/\n 215,\n/**/\n 214,\n/**/\n 213,\n/**/\n 212,\n/**/\n 211,\n/**/\n 210,\n/**/\n 209,\n/**/\n 208,\n/**/\n 207,\n/**/\n 206,\n/**/\n 205,\n/**/\n 204,\n/**/\n 203,\n/**/\n 202,\n/**/\n 201,\n/**/\n 200,\n/**/\n 199,\n/**/\n 198,\n/**/\n 197,\n/**/\n 196,\n/**/\n 195,\n/**/\n 194,\n/**/\n 193,\n/**/\n 192,\n/**/\n 191,\n/**/\n 190,\n/**/\n 189,\n/**/\n 188,\n/**/\n 187,\n/**/\n 186,\n/**/\n 185,\n/**/\n 184,\n/**/\n 183,\n/**/\n 182,\n/**/\n 181,\n/**/\n 180,\n/**/\n 179,\n/**/\n 178,\n/**/\n 177,\n/**/\n 176,\n/**/\n 175,\n/**/\n 174,\n/**/\n 173,\n/**/\n 172,\n/**/\n 171,\n/**/\n 170,\n/**/\n 169,\n/**/\n 168,\n/**/\n 167,\n/**/\n 166,\n/**/\n 165,\n/**/\n 164,\n/**/\n 163,\n/**/\n 162,\n/**/\n 161,\n/**/\n 160,\n/**/\n 159,\n/**/\n 158,\n/**/\n 157,\n/**/\n 156,\n/**/\n 155,\n/**/\n 154,\n/**/\n 153,\n/**/\n 152,\n/**/\n 151,\n/**/\n 150,\n/**/\n 149,\n/**/\n 148,\n/**/\n 147,\n/**/\n 146,\n/**/\n 145,\n/**/\n 144,\n/**/\n 143,\n/**/\n 142,\n/**/\n 141,\n/**/\n 140,\n/**/\n 139,\n/**/\n 138,\n/**/\n 137,\n/**/\n 136,\n/**/\n 135,\n/**/\n 134,\n/**/\n 133,\n/**/\n 132,\n/**/\n 131,\n/**/\n 130,\n/**/\n 129,\n/**/\n 128,\n/**/\n 127,\n/**/\n 126,\n/**/\n 125,\n/**/\n 124,\n/**/\n 123,\n/**/\n 122,\n/**/\n 121,\n/**/\n 120,\n/**/\n 119,\n/**/\n 118,\n/**/\n 117,\n/**/\n 116,\n/**/\n 115,\n/**/\n 114,\n/**/\n 113,\n/**/\n 112,\n/**/\n 111,\n/**/\n 110,\n/**/\n 109,\n/**/\n 108,\n/**/\n 107,\n/**/\n 106,\n/**/\n 105,\n/**/\n 104,\n/**/\n 103,\n/**/\n 102,\n/**/\n 101,\n/**/\n 100,\n/**/\n 99,\n/**/\n 98,\n/**/\n 97,\n/**/\n 96,\n/**/\n 95,\n/**/\n 94,\n/**/\n 93,\n/**/\n 92,\n/**/\n 91,\n/**/\n 90,\n/**/\n 89,\n/**/\n 88,\n/**/\n 87,\n/**/\n 86,\n/**/\n 85,\n/**/\n 84,\n/**/\n 83,\n/**/\n 82,\n/**/\n 81,\n/**/\n 80,\n/**/\n 79,\n/**/\n 78,\n/**/\n 77,\n/**/\n 76,\n/**/\n 75,\n/**/\n 74,\n/**/\n 73,\n/**/\n 72,\n/**/\n 71,\n/**/\n 70,\n/**/\n 69,\n/**/\n 68,\n/**/\n 67,\n/**/\n 66,\n/**/\n 65,\n/**/\n 64,\n/**/\n 63,\n/**/\n 62,\n/**/\n 61,\n/**/\n 60,\n/**/\n 59,\n/**/\n 58,\n/**/\n 57,\n/**/\n 56,\n/**/\n 55,\n/**/\n 54,\n/**/\n 53,\n/**/\n 52,\n/**/\n 51,\n/**/\n 50,\n/**/\n 49,\n/**/\n 48,\n/**/\n 47,\n/**/\n 46,\n/**/\n 45,\n/**/\n 44,\n/**/\n 43,\n/**/\n 42,\n/**/\n 41,\n/**/\n 40,\n/**/\n 39,\n/**/\n 38,\n/**/\n 37,\n/**/\n 36,\n/**/\n 35,\n/**/\n 34,\n/**/\n 33,\n/**/\n 32,\n/**/\n 31,\n/**/\n 30,\n/**/\n 29,\n/**/\n 28,\n/**/\n 27,\n/**/\n 26,\n/**/\n 25,\n/**/\n 24,\n/**/\n 23,\n/**/\n 22,\n/**/\n 21,\n/**/\n 20,\n/**/\n 19,\n/**/\n 18,\n/**/\n 17,\n/**/\n 16,\n/**/\n 15,\n/**/\n 14,\n/**/\n 13,\n/**/\n 12,\n/**/\n 11,\n/**/\n 10,\n/**/\n 9,\n/**/\n 8,\n/**/\n 7,\n/**/\n 6,\n/**/\n 5,\n/**/\n 4,\n/**/\n 3,\n/**/\n 2,\n/**/\n 1,\n/**/\n 0\n};", "/*\n * Place to put a short description when adding a feature with a patch.\n * Keep it short, e.g.,: \"relative numbers\", \"persistent undo\".\n * Also add a comment marker to separate the lines.\n * See the official Vim patches for the diff format: It must use a context of\n * one line only. Create it by hand or use \"diff -C2\" and edit the patch.\n */\nstatic char *(extra_patches[]) =\n{ /* Add your patch description below this line */\n/**/\n NULL\n};", " int\nhighest_patch(void)\n{\n // this relies on the highest patch number to be the first entry\n return included_patches[0];\n}", "#if defined(FEAT_EVAL) || defined(PROTO)\n/*\n * Return TRUE if patch \"n\" has been included.\n */\n int\nhas_patch(int n)\n{\n int\t\ti;", " for (i = 0; included_patches[i] != 0; ++i)\n\tif (included_patches[i] == n)\n\t return TRUE;\n return FALSE;\n}\n#endif", " void\nex_version(exarg_T *eap)\n{\n /*\n * Ignore a \":version 9.99\" command.\n */\n if (*eap->arg == NUL)\n {\n\tmsg_putchar('\\n');\n\tlist_version();\n }\n}", "/*\n * Output a string for the version message. If it's going to wrap, output a\n * newline, unless the message is too long to fit on the screen anyway.\n * When \"wrap\" is TRUE wrap the string in [].\n */\n static void\nversion_msg_wrap(char_u *s, int wrap)\n{\n int\t\tlen = (int)vim_strsize(s) + (wrap ? 2 : 0);", " if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns\n\t\t\t\t\t\t\t\t&& *s != '\\n')\n\tmsg_putchar('\\n');\n if (!got_int)\n {\n\tif (wrap)\n\t msg_puts(\"[\");\n\tmsg_puts((char *)s);\n\tif (wrap)\n\t msg_puts(\"]\");\n }\n}", " static void\nversion_msg(char *s)\n{\n version_msg_wrap((char_u *)s, FALSE);\n}", "/*\n * List all features aligned in columns, dictionary style.\n */\n static void\nlist_features(void)\n{\n list_in_columns((char_u **)features, -1, -1);\n}", "/*\n * List string items nicely aligned in columns.\n * When \"size\" is < 0 then the last entry is marked with NULL.\n * The entry with index \"current\" is inclosed in [].\n */\n void\nlist_in_columns(char_u **items, int size, int current)\n{\n int\t\ti;\n int\t\tncol;\n int\t\tnrow;\n int\t\tcur_row = 1;\n int\t\titem_count = 0;\n int\t\twidth = 0;\n#ifdef FEAT_SYN_HL\n int\t\tuse_highlight = (items == (char_u **)features);\n#endif", " /* Find the length of the longest item, use that + 1 as the column\n * width. */\n for (i = 0; size < 0 ? items[i] != NULL : i < size; ++i)\n {\n\tint l = (int)vim_strsize(items[i]) + (i == current ? 2 : 0);", "\tif (l > width)\n\t width = l;\n\t++item_count;\n }\n width += 1;", " if (Columns < width)\n {\n\t// Not enough screen columns - show one per line\n\tfor (i = 0; i < item_count; ++i)\n\t{\n\t version_msg_wrap(items[i], i == current);\n\t if (msg_col > 0 && i < item_count - 1)\n\t\tmsg_putchar('\\n');\n\t}\n\treturn;\n }", " // The rightmost column doesn't need a separator.\n // Sacrifice it to fit in one more column if possible.\n ncol = (int) (Columns + 1) / width;\n nrow = item_count / ncol + (item_count % ncol ? 1 : 0);", " // \"i\" counts columns then rows. \"idx\" counts rows then columns.\n for (i = 0; !got_int && i < nrow * ncol; ++i)\n {\n\tint idx = (i / ncol) + (i % ncol) * nrow;", "\tif (idx < item_count)\n\t{\n\t int last_col = (i + 1) % ncol == 0;", "\t if (idx == current)\n\t\tmsg_putchar('[');\n#ifdef FEAT_SYN_HL\n\t if (use_highlight && items[idx][0] == '-')\n\t\tmsg_puts_attr((char *)items[idx], HL_ATTR(HLF_W));\n\t else\n#endif\n\t\tmsg_puts((char *)items[idx]);\n\t if (idx == current)\n\t\tmsg_putchar(']');\n\t if (last_col)\n\t {\n\t\tif (msg_col > 0 && cur_row < nrow)\n\t\t msg_putchar('\\n');\n\t\t++cur_row;\n\t }\n\t else\n\t {\n\t\twhile (msg_col % width)\n\t\t msg_putchar(' ');\n\t }\n\t}\n\telse\n\t{\n\t // this row is out of items, thus at the end of the row\n\t if (msg_col > 0)\n\t {\n\t\tif (cur_row < nrow)\n\t\t msg_putchar('\\n');\n\t\t++cur_row;\n\t }\n\t}\n }\n}", " void\nlist_version(void)\n{\n int\t\ti;\n int\t\tfirst;\n char\t*s = \"\";", " /*\n * When adding features here, don't forget to update the list of\n * internal variables in eval.c!\n */\n init_longVersion();\n msg(longVersion);\n#ifdef MSWIN\n# ifdef FEAT_GUI_MSWIN\n# ifdef VIMDLL\n# ifdef _WIN64\n msg_puts(_(\"\\nMS-Windows 64-bit GUI/console version\"));\n# else\n msg_puts(_(\"\\nMS-Windows 32-bit GUI/console version\"));\n# endif\n# else\n# ifdef _WIN64\n msg_puts(_(\"\\nMS-Windows 64-bit GUI version\"));\n# else\n msg_puts(_(\"\\nMS-Windows 32-bit GUI version\"));\n# endif\n# endif\n# ifdef FEAT_OLE\n msg_puts(_(\" with OLE support\"));\n# endif\n# else\n# ifdef _WIN64\n msg_puts(_(\"\\nMS-Windows 64-bit console version\"));\n# else\n msg_puts(_(\"\\nMS-Windows 32-bit console version\"));\n# endif\n# endif\n#endif\n#if defined(MACOS_X)\n# if defined(MACOS_X_DARWIN)\n msg_puts(_(\"\\nmacOS version\"));\n# else\n msg_puts(_(\"\\nmacOS version w/o darwin feat.\"));\n# endif\n#endif", "#ifdef VMS\n msg_puts(_(\"\\nOpenVMS version\"));\n# ifdef HAVE_PATHDEF\n if (*compiled_arch != NUL)\n {\n\tmsg_puts(\" - \");\n\tmsg_puts((char *)compiled_arch);\n }\n# endif", "#endif", " /* Print the list of patch numbers if there is at least one. */\n /* Print a range when patches are consecutive: \"1-10, 12, 15-40, 42-45\" */\n if (included_patches[0] != 0)\n {\n\tmsg_puts(_(\"\\nIncluded patches: \"));\n\tfirst = -1;\n\t/* find last one */\n\tfor (i = 0; included_patches[i] != 0; ++i)\n\t ;\n\twhile (--i >= 0)\n\t{\n\t if (first < 0)\n\t\tfirst = included_patches[i];\n\t if (i == 0 || included_patches[i - 1] != included_patches[i] + 1)\n\t {\n\t\tmsg_puts(s);\n\t\ts = \", \";\n\t\tmsg_outnum((long)first);\n\t\tif (first != included_patches[i])\n\t\t{\n\t\t msg_puts(\"-\");\n\t\t msg_outnum((long)included_patches[i]);\n\t\t}\n\t\tfirst = -1;\n\t }\n\t}\n }", " /* Print the list of extra patch descriptions if there is at least one. */\n if (extra_patches[0] != NULL)\n {\n\tmsg_puts(_(\"\\nExtra patches: \"));\n\ts = \"\";\n\tfor (i = 0; extra_patches[i] != NULL; ++i)\n\t{\n\t msg_puts(s);\n\t s = \", \";\n\t msg_puts(extra_patches[i]);\n\t}\n }", "#ifdef MODIFIED_BY\n msg_puts(\"\\n\");\n msg_puts(_(\"Modified by \"));\n msg_puts(MODIFIED_BY);\n#endif", "#ifdef HAVE_PATHDEF\n if (*compiled_user != NUL || *compiled_sys != NUL)\n {\n\tmsg_puts(_(\"\\nCompiled \"));\n\tif (*compiled_user != NUL)\n\t{\n\t msg_puts(_(\"by \"));\n\t msg_puts((char *)compiled_user);\n\t}\n\tif (*compiled_sys != NUL)\n\t{\n\t msg_puts(\"@\");\n\t msg_puts((char *)compiled_sys);\n\t}\n }\n#endif", "#ifdef FEAT_HUGE\n msg_puts(_(\"\\nHuge version \"));\n#else\n# ifdef FEAT_BIG\n msg_puts(_(\"\\nBig version \"));\n# else\n# ifdef FEAT_NORMAL\n msg_puts(_(\"\\nNormal version \"));\n# else\n# ifdef FEAT_SMALL\n msg_puts(_(\"\\nSmall version \"));\n# else\n msg_puts(_(\"\\nTiny version \"));\n# endif\n# endif\n# endif\n#endif\n#ifndef FEAT_GUI\n msg_puts(_(\"without GUI.\"));\n#else\n# ifdef FEAT_GUI_GTK\n# ifdef USE_GTK3\n msg_puts(_(\"with GTK3 GUI.\"));\n# else\n# ifdef FEAT_GUI_GNOME\n msg_puts(_(\"with GTK2-GNOME GUI.\"));\n# else\n msg_puts(_(\"with GTK2 GUI.\"));\n# endif\n# endif\n# else\n# ifdef FEAT_GUI_MOTIF\n msg_puts(_(\"with X11-Motif GUI.\"));\n# else\n# ifdef FEAT_GUI_ATHENA\n# ifdef FEAT_GUI_NEXTAW\n msg_puts(_(\"with X11-neXtaw GUI.\"));\n# else\n msg_puts(_(\"with X11-Athena GUI.\"));\n# endif\n# else\n# ifdef FEAT_GUI_PHOTON\n msg_puts(_(\"with Photon GUI.\"));\n# else\n# if defined(MSWIN)\n msg_puts(_(\"with GUI.\"));\n# else\n#\tif defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON\n msg_puts(_(\"with Carbon GUI.\"));\n#\telse\n#\t if defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX\n msg_puts(_(\"with Cocoa GUI.\"));\n#\t else\n#\t endif\n#\tendif\n# endif\n# endif\n# endif\n# endif\n# endif\n#endif\n version_msg(_(\" Features included (+) or not (-):\\n\"));", " list_features();\n if (msg_col > 0)\n\tmsg_putchar('\\n');", "#ifdef SYS_VIMRC_FILE\n version_msg(_(\" system vimrc file: \\\"\"));\n version_msg(SYS_VIMRC_FILE);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_VIMRC_FILE\n version_msg(_(\" user vimrc file: \\\"\"));\n version_msg(USR_VIMRC_FILE);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_VIMRC_FILE2\n version_msg(_(\" 2nd user vimrc file: \\\"\"));\n version_msg(USR_VIMRC_FILE2);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_VIMRC_FILE3\n version_msg(_(\" 3rd user vimrc file: \\\"\"));\n version_msg(USR_VIMRC_FILE3);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_EXRC_FILE\n version_msg(_(\" user exrc file: \\\"\"));\n version_msg(USR_EXRC_FILE);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_EXRC_FILE2\n version_msg(_(\" 2nd user exrc file: \\\"\"));\n version_msg(USR_EXRC_FILE2);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef FEAT_GUI\n# ifdef SYS_GVIMRC_FILE\n version_msg(_(\" system gvimrc file: \\\"\"));\n version_msg(SYS_GVIMRC_FILE);\n version_msg(\"\\\"\\n\");\n# endif\n version_msg(_(\" user gvimrc file: \\\"\"));\n version_msg(USR_GVIMRC_FILE);\n version_msg(\"\\\"\\n\");\n# ifdef USR_GVIMRC_FILE2\n version_msg(_(\"2nd user gvimrc file: \\\"\"));\n version_msg(USR_GVIMRC_FILE2);\n version_msg(\"\\\"\\n\");\n# endif\n# ifdef USR_GVIMRC_FILE3\n version_msg(_(\"3rd user gvimrc file: \\\"\"));\n version_msg(USR_GVIMRC_FILE3);\n version_msg(\"\\\"\\n\");\n# endif\n#endif\n version_msg(_(\" defaults file: \\\"\"));\n version_msg(VIM_DEFAULTS_FILE);\n version_msg(\"\\\"\\n\");\n#ifdef FEAT_GUI\n# ifdef SYS_MENU_FILE\n version_msg(_(\" system menu file: \\\"\"));\n version_msg(SYS_MENU_FILE);\n version_msg(\"\\\"\\n\");\n# endif\n#endif\n#ifdef HAVE_PATHDEF\n if (*default_vim_dir != NUL)\n {\n\tversion_msg(_(\" fall-back for $VIM: \\\"\"));\n\tversion_msg((char *)default_vim_dir);\n\tversion_msg(\"\\\"\\n\");\n }\n if (*default_vimruntime_dir != NUL)\n {\n\tversion_msg(_(\" f-b for $VIMRUNTIME: \\\"\"));\n\tversion_msg((char *)default_vimruntime_dir);\n\tversion_msg(\"\\\"\\n\");\n }\n version_msg(_(\"Compilation: \"));\n version_msg((char *)all_cflags);\n version_msg(\"\\n\");\n#ifdef VMS\n if (*compiler_version != NUL)\n {\n\tversion_msg(_(\"Compiler: \"));\n\tversion_msg((char *)compiler_version);\n\tversion_msg(\"\\n\");\n }\n#endif\n version_msg(_(\"Linking: \"));\n version_msg((char *)all_lflags);\n#endif\n#ifdef DEBUG\n version_msg(\"\\n\");\n version_msg(_(\" DEBUG BUILD\"));\n#endif\n}", "static void do_intro_line(int row, char_u *mesg, int add_version, int attr);", "/*\n * Show the intro message when not editing a file.\n */\n void\nmaybe_intro_message(void)\n{\n if (BUFEMPTY()\n\t && curbuf->b_fname == NULL\n\t && firstwin->w_next == NULL\n\t && vim_strchr(p_shm, SHM_INTRO) == NULL)\n\tintro_message(FALSE);\n}", "/*\n * Give an introductory message about Vim.\n * Only used when starting Vim on an empty file, without a file name.\n * Or with the \":intro\" command (for Sven :-).\n */\n void\nintro_message(\n int\t\tcolon)\t\t/* TRUE for \":intro\" */\n{\n int\t\ti;\n int\t\trow;\n int\t\tblanklines;\n int\t\tsponsor;\n char\t*p;\n static char\t*(lines[]) =\n {\n\tN_(\"VIM - Vi IMproved\"),\n\t\"\",\n\tN_(\"version \"),\n\tN_(\"by Bram Moolenaar et al.\"),\n#ifdef MODIFIED_BY\n\t\" \",\n#endif\n\tN_(\"Vim is open source and freely distributable\"),\n\t\"\",\n\tN_(\"Help poor children in Uganda!\"),\n\tN_(\"type :help iccf<Enter> for information \"),\n\t\"\",\n\tN_(\"type :q<Enter> to exit \"),\n\tN_(\"type :help<Enter> or <F1> for on-line help\"),\n\tN_(\"type :help version8<Enter> for version info\"),\n\tNULL,\n\t\"\",\n\tN_(\"Running in Vi compatible mode\"),\n\tN_(\"type :set nocp<Enter> for Vim defaults\"),\n\tN_(\"type :help cp-default<Enter> for info on this\"),\n };\n#ifdef FEAT_GUI\n static char\t*(gui_lines[]) =\n {\n\tNULL,\n\tNULL,\n\tNULL,\n\tNULL,\n#ifdef MODIFIED_BY\n\tNULL,\n#endif\n\tNULL,\n\tNULL,\n\tNULL,\n\tN_(\"menu Help->Orphans for information \"),\n\tNULL,\n\tN_(\"Running modeless, typed text is inserted\"),\n\tN_(\"menu Edit->Global Settings->Toggle Insert Mode \"),\n\tN_(\" for two modes \"),\n\tNULL,\n\tNULL,\n\tNULL,\n\tN_(\"menu Edit->Global Settings->Toggle Vi Compatible\"),\n\tN_(\" for Vim defaults \"),\n };\n#endif", " /* blanklines = screen height - # message lines */\n blanklines = (int)Rows - ((sizeof(lines) / sizeof(char *)) - 1);\n if (!p_cp)\n\tblanklines += 4; /* add 4 for not showing \"Vi compatible\" message */", " /* Don't overwrite a statusline. Depends on 'cmdheight'. */\n if (p_ls > 1)\n\tblanklines -= Rows - topframe->fr_height;\n if (blanklines < 0)\n\tblanklines = 0;", " /* Show the sponsor and register message one out of four times, the Uganda\n * message two out of four times. */\n sponsor = (int)time(NULL);\n sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);", " /* start displaying the message lines after half of the blank lines */\n row = blanklines / 2;\n if ((row >= 2 && Columns >= 50) || colon)\n {\n\tfor (i = 0; i < (int)(sizeof(lines) / sizeof(char *)); ++i)\n\t{\n\t p = lines[i];\n#ifdef FEAT_GUI\n\t if (p_im && gui.in_use && gui_lines[i] != NULL)\n\t\tp = gui_lines[i];\n#endif\n\t if (p == NULL)\n\t {\n\t\tif (!p_cp)\n\t\t break;\n\t\tcontinue;\n\t }\n\t if (sponsor != 0)\n\t {\n\t\tif (strstr(p, \"children\") != NULL)\n\t\t p = sponsor < 0\n\t\t\t? N_(\"Sponsor Vim development!\")\n\t\t\t: N_(\"Become a registered Vim user!\");\n\t\telse if (strstr(p, \"iccf\") != NULL)\n\t\t p = sponsor < 0\n\t\t\t? N_(\"type :help sponsor<Enter> for information \")\n\t\t\t: N_(\"type :help register<Enter> for information \");\n\t\telse if (strstr(p, \"Orphans\") != NULL)\n\t\t p = N_(\"menu Help->Sponsor/Register for information \");\n\t }\n\t if (*p != NUL)\n\t\tdo_intro_line(row, (char_u *)_(p), i == 2, 0);\n\t ++row;\n\t}\n }", " /* Make the wait-return message appear just below the text. */\n if (colon)\n\tmsg_row = row;\n}", " static void\ndo_intro_line(\n int\t\trow,\n char_u\t*mesg,\n int\t\tadd_version,\n int\t\tattr)\n{\n char_u\tvers[20];\n int\t\tcol;\n char_u\t*p;\n int\t\tl;\n int\t\tclen;\n#ifdef MODIFIED_BY\n# define MODBY_LEN 150\n char_u\tmodby[MODBY_LEN];", " if (*mesg == ' ')\n {\n\tvim_strncpy(modby, (char_u *)_(\"Modified by \"), MODBY_LEN - 1);\n\tl = (int)STRLEN(modby);\n\tvim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1);\n\tmesg = modby;\n }\n#endif", " /* Center the message horizontally. */\n col = vim_strsize(mesg);\n if (add_version)\n {\n\tSTRCPY(vers, mediumVersion);\n\tif (highest_patch())\n\t{\n\t /* Check for 9.9x or 9.9xx, alpha/beta version */\n\t if (isalpha((int)vers[3]))\n\t {\n\t\tint len = (isalpha((int)vers[4])) ? 5 : 4;\n\t\tsprintf((char *)vers + len, \".%d%s\", highest_patch(),\n\t\t\t\t\t\t\t mediumVersion + len);\n\t }\n\t else\n\t\tsprintf((char *)vers + 3, \".%d\", highest_patch());\n\t}\n\tcol += (int)STRLEN(vers);\n }\n col = (Columns - col) / 2;\n if (col < 0)\n\tcol = 0;", " /* Split up in parts to highlight <> items differently. */\n for (p = mesg; *p != NUL; p += l)\n {\n\tclen = 0;\n\tfor (l = 0; p[l] != NUL\n\t\t\t && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)\n\t{\n\t if (has_mbyte)\n\t {\n\t\tclen += ptr2cells(p + l);\n\t\tl += (*mb_ptr2len)(p + l) - 1;\n\t }\n\t else\n\t\tclen += byte2cells(p[l]);\n\t}\n\tscreen_puts_len(p, l, row, col, *p == '<' ? HL_ATTR(HLF_8) : attr);\n\tcol += clen;\n }", " /* Add the version number to the version line. */\n if (add_version)\n\tscreen_puts(vers, row, col, 0);\n}", "/*\n * \":intro\": clear screen, display intro screen and wait for return.\n */\n void\nex_intro(exarg_T *eap UNUSED)\n{\n screenclear();\n intro_message(TRUE);\n wait_return(TRUE);\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [2290, 755, 4659], "buggy_code_start_loc": [2290, 755, 4643], "filenames": ["src/testdir/test_autocmd.vim", "src/version.c", "src/window.c"], "fixing_code_end_loc": [2299, 758, 4660], "fixing_code_start_loc": [2291, 756, 4644], "message": "The autocmd feature in window.c in Vim before 8.1.2136 accesses freed memory.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:vim:vim:*:*:*:*:*:*:*:*", "matchCriteriaId": "8BA1A77F-AC6C-4A51-A1C0-873DE3A2BF19", "versionEndExcluding": "8.1.2136", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "8.1.2121", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:12.04:*:*:*:esm:*:*:*", "matchCriteriaId": "8D305F7A-D159-4716-AB26-5E38BB5CD991", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:14.04:*:*:*:esm:*:*:*", "matchCriteriaId": "815D70A8-47D3-459C-A32C-9FEACA0659D1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:lts:*:*:*", "matchCriteriaId": "F7016A2A-8365-4F1A-89A2-7A19F2BCAE5B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:19.10:*:*:*:*:*:*:*", "matchCriteriaId": "A31C8344-3E02-4EB8-8BD8-4C84B7959624", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The autocmd feature in window.c in Vim before 8.1.2136 accesses freed memory."}, {"lang": "es", "value": "La funcionalidad autocmd en el archivo window.c en Vim versiones anteriores a la versi\u00f3n 8.1.2136, accede a la memoria liberada."}], "evaluatorComment": null, "id": "CVE-2019-20079", "lastModified": "2020-10-20T16:04:08.370", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-12-30T01:15:12.290", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/commit/ec66c41d84e574baf8009dbc0bd088d2bc5b2421"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/compare/v8.1.2135...v8.1.2136"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "https://packetstormsecurity.com/files/154898"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4309-1/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-416"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/vim/vim/commit/ec66c41d84e574baf8009dbc0bd088d2bc5b2421"}, "type": "CWE-416"}
352
Determine whether the {function_name} code is vulnerable or not.
[ "/* vi:set ts=8 sts=4 sw=4 noet:\n *\n * VIM - Vi IMproved\t\tby Bram Moolenaar\n *\n * Do \":help uganda\" in Vim to read copying and usage conditions.\n * Do \":help credits\" in Vim to see a list of people who contributed.\n * See README.txt for an overview of the Vim source code.\n */", "#include \"vim.h\"", "#ifdef AMIGA\n# include <time.h>\t/* for time() */\n#endif", "/*\n * Vim originated from Stevie version 3.6 (Fish disk 217) by GRWalter (Fred)\n * It has been changed beyond recognition since then.\n *\n * Differences between version 7.4 and 8.x can be found with \":help version8\".\n * Differences between version 6.4 and 7.x can be found with \":help version7\".\n * Differences between version 5.8 and 6.x can be found with \":help version6\".\n * Differences between version 4.x and 5.x can be found with \":help version5\".\n * Differences between version 3.0 and 4.x can be found with \":help version4\".\n * All the remarks about older versions have been removed, they are not very\n * interesting.\n */", "#include \"version.h\"", "char\t\t*Version = VIM_VERSION_SHORT;\nstatic char\t*mediumVersion = VIM_VERSION_MEDIUM;", "#if defined(HAVE_DATE_TIME) || defined(PROTO)\n# if (defined(VMS) && defined(VAXC)) || defined(PROTO)\nchar\tlongVersion[sizeof(VIM_VERSION_LONG_DATE) + sizeof(__DATE__)\n\t\t\t\t\t\t + sizeof(__TIME__) + 3];", " void\ninit_longVersion(void)\n{\n /*\n * Construct the long version string. Necessary because\n * VAX C can't concatenate strings in the preprocessor.\n */\n strcpy(longVersion, VIM_VERSION_LONG_DATE);\n strcat(longVersion, __DATE__);\n strcat(longVersion, \" \");\n strcat(longVersion, __TIME__);\n strcat(longVersion, \")\");\n}", "# else\n void\ninit_longVersion(void)\n{\n char *date_time = __DATE__ \" \" __TIME__;\n char *msg = _(\"%s (%s, compiled %s)\");\n size_t len = strlen(msg)\n\t\t+ strlen(VIM_VERSION_LONG_ONLY)\n\t\t+ strlen(VIM_VERSION_DATE_ONLY)\n\t\t+ strlen(date_time);", " longVersion = alloc(len);\n if (longVersion == NULL)\n\tlongVersion = VIM_VERSION_LONG;\n else\n\tvim_snprintf(longVersion, len, msg,\n\t\t VIM_VERSION_LONG_ONLY, VIM_VERSION_DATE_ONLY, date_time);\n}\n# endif\n#else\nchar\t*longVersion = VIM_VERSION_LONG;", " void\ninit_longVersion(void)\n{\n // nothing to do\n}\n#endif", "static char *(features[]) =\n{\n#ifdef HAVE_ACL\n\t\"+acl\",\n#else\n\t\"-acl\",\n#endif\n#ifdef AMIGA\t\t/* only for Amiga systems */\n# ifdef FEAT_ARP\n\t\"+ARP\",\n# else\n\t\"-ARP\",\n# endif\n#endif\n#ifdef FEAT_ARABIC\n\t\"+arabic\",\n#else\n\t\"-arabic\",\n#endif\n\t\"+autocmd\",\n#ifdef FEAT_AUTOCHDIR\n \"+autochdir\",\n#else\n \"-autochdir\",\n#endif\n#ifdef FEAT_AUTOSERVERNAME\n\t\"+autoservername\",\n#else\n\t\"-autoservername\",\n#endif\n#ifdef FEAT_BEVAL_GUI\n\t\"+balloon_eval\",\n#else\n\t\"-balloon_eval\",\n#endif\n#ifdef FEAT_BEVAL_TERM\n\t\"+balloon_eval_term\",\n#else\n\t\"-balloon_eval_term\",\n#endif\n#ifdef FEAT_BROWSE\n\t\"+browse\",\n#else\n\t\"-browse\",\n#endif\n#ifdef NO_BUILTIN_TCAPS\n\t\"-builtin_terms\",\n#endif\n#ifdef SOME_BUILTIN_TCAPS\n\t\"+builtin_terms\",\n#endif\n#ifdef ALL_BUILTIN_TCAPS\n\t\"++builtin_terms\",\n#endif\n#ifdef FEAT_BYTEOFF\n\t\"+byte_offset\",\n#else\n\t\"-byte_offset\",\n#endif\n#ifdef FEAT_JOB_CHANNEL\n\t\"+channel\",\n#else\n\t\"-channel\",\n#endif\n#ifdef FEAT_CINDENT\n\t\"+cindent\",\n#else\n\t\"-cindent\",\n#endif\n#ifdef FEAT_CLIENTSERVER\n\t\"+clientserver\",\n#else\n\t\"-clientserver\",\n#endif\n#ifdef FEAT_CLIPBOARD\n\t\"+clipboard\",\n#else\n\t\"-clipboard\",\n#endif\n\t\"+cmdline_compl\",\n\t\"+cmdline_hist\",\n#ifdef FEAT_CMDL_INFO\n\t\"+cmdline_info\",\n#else\n\t\"-cmdline_info\",\n#endif\n\t\"+comments\",\n#ifdef FEAT_CONCEAL\n\t\"+conceal\",\n#else\n\t\"-conceal\",\n#endif\n#ifdef FEAT_CRYPT\n\t\"+cryptv\",\n#else\n\t\"-cryptv\",\n#endif\n#ifdef FEAT_CSCOPE\n\t\"+cscope\",\n#else\n\t\"-cscope\",\n#endif\n\t\"+cursorbind\",\n#ifdef CURSOR_SHAPE\n\t\"+cursorshape\",\n#else\n\t\"-cursorshape\",\n#endif\n#if defined(FEAT_CON_DIALOG) && defined(FEAT_GUI_DIALOG)\n\t\"+dialog_con_gui\",\n#else\n# if defined(FEAT_CON_DIALOG)\n\t\"+dialog_con\",\n# else\n# if defined(FEAT_GUI_DIALOG)\n\t\"+dialog_gui\",\n# else\n\t\"-dialog\",\n# endif\n# endif\n#endif\n#ifdef FEAT_DIFF\n\t\"+diff\",\n#else\n\t\"-diff\",\n#endif\n#ifdef FEAT_DIGRAPHS\n\t\"+digraphs\",\n#else\n\t\"-digraphs\",\n#endif\n#ifdef FEAT_GUI_MSWIN\n# ifdef FEAT_DIRECTX\n\t\"+directx\",\n# else\n\t\"-directx\",\n# endif\n#endif\n#ifdef FEAT_DND\n\t\"+dnd\",\n#else\n\t\"-dnd\",\n#endif\n#ifdef EBCDIC\n\t\"+ebcdic\",\n#else\n\t\"-ebcdic\",\n#endif\n#ifdef FEAT_EMACS_TAGS\n\t\"+emacs_tags\",\n#else\n\t\"-emacs_tags\",\n#endif\n#ifdef FEAT_EVAL\n\t\"+eval\",\n#else\n\t\"-eval\",\n#endif\n\t\"+ex_extra\",\n#ifdef FEAT_SEARCH_EXTRA\n\t\"+extra_search\",\n#else\n\t\"-extra_search\",\n#endif\n\t\"-farsi\",\n#ifdef FEAT_SEARCHPATH\n\t\"+file_in_path\",\n#else\n\t\"-file_in_path\",\n#endif\n#ifdef FEAT_FIND_ID\n\t\"+find_in_path\",\n#else\n\t\"-find_in_path\",\n#endif\n#ifdef FEAT_FLOAT\n\t\"+float\",\n#else\n\t\"-float\",\n#endif\n#ifdef FEAT_FOLDING\n\t\"+folding\",\n#else\n\t\"-folding\",\n#endif\n#ifdef FEAT_FOOTER\n\t\"+footer\",\n#else\n\t\"-footer\",\n#endif\n\t /* only interesting on Unix systems */\n#if !defined(USE_SYSTEM) && defined(UNIX)\n\t\"+fork()\",\n#endif\n#ifdef FEAT_GETTEXT\n# ifdef DYNAMIC_GETTEXT\n\t\"+gettext/dyn\",\n# else\n\t\"+gettext\",\n# endif\n#else\n\t\"-gettext\",\n#endif\n#ifdef FEAT_HANGULIN\n\t\"+hangul_input\",\n#else\n\t\"-hangul_input\",\n#endif\n#if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV)\n# ifdef DYNAMIC_ICONV\n\t\"+iconv/dyn\",\n# else\n\t\"+iconv\",\n# endif\n#else\n\t\"-iconv\",\n#endif\n\t\"+insert_expand\",\n#ifdef FEAT_JOB_CHANNEL\n\t\"+job\",\n#else\n\t\"-job\",\n#endif\n#ifdef FEAT_JUMPLIST\n\t\"+jumplist\",\n#else\n\t\"-jumplist\",\n#endif\n#ifdef FEAT_KEYMAP\n\t\"+keymap\",\n#else\n\t\"-keymap\",\n#endif\n#ifdef FEAT_EVAL\n\t\"+lambda\",\n#else\n\t\"-lambda\",\n#endif\n#ifdef FEAT_LANGMAP\n\t\"+langmap\",\n#else\n\t\"-langmap\",\n#endif\n#ifdef FEAT_LIBCALL\n\t\"+libcall\",\n#else\n\t\"-libcall\",\n#endif\n#ifdef FEAT_LINEBREAK\n\t\"+linebreak\",\n#else\n\t\"-linebreak\",\n#endif\n#ifdef FEAT_LISP\n\t\"+lispindent\",\n#else\n\t\"-lispindent\",\n#endif\n\t\"+listcmds\",\n\t\"+localmap\",\n#ifdef FEAT_LUA\n# ifdef DYNAMIC_LUA\n\t\"+lua/dyn\",\n# else\n\t\"+lua\",\n# endif\n#else\n\t\"-lua\",\n#endif\n#ifdef FEAT_MENU\n\t\"+menu\",\n#else\n\t\"-menu\",\n#endif\n#ifdef FEAT_SESSION\n\t\"+mksession\",\n#else\n\t\"-mksession\",\n#endif\n\t\"+modify_fname\",\n#ifdef FEAT_MOUSE\n\t\"+mouse\",\n# ifdef FEAT_MOUSESHAPE\n\t\"+mouseshape\",\n# else\n\t\"-mouseshape\",\n# endif\n# else\n\t\"-mouse\",\n#endif", "#if defined(UNIX) || defined(VMS)\n# ifdef FEAT_MOUSE_DEC\n\t\"+mouse_dec\",\n# else\n\t\"-mouse_dec\",\n# endif\n# ifdef FEAT_MOUSE_GPM\n\t\"+mouse_gpm\",\n# else\n\t\"-mouse_gpm\",\n# endif\n# ifdef FEAT_MOUSE_JSB\n\t\"+mouse_jsbterm\",\n# else\n\t\"-mouse_jsbterm\",\n# endif\n# ifdef FEAT_MOUSE_NET\n\t\"+mouse_netterm\",\n# else\n\t\"-mouse_netterm\",\n# endif\n#endif", "#ifdef __QNX__\n# ifdef FEAT_MOUSE_PTERM\n\t\"+mouse_pterm\",\n# else\n\t\"-mouse_pterm\",\n# endif\n#endif", "#if defined(UNIX) || defined(VMS)\n# ifdef FEAT_MOUSE_XTERM\n\t\"+mouse_sgr\",\n# else\n\t\"-mouse_sgr\",\n# endif\n# ifdef FEAT_SYSMOUSE\n\t\"+mouse_sysmouse\",\n# else\n\t\"-mouse_sysmouse\",\n# endif\n# ifdef FEAT_MOUSE_URXVT\n\t\"+mouse_urxvt\",\n# else\n\t\"-mouse_urxvt\",\n# endif\n# ifdef FEAT_MOUSE_XTERM\n\t\"+mouse_xterm\",\n# else\n\t\"-mouse_xterm\",\n# endif\n#endif", "#ifdef FEAT_MBYTE_IME\n# ifdef DYNAMIC_IME\n\t\"+multi_byte_ime/dyn\",\n# else\n\t\"+multi_byte_ime\",\n# endif\n#else\n\t\"+multi_byte\",\n#endif\n#ifdef FEAT_MULTI_LANG\n\t\"+multi_lang\",\n#else\n\t\"-multi_lang\",\n#endif\n#ifdef FEAT_MZSCHEME\n# ifdef DYNAMIC_MZSCHEME\n\t\"+mzscheme/dyn\",\n# else\n\t\"+mzscheme\",\n# endif\n#else\n\t\"-mzscheme\",\n#endif\n#ifdef FEAT_NETBEANS_INTG\n\t\"+netbeans_intg\",\n#else\n\t\"-netbeans_intg\",\n#endif\n#ifdef FEAT_NUM64\n\t\"+num64\",\n#else\n\t\"-num64\",\n#endif\n#ifdef FEAT_GUI_MSWIN\n# ifdef FEAT_OLE\n\t\"+ole\",\n# else\n\t\"-ole\",\n# endif\n#endif\n#ifdef FEAT_EVAL\n\t\"+packages\",\n#else\n\t\"-packages\",\n#endif\n#ifdef FEAT_PATH_EXTRA\n\t\"+path_extra\",\n#else\n\t\"-path_extra\",\n#endif\n#ifdef FEAT_PERL\n# ifdef DYNAMIC_PERL\n\t\"+perl/dyn\",\n# else\n\t\"+perl\",\n# endif\n#else\n\t\"-perl\",\n#endif\n#ifdef FEAT_PERSISTENT_UNDO\n\t\"+persistent_undo\",\n#else\n\t\"-persistent_undo\",\n#endif\n#ifdef FEAT_PRINTER\n# ifdef FEAT_POSTSCRIPT\n\t\"+postscript\",\n# else\n\t\"-postscript\",\n# endif\n\t\"+printer\",\n#else\n\t\"-printer\",\n#endif\n#ifdef FEAT_PROFILE\n\t\"+profile\",\n#else\n\t\"-profile\",\n#endif\n#ifdef FEAT_PYTHON\n# ifdef DYNAMIC_PYTHON\n\t\"+python/dyn\",\n# else\n\t\"+python\",\n# endif\n#else\n\t\"-python\",\n#endif\n#ifdef FEAT_PYTHON3\n# ifdef DYNAMIC_PYTHON3\n\t\"+python3/dyn\",\n# else\n\t\"+python3\",\n# endif\n#else\n\t\"-python3\",\n#endif\n#ifdef FEAT_QUICKFIX\n\t\"+quickfix\",\n#else\n\t\"-quickfix\",\n#endif\n#ifdef FEAT_RELTIME\n\t\"+reltime\",\n#else\n\t\"-reltime\",\n#endif\n#ifdef FEAT_RIGHTLEFT\n\t\"+rightleft\",\n#else\n\t\"-rightleft\",\n#endif\n#ifdef FEAT_RUBY\n# ifdef DYNAMIC_RUBY\n\t\"+ruby/dyn\",\n# else\n\t\"+ruby\",\n# endif\n#else\n\t\"-ruby\",\n#endif\n\t\"+scrollbind\",\n#ifdef FEAT_SIGNS\n\t\"+signs\",\n#else\n\t\"-signs\",\n#endif\n#ifdef FEAT_SMARTINDENT\n\t\"+smartindent\",\n#else\n\t\"-smartindent\",\n#endif\n#ifdef FEAT_SOUND\n\t\"+sound\",\n#else\n\t\"-sound\",\n#endif\n#ifdef FEAT_SPELL\n\t\"+spell\",\n#else\n\t\"-spell\",\n#endif\n#ifdef STARTUPTIME\n\t\"+startuptime\",\n#else\n\t\"-startuptime\",\n#endif\n#ifdef FEAT_STL_OPT\n\t\"+statusline\",\n#else\n\t\"-statusline\",\n#endif\n\t\"-sun_workshop\",\n#ifdef FEAT_SYN_HL\n\t\"+syntax\",\n#else\n\t\"-syntax\",\n#endif\n\t /* only interesting on Unix systems */\n#if defined(USE_SYSTEM) && defined(UNIX)\n\t\"+system()\",\n#endif\n#ifdef FEAT_TAG_BINS\n\t\"+tag_binary\",\n#else\n\t\"-tag_binary\",\n#endif\n\t\"-tag_old_static\",\n\t\"-tag_any_white\",\n#ifdef FEAT_TCL\n# ifdef DYNAMIC_TCL\n\t\"+tcl/dyn\",\n# else\n\t\"+tcl\",\n# endif\n#else\n\t\"-tcl\",\n#endif\n#ifdef FEAT_TERMGUICOLORS\n\t\"+termguicolors\",\n#else\n\t\"-termguicolors\",\n#endif\n#ifdef FEAT_TERMINAL\n\t\"+terminal\",\n#else\n\t\"-terminal\",\n#endif\n#if defined(UNIX)\n/* only Unix can have terminfo instead of termcap */\n# ifdef TERMINFO\n\t\"+terminfo\",\n# else\n\t\"-terminfo\",\n# endif\n#endif\n#ifdef FEAT_TERMRESPONSE\n\t\"+termresponse\",\n#else\n\t\"-termresponse\",\n#endif\n#ifdef FEAT_TEXTOBJ\n\t\"+textobjects\",\n#else\n\t\"-textobjects\",\n#endif\n#ifdef FEAT_TEXT_PROP\n\t\"+textprop\",\n#else\n\t\"-textprop\",\n#endif\n#if !defined(UNIX)\n/* unix always includes termcap support */\n# ifdef HAVE_TGETENT\n\t\"+tgetent\",\n# else\n\t\"-tgetent\",\n# endif\n#endif\n#ifdef FEAT_TIMERS\n\t\"+timers\",\n#else\n\t\"-timers\",\n#endif\n#ifdef FEAT_TITLE\n\t\"+title\",\n#else\n\t\"-title\",\n#endif\n#ifdef FEAT_TOOLBAR\n\t\"+toolbar\",\n#else\n\t\"-toolbar\",\n#endif\n\t\"+user_commands\",\n#ifdef FEAT_VARTABS\n\t\"+vartabs\",\n#else\n\t\"-vartabs\",\n#endif\n\t\"+vertsplit\",\n\t\"+virtualedit\",\n\t\"+visual\",\n\t\"+visualextra\",\n#ifdef FEAT_VIMINFO\n\t\"+viminfo\",\n#else\n\t\"-viminfo\",\n#endif\n\t\"+vreplace\",\n#ifdef MSWIN\n# ifdef FEAT_VTP\n\t\"+vtp\",\n# else\n\t\"-vtp\",\n# endif\n#endif\n#ifdef FEAT_WILDIGN\n\t\"+wildignore\",\n#else\n\t\"-wildignore\",\n#endif\n#ifdef FEAT_WILDMENU\n\t\"+wildmenu\",\n#else\n\t\"-wildmenu\",\n#endif\n\t\"+windows\",\n#ifdef FEAT_WRITEBACKUP\n\t\"+writebackup\",\n#else\n\t\"-writebackup\",\n#endif\n#if defined(UNIX) || defined(VMS)\n# ifdef FEAT_X11\n\t\"+X11\",\n# else\n\t\"-X11\",\n# endif\n#endif\n#ifdef FEAT_XFONTSET\n\t\"+xfontset\",\n#else\n\t\"-xfontset\",\n#endif\n#ifdef FEAT_XIM\n\t\"+xim\",\n#else\n\t\"-xim\",\n#endif\n#ifdef MSWIN\n# ifdef FEAT_XPM_W32\n\t\"+xpm_w32\",\n# else\n\t\"-xpm_w32\",\n# endif\n#else\n# ifdef HAVE_XPM\n\t\"+xpm\",\n# else\n\t\"-xpm\",\n# endif\n#endif\n#if defined(UNIX) || defined(VMS)\n# ifdef USE_XSMP_INTERACT\n\t\"+xsmp_interact\",\n# else\n# ifdef USE_XSMP\n\t\"+xsmp\",\n# else\n\t\"-xsmp\",\n# endif\n# endif\n# ifdef FEAT_XCLIPBOARD\n\t\"+xterm_clipboard\",\n# else\n\t\"-xterm_clipboard\",\n# endif\n#endif\n#ifdef FEAT_XTERM_SAVE\n\t\"+xterm_save\",\n#else\n\t\"-xterm_save\",\n#endif\n\tNULL\n};", "static int included_patches[] =\n{ /* Add new patch number below this line */", "/**/\n 2136,", "/**/\n 2135,\n/**/\n 2134,\n/**/\n 2133,\n/**/\n 2132,\n/**/\n 2131,\n/**/\n 2130,\n/**/\n 2129,\n/**/\n 2128,\n/**/\n 2127,\n/**/\n 2126,\n/**/\n 2125,\n/**/\n 2124,\n/**/\n 2123,\n/**/\n 2122,\n/**/\n 2121,\n/**/\n 2120,\n/**/\n 2119,\n/**/\n 2118,\n/**/\n 2117,\n/**/\n 2116,\n/**/\n 2115,\n/**/\n 2114,\n/**/\n 2113,\n/**/\n 2112,\n/**/\n 2111,\n/**/\n 2110,\n/**/\n 2109,\n/**/\n 2108,\n/**/\n 2107,\n/**/\n 2106,\n/**/\n 2105,\n/**/\n 2104,\n/**/\n 2103,\n/**/\n 2102,\n/**/\n 2101,\n/**/\n 2100,\n/**/\n 2099,\n/**/\n 2098,\n/**/\n 2097,\n/**/\n 2096,\n/**/\n 2095,\n/**/\n 2094,\n/**/\n 2093,\n/**/\n 2092,\n/**/\n 2091,\n/**/\n 2090,\n/**/\n 2089,\n/**/\n 2088,\n/**/\n 2087,\n/**/\n 2086,\n/**/\n 2085,\n/**/\n 2084,\n/**/\n 2083,\n/**/\n 2082,\n/**/\n 2081,\n/**/\n 2080,\n/**/\n 2079,\n/**/\n 2078,\n/**/\n 2077,\n/**/\n 2076,\n/**/\n 2075,\n/**/\n 2074,\n/**/\n 2073,\n/**/\n 2072,\n/**/\n 2071,\n/**/\n 2070,\n/**/\n 2069,\n/**/\n 2068,\n/**/\n 2067,\n/**/\n 2066,\n/**/\n 2065,\n/**/\n 2064,\n/**/\n 2063,\n/**/\n 2062,\n/**/\n 2061,\n/**/\n 2060,\n/**/\n 2059,\n/**/\n 2058,\n/**/\n 2057,\n/**/\n 2056,\n/**/\n 2055,\n/**/\n 2054,\n/**/\n 2053,\n/**/\n 2052,\n/**/\n 2051,\n/**/\n 2050,\n/**/\n 2049,\n/**/\n 2048,\n/**/\n 2047,\n/**/\n 2046,\n/**/\n 2045,\n/**/\n 2044,\n/**/\n 2043,\n/**/\n 2042,\n/**/\n 2041,\n/**/\n 2040,\n/**/\n 2039,\n/**/\n 2038,\n/**/\n 2037,\n/**/\n 2036,\n/**/\n 2035,\n/**/\n 2034,\n/**/\n 2033,\n/**/\n 2032,\n/**/\n 2031,\n/**/\n 2030,\n/**/\n 2029,\n/**/\n 2028,\n/**/\n 2027,\n/**/\n 2026,\n/**/\n 2025,\n/**/\n 2024,\n/**/\n 2023,\n/**/\n 2022,\n/**/\n 2021,\n/**/\n 2020,\n/**/\n 2019,\n/**/\n 2018,\n/**/\n 2017,\n/**/\n 2016,\n/**/\n 2015,\n/**/\n 2014,\n/**/\n 2013,\n/**/\n 2012,\n/**/\n 2011,\n/**/\n 2010,\n/**/\n 2009,\n/**/\n 2008,\n/**/\n 2007,\n/**/\n 2006,\n/**/\n 2005,\n/**/\n 2004,\n/**/\n 2003,\n/**/\n 2002,\n/**/\n 2001,\n/**/\n 2000,\n/**/\n 1999,\n/**/\n 1998,\n/**/\n 1997,\n/**/\n 1996,\n/**/\n 1995,\n/**/\n 1994,\n/**/\n 1993,\n/**/\n 1992,\n/**/\n 1991,\n/**/\n 1990,\n/**/\n 1989,\n/**/\n 1988,\n/**/\n 1987,\n/**/\n 1986,\n/**/\n 1985,\n/**/\n 1984,\n/**/\n 1983,\n/**/\n 1982,\n/**/\n 1981,\n/**/\n 1980,\n/**/\n 1979,\n/**/\n 1978,\n/**/\n 1977,\n/**/\n 1976,\n/**/\n 1975,\n/**/\n 1974,\n/**/\n 1973,\n/**/\n 1972,\n/**/\n 1971,\n/**/\n 1970,\n/**/\n 1969,\n/**/\n 1968,\n/**/\n 1967,\n/**/\n 1966,\n/**/\n 1965,\n/**/\n 1964,\n/**/\n 1963,\n/**/\n 1962,\n/**/\n 1961,\n/**/\n 1960,\n/**/\n 1959,\n/**/\n 1958,\n/**/\n 1957,\n/**/\n 1956,\n/**/\n 1955,\n/**/\n 1954,\n/**/\n 1953,\n/**/\n 1952,\n/**/\n 1951,\n/**/\n 1950,\n/**/\n 1949,\n/**/\n 1948,\n/**/\n 1947,\n/**/\n 1946,\n/**/\n 1945,\n/**/\n 1944,\n/**/\n 1943,\n/**/\n 1942,\n/**/\n 1941,\n/**/\n 1940,\n/**/\n 1939,\n/**/\n 1938,\n/**/\n 1937,\n/**/\n 1936,\n/**/\n 1935,\n/**/\n 1934,\n/**/\n 1933,\n/**/\n 1932,\n/**/\n 1931,\n/**/\n 1930,\n/**/\n 1929,\n/**/\n 1928,\n/**/\n 1927,\n/**/\n 1926,\n/**/\n 1925,\n/**/\n 1924,\n/**/\n 1923,\n/**/\n 1922,\n/**/\n 1921,\n/**/\n 1920,\n/**/\n 1919,\n/**/\n 1918,\n/**/\n 1917,\n/**/\n 1916,\n/**/\n 1915,\n/**/\n 1914,\n/**/\n 1913,\n/**/\n 1912,\n/**/\n 1911,\n/**/\n 1910,\n/**/\n 1909,\n/**/\n 1908,\n/**/\n 1907,\n/**/\n 1906,\n/**/\n 1905,\n/**/\n 1904,\n/**/\n 1903,\n/**/\n 1902,\n/**/\n 1901,\n/**/\n 1900,\n/**/\n 1899,\n/**/\n 1898,\n/**/\n 1897,\n/**/\n 1896,\n/**/\n 1895,\n/**/\n 1894,\n/**/\n 1893,\n/**/\n 1892,\n/**/\n 1891,\n/**/\n 1890,\n/**/\n 1889,\n/**/\n 1888,\n/**/\n 1887,\n/**/\n 1886,\n/**/\n 1885,\n/**/\n 1884,\n/**/\n 1883,\n/**/\n 1882,\n/**/\n 1881,\n/**/\n 1880,\n/**/\n 1879,\n/**/\n 1878,\n/**/\n 1877,\n/**/\n 1876,\n/**/\n 1875,\n/**/\n 1874,\n/**/\n 1873,\n/**/\n 1872,\n/**/\n 1871,\n/**/\n 1870,\n/**/\n 1869,\n/**/\n 1868,\n/**/\n 1867,\n/**/\n 1866,\n/**/\n 1865,\n/**/\n 1864,\n/**/\n 1863,\n/**/\n 1862,\n/**/\n 1861,\n/**/\n 1860,\n/**/\n 1859,\n/**/\n 1858,\n/**/\n 1857,\n/**/\n 1856,\n/**/\n 1855,\n/**/\n 1854,\n/**/\n 1853,\n/**/\n 1852,\n/**/\n 1851,\n/**/\n 1850,\n/**/\n 1849,\n/**/\n 1848,\n/**/\n 1847,\n/**/\n 1846,\n/**/\n 1845,\n/**/\n 1844,\n/**/\n 1843,\n/**/\n 1842,\n/**/\n 1841,\n/**/\n 1840,\n/**/\n 1839,\n/**/\n 1838,\n/**/\n 1837,\n/**/\n 1836,\n/**/\n 1835,\n/**/\n 1834,\n/**/\n 1833,\n/**/\n 1832,\n/**/\n 1831,\n/**/\n 1830,\n/**/\n 1829,\n/**/\n 1828,\n/**/\n 1827,\n/**/\n 1826,\n/**/\n 1825,\n/**/\n 1824,\n/**/\n 1823,\n/**/\n 1822,\n/**/\n 1821,\n/**/\n 1820,\n/**/\n 1819,\n/**/\n 1818,\n/**/\n 1817,\n/**/\n 1816,\n/**/\n 1815,\n/**/\n 1814,\n/**/\n 1813,\n/**/\n 1812,\n/**/\n 1811,\n/**/\n 1810,\n/**/\n 1809,\n/**/\n 1808,\n/**/\n 1807,\n/**/\n 1806,\n/**/\n 1805,\n/**/\n 1804,\n/**/\n 1803,\n/**/\n 1802,\n/**/\n 1801,\n/**/\n 1800,\n/**/\n 1799,\n/**/\n 1798,\n/**/\n 1797,\n/**/\n 1796,\n/**/\n 1795,\n/**/\n 1794,\n/**/\n 1793,\n/**/\n 1792,\n/**/\n 1791,\n/**/\n 1790,\n/**/\n 1789,\n/**/\n 1788,\n/**/\n 1787,\n/**/\n 1786,\n/**/\n 1785,\n/**/\n 1784,\n/**/\n 1783,\n/**/\n 1782,\n/**/\n 1781,\n/**/\n 1780,\n/**/\n 1779,\n/**/\n 1778,\n/**/\n 1777,\n/**/\n 1776,\n/**/\n 1775,\n/**/\n 1774,\n/**/\n 1773,\n/**/\n 1772,\n/**/\n 1771,\n/**/\n 1770,\n/**/\n 1769,\n/**/\n 1768,\n/**/\n 1767,\n/**/\n 1766,\n/**/\n 1765,\n/**/\n 1764,\n/**/\n 1763,\n/**/\n 1762,\n/**/\n 1761,\n/**/\n 1760,\n/**/\n 1759,\n/**/\n 1758,\n/**/\n 1757,\n/**/\n 1756,\n/**/\n 1755,\n/**/\n 1754,\n/**/\n 1753,\n/**/\n 1752,\n/**/\n 1751,\n/**/\n 1750,\n/**/\n 1749,\n/**/\n 1748,\n/**/\n 1747,\n/**/\n 1746,\n/**/\n 1745,\n/**/\n 1744,\n/**/\n 1743,\n/**/\n 1742,\n/**/\n 1741,\n/**/\n 1740,\n/**/\n 1739,\n/**/\n 1738,\n/**/\n 1737,\n/**/\n 1736,\n/**/\n 1735,\n/**/\n 1734,\n/**/\n 1733,\n/**/\n 1732,\n/**/\n 1731,\n/**/\n 1730,\n/**/\n 1729,\n/**/\n 1728,\n/**/\n 1727,\n/**/\n 1726,\n/**/\n 1725,\n/**/\n 1724,\n/**/\n 1723,\n/**/\n 1722,\n/**/\n 1721,\n/**/\n 1720,\n/**/\n 1719,\n/**/\n 1718,\n/**/\n 1717,\n/**/\n 1716,\n/**/\n 1715,\n/**/\n 1714,\n/**/\n 1713,\n/**/\n 1712,\n/**/\n 1711,\n/**/\n 1710,\n/**/\n 1709,\n/**/\n 1708,\n/**/\n 1707,\n/**/\n 1706,\n/**/\n 1705,\n/**/\n 1704,\n/**/\n 1703,\n/**/\n 1702,\n/**/\n 1701,\n/**/\n 1700,\n/**/\n 1699,\n/**/\n 1698,\n/**/\n 1697,\n/**/\n 1696,\n/**/\n 1695,\n/**/\n 1694,\n/**/\n 1693,\n/**/\n 1692,\n/**/\n 1691,\n/**/\n 1690,\n/**/\n 1689,\n/**/\n 1688,\n/**/\n 1687,\n/**/\n 1686,\n/**/\n 1685,\n/**/\n 1684,\n/**/\n 1683,\n/**/\n 1682,\n/**/\n 1681,\n/**/\n 1680,\n/**/\n 1679,\n/**/\n 1678,\n/**/\n 1677,\n/**/\n 1676,\n/**/\n 1675,\n/**/\n 1674,\n/**/\n 1673,\n/**/\n 1672,\n/**/\n 1671,\n/**/\n 1670,\n/**/\n 1669,\n/**/\n 1668,\n/**/\n 1667,\n/**/\n 1666,\n/**/\n 1665,\n/**/\n 1664,\n/**/\n 1663,\n/**/\n 1662,\n/**/\n 1661,\n/**/\n 1660,\n/**/\n 1659,\n/**/\n 1658,\n/**/\n 1657,\n/**/\n 1656,\n/**/\n 1655,\n/**/\n 1654,\n/**/\n 1653,\n/**/\n 1652,\n/**/\n 1651,\n/**/\n 1650,\n/**/\n 1649,\n/**/\n 1648,\n/**/\n 1647,\n/**/\n 1646,\n/**/\n 1645,\n/**/\n 1644,\n/**/\n 1643,\n/**/\n 1642,\n/**/\n 1641,\n/**/\n 1640,\n/**/\n 1639,\n/**/\n 1638,\n/**/\n 1637,\n/**/\n 1636,\n/**/\n 1635,\n/**/\n 1634,\n/**/\n 1633,\n/**/\n 1632,\n/**/\n 1631,\n/**/\n 1630,\n/**/\n 1629,\n/**/\n 1628,\n/**/\n 1627,\n/**/\n 1626,\n/**/\n 1625,\n/**/\n 1624,\n/**/\n 1623,\n/**/\n 1622,\n/**/\n 1621,\n/**/\n 1620,\n/**/\n 1619,\n/**/\n 1618,\n/**/\n 1617,\n/**/\n 1616,\n/**/\n 1615,\n/**/\n 1614,\n/**/\n 1613,\n/**/\n 1612,\n/**/\n 1611,\n/**/\n 1610,\n/**/\n 1609,\n/**/\n 1608,\n/**/\n 1607,\n/**/\n 1606,\n/**/\n 1605,\n/**/\n 1604,\n/**/\n 1603,\n/**/\n 1602,\n/**/\n 1601,\n/**/\n 1600,\n/**/\n 1599,\n/**/\n 1598,\n/**/\n 1597,\n/**/\n 1596,\n/**/\n 1595,\n/**/\n 1594,\n/**/\n 1593,\n/**/\n 1592,\n/**/\n 1591,\n/**/\n 1590,\n/**/\n 1589,\n/**/\n 1588,\n/**/\n 1587,\n/**/\n 1586,\n/**/\n 1585,\n/**/\n 1584,\n/**/\n 1583,\n/**/\n 1582,\n/**/\n 1581,\n/**/\n 1580,\n/**/\n 1579,\n/**/\n 1578,\n/**/\n 1577,\n/**/\n 1576,\n/**/\n 1575,\n/**/\n 1574,\n/**/\n 1573,\n/**/\n 1572,\n/**/\n 1571,\n/**/\n 1570,\n/**/\n 1569,\n/**/\n 1568,\n/**/\n 1567,\n/**/\n 1566,\n/**/\n 1565,\n/**/\n 1564,\n/**/\n 1563,\n/**/\n 1562,\n/**/\n 1561,\n/**/\n 1560,\n/**/\n 1559,\n/**/\n 1558,\n/**/\n 1557,\n/**/\n 1556,\n/**/\n 1555,\n/**/\n 1554,\n/**/\n 1553,\n/**/\n 1552,\n/**/\n 1551,\n/**/\n 1550,\n/**/\n 1549,\n/**/\n 1548,\n/**/\n 1547,\n/**/\n 1546,\n/**/\n 1545,\n/**/\n 1544,\n/**/\n 1543,\n/**/\n 1542,\n/**/\n 1541,\n/**/\n 1540,\n/**/\n 1539,\n/**/\n 1538,\n/**/\n 1537,\n/**/\n 1536,\n/**/\n 1535,\n/**/\n 1534,\n/**/\n 1533,\n/**/\n 1532,\n/**/\n 1531,\n/**/\n 1530,\n/**/\n 1529,\n/**/\n 1528,\n/**/\n 1527,\n/**/\n 1526,\n/**/\n 1525,\n/**/\n 1524,\n/**/\n 1523,\n/**/\n 1522,\n/**/\n 1521,\n/**/\n 1520,\n/**/\n 1519,\n/**/\n 1518,\n/**/\n 1517,\n/**/\n 1516,\n/**/\n 1515,\n/**/\n 1514,\n/**/\n 1513,\n/**/\n 1512,\n/**/\n 1511,\n/**/\n 1510,\n/**/\n 1509,\n/**/\n 1508,\n/**/\n 1507,\n/**/\n 1506,\n/**/\n 1505,\n/**/\n 1504,\n/**/\n 1503,\n/**/\n 1502,\n/**/\n 1501,\n/**/\n 1500,\n/**/\n 1499,\n/**/\n 1498,\n/**/\n 1497,\n/**/\n 1496,\n/**/\n 1495,\n/**/\n 1494,\n/**/\n 1493,\n/**/\n 1492,\n/**/\n 1491,\n/**/\n 1490,\n/**/\n 1489,\n/**/\n 1488,\n/**/\n 1487,\n/**/\n 1486,\n/**/\n 1485,\n/**/\n 1484,\n/**/\n 1483,\n/**/\n 1482,\n/**/\n 1481,\n/**/\n 1480,\n/**/\n 1479,\n/**/\n 1478,\n/**/\n 1477,\n/**/\n 1476,\n/**/\n 1475,\n/**/\n 1474,\n/**/\n 1473,\n/**/\n 1472,\n/**/\n 1471,\n/**/\n 1470,\n/**/\n 1469,\n/**/\n 1468,\n/**/\n 1467,\n/**/\n 1466,\n/**/\n 1465,\n/**/\n 1464,\n/**/\n 1463,\n/**/\n 1462,\n/**/\n 1461,\n/**/\n 1460,\n/**/\n 1459,\n/**/\n 1458,\n/**/\n 1457,\n/**/\n 1456,\n/**/\n 1455,\n/**/\n 1454,\n/**/\n 1453,\n/**/\n 1452,\n/**/\n 1451,\n/**/\n 1450,\n/**/\n 1449,\n/**/\n 1448,\n/**/\n 1447,\n/**/\n 1446,\n/**/\n 1445,\n/**/\n 1444,\n/**/\n 1443,\n/**/\n 1442,\n/**/\n 1441,\n/**/\n 1440,\n/**/\n 1439,\n/**/\n 1438,\n/**/\n 1437,\n/**/\n 1436,\n/**/\n 1435,\n/**/\n 1434,\n/**/\n 1433,\n/**/\n 1432,\n/**/\n 1431,\n/**/\n 1430,\n/**/\n 1429,\n/**/\n 1428,\n/**/\n 1427,\n/**/\n 1426,\n/**/\n 1425,\n/**/\n 1424,\n/**/\n 1423,\n/**/\n 1422,\n/**/\n 1421,\n/**/\n 1420,\n/**/\n 1419,\n/**/\n 1418,\n/**/\n 1417,\n/**/\n 1416,\n/**/\n 1415,\n/**/\n 1414,\n/**/\n 1413,\n/**/\n 1412,\n/**/\n 1411,\n/**/\n 1410,\n/**/\n 1409,\n/**/\n 1408,\n/**/\n 1407,\n/**/\n 1406,\n/**/\n 1405,\n/**/\n 1404,\n/**/\n 1403,\n/**/\n 1402,\n/**/\n 1401,\n/**/\n 1400,\n/**/\n 1399,\n/**/\n 1398,\n/**/\n 1397,\n/**/\n 1396,\n/**/\n 1395,\n/**/\n 1394,\n/**/\n 1393,\n/**/\n 1392,\n/**/\n 1391,\n/**/\n 1390,\n/**/\n 1389,\n/**/\n 1388,\n/**/\n 1387,\n/**/\n 1386,\n/**/\n 1385,\n/**/\n 1384,\n/**/\n 1383,\n/**/\n 1382,\n/**/\n 1381,\n/**/\n 1380,\n/**/\n 1379,\n/**/\n 1378,\n/**/\n 1377,\n/**/\n 1376,\n/**/\n 1375,\n/**/\n 1374,\n/**/\n 1373,\n/**/\n 1372,\n/**/\n 1371,\n/**/\n 1370,\n/**/\n 1369,\n/**/\n 1368,\n/**/\n 1367,\n/**/\n 1366,\n/**/\n 1365,\n/**/\n 1364,\n/**/\n 1363,\n/**/\n 1362,\n/**/\n 1361,\n/**/\n 1360,\n/**/\n 1359,\n/**/\n 1358,\n/**/\n 1357,\n/**/\n 1356,\n/**/\n 1355,\n/**/\n 1354,\n/**/\n 1353,\n/**/\n 1352,\n/**/\n 1351,\n/**/\n 1350,\n/**/\n 1349,\n/**/\n 1348,\n/**/\n 1347,\n/**/\n 1346,\n/**/\n 1345,\n/**/\n 1344,\n/**/\n 1343,\n/**/\n 1342,\n/**/\n 1341,\n/**/\n 1340,\n/**/\n 1339,\n/**/\n 1338,\n/**/\n 1337,\n/**/\n 1336,\n/**/\n 1335,\n/**/\n 1334,\n/**/\n 1333,\n/**/\n 1332,\n/**/\n 1331,\n/**/\n 1330,\n/**/\n 1329,\n/**/\n 1328,\n/**/\n 1327,\n/**/\n 1326,\n/**/\n 1325,\n/**/\n 1324,\n/**/\n 1323,\n/**/\n 1322,\n/**/\n 1321,\n/**/\n 1320,\n/**/\n 1319,\n/**/\n 1318,\n/**/\n 1317,\n/**/\n 1316,\n/**/\n 1315,\n/**/\n 1314,\n/**/\n 1313,\n/**/\n 1312,\n/**/\n 1311,\n/**/\n 1310,\n/**/\n 1309,\n/**/\n 1308,\n/**/\n 1307,\n/**/\n 1306,\n/**/\n 1305,\n/**/\n 1304,\n/**/\n 1303,\n/**/\n 1302,\n/**/\n 1301,\n/**/\n 1300,\n/**/\n 1299,\n/**/\n 1298,\n/**/\n 1297,\n/**/\n 1296,\n/**/\n 1295,\n/**/\n 1294,\n/**/\n 1293,\n/**/\n 1292,\n/**/\n 1291,\n/**/\n 1290,\n/**/\n 1289,\n/**/\n 1288,\n/**/\n 1287,\n/**/\n 1286,\n/**/\n 1285,\n/**/\n 1284,\n/**/\n 1283,\n/**/\n 1282,\n/**/\n 1281,\n/**/\n 1280,\n/**/\n 1279,\n/**/\n 1278,\n/**/\n 1277,\n/**/\n 1276,\n/**/\n 1275,\n/**/\n 1274,\n/**/\n 1273,\n/**/\n 1272,\n/**/\n 1271,\n/**/\n 1270,\n/**/\n 1269,\n/**/\n 1268,\n/**/\n 1267,\n/**/\n 1266,\n/**/\n 1265,\n/**/\n 1264,\n/**/\n 1263,\n/**/\n 1262,\n/**/\n 1261,\n/**/\n 1260,\n/**/\n 1259,\n/**/\n 1258,\n/**/\n 1257,\n/**/\n 1256,\n/**/\n 1255,\n/**/\n 1254,\n/**/\n 1253,\n/**/\n 1252,\n/**/\n 1251,\n/**/\n 1250,\n/**/\n 1249,\n/**/\n 1248,\n/**/\n 1247,\n/**/\n 1246,\n/**/\n 1245,\n/**/\n 1244,\n/**/\n 1243,\n/**/\n 1242,\n/**/\n 1241,\n/**/\n 1240,\n/**/\n 1239,\n/**/\n 1238,\n/**/\n 1237,\n/**/\n 1236,\n/**/\n 1235,\n/**/\n 1234,\n/**/\n 1233,\n/**/\n 1232,\n/**/\n 1231,\n/**/\n 1230,\n/**/\n 1229,\n/**/\n 1228,\n/**/\n 1227,\n/**/\n 1226,\n/**/\n 1225,\n/**/\n 1224,\n/**/\n 1223,\n/**/\n 1222,\n/**/\n 1221,\n/**/\n 1220,\n/**/\n 1219,\n/**/\n 1218,\n/**/\n 1217,\n/**/\n 1216,\n/**/\n 1215,\n/**/\n 1214,\n/**/\n 1213,\n/**/\n 1212,\n/**/\n 1211,\n/**/\n 1210,\n/**/\n 1209,\n/**/\n 1208,\n/**/\n 1207,\n/**/\n 1206,\n/**/\n 1205,\n/**/\n 1204,\n/**/\n 1203,\n/**/\n 1202,\n/**/\n 1201,\n/**/\n 1200,\n/**/\n 1199,\n/**/\n 1198,\n/**/\n 1197,\n/**/\n 1196,\n/**/\n 1195,\n/**/\n 1194,\n/**/\n 1193,\n/**/\n 1192,\n/**/\n 1191,\n/**/\n 1190,\n/**/\n 1189,\n/**/\n 1188,\n/**/\n 1187,\n/**/\n 1186,\n/**/\n 1185,\n/**/\n 1184,\n/**/\n 1183,\n/**/\n 1182,\n/**/\n 1181,\n/**/\n 1180,\n/**/\n 1179,\n/**/\n 1178,\n/**/\n 1177,\n/**/\n 1176,\n/**/\n 1175,\n/**/\n 1174,\n/**/\n 1173,\n/**/\n 1172,\n/**/\n 1171,\n/**/\n 1170,\n/**/\n 1169,\n/**/\n 1168,\n/**/\n 1167,\n/**/\n 1166,\n/**/\n 1165,\n/**/\n 1164,\n/**/\n 1163,\n/**/\n 1162,\n/**/\n 1161,\n/**/\n 1160,\n/**/\n 1159,\n/**/\n 1158,\n/**/\n 1157,\n/**/\n 1156,\n/**/\n 1155,\n/**/\n 1154,\n/**/\n 1153,\n/**/\n 1152,\n/**/\n 1151,\n/**/\n 1150,\n/**/\n 1149,\n/**/\n 1148,\n/**/\n 1147,\n/**/\n 1146,\n/**/\n 1145,\n/**/\n 1144,\n/**/\n 1143,\n/**/\n 1142,\n/**/\n 1141,\n/**/\n 1140,\n/**/\n 1139,\n/**/\n 1138,\n/**/\n 1137,\n/**/\n 1136,\n/**/\n 1135,\n/**/\n 1134,\n/**/\n 1133,\n/**/\n 1132,\n/**/\n 1131,\n/**/\n 1130,\n/**/\n 1129,\n/**/\n 1128,\n/**/\n 1127,\n/**/\n 1126,\n/**/\n 1125,\n/**/\n 1124,\n/**/\n 1123,\n/**/\n 1122,\n/**/\n 1121,\n/**/\n 1120,\n/**/\n 1119,\n/**/\n 1118,\n/**/\n 1117,\n/**/\n 1116,\n/**/\n 1115,\n/**/\n 1114,\n/**/\n 1113,\n/**/\n 1112,\n/**/\n 1111,\n/**/\n 1110,\n/**/\n 1109,\n/**/\n 1108,\n/**/\n 1107,\n/**/\n 1106,\n/**/\n 1105,\n/**/\n 1104,\n/**/\n 1103,\n/**/\n 1102,\n/**/\n 1101,\n/**/\n 1100,\n/**/\n 1099,\n/**/\n 1098,\n/**/\n 1097,\n/**/\n 1096,\n/**/\n 1095,\n/**/\n 1094,\n/**/\n 1093,\n/**/\n 1092,\n/**/\n 1091,\n/**/\n 1090,\n/**/\n 1089,\n/**/\n 1088,\n/**/\n 1087,\n/**/\n 1086,\n/**/\n 1085,\n/**/\n 1084,\n/**/\n 1083,\n/**/\n 1082,\n/**/\n 1081,\n/**/\n 1080,\n/**/\n 1079,\n/**/\n 1078,\n/**/\n 1077,\n/**/\n 1076,\n/**/\n 1075,\n/**/\n 1074,\n/**/\n 1073,\n/**/\n 1072,\n/**/\n 1071,\n/**/\n 1070,\n/**/\n 1069,\n/**/\n 1068,\n/**/\n 1067,\n/**/\n 1066,\n/**/\n 1065,\n/**/\n 1064,\n/**/\n 1063,\n/**/\n 1062,\n/**/\n 1061,\n/**/\n 1060,\n/**/\n 1059,\n/**/\n 1058,\n/**/\n 1057,\n/**/\n 1056,\n/**/\n 1055,\n/**/\n 1054,\n/**/\n 1053,\n/**/\n 1052,\n/**/\n 1051,\n/**/\n 1050,\n/**/\n 1049,\n/**/\n 1048,\n/**/\n 1047,\n/**/\n 1046,\n/**/\n 1045,\n/**/\n 1044,\n/**/\n 1043,\n/**/\n 1042,\n/**/\n 1041,\n/**/\n 1040,\n/**/\n 1039,\n/**/\n 1038,\n/**/\n 1037,\n/**/\n 1036,\n/**/\n 1035,\n/**/\n 1034,\n/**/\n 1033,\n/**/\n 1032,\n/**/\n 1031,\n/**/\n 1030,\n/**/\n 1029,\n/**/\n 1028,\n/**/\n 1027,\n/**/\n 1026,\n/**/\n 1025,\n/**/\n 1024,\n/**/\n 1023,\n/**/\n 1022,\n/**/\n 1021,\n/**/\n 1020,\n/**/\n 1019,\n/**/\n 1018,\n/**/\n 1017,\n/**/\n 1016,\n/**/\n 1015,\n/**/\n 1014,\n/**/\n 1013,\n/**/\n 1012,\n/**/\n 1011,\n/**/\n 1010,\n/**/\n 1009,\n/**/\n 1008,\n/**/\n 1007,\n/**/\n 1006,\n/**/\n 1005,\n/**/\n 1004,\n/**/\n 1003,\n/**/\n 1002,\n/**/\n 1001,\n/**/\n 1000,\n/**/\n 999,\n/**/\n 998,\n/**/\n 997,\n/**/\n 996,\n/**/\n 995,\n/**/\n 994,\n/**/\n 993,\n/**/\n 992,\n/**/\n 991,\n/**/\n 990,\n/**/\n 989,\n/**/\n 988,\n/**/\n 987,\n/**/\n 986,\n/**/\n 985,\n/**/\n 984,\n/**/\n 983,\n/**/\n 982,\n/**/\n 981,\n/**/\n 980,\n/**/\n 979,\n/**/\n 978,\n/**/\n 977,\n/**/\n 976,\n/**/\n 975,\n/**/\n 974,\n/**/\n 973,\n/**/\n 972,\n/**/\n 971,\n/**/\n 970,\n/**/\n 969,\n/**/\n 968,\n/**/\n 967,\n/**/\n 966,\n/**/\n 965,\n/**/\n 964,\n/**/\n 963,\n/**/\n 962,\n/**/\n 961,\n/**/\n 960,\n/**/\n 959,\n/**/\n 958,\n/**/\n 957,\n/**/\n 956,\n/**/\n 955,\n/**/\n 954,\n/**/\n 953,\n/**/\n 952,\n/**/\n 951,\n/**/\n 950,\n/**/\n 949,\n/**/\n 948,\n/**/\n 947,\n/**/\n 946,\n/**/\n 945,\n/**/\n 944,\n/**/\n 943,\n/**/\n 942,\n/**/\n 941,\n/**/\n 940,\n/**/\n 939,\n/**/\n 938,\n/**/\n 937,\n/**/\n 936,\n/**/\n 935,\n/**/\n 934,\n/**/\n 933,\n/**/\n 932,\n/**/\n 931,\n/**/\n 930,\n/**/\n 929,\n/**/\n 928,\n/**/\n 927,\n/**/\n 926,\n/**/\n 925,\n/**/\n 924,\n/**/\n 923,\n/**/\n 922,\n/**/\n 921,\n/**/\n 920,\n/**/\n 919,\n/**/\n 918,\n/**/\n 917,\n/**/\n 916,\n/**/\n 915,\n/**/\n 914,\n/**/\n 913,\n/**/\n 912,\n/**/\n 911,\n/**/\n 910,\n/**/\n 909,\n/**/\n 908,\n/**/\n 907,\n/**/\n 906,\n/**/\n 905,\n/**/\n 904,\n/**/\n 903,\n/**/\n 902,\n/**/\n 901,\n/**/\n 900,\n/**/\n 899,\n/**/\n 898,\n/**/\n 897,\n/**/\n 896,\n/**/\n 895,\n/**/\n 894,\n/**/\n 893,\n/**/\n 892,\n/**/\n 891,\n/**/\n 890,\n/**/\n 889,\n/**/\n 888,\n/**/\n 887,\n/**/\n 886,\n/**/\n 885,\n/**/\n 884,\n/**/\n 883,\n/**/\n 882,\n/**/\n 881,\n/**/\n 880,\n/**/\n 879,\n/**/\n 878,\n/**/\n 877,\n/**/\n 876,\n/**/\n 875,\n/**/\n 874,\n/**/\n 873,\n/**/\n 872,\n/**/\n 871,\n/**/\n 870,\n/**/\n 869,\n/**/\n 868,\n/**/\n 867,\n/**/\n 866,\n/**/\n 865,\n/**/\n 864,\n/**/\n 863,\n/**/\n 862,\n/**/\n 861,\n/**/\n 860,\n/**/\n 859,\n/**/\n 858,\n/**/\n 857,\n/**/\n 856,\n/**/\n 855,\n/**/\n 854,\n/**/\n 853,\n/**/\n 852,\n/**/\n 851,\n/**/\n 850,\n/**/\n 849,\n/**/\n 848,\n/**/\n 847,\n/**/\n 846,\n/**/\n 845,\n/**/\n 844,\n/**/\n 843,\n/**/\n 842,\n/**/\n 841,\n/**/\n 840,\n/**/\n 839,\n/**/\n 838,\n/**/\n 837,\n/**/\n 836,\n/**/\n 835,\n/**/\n 834,\n/**/\n 833,\n/**/\n 832,\n/**/\n 831,\n/**/\n 830,\n/**/\n 829,\n/**/\n 828,\n/**/\n 827,\n/**/\n 826,\n/**/\n 825,\n/**/\n 824,\n/**/\n 823,\n/**/\n 822,\n/**/\n 821,\n/**/\n 820,\n/**/\n 819,\n/**/\n 818,\n/**/\n 817,\n/**/\n 816,\n/**/\n 815,\n/**/\n 814,\n/**/\n 813,\n/**/\n 812,\n/**/\n 811,\n/**/\n 810,\n/**/\n 809,\n/**/\n 808,\n/**/\n 807,\n/**/\n 806,\n/**/\n 805,\n/**/\n 804,\n/**/\n 803,\n/**/\n 802,\n/**/\n 801,\n/**/\n 800,\n/**/\n 799,\n/**/\n 798,\n/**/\n 797,\n/**/\n 796,\n/**/\n 795,\n/**/\n 794,\n/**/\n 793,\n/**/\n 792,\n/**/\n 791,\n/**/\n 790,\n/**/\n 789,\n/**/\n 788,\n/**/\n 787,\n/**/\n 786,\n/**/\n 785,\n/**/\n 784,\n/**/\n 783,\n/**/\n 782,\n/**/\n 781,\n/**/\n 780,\n/**/\n 779,\n/**/\n 778,\n/**/\n 777,\n/**/\n 776,\n/**/\n 775,\n/**/\n 774,\n/**/\n 773,\n/**/\n 772,\n/**/\n 771,\n/**/\n 770,\n/**/\n 769,\n/**/\n 768,\n/**/\n 767,\n/**/\n 766,\n/**/\n 765,\n/**/\n 764,\n/**/\n 763,\n/**/\n 762,\n/**/\n 761,\n/**/\n 760,\n/**/\n 759,\n/**/\n 758,\n/**/\n 757,\n/**/\n 756,\n/**/\n 755,\n/**/\n 754,\n/**/\n 753,\n/**/\n 752,\n/**/\n 751,\n/**/\n 750,\n/**/\n 749,\n/**/\n 748,\n/**/\n 747,\n/**/\n 746,\n/**/\n 745,\n/**/\n 744,\n/**/\n 743,\n/**/\n 742,\n/**/\n 741,\n/**/\n 740,\n/**/\n 739,\n/**/\n 738,\n/**/\n 737,\n/**/\n 736,\n/**/\n 735,\n/**/\n 734,\n/**/\n 733,\n/**/\n 732,\n/**/\n 731,\n/**/\n 730,\n/**/\n 729,\n/**/\n 728,\n/**/\n 727,\n/**/\n 726,\n/**/\n 725,\n/**/\n 724,\n/**/\n 723,\n/**/\n 722,\n/**/\n 721,\n/**/\n 720,\n/**/\n 719,\n/**/\n 718,\n/**/\n 717,\n/**/\n 716,\n/**/\n 715,\n/**/\n 714,\n/**/\n 713,\n/**/\n 712,\n/**/\n 711,\n/**/\n 710,\n/**/\n 709,\n/**/\n 708,\n/**/\n 707,\n/**/\n 706,\n/**/\n 705,\n/**/\n 704,\n/**/\n 703,\n/**/\n 702,\n/**/\n 701,\n/**/\n 700,\n/**/\n 699,\n/**/\n 698,\n/**/\n 697,\n/**/\n 696,\n/**/\n 695,\n/**/\n 694,\n/**/\n 693,\n/**/\n 692,\n/**/\n 691,\n/**/\n 690,\n/**/\n 689,\n/**/\n 688,\n/**/\n 687,\n/**/\n 686,\n/**/\n 685,\n/**/\n 684,\n/**/\n 683,\n/**/\n 682,\n/**/\n 681,\n/**/\n 680,\n/**/\n 679,\n/**/\n 678,\n/**/\n 677,\n/**/\n 676,\n/**/\n 675,\n/**/\n 674,\n/**/\n 673,\n/**/\n 672,\n/**/\n 671,\n/**/\n 670,\n/**/\n 669,\n/**/\n 668,\n/**/\n 667,\n/**/\n 666,\n/**/\n 665,\n/**/\n 664,\n/**/\n 663,\n/**/\n 662,\n/**/\n 661,\n/**/\n 660,\n/**/\n 659,\n/**/\n 658,\n/**/\n 657,\n/**/\n 656,\n/**/\n 655,\n/**/\n 654,\n/**/\n 653,\n/**/\n 652,\n/**/\n 651,\n/**/\n 650,\n/**/\n 649,\n/**/\n 648,\n/**/\n 647,\n/**/\n 646,\n/**/\n 645,\n/**/\n 644,\n/**/\n 643,\n/**/\n 642,\n/**/\n 641,\n/**/\n 640,\n/**/\n 639,\n/**/\n 638,\n/**/\n 637,\n/**/\n 636,\n/**/\n 635,\n/**/\n 634,\n/**/\n 633,\n/**/\n 632,\n/**/\n 631,\n/**/\n 630,\n/**/\n 629,\n/**/\n 628,\n/**/\n 627,\n/**/\n 626,\n/**/\n 625,\n/**/\n 624,\n/**/\n 623,\n/**/\n 622,\n/**/\n 621,\n/**/\n 620,\n/**/\n 619,\n/**/\n 618,\n/**/\n 617,\n/**/\n 616,\n/**/\n 615,\n/**/\n 614,\n/**/\n 613,\n/**/\n 612,\n/**/\n 611,\n/**/\n 610,\n/**/\n 609,\n/**/\n 608,\n/**/\n 607,\n/**/\n 606,\n/**/\n 605,\n/**/\n 604,\n/**/\n 603,\n/**/\n 602,\n/**/\n 601,\n/**/\n 600,\n/**/\n 599,\n/**/\n 598,\n/**/\n 597,\n/**/\n 596,\n/**/\n 595,\n/**/\n 594,\n/**/\n 593,\n/**/\n 592,\n/**/\n 591,\n/**/\n 590,\n/**/\n 589,\n/**/\n 588,\n/**/\n 587,\n/**/\n 586,\n/**/\n 585,\n/**/\n 584,\n/**/\n 583,\n/**/\n 582,\n/**/\n 581,\n/**/\n 580,\n/**/\n 579,\n/**/\n 578,\n/**/\n 577,\n/**/\n 576,\n/**/\n 575,\n/**/\n 574,\n/**/\n 573,\n/**/\n 572,\n/**/\n 571,\n/**/\n 570,\n/**/\n 569,\n/**/\n 568,\n/**/\n 567,\n/**/\n 566,\n/**/\n 565,\n/**/\n 564,\n/**/\n 563,\n/**/\n 562,\n/**/\n 561,\n/**/\n 560,\n/**/\n 559,\n/**/\n 558,\n/**/\n 557,\n/**/\n 556,\n/**/\n 555,\n/**/\n 554,\n/**/\n 553,\n/**/\n 552,\n/**/\n 551,\n/**/\n 550,\n/**/\n 549,\n/**/\n 548,\n/**/\n 547,\n/**/\n 546,\n/**/\n 545,\n/**/\n 544,\n/**/\n 543,\n/**/\n 542,\n/**/\n 541,\n/**/\n 540,\n/**/\n 539,\n/**/\n 538,\n/**/\n 537,\n/**/\n 536,\n/**/\n 535,\n/**/\n 534,\n/**/\n 533,\n/**/\n 532,\n/**/\n 531,\n/**/\n 530,\n/**/\n 529,\n/**/\n 528,\n/**/\n 527,\n/**/\n 526,\n/**/\n 525,\n/**/\n 524,\n/**/\n 523,\n/**/\n 522,\n/**/\n 521,\n/**/\n 520,\n/**/\n 519,\n/**/\n 518,\n/**/\n 517,\n/**/\n 516,\n/**/\n 515,\n/**/\n 514,\n/**/\n 513,\n/**/\n 512,\n/**/\n 511,\n/**/\n 510,\n/**/\n 509,\n/**/\n 508,\n/**/\n 507,\n/**/\n 506,\n/**/\n 505,\n/**/\n 504,\n/**/\n 503,\n/**/\n 502,\n/**/\n 501,\n/**/\n 500,\n/**/\n 499,\n/**/\n 498,\n/**/\n 497,\n/**/\n 496,\n/**/\n 495,\n/**/\n 494,\n/**/\n 493,\n/**/\n 492,\n/**/\n 491,\n/**/\n 490,\n/**/\n 489,\n/**/\n 488,\n/**/\n 487,\n/**/\n 486,\n/**/\n 485,\n/**/\n 484,\n/**/\n 483,\n/**/\n 482,\n/**/\n 481,\n/**/\n 480,\n/**/\n 479,\n/**/\n 478,\n/**/\n 477,\n/**/\n 476,\n/**/\n 475,\n/**/\n 474,\n/**/\n 473,\n/**/\n 472,\n/**/\n 471,\n/**/\n 470,\n/**/\n 469,\n/**/\n 468,\n/**/\n 467,\n/**/\n 466,\n/**/\n 465,\n/**/\n 464,\n/**/\n 463,\n/**/\n 462,\n/**/\n 461,\n/**/\n 460,\n/**/\n 459,\n/**/\n 458,\n/**/\n 457,\n/**/\n 456,\n/**/\n 455,\n/**/\n 454,\n/**/\n 453,\n/**/\n 452,\n/**/\n 451,\n/**/\n 450,\n/**/\n 449,\n/**/\n 448,\n/**/\n 447,\n/**/\n 446,\n/**/\n 445,\n/**/\n 444,\n/**/\n 443,\n/**/\n 442,\n/**/\n 441,\n/**/\n 440,\n/**/\n 439,\n/**/\n 438,\n/**/\n 437,\n/**/\n 436,\n/**/\n 435,\n/**/\n 434,\n/**/\n 433,\n/**/\n 432,\n/**/\n 431,\n/**/\n 430,\n/**/\n 429,\n/**/\n 428,\n/**/\n 427,\n/**/\n 426,\n/**/\n 425,\n/**/\n 424,\n/**/\n 423,\n/**/\n 422,\n/**/\n 421,\n/**/\n 420,\n/**/\n 419,\n/**/\n 418,\n/**/\n 417,\n/**/\n 416,\n/**/\n 415,\n/**/\n 414,\n/**/\n 413,\n/**/\n 412,\n/**/\n 411,\n/**/\n 410,\n/**/\n 409,\n/**/\n 408,\n/**/\n 407,\n/**/\n 406,\n/**/\n 405,\n/**/\n 404,\n/**/\n 403,\n/**/\n 402,\n/**/\n 401,\n/**/\n 400,\n/**/\n 399,\n/**/\n 398,\n/**/\n 397,\n/**/\n 396,\n/**/\n 395,\n/**/\n 394,\n/**/\n 393,\n/**/\n 392,\n/**/\n 391,\n/**/\n 390,\n/**/\n 389,\n/**/\n 388,\n/**/\n 387,\n/**/\n 386,\n/**/\n 385,\n/**/\n 384,\n/**/\n 383,\n/**/\n 382,\n/**/\n 381,\n/**/\n 380,\n/**/\n 379,\n/**/\n 378,\n/**/\n 377,\n/**/\n 376,\n/**/\n 375,\n/**/\n 374,\n/**/\n 373,\n/**/\n 372,\n/**/\n 371,\n/**/\n 370,\n/**/\n 369,\n/**/\n 368,\n/**/\n 367,\n/**/\n 366,\n/**/\n 365,\n/**/\n 364,\n/**/\n 363,\n/**/\n 362,\n/**/\n 361,\n/**/\n 360,\n/**/\n 359,\n/**/\n 358,\n/**/\n 357,\n/**/\n 356,\n/**/\n 355,\n/**/\n 354,\n/**/\n 353,\n/**/\n 352,\n/**/\n 351,\n/**/\n 350,\n/**/\n 349,\n/**/\n 348,\n/**/\n 347,\n/**/\n 346,\n/**/\n 345,\n/**/\n 344,\n/**/\n 343,\n/**/\n 342,\n/**/\n 341,\n/**/\n 340,\n/**/\n 339,\n/**/\n 338,\n/**/\n 337,\n/**/\n 336,\n/**/\n 335,\n/**/\n 334,\n/**/\n 333,\n/**/\n 332,\n/**/\n 331,\n/**/\n 330,\n/**/\n 329,\n/**/\n 328,\n/**/\n 327,\n/**/\n 326,\n/**/\n 325,\n/**/\n 324,\n/**/\n 323,\n/**/\n 322,\n/**/\n 321,\n/**/\n 320,\n/**/\n 319,\n/**/\n 318,\n/**/\n 317,\n/**/\n 316,\n/**/\n 315,\n/**/\n 314,\n/**/\n 313,\n/**/\n 312,\n/**/\n 311,\n/**/\n 310,\n/**/\n 309,\n/**/\n 308,\n/**/\n 307,\n/**/\n 306,\n/**/\n 305,\n/**/\n 304,\n/**/\n 303,\n/**/\n 302,\n/**/\n 301,\n/**/\n 300,\n/**/\n 299,\n/**/\n 298,\n/**/\n 297,\n/**/\n 296,\n/**/\n 295,\n/**/\n 294,\n/**/\n 293,\n/**/\n 292,\n/**/\n 291,\n/**/\n 290,\n/**/\n 289,\n/**/\n 288,\n/**/\n 287,\n/**/\n 286,\n/**/\n 285,\n/**/\n 284,\n/**/\n 283,\n/**/\n 282,\n/**/\n 281,\n/**/\n 280,\n/**/\n 279,\n/**/\n 278,\n/**/\n 277,\n/**/\n 276,\n/**/\n 275,\n/**/\n 274,\n/**/\n 273,\n/**/\n 272,\n/**/\n 271,\n/**/\n 270,\n/**/\n 269,\n/**/\n 268,\n/**/\n 267,\n/**/\n 266,\n/**/\n 265,\n/**/\n 264,\n/**/\n 263,\n/**/\n 262,\n/**/\n 261,\n/**/\n 260,\n/**/\n 259,\n/**/\n 258,\n/**/\n 257,\n/**/\n 256,\n/**/\n 255,\n/**/\n 254,\n/**/\n 253,\n/**/\n 252,\n/**/\n 251,\n/**/\n 250,\n/**/\n 249,\n/**/\n 248,\n/**/\n 247,\n/**/\n 246,\n/**/\n 245,\n/**/\n 244,\n/**/\n 243,\n/**/\n 242,\n/**/\n 241,\n/**/\n 240,\n/**/\n 239,\n/**/\n 238,\n/**/\n 237,\n/**/\n 236,\n/**/\n 235,\n/**/\n 234,\n/**/\n 233,\n/**/\n 232,\n/**/\n 231,\n/**/\n 230,\n/**/\n 229,\n/**/\n 228,\n/**/\n 227,\n/**/\n 226,\n/**/\n 225,\n/**/\n 224,\n/**/\n 223,\n/**/\n 222,\n/**/\n 221,\n/**/\n 220,\n/**/\n 219,\n/**/\n 218,\n/**/\n 217,\n/**/\n 216,\n/**/\n 215,\n/**/\n 214,\n/**/\n 213,\n/**/\n 212,\n/**/\n 211,\n/**/\n 210,\n/**/\n 209,\n/**/\n 208,\n/**/\n 207,\n/**/\n 206,\n/**/\n 205,\n/**/\n 204,\n/**/\n 203,\n/**/\n 202,\n/**/\n 201,\n/**/\n 200,\n/**/\n 199,\n/**/\n 198,\n/**/\n 197,\n/**/\n 196,\n/**/\n 195,\n/**/\n 194,\n/**/\n 193,\n/**/\n 192,\n/**/\n 191,\n/**/\n 190,\n/**/\n 189,\n/**/\n 188,\n/**/\n 187,\n/**/\n 186,\n/**/\n 185,\n/**/\n 184,\n/**/\n 183,\n/**/\n 182,\n/**/\n 181,\n/**/\n 180,\n/**/\n 179,\n/**/\n 178,\n/**/\n 177,\n/**/\n 176,\n/**/\n 175,\n/**/\n 174,\n/**/\n 173,\n/**/\n 172,\n/**/\n 171,\n/**/\n 170,\n/**/\n 169,\n/**/\n 168,\n/**/\n 167,\n/**/\n 166,\n/**/\n 165,\n/**/\n 164,\n/**/\n 163,\n/**/\n 162,\n/**/\n 161,\n/**/\n 160,\n/**/\n 159,\n/**/\n 158,\n/**/\n 157,\n/**/\n 156,\n/**/\n 155,\n/**/\n 154,\n/**/\n 153,\n/**/\n 152,\n/**/\n 151,\n/**/\n 150,\n/**/\n 149,\n/**/\n 148,\n/**/\n 147,\n/**/\n 146,\n/**/\n 145,\n/**/\n 144,\n/**/\n 143,\n/**/\n 142,\n/**/\n 141,\n/**/\n 140,\n/**/\n 139,\n/**/\n 138,\n/**/\n 137,\n/**/\n 136,\n/**/\n 135,\n/**/\n 134,\n/**/\n 133,\n/**/\n 132,\n/**/\n 131,\n/**/\n 130,\n/**/\n 129,\n/**/\n 128,\n/**/\n 127,\n/**/\n 126,\n/**/\n 125,\n/**/\n 124,\n/**/\n 123,\n/**/\n 122,\n/**/\n 121,\n/**/\n 120,\n/**/\n 119,\n/**/\n 118,\n/**/\n 117,\n/**/\n 116,\n/**/\n 115,\n/**/\n 114,\n/**/\n 113,\n/**/\n 112,\n/**/\n 111,\n/**/\n 110,\n/**/\n 109,\n/**/\n 108,\n/**/\n 107,\n/**/\n 106,\n/**/\n 105,\n/**/\n 104,\n/**/\n 103,\n/**/\n 102,\n/**/\n 101,\n/**/\n 100,\n/**/\n 99,\n/**/\n 98,\n/**/\n 97,\n/**/\n 96,\n/**/\n 95,\n/**/\n 94,\n/**/\n 93,\n/**/\n 92,\n/**/\n 91,\n/**/\n 90,\n/**/\n 89,\n/**/\n 88,\n/**/\n 87,\n/**/\n 86,\n/**/\n 85,\n/**/\n 84,\n/**/\n 83,\n/**/\n 82,\n/**/\n 81,\n/**/\n 80,\n/**/\n 79,\n/**/\n 78,\n/**/\n 77,\n/**/\n 76,\n/**/\n 75,\n/**/\n 74,\n/**/\n 73,\n/**/\n 72,\n/**/\n 71,\n/**/\n 70,\n/**/\n 69,\n/**/\n 68,\n/**/\n 67,\n/**/\n 66,\n/**/\n 65,\n/**/\n 64,\n/**/\n 63,\n/**/\n 62,\n/**/\n 61,\n/**/\n 60,\n/**/\n 59,\n/**/\n 58,\n/**/\n 57,\n/**/\n 56,\n/**/\n 55,\n/**/\n 54,\n/**/\n 53,\n/**/\n 52,\n/**/\n 51,\n/**/\n 50,\n/**/\n 49,\n/**/\n 48,\n/**/\n 47,\n/**/\n 46,\n/**/\n 45,\n/**/\n 44,\n/**/\n 43,\n/**/\n 42,\n/**/\n 41,\n/**/\n 40,\n/**/\n 39,\n/**/\n 38,\n/**/\n 37,\n/**/\n 36,\n/**/\n 35,\n/**/\n 34,\n/**/\n 33,\n/**/\n 32,\n/**/\n 31,\n/**/\n 30,\n/**/\n 29,\n/**/\n 28,\n/**/\n 27,\n/**/\n 26,\n/**/\n 25,\n/**/\n 24,\n/**/\n 23,\n/**/\n 22,\n/**/\n 21,\n/**/\n 20,\n/**/\n 19,\n/**/\n 18,\n/**/\n 17,\n/**/\n 16,\n/**/\n 15,\n/**/\n 14,\n/**/\n 13,\n/**/\n 12,\n/**/\n 11,\n/**/\n 10,\n/**/\n 9,\n/**/\n 8,\n/**/\n 7,\n/**/\n 6,\n/**/\n 5,\n/**/\n 4,\n/**/\n 3,\n/**/\n 2,\n/**/\n 1,\n/**/\n 0\n};", "/*\n * Place to put a short description when adding a feature with a patch.\n * Keep it short, e.g.,: \"relative numbers\", \"persistent undo\".\n * Also add a comment marker to separate the lines.\n * See the official Vim patches for the diff format: It must use a context of\n * one line only. Create it by hand or use \"diff -C2\" and edit the patch.\n */\nstatic char *(extra_patches[]) =\n{ /* Add your patch description below this line */\n/**/\n NULL\n};", " int\nhighest_patch(void)\n{\n // this relies on the highest patch number to be the first entry\n return included_patches[0];\n}", "#if defined(FEAT_EVAL) || defined(PROTO)\n/*\n * Return TRUE if patch \"n\" has been included.\n */\n int\nhas_patch(int n)\n{\n int\t\ti;", " for (i = 0; included_patches[i] != 0; ++i)\n\tif (included_patches[i] == n)\n\t return TRUE;\n return FALSE;\n}\n#endif", " void\nex_version(exarg_T *eap)\n{\n /*\n * Ignore a \":version 9.99\" command.\n */\n if (*eap->arg == NUL)\n {\n\tmsg_putchar('\\n');\n\tlist_version();\n }\n}", "/*\n * Output a string for the version message. If it's going to wrap, output a\n * newline, unless the message is too long to fit on the screen anyway.\n * When \"wrap\" is TRUE wrap the string in [].\n */\n static void\nversion_msg_wrap(char_u *s, int wrap)\n{\n int\t\tlen = (int)vim_strsize(s) + (wrap ? 2 : 0);", " if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns\n\t\t\t\t\t\t\t\t&& *s != '\\n')\n\tmsg_putchar('\\n');\n if (!got_int)\n {\n\tif (wrap)\n\t msg_puts(\"[\");\n\tmsg_puts((char *)s);\n\tif (wrap)\n\t msg_puts(\"]\");\n }\n}", " static void\nversion_msg(char *s)\n{\n version_msg_wrap((char_u *)s, FALSE);\n}", "/*\n * List all features aligned in columns, dictionary style.\n */\n static void\nlist_features(void)\n{\n list_in_columns((char_u **)features, -1, -1);\n}", "/*\n * List string items nicely aligned in columns.\n * When \"size\" is < 0 then the last entry is marked with NULL.\n * The entry with index \"current\" is inclosed in [].\n */\n void\nlist_in_columns(char_u **items, int size, int current)\n{\n int\t\ti;\n int\t\tncol;\n int\t\tnrow;\n int\t\tcur_row = 1;\n int\t\titem_count = 0;\n int\t\twidth = 0;\n#ifdef FEAT_SYN_HL\n int\t\tuse_highlight = (items == (char_u **)features);\n#endif", " /* Find the length of the longest item, use that + 1 as the column\n * width. */\n for (i = 0; size < 0 ? items[i] != NULL : i < size; ++i)\n {\n\tint l = (int)vim_strsize(items[i]) + (i == current ? 2 : 0);", "\tif (l > width)\n\t width = l;\n\t++item_count;\n }\n width += 1;", " if (Columns < width)\n {\n\t// Not enough screen columns - show one per line\n\tfor (i = 0; i < item_count; ++i)\n\t{\n\t version_msg_wrap(items[i], i == current);\n\t if (msg_col > 0 && i < item_count - 1)\n\t\tmsg_putchar('\\n');\n\t}\n\treturn;\n }", " // The rightmost column doesn't need a separator.\n // Sacrifice it to fit in one more column if possible.\n ncol = (int) (Columns + 1) / width;\n nrow = item_count / ncol + (item_count % ncol ? 1 : 0);", " // \"i\" counts columns then rows. \"idx\" counts rows then columns.\n for (i = 0; !got_int && i < nrow * ncol; ++i)\n {\n\tint idx = (i / ncol) + (i % ncol) * nrow;", "\tif (idx < item_count)\n\t{\n\t int last_col = (i + 1) % ncol == 0;", "\t if (idx == current)\n\t\tmsg_putchar('[');\n#ifdef FEAT_SYN_HL\n\t if (use_highlight && items[idx][0] == '-')\n\t\tmsg_puts_attr((char *)items[idx], HL_ATTR(HLF_W));\n\t else\n#endif\n\t\tmsg_puts((char *)items[idx]);\n\t if (idx == current)\n\t\tmsg_putchar(']');\n\t if (last_col)\n\t {\n\t\tif (msg_col > 0 && cur_row < nrow)\n\t\t msg_putchar('\\n');\n\t\t++cur_row;\n\t }\n\t else\n\t {\n\t\twhile (msg_col % width)\n\t\t msg_putchar(' ');\n\t }\n\t}\n\telse\n\t{\n\t // this row is out of items, thus at the end of the row\n\t if (msg_col > 0)\n\t {\n\t\tif (cur_row < nrow)\n\t\t msg_putchar('\\n');\n\t\t++cur_row;\n\t }\n\t}\n }\n}", " void\nlist_version(void)\n{\n int\t\ti;\n int\t\tfirst;\n char\t*s = \"\";", " /*\n * When adding features here, don't forget to update the list of\n * internal variables in eval.c!\n */\n init_longVersion();\n msg(longVersion);\n#ifdef MSWIN\n# ifdef FEAT_GUI_MSWIN\n# ifdef VIMDLL\n# ifdef _WIN64\n msg_puts(_(\"\\nMS-Windows 64-bit GUI/console version\"));\n# else\n msg_puts(_(\"\\nMS-Windows 32-bit GUI/console version\"));\n# endif\n# else\n# ifdef _WIN64\n msg_puts(_(\"\\nMS-Windows 64-bit GUI version\"));\n# else\n msg_puts(_(\"\\nMS-Windows 32-bit GUI version\"));\n# endif\n# endif\n# ifdef FEAT_OLE\n msg_puts(_(\" with OLE support\"));\n# endif\n# else\n# ifdef _WIN64\n msg_puts(_(\"\\nMS-Windows 64-bit console version\"));\n# else\n msg_puts(_(\"\\nMS-Windows 32-bit console version\"));\n# endif\n# endif\n#endif\n#if defined(MACOS_X)\n# if defined(MACOS_X_DARWIN)\n msg_puts(_(\"\\nmacOS version\"));\n# else\n msg_puts(_(\"\\nmacOS version w/o darwin feat.\"));\n# endif\n#endif", "#ifdef VMS\n msg_puts(_(\"\\nOpenVMS version\"));\n# ifdef HAVE_PATHDEF\n if (*compiled_arch != NUL)\n {\n\tmsg_puts(\" - \");\n\tmsg_puts((char *)compiled_arch);\n }\n# endif", "#endif", " /* Print the list of patch numbers if there is at least one. */\n /* Print a range when patches are consecutive: \"1-10, 12, 15-40, 42-45\" */\n if (included_patches[0] != 0)\n {\n\tmsg_puts(_(\"\\nIncluded patches: \"));\n\tfirst = -1;\n\t/* find last one */\n\tfor (i = 0; included_patches[i] != 0; ++i)\n\t ;\n\twhile (--i >= 0)\n\t{\n\t if (first < 0)\n\t\tfirst = included_patches[i];\n\t if (i == 0 || included_patches[i - 1] != included_patches[i] + 1)\n\t {\n\t\tmsg_puts(s);\n\t\ts = \", \";\n\t\tmsg_outnum((long)first);\n\t\tif (first != included_patches[i])\n\t\t{\n\t\t msg_puts(\"-\");\n\t\t msg_outnum((long)included_patches[i]);\n\t\t}\n\t\tfirst = -1;\n\t }\n\t}\n }", " /* Print the list of extra patch descriptions if there is at least one. */\n if (extra_patches[0] != NULL)\n {\n\tmsg_puts(_(\"\\nExtra patches: \"));\n\ts = \"\";\n\tfor (i = 0; extra_patches[i] != NULL; ++i)\n\t{\n\t msg_puts(s);\n\t s = \", \";\n\t msg_puts(extra_patches[i]);\n\t}\n }", "#ifdef MODIFIED_BY\n msg_puts(\"\\n\");\n msg_puts(_(\"Modified by \"));\n msg_puts(MODIFIED_BY);\n#endif", "#ifdef HAVE_PATHDEF\n if (*compiled_user != NUL || *compiled_sys != NUL)\n {\n\tmsg_puts(_(\"\\nCompiled \"));\n\tif (*compiled_user != NUL)\n\t{\n\t msg_puts(_(\"by \"));\n\t msg_puts((char *)compiled_user);\n\t}\n\tif (*compiled_sys != NUL)\n\t{\n\t msg_puts(\"@\");\n\t msg_puts((char *)compiled_sys);\n\t}\n }\n#endif", "#ifdef FEAT_HUGE\n msg_puts(_(\"\\nHuge version \"));\n#else\n# ifdef FEAT_BIG\n msg_puts(_(\"\\nBig version \"));\n# else\n# ifdef FEAT_NORMAL\n msg_puts(_(\"\\nNormal version \"));\n# else\n# ifdef FEAT_SMALL\n msg_puts(_(\"\\nSmall version \"));\n# else\n msg_puts(_(\"\\nTiny version \"));\n# endif\n# endif\n# endif\n#endif\n#ifndef FEAT_GUI\n msg_puts(_(\"without GUI.\"));\n#else\n# ifdef FEAT_GUI_GTK\n# ifdef USE_GTK3\n msg_puts(_(\"with GTK3 GUI.\"));\n# else\n# ifdef FEAT_GUI_GNOME\n msg_puts(_(\"with GTK2-GNOME GUI.\"));\n# else\n msg_puts(_(\"with GTK2 GUI.\"));\n# endif\n# endif\n# else\n# ifdef FEAT_GUI_MOTIF\n msg_puts(_(\"with X11-Motif GUI.\"));\n# else\n# ifdef FEAT_GUI_ATHENA\n# ifdef FEAT_GUI_NEXTAW\n msg_puts(_(\"with X11-neXtaw GUI.\"));\n# else\n msg_puts(_(\"with X11-Athena GUI.\"));\n# endif\n# else\n# ifdef FEAT_GUI_PHOTON\n msg_puts(_(\"with Photon GUI.\"));\n# else\n# if defined(MSWIN)\n msg_puts(_(\"with GUI.\"));\n# else\n#\tif defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON\n msg_puts(_(\"with Carbon GUI.\"));\n#\telse\n#\t if defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX\n msg_puts(_(\"with Cocoa GUI.\"));\n#\t else\n#\t endif\n#\tendif\n# endif\n# endif\n# endif\n# endif\n# endif\n#endif\n version_msg(_(\" Features included (+) or not (-):\\n\"));", " list_features();\n if (msg_col > 0)\n\tmsg_putchar('\\n');", "#ifdef SYS_VIMRC_FILE\n version_msg(_(\" system vimrc file: \\\"\"));\n version_msg(SYS_VIMRC_FILE);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_VIMRC_FILE\n version_msg(_(\" user vimrc file: \\\"\"));\n version_msg(USR_VIMRC_FILE);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_VIMRC_FILE2\n version_msg(_(\" 2nd user vimrc file: \\\"\"));\n version_msg(USR_VIMRC_FILE2);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_VIMRC_FILE3\n version_msg(_(\" 3rd user vimrc file: \\\"\"));\n version_msg(USR_VIMRC_FILE3);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_EXRC_FILE\n version_msg(_(\" user exrc file: \\\"\"));\n version_msg(USR_EXRC_FILE);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_EXRC_FILE2\n version_msg(_(\" 2nd user exrc file: \\\"\"));\n version_msg(USR_EXRC_FILE2);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef FEAT_GUI\n# ifdef SYS_GVIMRC_FILE\n version_msg(_(\" system gvimrc file: \\\"\"));\n version_msg(SYS_GVIMRC_FILE);\n version_msg(\"\\\"\\n\");\n# endif\n version_msg(_(\" user gvimrc file: \\\"\"));\n version_msg(USR_GVIMRC_FILE);\n version_msg(\"\\\"\\n\");\n# ifdef USR_GVIMRC_FILE2\n version_msg(_(\"2nd user gvimrc file: \\\"\"));\n version_msg(USR_GVIMRC_FILE2);\n version_msg(\"\\\"\\n\");\n# endif\n# ifdef USR_GVIMRC_FILE3\n version_msg(_(\"3rd user gvimrc file: \\\"\"));\n version_msg(USR_GVIMRC_FILE3);\n version_msg(\"\\\"\\n\");\n# endif\n#endif\n version_msg(_(\" defaults file: \\\"\"));\n version_msg(VIM_DEFAULTS_FILE);\n version_msg(\"\\\"\\n\");\n#ifdef FEAT_GUI\n# ifdef SYS_MENU_FILE\n version_msg(_(\" system menu file: \\\"\"));\n version_msg(SYS_MENU_FILE);\n version_msg(\"\\\"\\n\");\n# endif\n#endif\n#ifdef HAVE_PATHDEF\n if (*default_vim_dir != NUL)\n {\n\tversion_msg(_(\" fall-back for $VIM: \\\"\"));\n\tversion_msg((char *)default_vim_dir);\n\tversion_msg(\"\\\"\\n\");\n }\n if (*default_vimruntime_dir != NUL)\n {\n\tversion_msg(_(\" f-b for $VIMRUNTIME: \\\"\"));\n\tversion_msg((char *)default_vimruntime_dir);\n\tversion_msg(\"\\\"\\n\");\n }\n version_msg(_(\"Compilation: \"));\n version_msg((char *)all_cflags);\n version_msg(\"\\n\");\n#ifdef VMS\n if (*compiler_version != NUL)\n {\n\tversion_msg(_(\"Compiler: \"));\n\tversion_msg((char *)compiler_version);\n\tversion_msg(\"\\n\");\n }\n#endif\n version_msg(_(\"Linking: \"));\n version_msg((char *)all_lflags);\n#endif\n#ifdef DEBUG\n version_msg(\"\\n\");\n version_msg(_(\" DEBUG BUILD\"));\n#endif\n}", "static void do_intro_line(int row, char_u *mesg, int add_version, int attr);", "/*\n * Show the intro message when not editing a file.\n */\n void\nmaybe_intro_message(void)\n{\n if (BUFEMPTY()\n\t && curbuf->b_fname == NULL\n\t && firstwin->w_next == NULL\n\t && vim_strchr(p_shm, SHM_INTRO) == NULL)\n\tintro_message(FALSE);\n}", "/*\n * Give an introductory message about Vim.\n * Only used when starting Vim on an empty file, without a file name.\n * Or with the \":intro\" command (for Sven :-).\n */\n void\nintro_message(\n int\t\tcolon)\t\t/* TRUE for \":intro\" */\n{\n int\t\ti;\n int\t\trow;\n int\t\tblanklines;\n int\t\tsponsor;\n char\t*p;\n static char\t*(lines[]) =\n {\n\tN_(\"VIM - Vi IMproved\"),\n\t\"\",\n\tN_(\"version \"),\n\tN_(\"by Bram Moolenaar et al.\"),\n#ifdef MODIFIED_BY\n\t\" \",\n#endif\n\tN_(\"Vim is open source and freely distributable\"),\n\t\"\",\n\tN_(\"Help poor children in Uganda!\"),\n\tN_(\"type :help iccf<Enter> for information \"),\n\t\"\",\n\tN_(\"type :q<Enter> to exit \"),\n\tN_(\"type :help<Enter> or <F1> for on-line help\"),\n\tN_(\"type :help version8<Enter> for version info\"),\n\tNULL,\n\t\"\",\n\tN_(\"Running in Vi compatible mode\"),\n\tN_(\"type :set nocp<Enter> for Vim defaults\"),\n\tN_(\"type :help cp-default<Enter> for info on this\"),\n };\n#ifdef FEAT_GUI\n static char\t*(gui_lines[]) =\n {\n\tNULL,\n\tNULL,\n\tNULL,\n\tNULL,\n#ifdef MODIFIED_BY\n\tNULL,\n#endif\n\tNULL,\n\tNULL,\n\tNULL,\n\tN_(\"menu Help->Orphans for information \"),\n\tNULL,\n\tN_(\"Running modeless, typed text is inserted\"),\n\tN_(\"menu Edit->Global Settings->Toggle Insert Mode \"),\n\tN_(\" for two modes \"),\n\tNULL,\n\tNULL,\n\tNULL,\n\tN_(\"menu Edit->Global Settings->Toggle Vi Compatible\"),\n\tN_(\" for Vim defaults \"),\n };\n#endif", " /* blanklines = screen height - # message lines */\n blanklines = (int)Rows - ((sizeof(lines) / sizeof(char *)) - 1);\n if (!p_cp)\n\tblanklines += 4; /* add 4 for not showing \"Vi compatible\" message */", " /* Don't overwrite a statusline. Depends on 'cmdheight'. */\n if (p_ls > 1)\n\tblanklines -= Rows - topframe->fr_height;\n if (blanklines < 0)\n\tblanklines = 0;", " /* Show the sponsor and register message one out of four times, the Uganda\n * message two out of four times. */\n sponsor = (int)time(NULL);\n sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);", " /* start displaying the message lines after half of the blank lines */\n row = blanklines / 2;\n if ((row >= 2 && Columns >= 50) || colon)\n {\n\tfor (i = 0; i < (int)(sizeof(lines) / sizeof(char *)); ++i)\n\t{\n\t p = lines[i];\n#ifdef FEAT_GUI\n\t if (p_im && gui.in_use && gui_lines[i] != NULL)\n\t\tp = gui_lines[i];\n#endif\n\t if (p == NULL)\n\t {\n\t\tif (!p_cp)\n\t\t break;\n\t\tcontinue;\n\t }\n\t if (sponsor != 0)\n\t {\n\t\tif (strstr(p, \"children\") != NULL)\n\t\t p = sponsor < 0\n\t\t\t? N_(\"Sponsor Vim development!\")\n\t\t\t: N_(\"Become a registered Vim user!\");\n\t\telse if (strstr(p, \"iccf\") != NULL)\n\t\t p = sponsor < 0\n\t\t\t? N_(\"type :help sponsor<Enter> for information \")\n\t\t\t: N_(\"type :help register<Enter> for information \");\n\t\telse if (strstr(p, \"Orphans\") != NULL)\n\t\t p = N_(\"menu Help->Sponsor/Register for information \");\n\t }\n\t if (*p != NUL)\n\t\tdo_intro_line(row, (char_u *)_(p), i == 2, 0);\n\t ++row;\n\t}\n }", " /* Make the wait-return message appear just below the text. */\n if (colon)\n\tmsg_row = row;\n}", " static void\ndo_intro_line(\n int\t\trow,\n char_u\t*mesg,\n int\t\tadd_version,\n int\t\tattr)\n{\n char_u\tvers[20];\n int\t\tcol;\n char_u\t*p;\n int\t\tl;\n int\t\tclen;\n#ifdef MODIFIED_BY\n# define MODBY_LEN 150\n char_u\tmodby[MODBY_LEN];", " if (*mesg == ' ')\n {\n\tvim_strncpy(modby, (char_u *)_(\"Modified by \"), MODBY_LEN - 1);\n\tl = (int)STRLEN(modby);\n\tvim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1);\n\tmesg = modby;\n }\n#endif", " /* Center the message horizontally. */\n col = vim_strsize(mesg);\n if (add_version)\n {\n\tSTRCPY(vers, mediumVersion);\n\tif (highest_patch())\n\t{\n\t /* Check for 9.9x or 9.9xx, alpha/beta version */\n\t if (isalpha((int)vers[3]))\n\t {\n\t\tint len = (isalpha((int)vers[4])) ? 5 : 4;\n\t\tsprintf((char *)vers + len, \".%d%s\", highest_patch(),\n\t\t\t\t\t\t\t mediumVersion + len);\n\t }\n\t else\n\t\tsprintf((char *)vers + 3, \".%d\", highest_patch());\n\t}\n\tcol += (int)STRLEN(vers);\n }\n col = (Columns - col) / 2;\n if (col < 0)\n\tcol = 0;", " /* Split up in parts to highlight <> items differently. */\n for (p = mesg; *p != NUL; p += l)\n {\n\tclen = 0;\n\tfor (l = 0; p[l] != NUL\n\t\t\t && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)\n\t{\n\t if (has_mbyte)\n\t {\n\t\tclen += ptr2cells(p + l);\n\t\tl += (*mb_ptr2len)(p + l) - 1;\n\t }\n\t else\n\t\tclen += byte2cells(p[l]);\n\t}\n\tscreen_puts_len(p, l, row, col, *p == '<' ? HL_ATTR(HLF_8) : attr);\n\tcol += clen;\n }", " /* Add the version number to the version line. */\n if (add_version)\n\tscreen_puts(vers, row, col, 0);\n}", "/*\n * \":intro\": clear screen, display intro screen and wait for return.\n */\n void\nex_intro(exarg_T *eap UNUSED)\n{\n screenclear();\n intro_message(TRUE);\n wait_return(TRUE);\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [2290, 755, 4659], "buggy_code_start_loc": [2290, 755, 4643], "filenames": ["src/testdir/test_autocmd.vim", "src/version.c", "src/window.c"], "fixing_code_end_loc": [2299, 758, 4660], "fixing_code_start_loc": [2291, 756, 4644], "message": "The autocmd feature in window.c in Vim before 8.1.2136 accesses freed memory.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:vim:vim:*:*:*:*:*:*:*:*", "matchCriteriaId": "8BA1A77F-AC6C-4A51-A1C0-873DE3A2BF19", "versionEndExcluding": "8.1.2136", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "8.1.2121", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:12.04:*:*:*:esm:*:*:*", "matchCriteriaId": "8D305F7A-D159-4716-AB26-5E38BB5CD991", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:14.04:*:*:*:esm:*:*:*", "matchCriteriaId": "815D70A8-47D3-459C-A32C-9FEACA0659D1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:lts:*:*:*", "matchCriteriaId": "F7016A2A-8365-4F1A-89A2-7A19F2BCAE5B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:19.10:*:*:*:*:*:*:*", "matchCriteriaId": "A31C8344-3E02-4EB8-8BD8-4C84B7959624", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The autocmd feature in window.c in Vim before 8.1.2136 accesses freed memory."}, {"lang": "es", "value": "La funcionalidad autocmd en el archivo window.c en Vim versiones anteriores a la versi\u00f3n 8.1.2136, accede a la memoria liberada."}], "evaluatorComment": null, "id": "CVE-2019-20079", "lastModified": "2020-10-20T16:04:08.370", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-12-30T01:15:12.290", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/commit/ec66c41d84e574baf8009dbc0bd088d2bc5b2421"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/compare/v8.1.2135...v8.1.2136"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "https://packetstormsecurity.com/files/154898"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4309-1/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-416"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/vim/vim/commit/ec66c41d84e574baf8009dbc0bd088d2bc5b2421"}, "type": "CWE-416"}
352
Determine whether the {function_name} code is vulnerable or not.
[ "/* vi:set ts=8 sts=4 sw=4 noet:\n *\n * VIM - Vi IMproved\tby Bram Moolenaar\n *\n * Do \":help uganda\" in Vim to read a list of people who contributed.\n * Do \":help credits\" in Vim to see a list of people who contributed.\n * See README.txt for an overview of the Vim source code.\n */", "#include \"vim.h\"", "static void cmd_with_count(char *cmd, char_u *bufp, size_t bufsize, long Prenum);\nstatic void win_init(win_T *newp, win_T *oldp, int flags);\nstatic void win_init_some(win_T *newp, win_T *oldp);\nstatic void frame_comp_pos(frame_T *topfrp, int *row, int *col);\nstatic void frame_setheight(frame_T *curfrp, int height);\nstatic void frame_setwidth(frame_T *curfrp, int width);\nstatic void win_exchange(long);\nstatic void win_rotate(int, int);\nstatic void win_totop(int size, int flags);\nstatic void win_equal_rec(win_T *next_curwin, int current, frame_T *topfr, int dir, int col, int row, int width, int height);\nstatic win_T *win_free_mem(win_T *win, int *dirp, tabpage_T *tp);\nstatic frame_T *win_altframe(win_T *win, tabpage_T *tp);\nstatic tabpage_T *alt_tabpage(void);\nstatic win_T *frame2win(frame_T *frp);\nstatic int frame_has_win(frame_T *frp, win_T *wp);\nstatic void frame_new_height(frame_T *topfrp, int height, int topfirst, int wfh);\nstatic int frame_fixed_height(frame_T *frp);\nstatic int frame_fixed_width(frame_T *frp);\nstatic void frame_add_statusline(frame_T *frp);\nstatic void frame_new_width(frame_T *topfrp, int width, int leftfirst, int wfw);\nstatic void frame_add_vsep(frame_T *frp);\nstatic int frame_minwidth(frame_T *topfrp, win_T *next_curwin);\nstatic void frame_fix_width(win_T *wp);\nstatic int win_alloc_firstwin(win_T *oldwin);\nstatic void new_frame(win_T *wp);\nstatic tabpage_T *alloc_tabpage(void);\nstatic int leave_tabpage(buf_T *new_curbuf, int trigger_leave_autocmds);\nstatic void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, int trigger_enter_autocmds, int trigger_leave_autocmds);\nstatic void frame_fix_height(win_T *wp);\nstatic int frame_minheight(frame_T *topfrp, win_T *next_curwin);\nstatic int may_open_tabpage(void);\nstatic void win_enter_ext(win_T *wp, int undo_sync, int no_curwin, int trigger_new_autocmds, int trigger_enter_autocmds, int trigger_leave_autocmds);\nstatic void win_free(win_T *wp, tabpage_T *tp);\nstatic int win_unlisted(win_T *wp);\nstatic void win_append(win_T *after, win_T *wp);\nstatic void frame_append(frame_T *after, frame_T *frp);\nstatic void frame_insert(frame_T *before, frame_T *frp);\nstatic void frame_remove(frame_T *frp);\nstatic void win_goto_ver(int up, long count);\nstatic void win_goto_hor(int left, long count);\nstatic void frame_add_height(frame_T *frp, int n);\nstatic void last_status_rec(frame_T *fr, int statusline);", "static void make_snapshot_rec(frame_T *fr, frame_T **frp);\nstatic void clear_snapshot(tabpage_T *tp, int idx);\nstatic void clear_snapshot_rec(frame_T *fr);\nstatic int check_snapshot_rec(frame_T *sn, frame_T *fr);\nstatic win_T *restore_snapshot_rec(frame_T *sn, frame_T *fr);", "static int frame_check_height(frame_T *topfrp, int height);\nstatic int frame_check_width(frame_T *topfrp, int width);", "static win_T *win_alloc(win_T *after, int hidden);", "#define NOWIN\t\t(win_T *)-1\t/* non-existing window */", "#define ROWS_AVAIL (Rows - p_ch - tabline_height())", "static char *m_onlyone = N_(\"Already only one window\");", "// When non-zero splitting a window is forbidden. Used to avoid that nasty\n// autocommands mess up the window structure.\nstatic int split_disallowed = 0;", "// #define WIN_DEBUG\n#ifdef WIN_DEBUG\n/*\n * Call this method to log the current window layout.\n */\n static void\nlog_frame_layout(frame_T *frame)\n{\n ch_log(NULL, \"layout %s, wi: %d, he: %d, wwi: %d, whe: %d, id: %d\",\n\t frame->fr_layout == FR_LEAF ? \"LEAF\"\n\t\t\t\t : frame->fr_layout == FR_ROW ? \"ROW\" : \"COL\",\n\t frame->fr_width,\n\t frame->fr_height,\n\t frame->fr_win == NULL ? -1 : frame->fr_win->w_width,\n\t frame->fr_win == NULL ? -1 : frame->fr_win->w_height,\n\t frame->fr_win == NULL ? -1 : frame->fr_win->w_id);\n if (frame->fr_child != NULL)\n {\n\tch_log(NULL, \"children\");\n\tlog_frame_layout(frame->fr_child);\n\tif (frame->fr_next != NULL)\n\t ch_log(NULL, \"END of children\");\n }\n if (frame->fr_next != NULL)\n\tlog_frame_layout(frame->fr_next);\n}\n#endif", "/*\n * All CTRL-W window commands are handled here, called from normal_cmd().\n */\n void\ndo_window(\n int\t\tnchar,\n long\tPrenum,\n int\t\txchar)\t /* extra char from \":wincmd gx\" or NUL */\n{\n long\tPrenum1;\n win_T\t*wp;\n#if defined(FEAT_SEARCHPATH) || defined(FEAT_FIND_ID)\n char_u\t*ptr;\n linenr_T lnum = -1;\n#endif\n#ifdef FEAT_FIND_ID\n int\t\ttype = FIND_DEFINE;\n int\t\tlen;\n#endif\n char_u\tcbuf[40];", " if (ERROR_IF_POPUP_WINDOW)\n\treturn;", "#ifdef FEAT_CMDWIN\n# define CHECK_CMDWIN \\\n do { \\\n\tif (cmdwin_type != 0) \\\n\t{ \\\n\t emsg(_(e_cmdwin)); \\\n\t return; \\\n\t} \\\n } while (0)\n#else\n# define CHECK_CMDWIN do { /**/ } while (0)\n#endif", " Prenum1 = Prenum == 0 ? 1 : Prenum;", " switch (nchar)\n {\n/* split current window in two parts, horizontally */\n case 'S':\n case Ctrl_S:\n case 's':\n\t\tCHECK_CMDWIN;\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n#ifdef FEAT_QUICKFIX\n\t\t/* When splitting the quickfix window open a new buffer in it,\n\t\t * don't replicate the quickfix buffer. */\n\t\tif (bt_quickfix(curbuf))\n\t\t goto newwindow;\n#endif\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\t(void)win_split((int)Prenum, 0);\n\t\tbreak;", "/* split current window in two parts, vertically */\n case Ctrl_V:\n case 'v':\n\t\tCHECK_CMDWIN;\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n#ifdef FEAT_QUICKFIX\n\t\t/* When splitting the quickfix window open a new buffer in it,\n\t\t * don't replicate the quickfix buffer. */\n\t\tif (bt_quickfix(curbuf))\n\t\t goto newwindow;\n#endif\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\t(void)win_split((int)Prenum, WSP_VERT);\n\t\tbreak;", "/* split current window and edit alternate file */\n case Ctrl_HAT:\n case '^':\n\t\tCHECK_CMDWIN;\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */", "\t\tif (buflist_findnr(Prenum == 0\n\t\t\t\t\t? curwin->w_alt_fnum : Prenum) == NULL)\n\t\t{\n\t\t if (Prenum == 0)\n\t\t\temsg(_(e_noalt));\n\t\t else\n\t\t\tsemsg(_(\"E92: Buffer %ld not found\"), Prenum);\n\t\t break;\n\t\t}", "\t\tif (!curbuf_locked() && win_split(0, 0) == OK)\n\t\t (void)buflist_getfile(\n\t\t\t Prenum == 0 ? curwin->w_alt_fnum : Prenum,\n\t\t\t (linenr_T)0, GETF_ALT, FALSE);\n\t\tbreak;", "/* open new window */\n case Ctrl_N:\n case 'n':\n\t\tCHECK_CMDWIN;\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n#ifdef FEAT_QUICKFIX\nnewwindow:\n#endif\n\t\tif (Prenum)\n\t\t /* window height */\n\t\t vim_snprintf((char *)cbuf, sizeof(cbuf) - 5, \"%ld\", Prenum);\n\t\telse\n\t\t cbuf[0] = NUL;\n#if defined(FEAT_QUICKFIX)\n\t\tif (nchar == 'v' || nchar == Ctrl_V)\n\t\t STRCAT(cbuf, \"v\");\n#endif\n\t\tSTRCAT(cbuf, \"new\");\n\t\tdo_cmdline_cmd(cbuf);\n\t\tbreak;", "/* quit current window */\n case Ctrl_Q:\n case 'q':\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n\t\tcmd_with_count(\"quit\", cbuf, sizeof(cbuf), Prenum);\n\t\tdo_cmdline_cmd(cbuf);\n\t\tbreak;", "/* close current window */\n case Ctrl_C:\n case 'c':\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n\t\tcmd_with_count(\"close\", cbuf, sizeof(cbuf), Prenum);\n\t\tdo_cmdline_cmd(cbuf);\n\t\tbreak;", "#if defined(FEAT_QUICKFIX)\n/* close preview window */\n case Ctrl_Z:\n case 'z':\n\t\tCHECK_CMDWIN;\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n\t\tdo_cmdline_cmd((char_u *)\"pclose\");\n\t\tbreak;", "/* cursor to preview window */\n case 'P':\n\t\tFOR_ALL_WINDOWS(wp)\n\t\t if (wp->w_p_pvw)\n\t\t\tbreak;\n\t\tif (wp == NULL)\n\t\t emsg(_(\"E441: There is no preview window\"));\n\t\telse\n\t\t win_goto(wp);\n\t\tbreak;\n#endif", "/* close all but current window */\n case Ctrl_O:\n case 'o':\n\t\tCHECK_CMDWIN;\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n\t\tcmd_with_count(\"only\", cbuf, sizeof(cbuf), Prenum);\n\t\tdo_cmdline_cmd(cbuf);\n\t\tbreak;", "/* cursor to next window with wrap around */\n case Ctrl_W:\n case 'w':\n/* cursor to previous window with wrap around */\n case 'W':\n\t\tCHECK_CMDWIN;\n\t\tif (ONE_WINDOW && Prenum != 1)\t/* just one window */\n\t\t beep_flush();\n\t\telse\n\t\t{\n\t\t if (Prenum)\t\t\t/* go to specified window */\n\t\t {\n\t\t\tfor (wp = firstwin; --Prenum > 0; )\n\t\t\t{\n\t\t\t if (wp->w_next == NULL)\n\t\t\t\tbreak;\n\t\t\t else\n\t\t\t\twp = wp->w_next;\n\t\t\t}\n\t\t }\n\t\t else\n\t\t {\n\t\t\tif (nchar == 'W')\t /* go to previous window */\n\t\t\t{\n\t\t\t wp = curwin->w_prev;\n\t\t\t if (wp == NULL)\n\t\t\t\twp = lastwin;\t /* wrap around */\n\t\t\t}\n\t\t\telse\t\t\t /* go to next window */\n\t\t\t{\n\t\t\t wp = curwin->w_next;\n\t\t\t if (wp == NULL)\n\t\t\t\twp = firstwin;\t /* wrap around */\n\t\t\t}\n\t\t }\n\t\t win_goto(wp);\n\t\t}\n\t\tbreak;", "/* cursor to window below */\n case 'j':\n case K_DOWN:\n case Ctrl_J:\n\t\tCHECK_CMDWIN;\n\t\twin_goto_ver(FALSE, Prenum1);\n\t\tbreak;", "/* cursor to window above */\n case 'k':\n case K_UP:\n case Ctrl_K:\n\t\tCHECK_CMDWIN;\n\t\twin_goto_ver(TRUE, Prenum1);\n\t\tbreak;", "/* cursor to left window */\n case 'h':\n case K_LEFT:\n case Ctrl_H:\n case K_BS:\n\t\tCHECK_CMDWIN;\n\t\twin_goto_hor(TRUE, Prenum1);\n\t\tbreak;", "/* cursor to right window */\n case 'l':\n case K_RIGHT:\n case Ctrl_L:\n\t\tCHECK_CMDWIN;\n\t\twin_goto_hor(FALSE, Prenum1);\n\t\tbreak;", "/* move window to new tab page */\n case 'T':\n\t\tif (one_window())\n\t\t msg(_(m_onlyone));\n\t\telse\n\t\t{\n\t\t tabpage_T\t*oldtab = curtab;\n\t\t tabpage_T\t*newtab;", "\t\t /* First create a new tab with the window, then go back to\n\t\t * the old tab and close the window there. */\n\t\t wp = curwin;\n\t\t if (win_new_tabpage((int)Prenum) == OK\n\t\t\t\t\t\t && valid_tabpage(oldtab))\n\t\t {\n\t\t\tnewtab = curtab;\n\t\t\tgoto_tabpage_tp(oldtab, TRUE, TRUE);\n\t\t\tif (curwin == wp)\n\t\t\t win_close(curwin, FALSE);\n\t\t\tif (valid_tabpage(newtab))\n\t\t\t goto_tabpage_tp(newtab, TRUE, TRUE);\n\t\t }\n\t\t}\n\t\tbreak;", "/* cursor to top-left window */\n case 't':\n case Ctrl_T:\n\t\twin_goto(firstwin);\n\t\tbreak;", "/* cursor to bottom-right window */\n case 'b':\n case Ctrl_B:\n\t\twin_goto(lastwin);\n\t\tbreak;", "/* cursor to last accessed (previous) window */\n case 'p':\n case Ctrl_P:\n\t\tif (!win_valid(prevwin))\n\t\t beep_flush();\n\t\telse\n\t\t win_goto(prevwin);\n\t\tbreak;", "/* exchange current and next window */\n case 'x':\n case Ctrl_X:\n\t\tCHECK_CMDWIN;\n\t\twin_exchange(Prenum);\n\t\tbreak;", "/* rotate windows downwards */\n case Ctrl_R:\n case 'r':\n\t\tCHECK_CMDWIN;\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n\t\twin_rotate(FALSE, (int)Prenum1); /* downwards */\n\t\tbreak;", "/* rotate windows upwards */\n case 'R':\n\t\tCHECK_CMDWIN;\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n\t\twin_rotate(TRUE, (int)Prenum1);\t /* upwards */\n\t\tbreak;", "/* move window to the very top/bottom/left/right */\n case 'K':\n case 'J':\n case 'H':\n case 'L':\n\t\tCHECK_CMDWIN;\n\t\twin_totop((int)Prenum,\n\t\t\t((nchar == 'H' || nchar == 'L') ? WSP_VERT : 0)\n\t\t\t| ((nchar == 'H' || nchar == 'K') ? WSP_TOP : WSP_BOT));\n\t\tbreak;", "/* make all windows the same height */\n case '=':\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\twin_equal(NULL, FALSE, 'b');\n\t\tbreak;", "/* increase current window height */\n case '+':\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\twin_setheight(curwin->w_height + (int)Prenum1);\n\t\tbreak;", "/* decrease current window height */\n case '-':\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\twin_setheight(curwin->w_height - (int)Prenum1);\n\t\tbreak;", "/* set current window height */\n case Ctrl__:\n case '_':\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\twin_setheight(Prenum ? (int)Prenum : 9999);\n\t\tbreak;", "/* increase current window width */\n case '>':\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\twin_setwidth(curwin->w_width + (int)Prenum1);\n\t\tbreak;", "/* decrease current window width */\n case '<':\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\twin_setwidth(curwin->w_width - (int)Prenum1);\n\t\tbreak;", "/* set current window width */\n case '|':\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\twin_setwidth(Prenum != 0 ? (int)Prenum : 9999);\n\t\tbreak;", "/* jump to tag and split window if tag exists (in preview window) */\n#if defined(FEAT_QUICKFIX)\n case '}':\n\t\tCHECK_CMDWIN;\n\t\tif (Prenum)\n\t\t g_do_tagpreview = Prenum;\n\t\telse\n\t\t g_do_tagpreview = p_pvh;\n#endif\n\t\t/* FALLTHROUGH */\n case ']':\n case Ctrl_RSB:\n\t\tCHECK_CMDWIN;\n\t\t/* keep Visual mode, can select words to use as a tag */\n\t\tif (Prenum)\n\t\t postponed_split = Prenum;\n\t\telse\n\t\t postponed_split = -1;\n#ifdef FEAT_QUICKFIX\n\t\tif (nchar != '}')\n\t\t g_do_tagpreview = 0;\n#endif", "\t\t/* Execute the command right here, required when \"wincmd ]\"\n\t\t * was used in a function. */\n\t\tdo_nv_ident(Ctrl_RSB, NUL);\n\t\tbreak;", "#ifdef FEAT_SEARCHPATH\n/* edit file name under cursor in a new window */\n case 'f':\n case 'F':\n case Ctrl_F:\nwingotofile:\n\t\tCHECK_CMDWIN;", "\t\tptr = grab_file_name(Prenum1, &lnum);\n\t\tif (ptr != NULL)\n\t\t{\n\t\t tabpage_T\t*oldtab = curtab;\n\t\t win_T\t*oldwin = curwin;\n# ifdef FEAT_GUI\n\t\t need_mouse_correct = TRUE;\n# endif\n\t\t setpcmark();\n\t\t if (win_split(0, 0) == OK)\n\t\t {\n\t\t\tRESET_BINDING(curwin);\n\t\t\tif (do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL,\n\t\t\t\t\t\t ECMD_HIDE, NULL) == FAIL)\n\t\t\t{\n\t\t\t /* Failed to open the file, close the window\n\t\t\t * opened for it. */\n\t\t\t win_close(curwin, FALSE);\n\t\t\t goto_tabpage_win(oldtab, oldwin);\n\t\t\t}\n\t\t\telse if (nchar == 'F' && lnum >= 0)\n\t\t\t{\n\t\t\t curwin->w_cursor.lnum = lnum;\n\t\t\t check_cursor_lnum();\n\t\t\t beginline(BL_SOL | BL_FIX);\n\t\t\t}\n\t\t }\n\t\t vim_free(ptr);\n\t\t}\n\t\tbreak;\n#endif", "#ifdef FEAT_FIND_ID\n/* Go to the first occurrence of the identifier under cursor along path in a\n * new window -- webb\n */\n case 'i':\t\t\t /* Go to any match */\n case Ctrl_I:\n\t\ttype = FIND_ANY;\n\t\t/* FALLTHROUGH */\n case 'd':\t\t\t /* Go to definition, using 'define' */\n case Ctrl_D:\n\t\tCHECK_CMDWIN;\n\t\tif ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0)\n\t\t break;\n\t\tfind_pattern_in_path(ptr, 0, len, TRUE,\n\t\t\tPrenum == 0 ? TRUE : FALSE, type,\n\t\t\tPrenum1, ACTION_SPLIT, (linenr_T)1, (linenr_T)MAXLNUM);\n\t\tcurwin->w_set_curswant = TRUE;\n\t\tbreak;\n#endif", "/* Quickfix window only: view the result under the cursor in a new split. */\n#if defined(FEAT_QUICKFIX)\n case K_KENTER:\n case CAR:\n\t\tif (bt_quickfix(curbuf))\n\t\t qf_view_result(TRUE);\n\t\tbreak;\n#endif", "/* CTRL-W g extended commands */\n case 'g':\n case Ctrl_G:\n\t\tCHECK_CMDWIN;\n#ifdef USE_ON_FLY_SCROLL\n\t\tdont_scroll = TRUE;\t\t/* disallow scrolling here */\n#endif\n\t\t++no_mapping;\n\t\t++allow_keys; /* no mapping for xchar, but allow key codes */\n\t\tif (xchar == NUL)\n\t\t xchar = plain_vgetc();\n\t\tLANGMAP_ADJUST(xchar, TRUE);\n\t\t--no_mapping;\n\t\t--allow_keys;\n#ifdef FEAT_CMDL_INFO\n\t\t(void)add_to_showcmd(xchar);\n#endif\n\t\tswitch (xchar)\n\t\t{\n#if defined(FEAT_QUICKFIX)\n\t\t case '}':\n\t\t\txchar = Ctrl_RSB;\n\t\t\tif (Prenum)\n\t\t\t g_do_tagpreview = Prenum;\n\t\t\telse\n\t\t\t g_do_tagpreview = p_pvh;\n#endif\n\t\t\t/* FALLTHROUGH */\n\t\t case ']':\n\t\t case Ctrl_RSB:\n\t\t\t/* keep Visual mode, can select words to use as a tag */\n\t\t\tif (Prenum)\n\t\t\t postponed_split = Prenum;\n\t\t\telse\n\t\t\t postponed_split = -1;", "\t\t\t/* Execute the command right here, required when\n\t\t\t * \"wincmd g}\" was used in a function. */\n\t\t\tdo_nv_ident('g', xchar);\n\t\t\tbreak;", "#ifdef FEAT_SEARCHPATH\n\t\t case 'f':\t /* CTRL-W gf: \"gf\" in a new tab page */\n\t\t case 'F':\t /* CTRL-W gF: \"gF\" in a new tab page */\n\t\t\tcmdmod.tab = tabpage_index(curtab) + 1;\n\t\t\tnchar = xchar;\n\t\t\tgoto wingotofile;\n#endif\n\t\t case 't':\t // CTRL-W gt: go to next tab page\n\t\t\tgoto_tabpage((int)Prenum);\n\t\t\tbreak;", "\t\t case 'T':\t // CTRL-W gT: go to previous tab page\n\t\t\tgoto_tabpage(-(int)Prenum1);\n\t\t\tbreak;", "\t\t default:\n\t\t\tbeep_flush();\n\t\t\tbreak;\n\t\t}\n\t\tbreak;", " default:\tbeep_flush();\n\t\tbreak;\n }\n}", "/*\n * Figure out the address type for \":wincmd\".\n */\n void\nget_wincmd_addr_type(char_u *arg, exarg_T *eap)\n{\n switch (*arg)\n {\n case 'S':\n case Ctrl_S:\n case 's':\n case Ctrl_N:\n case 'n':\n case 'j':\n case Ctrl_J:\n case 'k':\n case Ctrl_K:\n case 'T':\n case Ctrl_R:\n case 'r':\n case 'R':\n case 'K':\n case 'J':\n case '+':\n case '-':\n case Ctrl__:\n case '_':\n case '|':\n case ']':\n case Ctrl_RSB:\n case 'g':\n case Ctrl_G:\n case Ctrl_V:\n case 'v':\n case 'h':\n case Ctrl_H:\n case 'l':\n case Ctrl_L:\n case 'H':\n case 'L':\n case '>':\n case '<':\n#if defined(FEAT_QUICKFIX)\n case '}':\n#endif\n#ifdef FEAT_SEARCHPATH\n case 'f':\n case 'F':\n case Ctrl_F:\n#endif\n#ifdef FEAT_FIND_ID\n case 'i':\n case Ctrl_I:\n case 'd':\n case Ctrl_D:\n#endif\n\t\t// window size or any count\n\t\teap->addr_type = ADDR_OTHER;\n\t\tbreak;", " case Ctrl_HAT:\n case '^':\n\t\t// buffer number\n\t\teap->addr_type = ADDR_BUFFERS;\n\t\tbreak;", " case Ctrl_Q:\n case 'q':\n case Ctrl_C:\n case 'c':\n case Ctrl_O:\n case 'o':\n case Ctrl_W:\n case 'w':\n case 'W':\n case 'x':\n case Ctrl_X:\n\t\t// window number\n\t\teap->addr_type = ADDR_WINDOWS;\n\t\tbreak;", "#if defined(FEAT_QUICKFIX)\n case Ctrl_Z:\n case 'z':\n case 'P':\n#endif\n case 't':\n case Ctrl_T:\n case 'b':\n case Ctrl_B:\n case 'p':\n case Ctrl_P:\n case '=':\n case CAR:\n\t\t// no count\n\t\teap->addr_type = ADDR_NONE;\n\t\tbreak;\n }\n}", " static void\ncmd_with_count(\n char\t*cmd,\n char_u\t*bufp,\n size_t\tbufsize,\n long\tPrenum)\n{\n size_t\tlen = STRLEN(cmd);", " STRCPY(bufp, cmd);\n if (Prenum > 0)\n\tvim_snprintf((char *)bufp + len, bufsize - len, \"%ld\", Prenum);\n}", "/*\n * If \"split_disallowed\" is set given an error and return FAIL.\n * Otherwise return OK.\n */\n static int\ncheck_split_disallowed()\n{\n if (split_disallowed > 0)\n {\n\temsg(_(\"E242: Can't split a window while closing another\"));\n\treturn FAIL;\n }\n return OK;\n}", "/*\n * split the current window, implements CTRL-W s and :split\n *\n * \"size\" is the height or width for the new window, 0 to use half of current\n * height or width.\n *\n * \"flags\":\n * WSP_ROOM: require enough room for new window\n * WSP_VERT: vertical split.\n * WSP_TOP: open window at the top-left of the shell (help window).\n * WSP_BOT: open window at the bottom-right of the shell (quickfix window).\n * WSP_HELP: creating the help window, keep layout snapshot\n *\n * return FAIL for failure, OK otherwise\n */\n int\nwin_split(int size, int flags)\n{\n if (ERROR_IF_POPUP_WINDOW)\n\treturn FAIL;", " /* When the \":tab\" modifier was used open a new tab page instead. */\n if (may_open_tabpage() == OK)\n\treturn OK;", " /* Add flags from \":vertical\", \":topleft\" and \":botright\". */\n flags |= cmdmod.split;\n if ((flags & WSP_TOP) && (flags & WSP_BOT))\n {\n\temsg(_(\"E442: Can't split topleft and botright at the same time\"));\n\treturn FAIL;\n }\n if (check_split_disallowed() == FAIL)\n\treturn FAIL;", " /* When creating the help window make a snapshot of the window layout.\n * Otherwise clear the snapshot, it's now invalid. */\n if (flags & WSP_HELP)\n\tmake_snapshot(SNAP_HELP_IDX);\n else\n\tclear_snapshot(curtab, SNAP_HELP_IDX);", " return win_split_ins(size, flags, NULL, 0);\n}", "/*\n * When \"new_wp\" is NULL: split the current window in two.\n * When \"new_wp\" is not NULL: insert this window at the far\n * top/left/right/bottom.\n * return FAIL for failure, OK otherwise\n */\n int\nwin_split_ins(\n int\t\tsize,\n int\t\tflags,\n win_T\t*new_wp,\n int\t\tdir)\n{\n win_T\t*wp = new_wp;\n win_T\t*oldwin;\n int\t\tnew_size = size;\n int\t\ti;\n int\t\tneed_status = 0;\n int\t\tdo_equal = FALSE;\n int\t\tneeded;\n int\t\tavailable;\n int\t\toldwin_height = 0;\n int\t\tlayout;\n frame_T\t*frp, *curfrp, *frp2, *prevfrp;\n int\t\tbefore;\n int\t\tminheight;\n int\t\twmh1;\n int\t\tdid_set_fraction = FALSE;", " if (flags & WSP_TOP)\n\toldwin = firstwin;\n else if (flags & WSP_BOT)\n\toldwin = lastwin;\n else\n\toldwin = curwin;", " /* add a status line when p_ls == 1 and splitting the first window */\n if (ONE_WINDOW && p_ls == 1 && oldwin->w_status_height == 0)\n {\n\tif (VISIBLE_HEIGHT(oldwin) <= p_wmh && new_wp == NULL)\n\t{\n\t emsg(_(e_noroom));\n\t return FAIL;\n\t}\n\tneed_status = STATUS_HEIGHT;\n }", "#ifdef FEAT_GUI\n /* May be needed for the scrollbars that are going to change. */\n if (gui.in_use)\n\tout_flush();\n#endif", " if (flags & WSP_VERT)\n {\n\tint\twmw1;\n\tint\tminwidth;", "\tlayout = FR_ROW;", "\t/*\n\t * Check if we are able to split the current window and compute its\n\t * width.\n\t */\n\t/* Current window requires at least 1 space. */\n\twmw1 = (p_wmw == 0 ? 1 : p_wmw);\n\tneeded = wmw1 + 1;\n\tif (flags & WSP_ROOM)\n\t needed += p_wiw - wmw1;\n\tif (flags & (WSP_BOT | WSP_TOP))\n\t{\n\t minwidth = frame_minwidth(topframe, NOWIN);\n\t available = topframe->fr_width;\n\t needed += minwidth;\n\t}\n\telse if (p_ea)\n\t{\n\t minwidth = frame_minwidth(oldwin->w_frame, NOWIN);\n\t prevfrp = oldwin->w_frame;\n\t for (frp = oldwin->w_frame->fr_parent; frp != NULL;\n\t\t\t\t\t\t\tfrp = frp->fr_parent)\n\t {\n\t\tif (frp->fr_layout == FR_ROW)\n\t\t FOR_ALL_FRAMES(frp2, frp->fr_child)\n\t\t\tif (frp2 != prevfrp)\n\t\t\t minwidth += frame_minwidth(frp2, NOWIN);\n\t\tprevfrp = frp;\n\t }\n\t available = topframe->fr_width;\n\t needed += minwidth;\n\t}\n\telse\n\t{\n\t minwidth = frame_minwidth(oldwin->w_frame, NOWIN);\n\t available = oldwin->w_frame->fr_width;\n\t needed += minwidth;\n\t}\n\tif (available < needed && new_wp == NULL)\n\t{\n\t emsg(_(e_noroom));\n\t return FAIL;\n\t}\n\tif (new_size == 0)\n\t new_size = oldwin->w_width / 2;\n\tif (new_size > available - minwidth - 1)\n\t new_size = available - minwidth - 1;\n\tif (new_size < wmw1)\n\t new_size = wmw1;", "\t/* if it doesn't fit in the current window, need win_equal() */\n\tif (oldwin->w_width - new_size - 1 < p_wmw)\n\t do_equal = TRUE;", "\t/* We don't like to take lines for the new window from a\n\t * 'winfixwidth' window. Take them from a window to the left or right\n\t * instead, if possible. Add one for the separator. */\n\tif (oldwin->w_p_wfw)\n\t win_setwidth_win(oldwin->w_width + new_size + 1, oldwin);", "\t/* Only make all windows the same width if one of them (except oldwin)\n\t * is wider than one of the split windows. */\n\tif (!do_equal && p_ea && size == 0 && *p_ead != 'v'\n\t\t\t\t\t && oldwin->w_frame->fr_parent != NULL)\n\t{\n\t frp = oldwin->w_frame->fr_parent->fr_child;\n\t while (frp != NULL)\n\t {\n\t\tif (frp->fr_win != oldwin && frp->fr_win != NULL\n\t\t\t&& (frp->fr_win->w_width > new_size\n\t\t\t || frp->fr_win->w_width > oldwin->w_width\n\t\t\t\t\t\t\t - new_size - 1))\n\t\t{\n\t\t do_equal = TRUE;\n\t\t break;\n\t\t}\n\t\tfrp = frp->fr_next;\n\t }\n\t}\n }\n else\n {\n\tlayout = FR_COL;", "\t/*\n\t * Check if we are able to split the current window and compute its\n\t * height.\n\t */\n\t/* Current window requires at least 1 space. */\n\twmh1 = (p_wmh == 0 ? 1 : p_wmh) + WINBAR_HEIGHT(curwin);\n\tneeded = wmh1 + STATUS_HEIGHT;\n\tif (flags & WSP_ROOM)\n\t needed += p_wh - wmh1;\n\tif (flags & (WSP_BOT | WSP_TOP))\n\t{\n\t minheight = frame_minheight(topframe, NOWIN) + need_status;\n\t available = topframe->fr_height;\n\t needed += minheight;\n\t}\n\telse if (p_ea)\n\t{\n\t minheight = frame_minheight(oldwin->w_frame, NOWIN) + need_status;\n\t prevfrp = oldwin->w_frame;\n\t for (frp = oldwin->w_frame->fr_parent; frp != NULL;\n\t\t\t\t\t\t\tfrp = frp->fr_parent)\n\t {\n\t\tif (frp->fr_layout == FR_COL)\n\t\t FOR_ALL_FRAMES(frp2, frp->fr_child)\n\t\t\tif (frp2 != prevfrp)\n\t\t\t minheight += frame_minheight(frp2, NOWIN);\n\t\tprevfrp = frp;\n\t }\n\t available = topframe->fr_height;\n\t needed += minheight;\n\t}\n\telse\n\t{\n\t minheight = frame_minheight(oldwin->w_frame, NOWIN) + need_status;\n\t available = oldwin->w_frame->fr_height;\n\t needed += minheight;\n\t}\n\tif (available < needed && new_wp == NULL)\n\t{\n\t emsg(_(e_noroom));\n\t return FAIL;\n\t}\n\toldwin_height = oldwin->w_height;\n\tif (need_status)\n\t{\n\t oldwin->w_status_height = STATUS_HEIGHT;\n\t oldwin_height -= STATUS_HEIGHT;\n\t}\n\tif (new_size == 0)\n\t new_size = oldwin_height / 2;\n\tif (new_size > available - minheight - STATUS_HEIGHT)\n\t new_size = available - minheight - STATUS_HEIGHT;\n\tif (new_size < wmh1)\n\t new_size = wmh1;", "\t/* if it doesn't fit in the current window, need win_equal() */\n\tif (oldwin_height - new_size - STATUS_HEIGHT < p_wmh)\n\t do_equal = TRUE;", "\t/* We don't like to take lines for the new window from a\n\t * 'winfixheight' window. Take them from a window above or below\n\t * instead, if possible. */\n\tif (oldwin->w_p_wfh)\n\t{\n\t /* Set w_fraction now so that the cursor keeps the same relative\n\t * vertical position using the old height. */\n\t set_fraction(oldwin);\n\t did_set_fraction = TRUE;", "\t win_setheight_win(oldwin->w_height + new_size + STATUS_HEIGHT,\n\t\t\t\t\t\t\t\t oldwin);\n\t oldwin_height = oldwin->w_height;\n\t if (need_status)\n\t\toldwin_height -= STATUS_HEIGHT;\n\t}", "\t/* Only make all windows the same height if one of them (except oldwin)\n\t * is higher than one of the split windows. */\n\tif (!do_equal && p_ea && size == 0 && *p_ead != 'h'\n\t && oldwin->w_frame->fr_parent != NULL)\n\t{\n\t frp = oldwin->w_frame->fr_parent->fr_child;\n\t while (frp != NULL)\n\t {\n\t\tif (frp->fr_win != oldwin && frp->fr_win != NULL\n\t\t\t&& (frp->fr_win->w_height > new_size\n\t\t\t || frp->fr_win->w_height > oldwin_height - new_size\n\t\t\t\t\t\t\t - STATUS_HEIGHT))\n\t\t{\n\t\t do_equal = TRUE;\n\t\t break;\n\t\t}\n\t\tfrp = frp->fr_next;\n\t }\n\t}\n }", " /*\n * allocate new window structure and link it in the window list\n */\n if ((flags & WSP_TOP) == 0\n\t && ((flags & WSP_BOT)\n\t\t|| (flags & WSP_BELOW)\n\t\t|| (!(flags & WSP_ABOVE)\n\t\t && ( (flags & WSP_VERT) ? p_spr : p_sb))))\n {\n\t/* new window below/right of current one */\n\tif (new_wp == NULL)\n\t wp = win_alloc(oldwin, FALSE);\n\telse\n\t win_append(oldwin, wp);\n }\n else\n {\n\tif (new_wp == NULL)\n\t wp = win_alloc(oldwin->w_prev, FALSE);\n\telse\n\t win_append(oldwin->w_prev, wp);\n }", " if (new_wp == NULL)\n {\n\tif (wp == NULL)\n\t return FAIL;", "\tnew_frame(wp);\n\tif (wp->w_frame == NULL)\n\t{\n\t win_free(wp, NULL);\n\t return FAIL;\n\t}", "\t/* make the contents of the new window the same as the current one */\n\twin_init(wp, curwin, flags);\n }", " /*\n * Reorganise the tree of frames to insert the new window.\n */\n if (flags & (WSP_TOP | WSP_BOT))\n {\n\tif ((topframe->fr_layout == FR_COL && (flags & WSP_VERT) == 0)\n\t || (topframe->fr_layout == FR_ROW && (flags & WSP_VERT) != 0))\n\t{\n\t curfrp = topframe->fr_child;\n\t if (flags & WSP_BOT)\n\t\twhile (curfrp->fr_next != NULL)\n\t\t curfrp = curfrp->fr_next;\n\t}\n\telse\n\t curfrp = topframe;\n\tbefore = (flags & WSP_TOP);\n }\n else\n {\n\tcurfrp = oldwin->w_frame;\n\tif (flags & WSP_BELOW)\n\t before = FALSE;\n\telse if (flags & WSP_ABOVE)\n\t before = TRUE;\n\telse if (flags & WSP_VERT)\n\t before = !p_spr;\n\telse\n\t before = !p_sb;\n }\n if (curfrp->fr_parent == NULL || curfrp->fr_parent->fr_layout != layout)\n {\n\t/* Need to create a new frame in the tree to make a branch. */\n\tfrp = ALLOC_CLEAR_ONE(frame_T);\n\t*frp = *curfrp;\n\tcurfrp->fr_layout = layout;\n\tfrp->fr_parent = curfrp;\n\tfrp->fr_next = NULL;\n\tfrp->fr_prev = NULL;\n\tcurfrp->fr_child = frp;\n\tcurfrp->fr_win = NULL;\n\tcurfrp = frp;\n\tif (frp->fr_win != NULL)\n\t oldwin->w_frame = frp;\n\telse\n\t FOR_ALL_FRAMES(frp, frp->fr_child)\n\t\tfrp->fr_parent = curfrp;\n }", " if (new_wp == NULL)\n\tfrp = wp->w_frame;\n else\n\tfrp = new_wp->w_frame;\n frp->fr_parent = curfrp->fr_parent;", " /* Insert the new frame at the right place in the frame list. */\n if (before)\n\tframe_insert(curfrp, frp);\n else\n\tframe_append(curfrp, frp);", " /* Set w_fraction now so that the cursor keeps the same relative\n * vertical position. */\n if (!did_set_fraction)\n\tset_fraction(oldwin);\n wp->w_fraction = oldwin->w_fraction;", " if (flags & WSP_VERT)\n {\n\twp->w_p_scr = curwin->w_p_scr;", "\tif (need_status)\n\t{\n\t win_new_height(oldwin, oldwin->w_height - 1);\n\t oldwin->w_status_height = need_status;\n\t}\n\tif (flags & (WSP_TOP | WSP_BOT))\n\t{\n\t /* set height and row of new window to full height */\n\t wp->w_winrow = tabline_height();\n\t win_new_height(wp, curfrp->fr_height - (p_ls > 0)\n\t\t\t\t\t\t\t - WINBAR_HEIGHT(wp));\n\t wp->w_status_height = (p_ls > 0);\n\t}\n\telse\n\t{\n\t /* height and row of new window is same as current window */\n\t wp->w_winrow = oldwin->w_winrow;\n\t win_new_height(wp, VISIBLE_HEIGHT(oldwin));\n\t wp->w_status_height = oldwin->w_status_height;\n\t}\n\tfrp->fr_height = curfrp->fr_height;", "\t/* \"new_size\" of the current window goes to the new window, use\n\t * one column for the vertical separator */\n\twin_new_width(wp, new_size);\n\tif (before)\n\t wp->w_vsep_width = 1;\n\telse\n\t{\n\t wp->w_vsep_width = oldwin->w_vsep_width;\n\t oldwin->w_vsep_width = 1;\n\t}\n\tif (flags & (WSP_TOP | WSP_BOT))\n\t{\n\t if (flags & WSP_BOT)\n\t\tframe_add_vsep(curfrp);\n\t /* Set width of neighbor frame */\n\t frame_new_width(curfrp, curfrp->fr_width\n\t\t - (new_size + ((flags & WSP_TOP) != 0)), flags & WSP_TOP,\n\t\t\t\t\t\t\t\t FALSE);\n\t}\n\telse\n\t win_new_width(oldwin, oldwin->w_width - (new_size + 1));\n\tif (before)\t/* new window left of current one */\n\t{\n\t wp->w_wincol = oldwin->w_wincol;\n\t oldwin->w_wincol += new_size + 1;\n\t}\n\telse\t\t/* new window right of current one */\n\t wp->w_wincol = oldwin->w_wincol + oldwin->w_width + 1;\n\tframe_fix_width(oldwin);\n\tframe_fix_width(wp);\n }\n else\n {\n\t/* width and column of new window is same as current window */\n\tif (flags & (WSP_TOP | WSP_BOT))\n\t{\n\t wp->w_wincol = 0;\n\t win_new_width(wp, Columns);\n\t wp->w_vsep_width = 0;\n\t}\n\telse\n\t{\n\t wp->w_wincol = oldwin->w_wincol;\n\t win_new_width(wp, oldwin->w_width);\n\t wp->w_vsep_width = oldwin->w_vsep_width;\n\t}\n\tfrp->fr_width = curfrp->fr_width;", "\t/* \"new_size\" of the current window goes to the new window, use\n\t * one row for the status line */\n\twin_new_height(wp, new_size);\n\tif (flags & (WSP_TOP | WSP_BOT))\n\t{\n\t int new_fr_height = curfrp->fr_height - new_size\n\t\t\t\t\t\t\t + WINBAR_HEIGHT(wp) ;", "\t if (!((flags & WSP_BOT) && p_ls == 0))\n\t\tnew_fr_height -= STATUS_HEIGHT;\n\t frame_new_height(curfrp, new_fr_height, flags & WSP_TOP, FALSE);\n\t}\n\telse\n\t win_new_height(oldwin, oldwin_height - (new_size + STATUS_HEIGHT));\n\tif (before)\t/* new window above current one */\n\t{\n\t wp->w_winrow = oldwin->w_winrow;\n\t wp->w_status_height = STATUS_HEIGHT;\n\t oldwin->w_winrow += wp->w_height + STATUS_HEIGHT;\n\t}\n\telse\t\t/* new window below current one */\n\t{\n\t wp->w_winrow = oldwin->w_winrow + VISIBLE_HEIGHT(oldwin)\n\t\t\t\t\t\t\t + STATUS_HEIGHT;\n\t wp->w_status_height = oldwin->w_status_height;\n\t if (!(flags & WSP_BOT))\n\t\toldwin->w_status_height = STATUS_HEIGHT;\n\t}\n\tif (flags & WSP_BOT)\n\t frame_add_statusline(curfrp);\n\tframe_fix_height(wp);\n\tframe_fix_height(oldwin);\n }", " if (flags & (WSP_TOP | WSP_BOT))\n\t(void)win_comp_pos();", " /*\n * Both windows need redrawing\n */\n redraw_win_later(wp, NOT_VALID);\n wp->w_redr_status = TRUE;\n redraw_win_later(oldwin, NOT_VALID);\n oldwin->w_redr_status = TRUE;", " if (need_status)\n {\n\tmsg_row = Rows - 1;\n\tmsg_col = sc_col;\n\tmsg_clr_eos_force();\t/* Old command/ruler may still be there */\n\tcomp_col();\n\tmsg_row = Rows - 1;\n\tmsg_col = 0;\t/* put position back at start of line */\n }", " /*\n * equalize the window sizes.\n */\n if (do_equal || dir != 0)\n\twin_equal(wp, TRUE,\n\t\t(flags & WSP_VERT) ? (dir == 'v' ? 'b' : 'h')\n\t\t: dir == 'h' ? 'b' : 'v');", " /* Don't change the window height/width to 'winheight' / 'winwidth' if a\n * size was given. */\n if (flags & WSP_VERT)\n {\n\ti = p_wiw;\n\tif (size != 0)\n\t p_wiw = size;", "# ifdef FEAT_GUI\n\t/* When 'guioptions' includes 'L' or 'R' may have to add scrollbars. */\n\tif (gui.in_use)\n\t gui_init_which_components(NULL);\n# endif\n }\n else\n {\n\ti = p_wh;\n\tif (size != 0)\n\t p_wh = size;\n }", "#ifdef FEAT_JUMPLIST\n /* Keep same changelist position in new window. */\n wp->w_changelistidx = oldwin->w_changelistidx;\n#endif", " /*\n * make the new window the current window\n */\n win_enter_ext(wp, FALSE, FALSE, TRUE, TRUE, TRUE);\n if (flags & WSP_VERT)\n\tp_wiw = i;\n else\n\tp_wh = i;", " return OK;\n}", "\n/*\n * Initialize window \"newp\" from window \"oldp\".\n * Used when splitting a window and when creating a new tab page.\n * The windows will both edit the same buffer.\n * WSP_NEWLOC may be specified in flags to prevent the location list from\n * being copied.\n */\n static void\nwin_init(win_T *newp, win_T *oldp, int flags UNUSED)\n{\n int\t\ti;", " newp->w_buffer = oldp->w_buffer;\n#ifdef FEAT_SYN_HL\n newp->w_s = &(oldp->w_buffer->b_s);\n#endif\n oldp->w_buffer->b_nwindows++;\n newp->w_cursor = oldp->w_cursor;\n newp->w_valid = 0;\n newp->w_curswant = oldp->w_curswant;\n newp->w_set_curswant = oldp->w_set_curswant;\n newp->w_topline = oldp->w_topline;\n#ifdef FEAT_DIFF\n newp->w_topfill = oldp->w_topfill;\n#endif\n newp->w_leftcol = oldp->w_leftcol;\n newp->w_pcmark = oldp->w_pcmark;\n newp->w_prev_pcmark = oldp->w_prev_pcmark;\n newp->w_alt_fnum = oldp->w_alt_fnum;\n newp->w_wrow = oldp->w_wrow;\n newp->w_fraction = oldp->w_fraction;\n newp->w_prev_fraction_row = oldp->w_prev_fraction_row;\n#ifdef FEAT_JUMPLIST\n copy_jumplist(oldp, newp);\n#endif\n#ifdef FEAT_QUICKFIX\n if (flags & WSP_NEWLOC)\n {\n\t/* Don't copy the location list. */\n\tnewp->w_llist = NULL;\n\tnewp->w_llist_ref = NULL;\n }\n else\n\tcopy_loclist_stack(oldp, newp);\n#endif\n newp->w_localdir = (oldp->w_localdir == NULL)\n\t\t\t\t ? NULL : vim_strsave(oldp->w_localdir);", " /* copy tagstack and folds */\n for (i = 0; i < oldp->w_tagstacklen; i++)\n {\n\ttaggy_T\t*tag = &newp->w_tagstack[i];\n\t*tag = oldp->w_tagstack[i];\n\tif (tag->tagname != NULL)\n\t tag->tagname = vim_strsave(tag->tagname);\n\tif (tag->user_data != NULL)\n\t tag->user_data = vim_strsave(tag->user_data);\n }\n newp->w_tagstackidx = oldp->w_tagstackidx;\n newp->w_tagstacklen = oldp->w_tagstacklen;\n#ifdef FEAT_FOLDING\n copyFoldingState(oldp, newp);\n#endif", " win_init_some(newp, oldp);", "#ifdef FEAT_SYN_HL\n check_colorcolumn(newp);\n#endif\n}", "/*\n * Initialize window \"newp\" from window \"old\".\n * Only the essential things are copied.\n */\n static void\nwin_init_some(win_T *newp, win_T *oldp)\n{\n /* Use the same argument list. */\n newp->w_alist = oldp->w_alist;\n ++newp->w_alist->al_refcount;\n newp->w_arg_idx = oldp->w_arg_idx;", " /* copy options from existing window */\n win_copy_options(oldp, newp);\n}", "/*\n * Return TRUE if \"win\" is a global popup or a popup in the current tab page.\n */\n int\nwin_valid_popup(win_T *win UNUSED)\n{\n#ifdef FEAT_TEXT_PROP\n win_T\t*wp;", " for (wp = first_popupwin; wp != NULL; wp = wp->w_next)\n\tif (wp == win)\n\t return TRUE;\n for (wp = curtab->tp_first_popupwin; wp != NULL; wp = wp->w_next)\n\tif (wp == win)\n\t return TRUE;\n#endif\n return FALSE;\n}", "/*\n * Check if \"win\" is a pointer to an existing window in the current tab page.\n */\n int\nwin_valid(win_T *win)\n{\n win_T\t*wp;", " if (win == NULL)\n\treturn FALSE;\n FOR_ALL_WINDOWS(wp)\n\tif (wp == win)\n\t return TRUE;\n return win_valid_popup(win);\n}", "/*\n * Check if \"win\" is a pointer to an existing window in any tab page.\n */\n int\nwin_valid_any_tab(win_T *win)\n{\n win_T\t*wp;\n tabpage_T\t*tp;", " if (win == NULL)\n\treturn FALSE;\n FOR_ALL_TABPAGES(tp)\n {\n\tFOR_ALL_WINDOWS_IN_TAB(tp, wp)\n\t{\n\t if (wp == win)\n\t\treturn TRUE;\n\t}\n#ifdef FEAT_TEXT_PROP\n\tfor (wp = tp->tp_first_popupwin; wp != NULL; wp = wp->w_next)\n\t if (wp == win)\n\t\treturn TRUE;\n#endif\n }\n return win_valid_popup(win);\n}", "/*\n * Return the number of windows.\n */\n int\nwin_count(void)\n{\n win_T\t*wp;\n int\t\tcount = 0;", " FOR_ALL_WINDOWS(wp)\n\t++count;\n return count;\n}", "/*\n * Make \"count\" windows on the screen.\n * Return actual number of windows on the screen.\n * Must be called when there is just one window, filling the whole screen\n * (excluding the command line).\n */\n int\nmake_windows(\n int\t\tcount,\n int\t\tvertical UNUSED) /* split windows vertically if TRUE */\n{\n int\t\tmaxcount;\n int\t\ttodo;", " if (vertical)\n {\n\t/* Each windows needs at least 'winminwidth' lines and a separator\n\t * column. */\n\tmaxcount = (curwin->w_width + curwin->w_vsep_width\n\t\t\t\t\t - (p_wiw - p_wmw)) / (p_wmw + 1);\n }\n else\n {\n\t/* Each window needs at least 'winminheight' lines and a status line. */\n\tmaxcount = (VISIBLE_HEIGHT(curwin) + curwin->w_status_height\n\t\t\t\t - (p_wh - p_wmh)) / (p_wmh + STATUS_HEIGHT);\n }", " if (maxcount < 2)\n\tmaxcount = 2;\n if (count > maxcount)\n\tcount = maxcount;", " /*\n * add status line now, otherwise first window will be too big\n */\n if (count > 1)\n\tlast_status(TRUE);", " /*\n * Don't execute autocommands while creating the windows. Must do that\n * when putting the buffers in the windows.\n */\n block_autocmds();", " /* todo is number of windows left to create */\n for (todo = count - 1; todo > 0; --todo)\n\tif (vertical)\n\t{\n\t if (win_split(curwin->w_width - (curwin->w_width - todo)\n\t\t\t/ (todo + 1) - 1, WSP_VERT | WSP_ABOVE) == FAIL)\n\t\tbreak;\n\t}\n\telse\n\t{\n\t if (win_split(curwin->w_height - (curwin->w_height - todo\n\t\t\t * STATUS_HEIGHT) / (todo + 1)\n\t\t\t- STATUS_HEIGHT, WSP_ABOVE) == FAIL)\n\t\tbreak;\n\t}", " unblock_autocmds();", " /* return actual number of windows */\n return (count - todo);\n}", "/*\n * Exchange current and next window\n */\n static void\nwin_exchange(long Prenum)\n{\n frame_T\t*frp;\n frame_T\t*frp2;\n win_T\t*wp;\n win_T\t*wp2;\n int\t\ttemp;", " if (ERROR_IF_POPUP_WINDOW)\n\treturn;\n if (ONE_WINDOW)\t // just one window\n {\n\tbeep_flush();\n\treturn;\n }", "#ifdef FEAT_GUI\n need_mouse_correct = TRUE;\n#endif", " /*\n * find window to exchange with\n */\n if (Prenum)\n {\n\tfrp = curwin->w_frame->fr_parent->fr_child;\n\twhile (frp != NULL && --Prenum > 0)\n\t frp = frp->fr_next;\n }\n else if (curwin->w_frame->fr_next != NULL)\t/* Swap with next */\n\tfrp = curwin->w_frame->fr_next;\n else /* Swap last window in row/col with previous */\n\tfrp = curwin->w_frame->fr_prev;", " /* We can only exchange a window with another window, not with a frame\n * containing windows. */\n if (frp == NULL || frp->fr_win == NULL || frp->fr_win == curwin)\n\treturn;\n wp = frp->fr_win;", "/*\n * 1. remove curwin from the list. Remember after which window it was in wp2\n * 2. insert curwin before wp in the list\n * if wp != wp2\n * 3. remove wp from the list\n * 4. insert wp after wp2\n * 5. exchange the status line height and vsep width.\n */\n wp2 = curwin->w_prev;\n frp2 = curwin->w_frame->fr_prev;\n if (wp->w_prev != curwin)\n {\n\twin_remove(curwin, NULL);\n\tframe_remove(curwin->w_frame);\n\twin_append(wp->w_prev, curwin);\n\tframe_insert(frp, curwin->w_frame);\n }\n if (wp != wp2)\n {\n\twin_remove(wp, NULL);\n\tframe_remove(wp->w_frame);\n\twin_append(wp2, wp);\n\tif (frp2 == NULL)\n\t frame_insert(wp->w_frame->fr_parent->fr_child, wp->w_frame);\n\telse\n\t frame_append(frp2, wp->w_frame);\n }\n temp = curwin->w_status_height;\n curwin->w_status_height = wp->w_status_height;\n wp->w_status_height = temp;\n temp = curwin->w_vsep_width;\n curwin->w_vsep_width = wp->w_vsep_width;\n wp->w_vsep_width = temp;", " /* If the windows are not in the same frame, exchange the sizes to avoid\n * messing up the window layout. Otherwise fix the frame sizes. */\n if (curwin->w_frame->fr_parent != wp->w_frame->fr_parent)\n {\n\ttemp = curwin->w_height;\n\tcurwin->w_height = wp->w_height;\n\twp->w_height = temp;\n\ttemp = curwin->w_width;\n\tcurwin->w_width = wp->w_width;\n\twp->w_width = temp;\n }\n else\n {\n\tframe_fix_height(curwin);\n\tframe_fix_height(wp);\n\tframe_fix_width(curwin);\n\tframe_fix_width(wp);\n }", " (void)win_comp_pos();\t\t/* recompute window positions */", " win_enter(wp, TRUE);\n redraw_all_later(NOT_VALID);\n}", "/*\n * rotate windows: if upwards TRUE the second window becomes the first one\n *\t\t if upwards FALSE the first window becomes the second one\n */\n static void\nwin_rotate(int upwards, int count)\n{\n win_T\t*wp1;\n win_T\t*wp2;\n frame_T\t*frp;\n int\t\tn;", " if (ONE_WINDOW)\t\t/* nothing to do */\n {\n\tbeep_flush();\n\treturn;\n }", "#ifdef FEAT_GUI\n need_mouse_correct = TRUE;\n#endif", " /* Check if all frames in this row/col have one window. */\n FOR_ALL_FRAMES(frp, curwin->w_frame->fr_parent->fr_child)\n\tif (frp->fr_win == NULL)\n\t{\n\t emsg(_(\"E443: Cannot rotate when another window is split\"));\n\t return;\n\t}", " while (count--)\n {\n\tif (upwards)\t\t/* first window becomes last window */\n\t{\n\t /* remove first window/frame from the list */\n\t frp = curwin->w_frame->fr_parent->fr_child;\n\t wp1 = frp->fr_win;\n\t win_remove(wp1, NULL);\n\t frame_remove(frp);", "\t /* find last frame and append removed window/frame after it */\n\t for ( ; frp->fr_next != NULL; frp = frp->fr_next)\n\t\t;\n\t win_append(frp->fr_win, wp1);\n\t frame_append(frp, wp1->w_frame);", "\t wp2 = frp->fr_win;\t\t/* previously last window */\n\t}\n\telse\t\t\t/* last window becomes first window */\n\t{\n\t /* find last window/frame in the list and remove it */\n\t for (frp = curwin->w_frame; frp->fr_next != NULL;\n\t\t\t\t\t\t\t frp = frp->fr_next)\n\t\t;\n\t wp1 = frp->fr_win;\n\t wp2 = wp1->w_prev;\t\t /* will become last window */\n\t win_remove(wp1, NULL);\n\t frame_remove(frp);", "\t /* append the removed window/frame before the first in the list */\n\t win_append(frp->fr_parent->fr_child->fr_win->w_prev, wp1);\n\t frame_insert(frp->fr_parent->fr_child, frp);\n\t}", "\t/* exchange status height and vsep width of old and new last window */\n\tn = wp2->w_status_height;\n\twp2->w_status_height = wp1->w_status_height;\n\twp1->w_status_height = n;\n\tframe_fix_height(wp1);\n\tframe_fix_height(wp2);\n\tn = wp2->w_vsep_width;\n\twp2->w_vsep_width = wp1->w_vsep_width;\n\twp1->w_vsep_width = n;\n\tframe_fix_width(wp1);\n\tframe_fix_width(wp2);", "\t/* recompute w_winrow and w_wincol for all windows */\n\t(void)win_comp_pos();\n }", " redraw_all_later(NOT_VALID);\n}", "/*\n * Move the current window to the very top/bottom/left/right of the screen.\n */\n static void\nwin_totop(int size, int flags)\n{\n int\t\tdir;\n int\t\theight = curwin->w_height;", " if (ONE_WINDOW)\n {\n\tbeep_flush();\n\treturn;\n }\n if (check_split_disallowed() == FAIL)\n\treturn;", " /* Remove the window and frame from the tree of frames. */\n (void)winframe_remove(curwin, &dir, NULL);\n win_remove(curwin, NULL);\n last_status(FALSE);\t /* may need to remove last status line */\n (void)win_comp_pos(); /* recompute window positions */", " /* Split a window on the desired side and put the window there. */\n (void)win_split_ins(size, flags, curwin, dir);\n if (!(flags & WSP_VERT))\n {\n\twin_setheight(height);\n\tif (p_ea)\n\t win_equal(curwin, TRUE, 'v');\n }", "#if defined(FEAT_GUI)\n /* When 'guioptions' includes 'L' or 'R' may have to remove or add\n * scrollbars. Have to update them anyway. */\n gui_may_update_scrollbars();\n#endif\n}", "/*\n * Move window \"win1\" to below/right of \"win2\" and make \"win1\" the current\n * window. Only works within the same frame!\n */\n void\nwin_move_after(win_T *win1, win_T *win2)\n{\n int\t\theight;", " /* check if the arguments are reasonable */\n if (win1 == win2)\n\treturn;", " /* check if there is something to do */\n if (win2->w_next != win1)\n {\n\tif (win1->w_frame->fr_parent != win2->w_frame->fr_parent)\n\t{\n\t iemsg(\"INTERNAL: trying to move a window into another frame\");\n\t return;\n\t}", "\t/* may need move the status line/vertical separator of the last window\n\t * */\n\tif (win1 == lastwin)\n\t{\n\t height = win1->w_prev->w_status_height;\n\t win1->w_prev->w_status_height = win1->w_status_height;\n\t win1->w_status_height = height;\n\t if (win1->w_prev->w_vsep_width == 1)\n\t {\n\t\t/* Remove the vertical separator from the last-but-one window,\n\t\t * add it to the last window. Adjust the frame widths. */\n\t\twin1->w_prev->w_vsep_width = 0;\n\t\twin1->w_prev->w_frame->fr_width -= 1;\n\t\twin1->w_vsep_width = 1;\n\t\twin1->w_frame->fr_width += 1;\n\t }\n\t}\n\telse if (win2 == lastwin)\n\t{\n\t height = win1->w_status_height;\n\t win1->w_status_height = win2->w_status_height;\n\t win2->w_status_height = height;\n\t if (win1->w_vsep_width == 1)\n\t {\n\t\t/* Remove the vertical separator from win1, add it to the last\n\t\t * window, win2. Adjust the frame widths. */\n\t\twin2->w_vsep_width = 1;\n\t\twin2->w_frame->fr_width += 1;\n\t\twin1->w_vsep_width = 0;\n\t\twin1->w_frame->fr_width -= 1;\n\t }\n\t}\n\twin_remove(win1, NULL);\n\tframe_remove(win1->w_frame);\n\twin_append(win2, win1);\n\tframe_append(win2->w_frame, win1->w_frame);", "\t(void)win_comp_pos();\t/* recompute w_winrow for all windows */\n\tredraw_later(NOT_VALID);\n }\n win_enter(win1, FALSE);\n}", "/*\n * Make all windows the same height.\n * 'next_curwin' will soon be the current window, make sure it has enough\n * rows.\n */\n void\nwin_equal(\n win_T\t*next_curwin,\t/* pointer to current window to be or NULL */\n int\t\tcurrent,\t/* do only frame with current window */\n int\t\tdir)\t\t/* 'v' for vertically, 'h' for horizontally,\n\t\t\t\t 'b' for both, 0 for using p_ead */\n{\n if (dir == 0)\n\tdir = *p_ead;\n win_equal_rec(next_curwin == NULL ? curwin : next_curwin, current,\n\t\t topframe, dir, 0, tabline_height(),\n\t\t\t\t\t (int)Columns, topframe->fr_height);\n}", "/*\n * Set a frame to a new position and height, spreading the available room\n * equally over contained frames.\n * The window \"next_curwin\" (if not NULL) should at least get the size from\n * 'winheight' and 'winwidth' if possible.\n */\n static void\nwin_equal_rec(\n win_T\t*next_curwin,\t/* pointer to current window to be or NULL */\n int\t\tcurrent,\t/* do only frame with current window */\n frame_T\t*topfr,\t\t/* frame to set size off */\n int\t\tdir,\t\t/* 'v', 'h' or 'b', see win_equal() */\n int\t\tcol,\t\t/* horizontal position for frame */\n int\t\trow,\t\t/* vertical position for frame */\n int\t\twidth,\t\t/* new width of frame */\n int\t\theight)\t\t/* new height of frame */\n{\n int\t\tn, m;\n int\t\textra_sep = 0;\n int\t\twincount, totwincount = 0;\n frame_T\t*fr;\n int\t\tnext_curwin_size = 0;\n int\t\troom = 0;\n int\t\tnew_size;\n int\t\thas_next_curwin = 0;\n int\t\thnc;", " if (topfr->fr_layout == FR_LEAF)\n {\n\t/* Set the width/height of this frame.\n\t * Redraw when size or position changes */\n\tif (topfr->fr_height != height || topfr->fr_win->w_winrow != row\n\t\t|| topfr->fr_width != width || topfr->fr_win->w_wincol != col\n\t )\n\t{\n\t topfr->fr_win->w_winrow = row;\n\t frame_new_height(topfr, height, FALSE, FALSE);\n\t topfr->fr_win->w_wincol = col;\n\t frame_new_width(topfr, width, FALSE, FALSE);\n\t redraw_all_later(NOT_VALID);\n\t}\n }\n else if (topfr->fr_layout == FR_ROW)\n {\n\ttopfr->fr_width = width;\n\ttopfr->fr_height = height;", "\tif (dir != 'v')\t\t\t/* equalize frame widths */\n\t{\n\t /* Compute the maximum number of windows horizontally in this\n\t * frame. */\n\t n = frame_minwidth(topfr, NOWIN);\n\t /* add one for the rightmost window, it doesn't have a separator */\n\t if (col + width == Columns)\n\t\textra_sep = 1;\n\t else\n\t\textra_sep = 0;\n\t totwincount = (n + extra_sep) / (p_wmw + 1);\n\t has_next_curwin = frame_has_win(topfr, next_curwin);", "\t /*\n\t * Compute width for \"next_curwin\" window and room available for\n\t * other windows.\n\t * \"m\" is the minimal width when counting p_wiw for \"next_curwin\".\n\t */\n\t m = frame_minwidth(topfr, next_curwin);\n\t room = width - m;\n\t if (room < 0)\n\t {\n\t\tnext_curwin_size = p_wiw + room;\n\t\troom = 0;\n\t }\n\t else\n\t {\n\t\tnext_curwin_size = -1;\n\t\tFOR_ALL_FRAMES(fr, topfr->fr_child)\n\t\t{\n\t\t /* If 'winfixwidth' set keep the window width if\n\t\t * possible.\n\t\t * Watch out for this window being the next_curwin. */\n\t\t if (frame_fixed_width(fr))\n\t\t {\n\t\t\tn = frame_minwidth(fr, NOWIN);\n\t\t\tnew_size = fr->fr_width;\n\t\t\tif (frame_has_win(fr, next_curwin))\n\t\t\t{\n\t\t\t room += p_wiw - p_wmw;\n\t\t\t next_curwin_size = 0;\n\t\t\t if (new_size < p_wiw)\n\t\t\t\tnew_size = p_wiw;\n\t\t\t}\n\t\t\telse\n\t\t\t /* These windows don't use up room. */\n\t\t\t totwincount -= (n + (fr->fr_next == NULL\n\t\t\t\t\t ? extra_sep : 0)) / (p_wmw + 1);\n\t\t\troom -= new_size - n;\n\t\t\tif (room < 0)\n\t\t\t{\n\t\t\t new_size += room;\n\t\t\t room = 0;\n\t\t\t}\n\t\t\tfr->fr_newwidth = new_size;\n\t\t }\n\t\t}\n\t\tif (next_curwin_size == -1)\n\t\t{\n\t\t if (!has_next_curwin)\n\t\t\tnext_curwin_size = 0;\n\t\t else if (totwincount > 1\n\t\t\t && (room + (totwincount - 2))\n\t\t\t\t\t\t / (totwincount - 1) > p_wiw)\n\t\t {\n\t\t\t/* Can make all windows wider than 'winwidth', spread\n\t\t\t * the room equally. */\n\t\t\tnext_curwin_size = (room + p_wiw\n\t\t\t\t\t + (totwincount - 1) * p_wmw\n\t\t\t\t\t + (totwincount - 1)) / totwincount;\n\t\t\troom -= next_curwin_size - p_wiw;\n\t\t }\n\t\t else\n\t\t\tnext_curwin_size = p_wiw;\n\t\t}\n\t }", "\t if (has_next_curwin)\n\t\t--totwincount;\t\t/* don't count curwin */\n\t}", "\tFOR_ALL_FRAMES(fr, topfr->fr_child)\n\t{\n\t wincount = 1;\n\t if (fr->fr_next == NULL)\n\t\t/* last frame gets all that remains (avoid roundoff error) */\n\t\tnew_size = width;\n\t else if (dir == 'v')\n\t\tnew_size = fr->fr_width;\n\t else if (frame_fixed_width(fr))\n\t {\n\t\tnew_size = fr->fr_newwidth;\n\t\twincount = 0;\t /* doesn't count as a sizeable window */\n\t }\n\t else\n\t {\n\t\t/* Compute the maximum number of windows horiz. in \"fr\". */\n\t\tn = frame_minwidth(fr, NOWIN);\n\t\twincount = (n + (fr->fr_next == NULL ? extra_sep : 0))\n\t\t\t\t\t\t\t\t/ (p_wmw + 1);\n\t\tm = frame_minwidth(fr, next_curwin);\n\t\tif (has_next_curwin)\n\t\t hnc = frame_has_win(fr, next_curwin);\n\t\telse\n\t\t hnc = FALSE;\n\t\tif (hnc)\t /* don't count next_curwin */\n\t\t --wincount;\n\t\tif (totwincount == 0)\n\t\t new_size = room;\n\t\telse\n\t\t new_size = (wincount * room + ((unsigned)totwincount >> 1))\n\t\t\t\t\t\t\t\t/ totwincount;\n\t\tif (hnc)\t /* add next_curwin size */\n\t\t{\n\t\t next_curwin_size -= p_wiw - (m - n);\n\t\t new_size += next_curwin_size;\n\t\t room -= new_size - next_curwin_size;\n\t\t}\n\t\telse\n\t\t room -= new_size;\n\t\tnew_size += n;\n\t }", "\t /* Skip frame that is full width when splitting or closing a\n\t * window, unless equalizing all frames. */\n\t if (!current || dir != 'v' || topfr->fr_parent != NULL\n\t\t || (new_size != fr->fr_width)\n\t\t || frame_has_win(fr, next_curwin))\n\t\twin_equal_rec(next_curwin, current, fr, dir, col, row,\n\t\t\t\t\t\t\t new_size, height);\n\t col += new_size;\n\t width -= new_size;\n\t totwincount -= wincount;\n\t}\n }\n else /* topfr->fr_layout == FR_COL */\n {\n\ttopfr->fr_width = width;\n\ttopfr->fr_height = height;", "\tif (dir != 'h')\t\t\t/* equalize frame heights */\n\t{\n\t /* Compute maximum number of windows vertically in this frame. */\n\t n = frame_minheight(topfr, NOWIN);\n\t /* add one for the bottom window if it doesn't have a statusline */\n\t if (row + height == cmdline_row && p_ls == 0)\n\t\textra_sep = 1;\n\t else\n\t\textra_sep = 0;\n\t totwincount = (n + extra_sep) / (p_wmh + 1);\n\t has_next_curwin = frame_has_win(topfr, next_curwin);", "\t /*\n\t * Compute height for \"next_curwin\" window and room available for\n\t * other windows.\n\t * \"m\" is the minimal height when counting p_wh for \"next_curwin\".\n\t */\n\t m = frame_minheight(topfr, next_curwin);\n\t room = height - m;\n\t if (room < 0)\n\t {\n\t\t/* The room is less then 'winheight', use all space for the\n\t\t * current window. */\n\t\tnext_curwin_size = p_wh + room;\n\t\troom = 0;\n\t }\n\t else\n\t {\n\t\tnext_curwin_size = -1;\n\t\tFOR_ALL_FRAMES(fr, topfr->fr_child)\n\t\t{\n\t\t /* If 'winfixheight' set keep the window height if\n\t\t * possible.\n\t\t * Watch out for this window being the next_curwin. */\n\t\t if (frame_fixed_height(fr))\n\t\t {\n\t\t\tn = frame_minheight(fr, NOWIN);\n\t\t\tnew_size = fr->fr_height;\n\t\t\tif (frame_has_win(fr, next_curwin))\n\t\t\t{\n\t\t\t room += p_wh - p_wmh;\n\t\t\t next_curwin_size = 0;\n\t\t\t if (new_size < p_wh)\n\t\t\t\tnew_size = p_wh;\n\t\t\t}\n\t\t\telse\n\t\t\t /* These windows don't use up room. */\n\t\t\t totwincount -= (n + (fr->fr_next == NULL\n\t\t\t\t\t ? extra_sep : 0)) / (p_wmh + 1);\n\t\t\troom -= new_size - n;\n\t\t\tif (room < 0)\n\t\t\t{\n\t\t\t new_size += room;\n\t\t\t room = 0;\n\t\t\t}\n\t\t\tfr->fr_newheight = new_size;\n\t\t }\n\t\t}\n\t\tif (next_curwin_size == -1)\n\t\t{\n\t\t if (!has_next_curwin)\n\t\t\tnext_curwin_size = 0;\n\t\t else if (totwincount > 1\n\t\t\t && (room + (totwincount - 2))\n\t\t\t\t\t\t / (totwincount - 1) > p_wh)\n\t\t {\n\t\t\t/* can make all windows higher than 'winheight',\n\t\t\t * spread the room equally. */\n\t\t\tnext_curwin_size = (room + p_wh\n\t\t\t\t\t + (totwincount - 1) * p_wmh\n\t\t\t\t\t + (totwincount - 1)) / totwincount;\n\t\t\troom -= next_curwin_size - p_wh;\n\t\t }\n\t\t else\n\t\t\tnext_curwin_size = p_wh;\n\t\t}\n\t }", "\t if (has_next_curwin)\n\t\t--totwincount;\t\t/* don't count curwin */\n\t}", "\tFOR_ALL_FRAMES(fr, topfr->fr_child)\n\t{\n\t wincount = 1;\n\t if (fr->fr_next == NULL)\n\t\t/* last frame gets all that remains (avoid roundoff error) */\n\t\tnew_size = height;\n\t else if (dir == 'h')\n\t\tnew_size = fr->fr_height;\n\t else if (frame_fixed_height(fr))\n\t {\n\t\tnew_size = fr->fr_newheight;\n\t\twincount = 0;\t /* doesn't count as a sizeable window */\n\t }\n\t else\n\t {\n\t\t/* Compute the maximum number of windows vert. in \"fr\". */\n\t\tn = frame_minheight(fr, NOWIN);\n\t\twincount = (n + (fr->fr_next == NULL ? extra_sep : 0))\n\t\t\t\t\t\t\t\t/ (p_wmh + 1);\n\t\tm = frame_minheight(fr, next_curwin);\n\t\tif (has_next_curwin)\n\t\t hnc = frame_has_win(fr, next_curwin);\n\t\telse\n\t\t hnc = FALSE;\n\t\tif (hnc)\t /* don't count next_curwin */\n\t\t --wincount;\n\t\tif (totwincount == 0)\n\t\t new_size = room;\n\t\telse\n\t\t new_size = (wincount * room + ((unsigned)totwincount >> 1))\n\t\t\t\t\t\t\t\t/ totwincount;\n\t\tif (hnc)\t /* add next_curwin size */\n\t\t{\n\t\t next_curwin_size -= p_wh - (m - n);\n\t\t new_size += next_curwin_size;\n\t\t room -= new_size - next_curwin_size;\n\t\t}\n\t\telse\n\t\t room -= new_size;\n\t\tnew_size += n;\n\t }\n\t /* Skip frame that is full width when splitting or closing a\n\t * window, unless equalizing all frames. */\n\t if (!current || dir != 'h' || topfr->fr_parent != NULL\n\t\t || (new_size != fr->fr_height)\n\t\t || frame_has_win(fr, next_curwin))\n\t\twin_equal_rec(next_curwin, current, fr, dir, col, row,\n\t\t\t\t\t\t\t width, new_size);\n\t row += new_size;\n\t height -= new_size;\n\t totwincount -= wincount;\n\t}\n }\n}", "#ifdef FEAT_JOB_CHANNEL\n static void\nleaving_window(win_T *win)\n{\n // Only matters for a prompt window.\n if (!bt_prompt(win->w_buffer))\n\treturn;", " // When leaving a prompt window stop Insert mode and perhaps restart\n // it when entering that window again.\n win->w_buffer->b_prompt_insert = restart_edit;\n if (restart_edit != 0 && mode_displayed)\n\tclear_cmdline = TRUE;\t\t/* unshow mode later */\n restart_edit = NUL;", " // When leaving the window (or closing the window) was done from a\n // callback we need to break out of the Insert mode loop and restart Insert\n // mode when entering the window again.\n if (State & INSERT)\n {\n\tstop_insert_mode = TRUE;\n\tif (win->w_buffer->b_prompt_insert == NUL)\n\t win->w_buffer->b_prompt_insert = 'A';\n }\n}", " static void\nentering_window(win_T *win)\n{\n // Only matters for a prompt window.\n if (!bt_prompt(win->w_buffer))\n\treturn;", " // When switching to a prompt buffer that was in Insert mode, don't stop\n // Insert mode, it may have been set in leaving_window().\n if (win->w_buffer->b_prompt_insert != NUL)\n\tstop_insert_mode = FALSE;", " // When entering the prompt window restart Insert mode if we were in Insert\n // mode when we left it.\n restart_edit = win->w_buffer->b_prompt_insert;\n}\n#endif", "/*\n * Close all windows for buffer \"buf\".\n */\n void\nclose_windows(\n buf_T\t*buf,\n int\t\tkeep_curwin)\t /* don't close \"curwin\" */\n{\n win_T\t*wp;\n tabpage_T *tp, *nexttp;\n int\t\th = tabline_height();\n int\t\tcount = tabpage_index(NULL);", " ++RedrawingDisabled;", " for (wp = firstwin; wp != NULL && !ONE_WINDOW; )\n {\n\tif (wp->w_buffer == buf && (!keep_curwin || wp != curwin)\n\t\t&& !(wp->w_closing || wp->w_buffer->b_locked > 0))\n\t{\n\t if (win_close(wp, FALSE) == FAIL)\n\t\t/* If closing the window fails give up, to avoid looping\n\t\t * forever. */\n\t\tbreak;", "\t /* Start all over, autocommands may change the window layout. */\n\t wp = firstwin;\n\t}\n\telse\n\t wp = wp->w_next;\n }", " /* Also check windows in other tab pages. */\n for (tp = first_tabpage; tp != NULL; tp = nexttp)\n {\n\tnexttp = tp->tp_next;\n\tif (tp != curtab)\n\t for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next)\n\t\tif (wp->w_buffer == buf\n\t\t && !(wp->w_closing || wp->w_buffer->b_locked > 0))\n\t\t{\n\t\t win_close_othertab(wp, FALSE, tp);", "\t\t /* Start all over, the tab page may be closed and\n\t\t * autocommands may change the window layout. */\n\t\t nexttp = first_tabpage;\n\t\t break;\n\t\t}\n }", " --RedrawingDisabled;", " if (count != tabpage_index(NULL))\n\tapply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf);", " redraw_tabline = TRUE;\n if (h != tabline_height())\n\tshell_new_rows();\n}", "/*\n * Return TRUE if the current window is the only window that exists (ignoring\n * \"aucmd_win\").\n * Returns FALSE if there is a window, possibly in another tab page.\n */\n static int\nlast_window(void)\n{\n return (one_window() && first_tabpage->tp_next == NULL);\n}", "/*\n * Return TRUE if there is only one window other than \"aucmd_win\" in the\n * current tab page.\n */\n int\none_window(void)\n{\n win_T\t*wp;\n int\t\tseen_one = FALSE;", " FOR_ALL_WINDOWS(wp)\n {\n\tif (wp != aucmd_win)\n\t{\n\t if (seen_one)\n\t\treturn FALSE;\n\t seen_one = TRUE;\n\t}\n }\n return TRUE;\n}", "/*\n * Close the possibly last window in a tab page.\n * Returns TRUE when the window was closed already.\n */\n static int\nclose_last_window_tabpage(\n win_T\t*win,\n int\t\tfree_buf,\n tabpage_T *prev_curtab)\n{\n if (ONE_WINDOW)\n {\n\tbuf_T\t*old_curbuf = curbuf;", "\t/*\n\t * Closing the last window in a tab page. First go to another tab\n\t * page and then close the window and the tab page. This avoids that\n\t * curwin and curtab are invalid while we are freeing memory, they may\n\t * be used in GUI events.\n\t * Don't trigger autocommands yet, they may use wrong values, so do\n\t * that below.\n\t */\n\tgoto_tabpage_tp(alt_tabpage(), FALSE, TRUE);\n\tredraw_tabline = TRUE;", "\t/* Safety check: Autocommands may have closed the window when jumping\n\t * to the other tab page. */\n\tif (valid_tabpage(prev_curtab) && prev_curtab->tp_firstwin == win)\n\t{\n\t int\t h = tabline_height();", "\t win_close_othertab(win, free_buf, prev_curtab);\n\t if (h != tabline_height())\n\t\tshell_new_rows();\n\t}\n#ifdef FEAT_JOB_CHANNEL\n\tentering_window(curwin);\n#endif\n\t/* Since goto_tabpage_tp above did not trigger *Enter autocommands, do\n\t * that now. */\n\tapply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf);\n\tapply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);\n\tapply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);\n\tif (old_curbuf != curbuf)\n\t apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);\n\treturn TRUE;\n }\n return FALSE;\n}", "/*\n * Close the buffer of \"win\" and unload it if \"action\" is DOBUF_UNLOAD.\n * \"action\" can also be zero (do nothing) or DOBUF_WIPE.\n * \"abort_if_last\" is passed to close_buffer(): abort closing if all other\n * windows are closed.\n */\n static void\nwin_close_buffer(win_T *win, int action, int abort_if_last)\n{\n#ifdef FEAT_SYN_HL\n // Free independent synblock before the buffer is freed.\n if (win->w_buffer != NULL)\n\treset_synblock(win);\n#endif", "#ifdef FEAT_QUICKFIX\n // When the quickfix/location list window is closed, unlist the buffer.\n if (win->w_buffer != NULL && bt_quickfix(win->w_buffer))\n\twin->w_buffer->b_p_bl = FALSE;\n#endif", " // Close the link to the buffer.\n if (win->w_buffer != NULL)\n {\n\tbufref_T bufref;", "\tset_bufref(&bufref, curbuf);\n\twin->w_closing = TRUE;\n\tclose_buffer(win, win->w_buffer, action, abort_if_last);\n\tif (win_valid_any_tab(win))\n\t win->w_closing = FALSE;\n\t// Make sure curbuf is valid. It can become invalid if 'bufhidden' is\n\t// \"wipe\".\n\tif (!bufref_valid(&bufref))\n\t curbuf = firstbuf;\n }\n}", "/*\n * Close window \"win\". Only works for the current tab page.\n * If \"free_buf\" is TRUE related buffer may be unloaded.\n *\n * Called by :quit, :close, :xit, :wq and findtag().\n * Returns FAIL when the window was not closed.\n */\n int\nwin_close(win_T *win, int free_buf)\n{\n win_T\t*wp;\n int\t\tother_buffer = FALSE;\n int\t\tclose_curwin = FALSE;\n int\t\tdir;\n int\t\thelp_window = FALSE;\n tabpage_T *prev_curtab = curtab;\n frame_T\t*win_frame = win->w_frame->fr_parent;", " if (ERROR_IF_POPUP_WINDOW)\n\treturn FAIL;", " if (last_window())\n {\n\temsg(_(\"E444: Cannot close last window\"));\n\treturn FAIL;\n }", " if (win->w_closing || (win->w_buffer != NULL\n\t\t\t\t\t && win->w_buffer->b_locked > 0))\n\treturn FAIL; /* window is already being closed */\n if (win_unlisted(win))\n {\n\temsg(_(\"E813: Cannot close autocmd or popup window\"));\n\treturn FAIL;\n }\n if ((firstwin == aucmd_win || lastwin == aucmd_win) && one_window())\n {\n\temsg(_(\"E814: Cannot close window, only autocmd window would remain\"));\n\treturn FAIL;\n }", " /* When closing the last window in a tab page first go to another tab page\n * and then close the window and the tab page to avoid that curwin and\n * curtab are invalid while we are freeing memory. */\n if (close_last_window_tabpage(win, free_buf, prev_curtab))\n return FAIL;", " /* When closing the help window, try restoring a snapshot after closing\n * the window. Otherwise clear the snapshot, it's now invalid. */\n if (bt_help(win->w_buffer))\n\thelp_window = TRUE;\n else\n\tclear_snapshot(curtab, SNAP_HELP_IDX);", " if (win == curwin)\n {\n#ifdef FEAT_JOB_CHANNEL\n\tleaving_window(curwin);\n#endif\n\t/*\n\t * Guess which window is going to be the new current window.\n\t * This may change because of the autocommands (sigh).\n\t */\n\twp = frame2win(win_altframe(win, NULL));", "\t/*\n\t * Be careful: If autocommands delete the window or cause this window\n\t * to be the last one left, return now.\n\t */\n\tif (wp->w_buffer != curbuf)\n\t{\n\t other_buffer = TRUE;\n\t win->w_closing = TRUE;\n\t apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);\n\t if (!win_valid(win))\n\t\treturn FAIL;\n\t win->w_closing = FALSE;\n\t if (last_window())\n\t\treturn FAIL;\n\t}\n\twin->w_closing = TRUE;\n\tapply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf);\n\tif (!win_valid(win))\n\t return FAIL;\n\twin->w_closing = FALSE;\n\tif (last_window())\n\t return FAIL;\n#ifdef FEAT_EVAL\n\t/* autocmds may abort script processing */\n\tif (aborting())\n\t return FAIL;\n#endif\n }", "#ifdef FEAT_GUI\n // Avoid trouble with scrollbars that are going to be deleted in\n // win_free().\n if (gui.in_use)\n\tout_flush();\n#endif", "#ifdef FEAT_TEXT_PROP\n if (popup_win_closed(win) && !win_valid(win))\n\treturn FAIL;\n#endif\n win_close_buffer(win, free_buf ? DOBUF_UNLOAD : 0, TRUE);", " if (only_one_window() && win_valid(win) && win->w_buffer == NULL\n\t && (last_window() || curtab != prev_curtab\n\t\t|| close_last_window_tabpage(win, free_buf, prev_curtab)))\n {\n\t/* Autocommands have closed all windows, quit now. Restore\n\t * curwin->w_buffer, otherwise writing viminfo may fail. */\n\tif (curwin->w_buffer == NULL)\n\t curwin->w_buffer = curbuf;\n\tgetout(0);\n }", " /* Autocommands may have moved to another tab page. */\n if (curtab != prev_curtab && win_valid_any_tab(win)\n\t\t\t\t\t\t && win->w_buffer == NULL)\n {\n\t/* Need to close the window anyway, since the buffer is NULL. */\n\twin_close_othertab(win, FALSE, prev_curtab);\n\treturn FAIL;\n }", " /* Autocommands may have closed the window already or closed the only\n * other window. */\n if (!win_valid(win) || last_window()\n\t || close_last_window_tabpage(win, free_buf, prev_curtab))\n\treturn FAIL;", " // Now we are really going to close the window. Disallow any autocommand\n // to split a window to avoid trouble.\n ++split_disallowed;", " /* Free the memory used for the window and get the window that received\n * the screen space. */\n wp = win_free_mem(win, &dir, NULL);", " /* Make sure curwin isn't invalid. It can cause severe trouble when\n * printing an error message. For win_equal() curbuf needs to be valid\n * too. */\n if (win == curwin)\n {\n\tcurwin = wp;\n#ifdef FEAT_QUICKFIX\n\tif (wp->w_p_pvw || bt_quickfix(wp->w_buffer))\n\t{\n\t /*\n\t * If the cursor goes to the preview or the quickfix window, try\n\t * finding another window to go to.\n\t */\n\t for (;;)\n\t {\n\t\tif (wp->w_next == NULL)\n\t\t wp = firstwin;\n\t\telse\n\t\t wp = wp->w_next;\n\t\tif (wp == curwin)\n\t\t break;\n\t\tif (!wp->w_p_pvw && !bt_quickfix(wp->w_buffer))\n\t\t{\n\t\t curwin = wp;\n\t\t break;\n\t\t}\n\t }\n\t}\n#endif\n\tcurbuf = curwin->w_buffer;\n\tclose_curwin = TRUE;", "\t/* The cursor position may be invalid if the buffer changed after last\n\t * using the window. */\n\tcheck_cursor();\n }\n if (p_ea && (*p_ead == 'b' || *p_ead == dir))\n\t/* If the frame of the closed window contains the new current window,\n\t * only resize that frame. Otherwise resize all windows. */\n\twin_equal(curwin, curwin->w_frame->fr_parent == win_frame, dir);\n else\n\twin_comp_pos();\n if (close_curwin)\n {\n\twin_enter_ext(wp, FALSE, TRUE, FALSE, TRUE, TRUE);\n\tif (other_buffer)\n\t /* careful: after this wp and win may be invalid! */\n\t apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);\n }", " --split_disallowed;", " /*\n * If last window has a status line now and we don't want one,\n * remove the status line.\n */\n last_status(FALSE);", " /* After closing the help window, try restoring the window layout from\n * before it was opened. */\n if (help_window)\n\trestore_snapshot(SNAP_HELP_IDX, close_curwin);", "#if defined(FEAT_GUI)\n /* When 'guioptions' includes 'L' or 'R' may have to remove scrollbars. */\n if (gui.in_use && !win_hasvertsplit())\n\tgui_init_which_components(NULL);\n#endif", " redraw_all_later(NOT_VALID);\n return OK;\n}", "/*\n * Close window \"win\" in tab page \"tp\", which is not the current tab page.\n * This may be the last window in that tab page and result in closing the tab,\n * thus \"tp\" may become invalid!\n * Caller must check if buffer is hidden and whether the tabline needs to be\n * updated.\n */\n void\nwin_close_othertab(win_T *win, int free_buf, tabpage_T *tp)\n{\n win_T\t*wp;\n int\t\tdir;\n tabpage_T *ptp = NULL;\n int\t\tfree_tp = FALSE;", " /* Get here with win->w_buffer == NULL when win_close() detects the tab\n * page changed. */\n if (win->w_closing || (win->w_buffer != NULL\n\t\t\t\t\t && win->w_buffer->b_locked > 0))\n\treturn; /* window is already being closed */", " if (win->w_buffer != NULL)\n\t/* Close the link to the buffer. */\n\tclose_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, FALSE);", " /* Careful: Autocommands may have closed the tab page or made it the\n * current tab page. */\n for (ptp = first_tabpage; ptp != NULL && ptp != tp; ptp = ptp->tp_next)\n\t;\n if (ptp == NULL || tp == curtab)\n\treturn;", " /* Autocommands may have closed the window already. */\n for (wp = tp->tp_firstwin; wp != NULL && wp != win; wp = wp->w_next)\n\t;\n if (wp == NULL)\n\treturn;", " /* When closing the last window in a tab page remove the tab page. */\n if (tp->tp_firstwin == tp->tp_lastwin)\n {\n\tif (tp == first_tabpage)\n\t first_tabpage = tp->tp_next;\n\telse\n\t{\n\t for (ptp = first_tabpage; ptp != NULL && ptp->tp_next != tp;\n\t\t\t\t\t\t\t ptp = ptp->tp_next)\n\t\t;\n\t if (ptp == NULL)\n\t {\n\t\tinternal_error(\"win_close_othertab()\");\n\t\treturn;\n\t }\n\t ptp->tp_next = tp->tp_next;\n\t}\n\tfree_tp = TRUE;\n }", " /* Free the memory used for the window. */\n win_free_mem(win, &dir, tp);", " if (free_tp)\n\tfree_tabpage(tp);\n}", "/*\n * Free the memory used for a window.\n * Returns a pointer to the window that got the freed up space.\n */\n static win_T *\nwin_free_mem(\n win_T\t*win,\n int\t\t*dirp,\t\t/* set to 'v' or 'h' for direction if 'ea' */\n tabpage_T\t*tp)\t\t/* tab page \"win\" is in, NULL for current */\n{\n frame_T\t*frp;\n win_T\t*wp;", " /* Remove the window and its frame from the tree of frames. */\n frp = win->w_frame;\n wp = winframe_remove(win, dirp, tp);\n vim_free(frp);\n win_free(win, tp);", " /* When deleting the current window of another tab page select a new\n * current window. */\n if (tp != NULL && win == tp->tp_curwin)\n\ttp->tp_curwin = wp;", " return wp;\n}", "#if defined(EXITFREE) || defined(PROTO)\n void\nwin_free_all(void)\n{\n int\t\tdummy;", " while (first_tabpage->tp_next != NULL)\n\ttabpage_close(TRUE);", " if (aucmd_win != NULL)\n {\n\t(void)win_free_mem(aucmd_win, &dummy, NULL);\n\taucmd_win = NULL;\n }\n# ifdef FEAT_TEXT_PROP\n close_all_popups();\n# endif", " while (firstwin != NULL)\n\t(void)win_free_mem(firstwin, &dummy, NULL);", " /* No window should be used after this. Set curwin to NULL to crash\n * instead of using freed memory. */\n curwin = NULL;\n}\n#endif", "/*\n * Remove a window and its frame from the tree of frames.\n * Returns a pointer to the window that got the freed up space.\n */\n win_T *\nwinframe_remove(\n win_T\t*win,\n int\t\t*dirp UNUSED,\t/* set to 'v' or 'h' for direction if 'ea' */\n tabpage_T\t*tp)\t\t/* tab page \"win\" is in, NULL for current */\n{\n frame_T\t*frp, *frp2, *frp3;\n frame_T\t*frp_close = win->w_frame;\n win_T\t*wp;", " /*\n * If there is only one window there is nothing to remove.\n */\n if (tp == NULL ? ONE_WINDOW : tp->tp_firstwin == tp->tp_lastwin)\n\treturn NULL;", " /*\n * Remove the window from its frame.\n */\n frp2 = win_altframe(win, tp);\n wp = frame2win(frp2);", " /* Remove this frame from the list of frames. */\n frame_remove(frp_close);", " if (frp_close->fr_parent->fr_layout == FR_COL)\n {\n\t/* When 'winfixheight' is set, try to find another frame in the column\n\t * (as close to the closed frame as possible) to distribute the height\n\t * to. */\n\tif (frp2->fr_win != NULL && frp2->fr_win->w_p_wfh)\n\t{\n\t frp = frp_close->fr_prev;\n\t frp3 = frp_close->fr_next;\n\t while (frp != NULL || frp3 != NULL)\n\t {\n\t\tif (frp != NULL)\n\t\t{\n\t\t if (!frame_fixed_height(frp))\n\t\t {\n\t\t\tfrp2 = frp;\n\t\t\twp = frame2win(frp2);\n\t\t\tbreak;\n\t\t }\n\t\t frp = frp->fr_prev;\n\t\t}\n\t\tif (frp3 != NULL)\n\t\t{\n\t\t if (frp3->fr_win != NULL && !frp3->fr_win->w_p_wfh)\n\t\t {\n\t\t\tfrp2 = frp3;\n\t\t\twp = frp3->fr_win;\n\t\t\tbreak;\n\t\t }\n\t\t frp3 = frp3->fr_next;\n\t\t}\n\t }\n\t}\n\tframe_new_height(frp2, frp2->fr_height + frp_close->fr_height,\n\t\t\t frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE);\n\t*dirp = 'v';\n }\n else\n {\n\t/* When 'winfixwidth' is set, try to find another frame in the column\n\t * (as close to the closed frame as possible) to distribute the width\n\t * to. */\n\tif (frp2->fr_win != NULL && frp2->fr_win->w_p_wfw)\n\t{\n\t frp = frp_close->fr_prev;\n\t frp3 = frp_close->fr_next;\n\t while (frp != NULL || frp3 != NULL)\n\t {\n\t\tif (frp != NULL)\n\t\t{\n\t\t if (!frame_fixed_width(frp))\n\t\t {\n\t\t\tfrp2 = frp;\n\t\t\twp = frame2win(frp2);\n\t\t\tbreak;\n\t\t }\n\t\t frp = frp->fr_prev;\n\t\t}\n\t\tif (frp3 != NULL)\n\t\t{\n\t\t if (frp3->fr_win != NULL && !frp3->fr_win->w_p_wfw)\n\t\t {\n\t\t\tfrp2 = frp3;\n\t\t\twp = frp3->fr_win;\n\t\t\tbreak;\n\t\t }\n\t\t frp3 = frp3->fr_next;\n\t\t}\n\t }\n\t}\n\tframe_new_width(frp2, frp2->fr_width + frp_close->fr_width,\n\t\t\t frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE);\n\t*dirp = 'h';\n }", " /* If rows/columns go to a window below/right its positions need to be\n * updated. Can only be done after the sizes have been updated. */\n if (frp2 == frp_close->fr_next)\n {\n\tint row = win->w_winrow;\n\tint col = win->w_wincol;", "\tframe_comp_pos(frp2, &row, &col);\n }", " if (frp2->fr_next == NULL && frp2->fr_prev == NULL)\n {\n\t/* There is no other frame in this list, move its info to the parent\n\t * and remove it. */\n\tfrp2->fr_parent->fr_layout = frp2->fr_layout;\n\tfrp2->fr_parent->fr_child = frp2->fr_child;\n\tFOR_ALL_FRAMES(frp, frp2->fr_child)\n\t frp->fr_parent = frp2->fr_parent;\n\tfrp2->fr_parent->fr_win = frp2->fr_win;\n\tif (frp2->fr_win != NULL)\n\t frp2->fr_win->w_frame = frp2->fr_parent;\n\tfrp = frp2->fr_parent;\n\tif (topframe->fr_child == frp2)\n\t topframe->fr_child = frp;\n\tvim_free(frp2);", "\tfrp2 = frp->fr_parent;\n\tif (frp2 != NULL && frp2->fr_layout == frp->fr_layout)\n\t{\n\t /* The frame above the parent has the same layout, have to merge\n\t * the frames into this list. */\n\t if (frp2->fr_child == frp)\n\t\tfrp2->fr_child = frp->fr_child;\n\t frp->fr_child->fr_prev = frp->fr_prev;\n\t if (frp->fr_prev != NULL)\n\t\tfrp->fr_prev->fr_next = frp->fr_child;\n\t for (frp3 = frp->fr_child; ; frp3 = frp3->fr_next)\n\t {\n\t\tfrp3->fr_parent = frp2;\n\t\tif (frp3->fr_next == NULL)\n\t\t{\n\t\t frp3->fr_next = frp->fr_next;\n\t\t if (frp->fr_next != NULL)\n\t\t\tfrp->fr_next->fr_prev = frp3;\n\t\t break;\n\t\t}\n\t }\n\t if (topframe->fr_child == frp)\n\t\ttopframe->fr_child = frp2;\n\t vim_free(frp);\n\t}\n }", " return wp;\n}", "/*\n * Return a pointer to the frame that will receive the empty screen space that\n * is left over after \"win\" is closed.\n *\n * If 'splitbelow' or 'splitright' is set, the space goes above or to the left\n * by default. Otherwise, the free space goes below or to the right. The\n * result is that opening a window and then immediately closing it will\n * preserve the initial window layout. The 'wfh' and 'wfw' settings are\n * respected when possible.\n */\n static frame_T *\nwin_altframe(\n win_T\t*win,\n tabpage_T\t*tp)\t\t/* tab page \"win\" is in, NULL for current */\n{\n frame_T\t*frp;\n frame_T\t*other_fr, *target_fr;", " if (tp == NULL ? ONE_WINDOW : tp->tp_firstwin == tp->tp_lastwin)\n\treturn alt_tabpage()->tp_curwin->w_frame;", " frp = win->w_frame;", " if (frp->fr_prev == NULL)\n\treturn frp->fr_next;\n if (frp->fr_next == NULL)\n\treturn frp->fr_prev;", " target_fr = frp->fr_next;\n other_fr = frp->fr_prev;\n if (p_spr || p_sb)\n {\n\ttarget_fr = frp->fr_prev;\n\tother_fr = frp->fr_next;\n }", " /* If 'wfh' or 'wfw' is set for the target and not for the alternate\n * window, reverse the selection. */\n if (frp->fr_parent != NULL && frp->fr_parent->fr_layout == FR_ROW)\n {\n\tif (frame_fixed_width(target_fr) && !frame_fixed_width(other_fr))\n\t target_fr = other_fr;\n }\n else\n {\n\tif (frame_fixed_height(target_fr) && !frame_fixed_height(other_fr))\n\t target_fr = other_fr;\n }", " return target_fr;\n}", "/*\n * Return the tabpage that will be used if the current one is closed.\n */\n static tabpage_T *\nalt_tabpage(void)\n{\n tabpage_T\t*tp;", " /* Use the next tab page if possible. */\n if (curtab->tp_next != NULL)\n\treturn curtab->tp_next;", " /* Find the last but one tab page. */\n for (tp = first_tabpage; tp->tp_next != curtab; tp = tp->tp_next)\n\t;\n return tp;\n}", "/*\n * Find the left-upper window in frame \"frp\".\n */\n static win_T *\nframe2win(frame_T *frp)\n{\n while (frp->fr_win == NULL)\n\tfrp = frp->fr_child;\n return frp->fr_win;\n}", "/*\n * Return TRUE if frame \"frp\" contains window \"wp\".\n */\n static int\nframe_has_win(frame_T *frp, win_T *wp)\n{\n frame_T\t*p;", " if (frp->fr_layout == FR_LEAF)\n\treturn frp->fr_win == wp;", " FOR_ALL_FRAMES(p, frp->fr_child)\n\tif (frame_has_win(p, wp))\n\t return TRUE;\n return FALSE;\n}", "/*\n * Set a new height for a frame. Recursively sets the height for contained\n * frames and windows. Caller must take care of positions.\n */\n static void\nframe_new_height(\n frame_T\t*topfrp,\n int\t\theight,\n int\t\ttopfirst,\t/* resize topmost contained frame first */\n int\t\twfh)\t\t/* obey 'winfixheight' when there is a choice;\n\t\t\t\t may cause the height not to be set */\n{\n frame_T\t*frp;\n int\t\textra_lines;\n int\t\th;", " if (topfrp->fr_win != NULL)\n {\n\t/* Simple case: just one window. */\n\twin_new_height(topfrp->fr_win,\n\t\t\t\t height - topfrp->fr_win->w_status_height\n\t\t\t\t\t - WINBAR_HEIGHT(topfrp->fr_win));\n }\n else if (topfrp->fr_layout == FR_ROW)\n {\n\tdo\n\t{\n\t /* All frames in this row get the same new height. */\n\t FOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t {\n\t\tframe_new_height(frp, height, topfirst, wfh);\n\t\tif (frp->fr_height > height)\n\t\t{\n\t\t /* Could not fit the windows, make the whole row higher. */\n\t\t height = frp->fr_height;\n\t\t break;\n\t\t}\n\t }\n\t}\n\twhile (frp != NULL);\n }\n else /* fr_layout == FR_COL */\n {\n\t/* Complicated case: Resize a column of frames. Resize the bottom\n\t * frame first, frames above that when needed. */", "\tfrp = topfrp->fr_child;\n\tif (wfh)\n\t /* Advance past frames with one window with 'wfh' set. */\n\t while (frame_fixed_height(frp))\n\t {\n\t\tfrp = frp->fr_next;\n\t\tif (frp == NULL)\n\t\t return;\t /* no frame without 'wfh', give up */\n\t }\n\tif (!topfirst)\n\t{\n\t /* Find the bottom frame of this column */\n\t while (frp->fr_next != NULL)\n\t\tfrp = frp->fr_next;\n\t if (wfh)\n\t\t/* Advance back for frames with one window with 'wfh' set. */\n\t\twhile (frame_fixed_height(frp))\n\t\t frp = frp->fr_prev;\n\t}", "\textra_lines = height - topfrp->fr_height;\n\tif (extra_lines < 0)\n\t{\n\t /* reduce height of contained frames, bottom or top frame first */\n\t while (frp != NULL)\n\t {\n\t\th = frame_minheight(frp, NULL);\n\t\tif (frp->fr_height + extra_lines < h)\n\t\t{\n\t\t extra_lines += frp->fr_height - h;\n\t\t frame_new_height(frp, h, topfirst, wfh);\n\t\t}\n\t\telse\n\t\t{\n\t\t frame_new_height(frp, frp->fr_height + extra_lines,\n\t\t\t\t\t\t\t topfirst, wfh);\n\t\t break;\n\t\t}\n\t\tif (topfirst)\n\t\t{\n\t\t do\n\t\t\tfrp = frp->fr_next;\n\t\t while (wfh && frp != NULL && frame_fixed_height(frp));\n\t\t}\n\t\telse\n\t\t{\n\t\t do\n\t\t\tfrp = frp->fr_prev;\n\t\t while (wfh && frp != NULL && frame_fixed_height(frp));\n\t\t}\n\t\t/* Increase \"height\" if we could not reduce enough frames. */\n\t\tif (frp == NULL)\n\t\t height -= extra_lines;\n\t }\n\t}\n\telse if (extra_lines > 0)\n\t{\n\t /* increase height of bottom or top frame */\n\t frame_new_height(frp, frp->fr_height + extra_lines, topfirst, wfh);\n\t}\n }\n topfrp->fr_height = height;\n}", "/*\n * Return TRUE if height of frame \"frp\" should not be changed because of\n * the 'winfixheight' option.\n */\n static int\nframe_fixed_height(frame_T *frp)\n{\n /* frame with one window: fixed height if 'winfixheight' set. */\n if (frp->fr_win != NULL)\n\treturn frp->fr_win->w_p_wfh;", " if (frp->fr_layout == FR_ROW)\n {\n\t/* The frame is fixed height if one of the frames in the row is fixed\n\t * height. */\n\tFOR_ALL_FRAMES(frp, frp->fr_child)\n\t if (frame_fixed_height(frp))\n\t\treturn TRUE;\n\treturn FALSE;\n }", " /* frp->fr_layout == FR_COL: The frame is fixed height if all of the\n * frames in the row are fixed height. */\n FOR_ALL_FRAMES(frp, frp->fr_child)\n\tif (!frame_fixed_height(frp))\n\t return FALSE;\n return TRUE;\n}", "/*\n * Return TRUE if width of frame \"frp\" should not be changed because of\n * the 'winfixwidth' option.\n */\n static int\nframe_fixed_width(frame_T *frp)\n{\n /* frame with one window: fixed width if 'winfixwidth' set. */\n if (frp->fr_win != NULL)\n\treturn frp->fr_win->w_p_wfw;", " if (frp->fr_layout == FR_COL)\n {\n\t/* The frame is fixed width if one of the frames in the row is fixed\n\t * width. */\n\tFOR_ALL_FRAMES(frp, frp->fr_child)\n\t if (frame_fixed_width(frp))\n\t\treturn TRUE;\n\treturn FALSE;\n }", " /* frp->fr_layout == FR_ROW: The frame is fixed width if all of the\n * frames in the row are fixed width. */\n FOR_ALL_FRAMES(frp, frp->fr_child)\n\tif (!frame_fixed_width(frp))\n\t return FALSE;\n return TRUE;\n}", "/*\n * Add a status line to windows at the bottom of \"frp\".\n * Note: Does not check if there is room!\n */\n static void\nframe_add_statusline(frame_T *frp)\n{\n win_T\t*wp;", " if (frp->fr_layout == FR_LEAF)\n {\n\twp = frp->fr_win;\n\tif (wp->w_status_height == 0)\n\t{\n\t if (wp->w_height > 0)\t/* don't make it negative */\n\t\t--wp->w_height;\n\t wp->w_status_height = STATUS_HEIGHT;\n\t}\n }\n else if (frp->fr_layout == FR_ROW)\n {\n\t/* Handle all the frames in the row. */\n\tFOR_ALL_FRAMES(frp, frp->fr_child)\n\t frame_add_statusline(frp);\n }\n else /* frp->fr_layout == FR_COL */\n {\n\t/* Only need to handle the last frame in the column. */\n\tfor (frp = frp->fr_child; frp->fr_next != NULL; frp = frp->fr_next)\n\t ;\n\tframe_add_statusline(frp);\n }\n}", "/*\n * Set width of a frame. Handles recursively going through contained frames.\n * May remove separator line for windows at the right side (for win_close()).\n */\n static void\nframe_new_width(\n frame_T\t*topfrp,\n int\t\twidth,\n int\t\tleftfirst,\t/* resize leftmost contained frame first */\n int\t\twfw)\t\t/* obey 'winfixwidth' when there is a choice;\n\t\t\t\t may cause the width not to be set */\n{\n frame_T\t*frp;\n int\t\textra_cols;\n int\t\tw;\n win_T\t*wp;", " if (topfrp->fr_layout == FR_LEAF)\n {\n\t/* Simple case: just one window. */\n\twp = topfrp->fr_win;\n\t/* Find out if there are any windows right of this one. */\n\tfor (frp = topfrp; frp->fr_parent != NULL; frp = frp->fr_parent)\n\t if (frp->fr_parent->fr_layout == FR_ROW && frp->fr_next != NULL)\n\t\tbreak;\n\tif (frp->fr_parent == NULL)\n\t wp->w_vsep_width = 0;\n\twin_new_width(wp, width - wp->w_vsep_width);\n }\n else if (topfrp->fr_layout == FR_COL)\n {\n\tdo\n\t{\n\t /* All frames in this column get the same new width. */\n\t FOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t {\n\t\tframe_new_width(frp, width, leftfirst, wfw);\n\t\tif (frp->fr_width > width)\n\t\t{\n\t\t /* Could not fit the windows, make whole column wider. */\n\t\t width = frp->fr_width;\n\t\t break;\n\t\t}\n\t }\n\t} while (frp != NULL);\n }\n else /* fr_layout == FR_ROW */\n {\n\t/* Complicated case: Resize a row of frames. Resize the rightmost\n\t * frame first, frames left of it when needed. */", "\tfrp = topfrp->fr_child;\n\tif (wfw)\n\t /* Advance past frames with one window with 'wfw' set. */\n\t while (frame_fixed_width(frp))\n\t {\n\t\tfrp = frp->fr_next;\n\t\tif (frp == NULL)\n\t\t return;\t /* no frame without 'wfw', give up */\n\t }\n\tif (!leftfirst)\n\t{\n\t /* Find the rightmost frame of this row */\n\t while (frp->fr_next != NULL)\n\t\tfrp = frp->fr_next;\n\t if (wfw)\n\t\t/* Advance back for frames with one window with 'wfw' set. */\n\t\twhile (frame_fixed_width(frp))\n\t\t frp = frp->fr_prev;\n\t}", "\textra_cols = width - topfrp->fr_width;\n\tif (extra_cols < 0)\n\t{\n\t /* reduce frame width, rightmost frame first */\n\t while (frp != NULL)\n\t {\n\t\tw = frame_minwidth(frp, NULL);\n\t\tif (frp->fr_width + extra_cols < w)\n\t\t{\n\t\t extra_cols += frp->fr_width - w;\n\t\t frame_new_width(frp, w, leftfirst, wfw);\n\t\t}\n\t\telse\n\t\t{\n\t\t frame_new_width(frp, frp->fr_width + extra_cols,\n\t\t\t\t\t\t\t leftfirst, wfw);\n\t\t break;\n\t\t}\n\t\tif (leftfirst)\n\t\t{\n\t\t do\n\t\t\tfrp = frp->fr_next;\n\t\t while (wfw && frp != NULL && frame_fixed_width(frp));\n\t\t}\n\t\telse\n\t\t{\n\t\t do\n\t\t\tfrp = frp->fr_prev;\n\t\t while (wfw && frp != NULL && frame_fixed_width(frp));\n\t\t}\n\t\t/* Increase \"width\" if we could not reduce enough frames. */\n\t\tif (frp == NULL)\n\t\t width -= extra_cols;\n\t }\n\t}\n\telse if (extra_cols > 0)\n\t{\n\t /* increase width of rightmost frame */\n\t frame_new_width(frp, frp->fr_width + extra_cols, leftfirst, wfw);\n\t}\n }\n topfrp->fr_width = width;\n}", "/*\n * Add the vertical separator to windows at the right side of \"frp\".\n * Note: Does not check if there is room!\n */\n static void\nframe_add_vsep(frame_T *frp)\n{\n win_T\t*wp;", " if (frp->fr_layout == FR_LEAF)\n {\n\twp = frp->fr_win;\n\tif (wp->w_vsep_width == 0)\n\t{\n\t if (wp->w_width > 0)\t/* don't make it negative */\n\t\t--wp->w_width;\n\t wp->w_vsep_width = 1;\n\t}\n }\n else if (frp->fr_layout == FR_COL)\n {\n\t/* Handle all the frames in the column. */\n\tFOR_ALL_FRAMES(frp, frp->fr_child)\n\t frame_add_vsep(frp);\n }\n else /* frp->fr_layout == FR_ROW */\n {\n\t/* Only need to handle the last frame in the row. */\n\tfrp = frp->fr_child;\n\twhile (frp->fr_next != NULL)\n\t frp = frp->fr_next;\n\tframe_add_vsep(frp);\n }\n}", "/*\n * Set frame width from the window it contains.\n */\n static void\nframe_fix_width(win_T *wp)\n{\n wp->w_frame->fr_width = wp->w_width + wp->w_vsep_width;\n}", "/*\n * Set frame height from the window it contains.\n */\n static void\nframe_fix_height(win_T *wp)\n{\n wp->w_frame->fr_height = VISIBLE_HEIGHT(wp) + wp->w_status_height;\n}", "/*\n * Compute the minimal height for frame \"topfrp\".\n * Uses the 'winminheight' option.\n * When \"next_curwin\" isn't NULL, use p_wh for this window.\n * When \"next_curwin\" is NOWIN, don't use at least one line for the current\n * window.\n */\n static int\nframe_minheight(frame_T *topfrp, win_T *next_curwin)\n{\n frame_T\t*frp;\n int\t\tm;\n int\t\tn;", " if (topfrp->fr_win != NULL)\n {\n\tif (topfrp->fr_win == next_curwin)\n\t m = p_wh + topfrp->fr_win->w_status_height;\n\telse\n\t{\n\t /* window: minimal height of the window plus status line */\n\t m = p_wmh + topfrp->fr_win->w_status_height;\n\t if (topfrp->fr_win == curwin && next_curwin == NULL)\n\t {\n\t\t/* Current window is minimal one line high and WinBar is\n\t\t * visible. */\n\t\tif (p_wmh == 0)\n\t\t ++m;\n\t\tm += WINBAR_HEIGHT(curwin);\n\t }\n\t}\n }\n else if (topfrp->fr_layout == FR_ROW)\n {\n\t/* get the minimal height from each frame in this row */\n\tm = 0;\n\tFOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t{\n\t n = frame_minheight(frp, next_curwin);\n\t if (n > m)\n\t\tm = n;\n\t}\n }\n else\n {\n\t/* Add up the minimal heights for all frames in this column. */\n\tm = 0;\n\tFOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t m += frame_minheight(frp, next_curwin);\n }", " return m;\n}", "/*\n * Compute the minimal width for frame \"topfrp\".\n * When \"next_curwin\" isn't NULL, use p_wiw for this window.\n * When \"next_curwin\" is NOWIN, don't use at least one column for the current\n * window.\n */\n static int\nframe_minwidth(\n frame_T\t*topfrp,\n win_T\t*next_curwin)\t/* use p_wh and p_wiw for next_curwin */\n{\n frame_T\t*frp;\n int\t\tm, n;", " if (topfrp->fr_win != NULL)\n {\n\tif (topfrp->fr_win == next_curwin)\n\t m = p_wiw + topfrp->fr_win->w_vsep_width;\n\telse\n\t{\n\t /* window: minimal width of the window plus separator column */\n\t m = p_wmw + topfrp->fr_win->w_vsep_width;\n\t /* Current window is minimal one column wide */\n\t if (p_wmw == 0 && topfrp->fr_win == curwin && next_curwin == NULL)\n\t\t++m;\n\t}\n }\n else if (topfrp->fr_layout == FR_COL)\n {\n\t/* get the minimal width from each frame in this column */\n\tm = 0;\n\tFOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t{\n\t n = frame_minwidth(frp, next_curwin);\n\t if (n > m)\n\t\tm = n;\n\t}\n }\n else\n {\n\t/* Add up the minimal widths for all frames in this row. */\n\tm = 0;\n\tFOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t m += frame_minwidth(frp, next_curwin);\n }", " return m;\n}", "\n/*\n * Try to close all windows except current one.\n * Buffers in the other windows become hidden if 'hidden' is set, or '!' is\n * used and the buffer was modified.\n *\n * Used by \":bdel\" and \":only\".\n */\n void\nclose_others(\n int\t\tmessage,\n int\t\tforceit)\t /* always hide all other windows */\n{\n win_T\t*wp;\n win_T\t*nextwp;\n int\t\tr;", " if (one_window())\n {\n\tif (message && !autocmd_busy)\n\t msg(_(m_onlyone));\n\treturn;\n }", " /* Be very careful here: autocommands may change the window layout. */\n for (wp = firstwin; win_valid(wp); wp = nextwp)\n {\n\tnextwp = wp->w_next;\n\tif (wp != curwin)\t\t/* don't close current window */\n\t{", "\t /* Check if it's allowed to abandon this window */\n\t r = can_abandon(wp->w_buffer, forceit);\n\t if (!win_valid(wp))\t\t/* autocommands messed wp up */\n\t {\n\t\tnextwp = firstwin;\n\t\tcontinue;\n\t }\n\t if (!r)\n\t {\n#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)\n\t\tif (message && (p_confirm || cmdmod.confirm) && p_write)\n\t\t{\n\t\t dialog_changed(wp->w_buffer, FALSE);\n\t\t if (!win_valid(wp))\t\t/* autocommands messed wp up */\n\t\t {\n\t\t\tnextwp = firstwin;\n\t\t\tcontinue;\n\t\t }\n\t\t}\n\t\tif (bufIsChanged(wp->w_buffer))\n#endif\n\t\t continue;\n\t }\n\t win_close(wp, !buf_hide(wp->w_buffer)\n\t\t\t\t\t && !bufIsChanged(wp->w_buffer));\n\t}\n }", " if (message && !ONE_WINDOW)\n\temsg(_(\"E445: Other window contains changes\"));\n}", " static void\nwin_init_empty(win_T *wp)\n{\n redraw_win_later(wp, NOT_VALID);\n wp->w_lines_valid = 0;\n wp->w_cursor.lnum = 1;\n wp->w_curswant = wp->w_cursor.col = 0;\n wp->w_cursor.coladd = 0;\n wp->w_pcmark.lnum = 1;\t/* pcmark not cleared but set to line 1 */\n wp->w_pcmark.col = 0;\n wp->w_prev_pcmark.lnum = 0;\n wp->w_prev_pcmark.col = 0;\n wp->w_topline = 1;\n#ifdef FEAT_DIFF\n wp->w_topfill = 0;\n#endif\n wp->w_botline = 2;\n#if defined(FEAT_SYN_HL) || defined(FEAT_SPELL)\n wp->w_s = &wp->w_buffer->b_s;\n#endif\n}", "/*\n * Init the current window \"curwin\".\n * Called when a new file is being edited.\n */\n void\ncurwin_init(void)\n{\n win_init_empty(curwin);\n}", "/*\n * Allocate the first window and put an empty buffer in it.\n * Called from main().\n * Return FAIL when something goes wrong (out of memory).\n */\n int\nwin_alloc_first(void)\n{\n if (win_alloc_firstwin(NULL) == FAIL)\n\treturn FAIL;", " first_tabpage = alloc_tabpage();\n if (first_tabpage == NULL)\n\treturn FAIL;\n first_tabpage->tp_topframe = topframe;\n curtab = first_tabpage;", " return OK;\n}", "/*\n * Allocate and init a window that is not a regular window.\n * This can only be done after the first window is fully initialized, thus it\n * can't be in win_alloc_first().\n */\n win_T *\nwin_alloc_popup_win(void)\n{\n win_T *wp;", " wp = win_alloc(NULL, TRUE);\n if (wp != NULL)\n {\n\t// We need to initialize options with something, using the current\n\t// window makes most sense.\n\twin_init_some(wp, curwin);", "\tRESET_BINDING(wp);\n\tnew_frame(wp);\n }\n return wp;\n}", "/*\n * Initialize window \"wp\" to display buffer \"buf\".\n */\n void\nwin_init_popup_win(win_T *wp, buf_T *buf)\n{\n wp->w_buffer = buf;\n ++buf->b_nwindows;\n win_init_empty(wp); // set cursor and topline to safe values", " // Make sure w_localdir and globaldir are NULL to avoid a chdir() in\n // win_enter_ext().\n VIM_CLEAR(wp->w_localdir);\n}", "/*\n * Allocate the first window or the first window in a new tab page.\n * When \"oldwin\" is NULL create an empty buffer for it.\n * When \"oldwin\" is not NULL copy info from it to the new window.\n * Return FAIL when something goes wrong (out of memory).\n */\n static int\nwin_alloc_firstwin(win_T *oldwin)\n{\n curwin = win_alloc(NULL, FALSE);\n if (oldwin == NULL)\n {\n\t/* Very first window, need to create an empty buffer for it and\n\t * initialize from scratch. */\n\tcurbuf = buflist_new(NULL, NULL, 1L, BLN_LISTED);\n\tif (curwin == NULL || curbuf == NULL)\n\t return FAIL;\n\tcurwin->w_buffer = curbuf;\n#ifdef FEAT_SYN_HL\n\tcurwin->w_s = &(curbuf->b_s);\n#endif\n\tcurbuf->b_nwindows = 1;\t/* there is one window */\n\tcurwin->w_alist = &global_alist;\n\tcurwin_init();\t\t/* init current window */\n }\n else\n {\n\t/* First window in new tab page, initialize it from \"oldwin\". */\n\twin_init(curwin, oldwin, 0);", "\t/* We don't want cursor- and scroll-binding in the first window. */\n\tRESET_BINDING(curwin);\n }", " new_frame(curwin);\n if (curwin->w_frame == NULL)\n\treturn FAIL;\n topframe = curwin->w_frame;\n topframe->fr_width = Columns;\n topframe->fr_height = Rows - p_ch;", " return OK;\n}", "/*\n * Create a frame for window \"wp\".\n */\n static void\nnew_frame(win_T *wp)\n{\n frame_T *frp = ALLOC_CLEAR_ONE(frame_T);", " wp->w_frame = frp;\n if (frp != NULL)\n {\n\tfrp->fr_layout = FR_LEAF;\n\tfrp->fr_win = wp;\n }\n}", "/*\n * Initialize the window and frame size to the maximum.\n */\n void\nwin_init_size(void)\n{\n firstwin->w_height = ROWS_AVAIL;\n topframe->fr_height = ROWS_AVAIL;\n firstwin->w_width = Columns;\n topframe->fr_width = Columns;\n}", "/*\n * Allocate a new tabpage_T and init the values.\n * Returns NULL when out of memory.\n */\n static tabpage_T *\nalloc_tabpage(void)\n{\n tabpage_T\t*tp;\n# ifdef FEAT_GUI\n int\t\ti;\n# endif", "\n tp = ALLOC_CLEAR_ONE(tabpage_T);\n if (tp == NULL)\n\treturn NULL;", "# ifdef FEAT_EVAL\n /* init t: variables */\n tp->tp_vars = dict_alloc();\n if (tp->tp_vars == NULL)\n {\n\tvim_free(tp);\n\treturn NULL;\n }\n init_var_dict(tp->tp_vars, &tp->tp_winvar, VAR_SCOPE);\n# endif", "# ifdef FEAT_GUI\n for (i = 0; i < 3; i++)\n\ttp->tp_prev_which_scrollbars[i] = -1;\n# endif\n# ifdef FEAT_DIFF\n tp->tp_diff_invalid = TRUE;\n# endif\n tp->tp_ch_used = p_ch;", " return tp;\n}", " void\nfree_tabpage(tabpage_T *tp)\n{\n int idx;", "# ifdef FEAT_DIFF\n diff_clear(tp);\n# endif\n# ifdef FEAT_TEXT_PROP\n while (tp->tp_first_popupwin != NULL)\n\tpopup_close_tabpage(tp, tp->tp_first_popupwin->w_id);\n#endif\n for (idx = 0; idx < SNAP_COUNT; ++idx)\n\tclear_snapshot(tp, idx);\n#ifdef FEAT_EVAL\n vars_clear(&tp->tp_vars->dv_hashtab);\t/* free all t: variables */\n hash_init(&tp->tp_vars->dv_hashtab);\n unref_var_dict(tp->tp_vars);\n#endif", " vim_free(tp->tp_localdir);", "#ifdef FEAT_PYTHON\n python_tabpage_free(tp);\n#endif", "#ifdef FEAT_PYTHON3\n python3_tabpage_free(tp);\n#endif", " vim_free(tp);\n}", "/*\n * Create a new Tab page with one window.\n * It will edit the current buffer, like after \":split\".\n * When \"after\" is 0 put it just after the current Tab page.\n * Otherwise put it just before tab page \"after\".\n * Return FAIL or OK.\n */\n int\nwin_new_tabpage(int after)\n{\n tabpage_T\t*tp = curtab;\n tabpage_T\t*newtp;\n int\t\tn;", " newtp = alloc_tabpage();\n if (newtp == NULL)\n\treturn FAIL;", " /* Remember the current windows in this Tab page. */\n if (leave_tabpage(curbuf, TRUE) == FAIL)\n {\n\tvim_free(newtp);\n\treturn FAIL;\n }\n curtab = newtp;", " newtp->tp_localdir = (tp->tp_localdir == NULL)\n\t\t\t\t ? NULL : vim_strsave(tp->tp_localdir);\n /* Create a new empty window. */\n if (win_alloc_firstwin(tp->tp_curwin) == OK)\n {\n\t/* Make the new Tab page the new topframe. */\n\tif (after == 1)\n\t{\n\t /* New tab page becomes the first one. */\n\t newtp->tp_next = first_tabpage;\n\t first_tabpage = newtp;\n\t}\n\telse\n\t{\n\t if (after > 0)\n\t {\n\t\t/* Put new tab page before tab page \"after\". */\n\t\tn = 2;\n\t\tfor (tp = first_tabpage; tp->tp_next != NULL\n\t\t\t\t\t && n < after; tp = tp->tp_next)\n\t\t ++n;\n\t }\n\t newtp->tp_next = tp->tp_next;\n\t tp->tp_next = newtp;\n\t}\n\twin_init_size();\n\tfirstwin->w_winrow = tabline_height();\n\twin_comp_scroll(curwin);", "\tnewtp->tp_topframe = topframe;\n\tlast_status(FALSE);", "#if defined(FEAT_GUI)\n\t/* When 'guioptions' includes 'L' or 'R' may have to remove or add\n\t * scrollbars. Have to update them anyway. */\n\tgui_may_update_scrollbars();\n#endif\n#ifdef FEAT_JOB_CHANNEL\n\tentering_window(curwin);\n#endif", "\tredraw_all_later(NOT_VALID);\n\tapply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf);\n\tapply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);\n\tapply_autocmds(EVENT_TABNEW, NULL, NULL, FALSE, curbuf);\n\tapply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);\n\treturn OK;\n }", " /* Failed, get back the previous Tab page */\n enter_tabpage(curtab, curbuf, TRUE, TRUE);\n return FAIL;\n}", "/*\n * Open a new tab page if \":tab cmd\" was used. It will edit the same buffer,\n * like with \":split\".\n * Returns OK if a new tab page was created, FAIL otherwise.\n */\n static int\nmay_open_tabpage(void)\n{\n int\t\tn = (cmdmod.tab == 0) ? postponed_split_tab : cmdmod.tab;", " if (n != 0)\n {\n\tcmdmod.tab = 0;\t /* reset it to avoid doing it twice */\n\tpostponed_split_tab = 0;\n\treturn win_new_tabpage(n);\n }\n return FAIL;\n}", "/*\n * Create up to \"maxcount\" tabpages with empty windows.\n * Returns the number of resulting tab pages.\n */\n int\nmake_tabpages(int maxcount)\n{\n int\t\tcount = maxcount;\n int\t\ttodo;", " /* Limit to 'tabpagemax' tabs. */\n if (count > p_tpm)\n\tcount = p_tpm;", " /*\n * Don't execute autocommands while creating the tab pages. Must do that\n * when putting the buffers in the windows.\n */\n block_autocmds();", " for (todo = count - 1; todo > 0; --todo)\n\tif (win_new_tabpage(0) == FAIL)\n\t break;", " unblock_autocmds();", " /* return actual number of tab pages */\n return (count - todo);\n}", "/*\n * Return TRUE when \"tpc\" points to a valid tab page.\n */\n int\nvalid_tabpage(tabpage_T *tpc)\n{\n tabpage_T\t*tp;", " FOR_ALL_TABPAGES(tp)\n\tif (tp == tpc)\n\t return TRUE;\n return FALSE;\n}", "/*\n * Return TRUE when \"tpc\" points to a valid tab page and at least one window is\n * valid.\n */\n int\nvalid_tabpage_win(tabpage_T *tpc)\n{\n tabpage_T\t*tp;\n win_T\t*wp;", " FOR_ALL_TABPAGES(tp)\n {\n\tif (tp == tpc)\n\t{\n\t FOR_ALL_WINDOWS_IN_TAB(tp, wp)\n\t {\n\t\tif (win_valid_any_tab(wp))\n\t\t return TRUE;\n\t }\n\t return FALSE;\n\t}\n }\n /* shouldn't happen */\n return FALSE;\n}", "/*\n * Close tabpage \"tab\", assuming it has no windows in it.\n * There must be another tabpage or this will crash.\n */\n void\nclose_tabpage(tabpage_T *tab)\n{\n tabpage_T\t*ptp;", " if (tab == first_tabpage)\n {\n\tfirst_tabpage = tab->tp_next;\n\tptp = first_tabpage;\n }\n else\n {\n\tfor (ptp = first_tabpage; ptp != NULL && ptp->tp_next != tab;\n\t\t\t\t\t\t\t ptp = ptp->tp_next)\n\t ;\n\tassert(ptp != NULL);\n\tptp->tp_next = tab->tp_next;\n }", " goto_tabpage_tp(ptp, FALSE, FALSE);\n free_tabpage(tab);\n}", "/*\n * Find tab page \"n\" (first one is 1). Returns NULL when not found.\n */\n tabpage_T *\nfind_tabpage(int n)\n{\n tabpage_T\t*tp;\n int\t\ti = 1;", " if (n == 0)\n\treturn curtab;", " for (tp = first_tabpage; tp != NULL && i != n; tp = tp->tp_next)\n\t++i;\n return tp;\n}", "/*\n * Get index of tab page \"tp\". First one has index 1.\n * When not found returns number of tab pages plus one.\n */\n int\ntabpage_index(tabpage_T *ftp)\n{\n int\t\ti = 1;\n tabpage_T\t*tp;", " for (tp = first_tabpage; tp != NULL && tp != ftp; tp = tp->tp_next)\n\t++i;\n return i;\n}", "/*\n * Prepare for leaving the current tab page.\n * When autocommands change \"curtab\" we don't leave the tab page and return\n * FAIL.\n * Careful: When OK is returned need to get a new tab page very very soon!\n */\n static int\nleave_tabpage(\n buf_T\t*new_curbuf UNUSED, /* what is going to be the new curbuf,\n\t\t\t\t NULL if unknown */\n int\t\ttrigger_leave_autocmds UNUSED)\n{\n tabpage_T\t*tp = curtab;", "#ifdef FEAT_JOB_CHANNEL\n leaving_window(curwin);\n#endif\n reset_VIsual_and_resel();\t/* stop Visual mode */\n if (trigger_leave_autocmds)\n {\n\tif (new_curbuf != curbuf)\n\t{\n\t apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);\n\t if (curtab != tp)\n\t\treturn FAIL;\n\t}\n\tapply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf);\n\tif (curtab != tp)\n\t return FAIL;\n\tapply_autocmds(EVENT_TABLEAVE, NULL, NULL, FALSE, curbuf);\n\tif (curtab != tp)\n\t return FAIL;\n }\n#if defined(FEAT_GUI)\n /* Remove the scrollbars. They may be added back later. */\n if (gui.in_use)\n\tgui_remove_scrollbars();\n#endif\n tp->tp_curwin = curwin;\n tp->tp_prevwin = prevwin;\n tp->tp_firstwin = firstwin;\n tp->tp_lastwin = lastwin;\n tp->tp_old_Rows = Rows;\n tp->tp_old_Columns = Columns;\n firstwin = NULL;\n lastwin = NULL;\n return OK;\n}", "/*\n * Start using tab page \"tp\".\n * Only to be used after leave_tabpage() or freeing the current tab page.\n * Only trigger *Enter autocommands when trigger_enter_autocmds is TRUE.\n * Only trigger *Leave autocommands when trigger_leave_autocmds is TRUE.\n */\n static void\nenter_tabpage(\n tabpage_T\t*tp,\n buf_T\t*old_curbuf UNUSED,\n int\t\ttrigger_enter_autocmds,\n int\t\ttrigger_leave_autocmds)\n{\n int\t\told_off = tp->tp_firstwin->w_winrow;\n win_T\t*next_prevwin = tp->tp_prevwin;", " curtab = tp;\n firstwin = tp->tp_firstwin;\n lastwin = tp->tp_lastwin;\n topframe = tp->tp_topframe;", " /* We would like doing the TabEnter event first, but we don't have a\n * valid current window yet, which may break some commands.\n * This triggers autocommands, thus may make \"tp\" invalid. */\n win_enter_ext(tp->tp_curwin, FALSE, TRUE, FALSE,\n\t\t\t trigger_enter_autocmds, trigger_leave_autocmds);\n prevwin = next_prevwin;", " last_status(FALSE);\t\t/* status line may appear or disappear */\n (void)win_comp_pos();\t/* recompute w_winrow for all windows */\n#ifdef FEAT_DIFF\n diff_need_scrollbind = TRUE;\n#endif", " /* The tabpage line may have appeared or disappeared, may need to resize\n * the frames for that. When the Vim window was resized need to update\n * frame sizes too. Use the stored value of p_ch, so that it can be\n * different for each tab page. */\n if (p_ch != curtab->tp_ch_used)\n\tclear_cmdline = TRUE;\n p_ch = curtab->tp_ch_used;\n if (curtab->tp_old_Rows != Rows || (old_off != firstwin->w_winrow\n#ifdef FEAT_GUI_TABLINE\n\t\t\t && !gui_use_tabline()\n#endif\n\t\t))\n\tshell_new_rows();\n if (curtab->tp_old_Columns != Columns && starting == 0)\n\tshell_new_columns();\t/* update window widths */", "#if defined(FEAT_GUI)\n /* When 'guioptions' includes 'L' or 'R' may have to remove or add\n * scrollbars. Have to update them anyway. */\n gui_may_update_scrollbars();\n#endif", " /* Apply autocommands after updating the display, when 'rows' and\n * 'columns' have been set correctly. */\n if (trigger_enter_autocmds)\n {\n\tapply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);\n\tif (old_curbuf != curbuf)\n\t apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);\n }", " redraw_all_later(NOT_VALID);\n}", "/*\n * Go to tab page \"n\". For \":tab N\" and \"Ngt\".\n * When \"n\" is 9999 go to the last tab page.\n */\n void\ngoto_tabpage(int n)\n{\n tabpage_T\t*tp = NULL; // shut up compiler\n tabpage_T\t*ttp;\n int\t\ti;", " if (text_locked())\n {\n\t/* Not allowed when editing the command line. */\n\ttext_locked_msg();\n\treturn;\n }", " /* If there is only one it can't work. */\n if (first_tabpage->tp_next == NULL)\n {\n\tif (n > 1)\n\t beep_flush();\n\treturn;\n }", " if (n == 0)\n {\n\t/* No count, go to next tab page, wrap around end. */\n\tif (curtab->tp_next == NULL)\n\t tp = first_tabpage;\n\telse\n\t tp = curtab->tp_next;\n }\n else if (n < 0)\n {\n\t/* \"gT\": go to previous tab page, wrap around end. \"N gT\" repeats\n\t * this N times. */\n\tttp = curtab;\n\tfor (i = n; i < 0; ++i)\n\t{\n\t for (tp = first_tabpage; tp->tp_next != ttp && tp->tp_next != NULL;\n\t\t tp = tp->tp_next)\n\t\t;\n\t ttp = tp;\n\t}\n }\n else if (n == 9999)\n {\n\t/* Go to last tab page. */\n\tfor (tp = first_tabpage; tp->tp_next != NULL; tp = tp->tp_next)\n\t ;\n }\n else\n {\n\t/* Go to tab page \"n\". */\n\ttp = find_tabpage(n);\n\tif (tp == NULL)\n\t{\n\t beep_flush();\n\t return;\n\t}\n }", " goto_tabpage_tp(tp, TRUE, TRUE);", "#ifdef FEAT_GUI_TABLINE\n if (gui_use_tabline())\n\tgui_mch_set_curtab(tabpage_index(curtab));\n#endif\n}", "/*\n * Go to tabpage \"tp\".\n * Only trigger *Enter autocommands when trigger_enter_autocmds is TRUE.\n * Only trigger *Leave autocommands when trigger_leave_autocmds is TRUE.\n * Note: doesn't update the GUI tab.\n */\n void\ngoto_tabpage_tp(\n tabpage_T\t*tp,\n int\t\ttrigger_enter_autocmds,\n int\t\ttrigger_leave_autocmds)\n{\n /* Don't repeat a message in another tab page. */\n set_keep_msg(NULL, 0);", " if (tp != curtab && leave_tabpage(tp->tp_curwin->w_buffer,\n\t\t\t\t\ttrigger_leave_autocmds) == OK)\n {\n\tif (valid_tabpage(tp))\n\t enter_tabpage(tp, curbuf, trigger_enter_autocmds,\n\t\t trigger_leave_autocmds);\n\telse\n\t enter_tabpage(curtab, curbuf, trigger_enter_autocmds,\n\t\t trigger_leave_autocmds);\n }\n}", "/*\n * Enter window \"wp\" in tab page \"tp\".\n * Also updates the GUI tab.\n */\n void\ngoto_tabpage_win(tabpage_T *tp, win_T *wp)\n{\n goto_tabpage_tp(tp, TRUE, TRUE);\n if (curtab == tp && win_valid(wp))\n {\n\twin_enter(wp, TRUE);\n# ifdef FEAT_GUI_TABLINE\n\tif (gui_use_tabline())\n\t gui_mch_set_curtab(tabpage_index(curtab));\n# endif\n }\n}", "/*\n * Move the current tab page to after tab page \"nr\".\n */\n void\ntabpage_move(int nr)\n{\n int\t\tn = 1;\n tabpage_T\t*tp, *tp_dst;", " if (first_tabpage->tp_next == NULL)\n\treturn;", " for (tp = first_tabpage; tp->tp_next != NULL && n < nr; tp = tp->tp_next)\n\t++n;", " if (tp == curtab || (nr > 0 && tp->tp_next != NULL\n\t\t\t\t\t\t && tp->tp_next == curtab))\n\treturn;", " tp_dst = tp;", " /* Remove the current tab page from the list of tab pages. */\n if (curtab == first_tabpage)\n\tfirst_tabpage = curtab->tp_next;\n else\n {\n\tFOR_ALL_TABPAGES(tp)\n\t if (tp->tp_next == curtab)\n\t\tbreak;\n\tif (tp == NULL)\t/* \"cannot happen\" */\n\t return;\n\ttp->tp_next = curtab->tp_next;\n }", " /* Re-insert it at the specified position. */\n if (nr <= 0)\n {\n\tcurtab->tp_next = first_tabpage;\n\tfirst_tabpage = curtab;\n }\n else\n {\n\tcurtab->tp_next = tp_dst->tp_next;\n\ttp_dst->tp_next = curtab;\n }", " /* Need to redraw the tabline. Tab page contents doesn't change. */\n redraw_tabline = TRUE;\n}", "\n/*\n * Go to another window.\n * When jumping to another buffer, stop Visual mode. Do this before\n * changing windows so we can yank the selection into the '*' register.\n * When jumping to another window on the same buffer, adjust its cursor\n * position to keep the same Visual area.\n */\n void\nwin_goto(win_T *wp)\n{\n#ifdef FEAT_CONCEAL\n win_T\t*owp = curwin;\n#endif", " if (ERROR_IF_POPUP_WINDOW)\n\treturn;\n if (text_locked())\n {\n\tbeep_flush();\n\ttext_locked_msg();\n\treturn;\n }\n if (curbuf_locked())\n\treturn;", " if (wp->w_buffer != curbuf)\n\treset_VIsual_and_resel();\n else if (VIsual_active)\n\twp->w_cursor = curwin->w_cursor;", "#ifdef FEAT_GUI\n need_mouse_correct = TRUE;\n#endif\n win_enter(wp, TRUE);", "#ifdef FEAT_CONCEAL\n // Conceal cursor line in previous window, unconceal in current window.\n if (win_valid(owp) && owp->w_p_cole > 0 && !msg_scrolled)\n\tredrawWinline(owp, owp->w_cursor.lnum);\n if (curwin->w_p_cole > 0 && !msg_scrolled)\n\tneed_cursor_line_redraw = TRUE;\n#endif\n}", "#if defined(FEAT_PERL) || defined(PROTO)\n/*\n * Find window number \"winnr\" (counting top to bottom).\n */\n win_T *\nwin_find_nr(int winnr)\n{\n win_T\t*wp;", " FOR_ALL_WINDOWS(wp)\n\tif (--winnr == 0)\n\t break;\n return wp;\n}\n#endif", "#if ((defined(FEAT_PYTHON) || defined(FEAT_PYTHON3))) || defined(PROTO)\n/*\n * Find the tabpage for window \"win\".\n */\n tabpage_T *\nwin_find_tabpage(win_T *win)\n{\n win_T\t*wp;\n tabpage_T\t*tp;", " FOR_ALL_TAB_WINDOWS(tp, wp)\n\t if (wp == win)\n\t\treturn tp;\n return NULL;\n}\n#endif", "/*\n * Get the above or below neighbor window of the specified window.\n * up - TRUE for the above neighbor\n * count - nth neighbor window\n * Returns the specified window if the neighbor is not found.\n */\n win_T *\nwin_vert_neighbor(tabpage_T *tp, win_T *wp, int up, long count)\n{\n frame_T\t*fr;\n frame_T\t*nfr;\n frame_T\t*foundfr;", " foundfr = wp->w_frame;\n while (count--)\n {\n\t/*\n\t * First go upwards in the tree of frames until we find a upwards or\n\t * downwards neighbor.\n\t */\n\tfr = foundfr;\n\tfor (;;)\n\t{\n\t if (fr == tp->tp_topframe)\n\t\tgoto end;\n\t if (up)\n\t\tnfr = fr->fr_prev;\n\t else\n\t\tnfr = fr->fr_next;\n\t if (fr->fr_parent->fr_layout == FR_COL && nfr != NULL)\n\t\tbreak;\n\t fr = fr->fr_parent;\n\t}", "\t/*\n\t * Now go downwards to find the bottom or top frame in it.\n\t */\n\tfor (;;)\n\t{\n\t if (nfr->fr_layout == FR_LEAF)\n\t {\n\t\tfoundfr = nfr;\n\t\tbreak;\n\t }\n\t fr = nfr->fr_child;\n\t if (nfr->fr_layout == FR_ROW)\n\t {\n\t\t/* Find the frame at the cursor row. */\n\t\twhile (fr->fr_next != NULL\n\t\t\t&& frame2win(fr)->w_wincol + fr->fr_width\n\t\t\t\t\t <= wp->w_wincol + wp->w_wcol)\n\t\t fr = fr->fr_next;\n\t }\n\t if (nfr->fr_layout == FR_COL && up)\n\t\twhile (fr->fr_next != NULL)\n\t\t fr = fr->fr_next;\n\t nfr = fr;\n\t}\n }\nend:\n return foundfr != NULL ? foundfr->fr_win : NULL;\n}", "/*\n * Move to window above or below \"count\" times.\n */\n static void\nwin_goto_ver(\n int\t\tup,\t\t// TRUE to go to win above\n long\tcount)\n{\n win_T\t*win;", " win = win_vert_neighbor(curtab, curwin, up, count);\n if (win != NULL)\n\twin_goto(win);\n}", "/*\n * Get the left or right neighbor window of the specified window.\n * left - TRUE for the left neighbor\n * count - nth neighbor window\n * Returns the specified window if the neighbor is not found.\n */\n win_T *\nwin_horz_neighbor(tabpage_T *tp, win_T *wp, int left, long count)\n{\n frame_T\t*fr;\n frame_T\t*nfr;\n frame_T\t*foundfr;", " foundfr = wp->w_frame;\n while (count--)\n {\n\t/*\n\t * First go upwards in the tree of frames until we find a left or\n\t * right neighbor.\n\t */\n\tfr = foundfr;\n\tfor (;;)\n\t{\n\t if (fr == tp->tp_topframe)\n\t\tgoto end;\n\t if (left)\n\t\tnfr = fr->fr_prev;\n\t else\n\t\tnfr = fr->fr_next;\n\t if (fr->fr_parent->fr_layout == FR_ROW && nfr != NULL)\n\t\tbreak;\n\t fr = fr->fr_parent;\n\t}", "\t/*\n\t * Now go downwards to find the leftmost or rightmost frame in it.\n\t */\n\tfor (;;)\n\t{\n\t if (nfr->fr_layout == FR_LEAF)\n\t {\n\t\tfoundfr = nfr;\n\t\tbreak;\n\t }\n\t fr = nfr->fr_child;\n\t if (nfr->fr_layout == FR_COL)\n\t {\n\t\t/* Find the frame at the cursor row. */\n\t\twhile (fr->fr_next != NULL\n\t\t\t&& frame2win(fr)->w_winrow + fr->fr_height\n\t\t\t\t\t <= wp->w_winrow + wp->w_wrow)\n\t\t fr = fr->fr_next;\n\t }\n\t if (nfr->fr_layout == FR_ROW && left)\n\t\twhile (fr->fr_next != NULL)\n\t\t fr = fr->fr_next;\n\t nfr = fr;\n\t}\n }\nend:\n return foundfr != NULL ? foundfr->fr_win : NULL;\n}", "/*\n * Move to left or right window.\n */\n static void\nwin_goto_hor(\n int\t\tleft,\t\t// TRUE to go to left win\n long\tcount)\n{\n win_T\t*win;", " win = win_horz_neighbor(curtab, curwin, left, count);\n if (win != NULL)\n\twin_goto(win);\n}", "/*\n * Make window \"wp\" the current window.\n */\n void\nwin_enter(win_T *wp, int undo_sync)\n{\n win_enter_ext(wp, undo_sync, FALSE, FALSE, TRUE, TRUE);\n}", "/*\n * Make window wp the current window.\n * Can be called with \"curwin_invalid\" TRUE, which means that curwin has just\n * been closed and isn't valid.\n */\n static void\nwin_enter_ext(\n win_T\t*wp,\n int\t\tundo_sync,\n int\t\tcurwin_invalid,\n int\t\ttrigger_new_autocmds,\n int\t\ttrigger_enter_autocmds,\n int\t\ttrigger_leave_autocmds)\n{\n int\t\tother_buffer = FALSE;", " if (wp == curwin && !curwin_invalid)\t/* nothing to do */\n\treturn;", "#ifdef FEAT_JOB_CHANNEL\n if (!curwin_invalid)\n\tleaving_window(curwin);\n#endif", " if (!curwin_invalid && trigger_leave_autocmds)\n {\n\t/*\n\t * Be careful: If autocommands delete the window, return now.\n\t */\n\tif (wp->w_buffer != curbuf)\n\t{\n\t apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);\n\t other_buffer = TRUE;\n\t if (!win_valid(wp))\n\t\treturn;\n\t}\n\tapply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf);\n\tif (!win_valid(wp))\n\t return;\n#ifdef FEAT_EVAL\n\t/* autocmds may abort script processing */\n\tif (aborting())\n\t return;\n#endif\n }", " /* sync undo before leaving the current buffer */\n if (undo_sync && curbuf != wp->w_buffer)\n\tu_sync(FALSE);", " /* Might need to scroll the old window before switching, e.g., when the\n * cursor was moved. */\n update_topline();", " /* may have to copy the buffer options when 'cpo' contains 'S' */\n if (wp->w_buffer != curbuf)\n\tbuf_copy_options(wp->w_buffer, BCO_ENTER | BCO_NOHELP);\n if (!curwin_invalid)\n {\n\tprevwin = curwin;\t/* remember for CTRL-W p */\n\tcurwin->w_redr_status = TRUE;\n }\n curwin = wp;\n curbuf = wp->w_buffer;\n check_cursor();\n if (!virtual_active())\n\tcurwin->w_cursor.coladd = 0;\n changed_line_abv_curs();\t/* assume cursor position needs updating */", " if (curwin->w_localdir != NULL || curtab->tp_localdir != NULL)\n {\n\tchar_u\t*dirname;", "\t// Window or tab has a local directory: Save current directory as\n\t// global directory (unless that was done already) and change to the\n\t// local directory.\n\tif (globaldir == NULL)\n\t{\n\t char_u\tcwd[MAXPATHL];", "\t if (mch_dirname(cwd, MAXPATHL) == OK)\n\t\tglobaldir = vim_strsave(cwd);\n\t}\n\tif (curwin->w_localdir != NULL)\n\t dirname = curwin->w_localdir;\n\telse\n\t dirname = curtab->tp_localdir;", "\tif (mch_chdir((char *)dirname) == 0)\n\t shorten_fnames(TRUE);\n }\n else if (globaldir != NULL)\n {\n\t/* Window doesn't have a local directory and we are not in the global\n\t * directory: Change to the global directory. */\n\tvim_ignored = mch_chdir((char *)globaldir);\n\tVIM_CLEAR(globaldir);\n\tshorten_fnames(TRUE);\n }", "#ifdef FEAT_JOB_CHANNEL\n entering_window(curwin);\n#endif", "", " if (trigger_new_autocmds)\n\tapply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf);\n if (trigger_enter_autocmds)\n {\n\tapply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);\n\tif (other_buffer)\n\t apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);\n }", "#ifdef FEAT_TITLE\n maketitle();\n#endif\n curwin->w_redr_status = TRUE;\n#ifdef FEAT_TERMINAL", " if (bt_terminal(wp->w_buffer))", "\t// terminal is likely in another mode\n\tredraw_mode = TRUE;\n#endif\n redraw_tabline = TRUE;\n if (restart_edit)\n\tredraw_later(VALID);\t/* causes status line redraw */", " /* set window height to desired minimal value */\n if (curwin->w_height < p_wh && !curwin->w_p_wfh\n#ifdef FEAT_TEXT_PROP\n\t && !popup_is_popup(curwin)\n#endif\n\t )\n\twin_setheight((int)p_wh);\n else if (curwin->w_height == 0)\n\twin_setheight(1);", " /* set window width to desired minimal value */\n if (curwin->w_width < p_wiw && !curwin->w_p_wfw)\n\twin_setwidth((int)p_wiw);", " setmouse();\t\t\t// in case jumped to/from help buffer", " /* Change directories when the 'acd' option is set. */\n DO_AUTOCHDIR;\n}", "\n/*\n * Jump to the first open window that contains buffer \"buf\", if one exists.\n * Returns a pointer to the window found, otherwise NULL.\n */\n win_T *\nbuf_jump_open_win(buf_T *buf)\n{\n win_T\t*wp = NULL;", " if (curwin->w_buffer == buf)\n\twp = curwin;\n else\n\tFOR_ALL_WINDOWS(wp)\n\t if (wp->w_buffer == buf)\n\t\tbreak;\n if (wp != NULL)\n\twin_enter(wp, FALSE);\n return wp;\n}", "/*\n * Jump to the first open window in any tab page that contains buffer \"buf\",\n * if one exists.\n * Returns a pointer to the window found, otherwise NULL.\n */\n win_T *\nbuf_jump_open_tab(buf_T *buf)\n{\n win_T\t*wp = buf_jump_open_win(buf);\n tabpage_T\t*tp;", " if (wp != NULL)\n\treturn wp;", " FOR_ALL_TABPAGES(tp)\n\tif (tp != curtab)\n\t{\n\t for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next)\n\t\tif (wp->w_buffer == buf)\n\t\t break;\n\t if (wp != NULL)\n\t {\n\t\tgoto_tabpage_win(tp, wp);\n\t\tif (curwin != wp)\n\t\t wp = NULL;\t/* something went wrong */\n\t\tbreak;\n\t }\n\t}\n return wp;\n}", "static int last_win_id = LOWEST_WIN_ID - 1;", "/*\n * Allocate a window structure and link it in the window list when \"hidden\" is\n * FALSE.\n */\n static win_T *\nwin_alloc(win_T *after UNUSED, int hidden UNUSED)\n{\n win_T\t*new_wp;", " /*\n * allocate window structure and linesizes arrays\n */\n new_wp = ALLOC_CLEAR_ONE(win_T);\n if (new_wp == NULL)\n\treturn NULL;", " if (win_alloc_lines(new_wp) == FAIL)\n {\n\tvim_free(new_wp);\n\treturn NULL;\n }", " new_wp->w_id = ++last_win_id;", "#ifdef FEAT_EVAL\n /* init w: variables */\n new_wp->w_vars = dict_alloc();\n if (new_wp->w_vars == NULL)\n {\n\twin_free_lsize(new_wp);\n\tvim_free(new_wp);\n\treturn NULL;\n }\n init_var_dict(new_wp->w_vars, &new_wp->w_winvar, VAR_SCOPE);\n#endif", " /* Don't execute autocommands while the window is not properly\n * initialized yet. gui_create_scrollbar() may trigger a FocusGained\n * event. */\n block_autocmds();", " /*\n * link the window in the window list\n */\n if (!hidden)\n\twin_append(after, new_wp);\n new_wp->w_wincol = 0;\n new_wp->w_width = Columns;", " /* position the display and the cursor at the top of the file. */\n new_wp->w_topline = 1;\n#ifdef FEAT_DIFF\n new_wp->w_topfill = 0;\n#endif\n new_wp->w_botline = 2;\n new_wp->w_cursor.lnum = 1;\n new_wp->w_scbind_pos = 1;", " // use global option value for global-local options\n new_wp->w_p_so = -1;\n new_wp->w_p_siso = -1;", " /* We won't calculate w_fraction until resizing the window */\n new_wp->w_fraction = 0;\n new_wp->w_prev_fraction_row = -1;", "#ifdef FEAT_GUI\n if (gui.in_use)\n {\n\tgui_create_scrollbar(&new_wp->w_scrollbars[SBAR_LEFT],\n\t\tSBAR_LEFT, new_wp);\n\tgui_create_scrollbar(&new_wp->w_scrollbars[SBAR_RIGHT],\n\t\tSBAR_RIGHT, new_wp);\n }\n#endif\n#ifdef FEAT_FOLDING\n foldInitWin(new_wp);\n#endif\n unblock_autocmds();\n#ifdef FEAT_SEARCH_EXTRA\n new_wp->w_match_head = NULL;\n new_wp->w_next_match_id = 4;\n#endif\n return new_wp;\n}", "/*\n * Remove window 'wp' from the window list and free the structure.\n */\n static void\nwin_free(\n win_T\t*wp,\n tabpage_T\t*tp)\t\t/* tab page \"win\" is in, NULL for current */\n{\n int\t\ti;\n buf_T\t*buf;\n wininfo_T\t*wip;", "#ifdef FEAT_FOLDING\n clearFolding(wp);\n#endif", " /* reduce the reference count to the argument list. */\n alist_unlink(wp->w_alist);", " /* Don't execute autocommands while the window is halfway being deleted.\n * gui_mch_destroy_scrollbar() may trigger a FocusGained event. */\n block_autocmds();", "#ifdef FEAT_LUA\n lua_window_free(wp);\n#endif", "#ifdef FEAT_MZSCHEME\n mzscheme_window_free(wp);\n#endif", "#ifdef FEAT_PERL\n perl_win_free(wp);\n#endif", "#ifdef FEAT_PYTHON\n python_window_free(wp);\n#endif", "#ifdef FEAT_PYTHON3\n python3_window_free(wp);\n#endif", "#ifdef FEAT_TCL\n tcl_window_free(wp);\n#endif", "#ifdef FEAT_RUBY\n ruby_window_free(wp);\n#endif", " clear_winopt(&wp->w_onebuf_opt);\n clear_winopt(&wp->w_allbuf_opt);", "#ifdef FEAT_EVAL\n vars_clear(&wp->w_vars->dv_hashtab);\t/* free all w: variables */\n hash_init(&wp->w_vars->dv_hashtab);\n unref_var_dict(wp->w_vars);\n#endif", " {\n\ttabpage_T\t*ttp;", "\tif (prevwin == wp)\n\t prevwin = NULL;\n\tFOR_ALL_TABPAGES(ttp)\n\t if (ttp->tp_prevwin == wp)\n\t\tttp->tp_prevwin = NULL;\n }\n win_free_lsize(wp);", " for (i = 0; i < wp->w_tagstacklen; ++i)\n {\n\tvim_free(wp->w_tagstack[i].tagname);\n\tvim_free(wp->w_tagstack[i].user_data);\n }\n vim_free(wp->w_localdir);", " /* Remove the window from the b_wininfo lists, it may happen that the\n * freed memory is re-used for another window. */\n FOR_ALL_BUFFERS(buf)\n\tfor (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)\n\t if (wip->wi_win == wp)\n\t\twip->wi_win = NULL;", "#ifdef FEAT_SEARCH_EXTRA\n clear_matches(wp);\n#endif", "#ifdef FEAT_JUMPLIST\n free_jumplist(wp);\n#endif", "#ifdef FEAT_QUICKFIX\n qf_free_all(wp);\n#endif", "#ifdef FEAT_GUI\n if (gui.in_use)\n {\n\tgui_mch_destroy_scrollbar(&wp->w_scrollbars[SBAR_LEFT]);\n\tgui_mch_destroy_scrollbar(&wp->w_scrollbars[SBAR_RIGHT]);\n }\n#endif /* FEAT_GUI */", "#ifdef FEAT_MENU\n remove_winbar(wp);\n#endif\n#ifdef FEAT_TEXT_PROP\n free_callback(&wp->w_close_cb);\n free_callback(&wp->w_filter_cb);\n for (i = 0; i < 4; ++i)\n\tVIM_CLEAR(wp->w_border_highlight[i]);\n vim_free(wp->w_scrollbar_highlight);\n vim_free(wp->w_thumb_highlight);\n vim_free(wp->w_popup_title);\n list_unref(wp->w_popup_mask);\n vim_free(wp->w_popup_mask_cells);\n#endif", "#ifdef FEAT_SYN_HL\n vim_free(wp->w_p_cc_cols);\n#endif", " if (win_valid_any_tab(wp))\n\twin_remove(wp, tp);\n if (autocmd_busy)\n {\n\twp->w_next = au_pending_free_win;\n\tau_pending_free_win = wp;\n }\n else\n\tvim_free(wp);", " unblock_autocmds();\n}", "/*\n * Return TRUE if \"wp\" is not in the list of windows: the autocmd window or a\n * popup window.\n */\n static int\nwin_unlisted(win_T *wp)\n{\n return wp == aucmd_win || WIN_IS_POPUP(wp);\n}", "#if defined(FEAT_TEXT_PROP) || defined(PROTO)\n/*\n * Free a popup window. This does not take the window out of the window list\n * and assumes there is only one toplevel frame, no split.\n */\n void\nwin_free_popup(win_T *win)\n{\n if (bt_popup(win->w_buffer))\n\twin_close_buffer(win, DOBUF_WIPE_REUSE, FALSE);\n else\n\tclose_buffer(win, win->w_buffer, 0, FALSE);\n# if defined(FEAT_TIMERS)\n if (win->w_popup_timer != NULL)\n\tstop_timer(win->w_popup_timer);\n# endif\n vim_free(win->w_frame);\n win_free(win, NULL);\n}\n#endif", "/*\n * Append window \"wp\" in the window list after window \"after\".\n */\n static void\nwin_append(win_T *after, win_T *wp)\n{\n win_T\t*before;", " if (after == NULL)\t /* after NULL is in front of the first */\n\tbefore = firstwin;\n else\n\tbefore = after->w_next;", " wp->w_next = before;\n wp->w_prev = after;\n if (after == NULL)\n\tfirstwin = wp;\n else\n\tafter->w_next = wp;\n if (before == NULL)\n\tlastwin = wp;\n else\n\tbefore->w_prev = wp;\n}", "/*\n * Remove a window from the window list.\n */\n void\nwin_remove(\n win_T\t*wp,\n tabpage_T\t*tp)\t\t/* tab page \"win\" is in, NULL for current */\n{\n if (wp->w_prev != NULL)\n\twp->w_prev->w_next = wp->w_next;\n else if (tp == NULL)\n\tfirstwin = curtab->tp_firstwin = wp->w_next;\n else\n\ttp->tp_firstwin = wp->w_next;", " if (wp->w_next != NULL)\n\twp->w_next->w_prev = wp->w_prev;\n else if (tp == NULL)\n\tlastwin = curtab->tp_lastwin = wp->w_prev;\n else\n\ttp->tp_lastwin = wp->w_prev;\n}", "/*\n * Append frame \"frp\" in a frame list after frame \"after\".\n */\n static void\nframe_append(frame_T *after, frame_T *frp)\n{\n frp->fr_next = after->fr_next;\n after->fr_next = frp;\n if (frp->fr_next != NULL)\n\tfrp->fr_next->fr_prev = frp;\n frp->fr_prev = after;\n}", "/*\n * Insert frame \"frp\" in a frame list before frame \"before\".\n */\n static void\nframe_insert(frame_T *before, frame_T *frp)\n{\n frp->fr_next = before;\n frp->fr_prev = before->fr_prev;\n before->fr_prev = frp;\n if (frp->fr_prev != NULL)\n\tfrp->fr_prev->fr_next = frp;\n else\n\tfrp->fr_parent->fr_child = frp;\n}", "/*\n * Remove a frame from a frame list.\n */\n static void\nframe_remove(frame_T *frp)\n{\n if (frp->fr_prev != NULL)\n\tfrp->fr_prev->fr_next = frp->fr_next;\n else\n {\n\tfrp->fr_parent->fr_child = frp->fr_next;\n\t/* special case: topframe->fr_child == frp */\n\tif (topframe->fr_child == frp)\n\t topframe->fr_child = frp->fr_next;\n }\n if (frp->fr_next != NULL)\n\tfrp->fr_next->fr_prev = frp->fr_prev;\n}", "/*\n * Allocate w_lines[] for window \"wp\".\n * Return FAIL for failure, OK for success.\n */\n int\nwin_alloc_lines(win_T *wp)\n{\n wp->w_lines_valid = 0;\n wp->w_lines = ALLOC_CLEAR_MULT(wline_T, Rows );\n if (wp->w_lines == NULL)\n\treturn FAIL;\n return OK;\n}", "/*\n * free lsize arrays for a window\n */\n void\nwin_free_lsize(win_T *wp)\n{\n /* TODO: why would wp be NULL here? */\n if (wp != NULL)\n\tVIM_CLEAR(wp->w_lines);\n}", "/*\n * Called from win_new_shellsize() after Rows changed.\n * This only does the current tab page, others must be done when made active.\n */\n void\nshell_new_rows(void)\n{\n int\t\th = (int)ROWS_AVAIL;", " if (firstwin == NULL)\t/* not initialized yet */\n\treturn;\n if (h < frame_minheight(topframe, NULL))\n\th = frame_minheight(topframe, NULL);", " /* First try setting the heights of windows with 'winfixheight'. If\n * that doesn't result in the right height, forget about that option. */\n frame_new_height(topframe, h, FALSE, TRUE);\n if (!frame_check_height(topframe, h))\n\tframe_new_height(topframe, h, FALSE, FALSE);", " (void)win_comp_pos();\t\t/* recompute w_winrow and w_wincol */\n compute_cmdrow();\n curtab->tp_ch_used = p_ch;", "#if 0\n /* Disabled: don't want making the screen smaller make a window larger. */\n if (p_ea)\n\twin_equal(curwin, FALSE, 'v');\n#endif\n}", "/*\n * Called from win_new_shellsize() after Columns changed.\n */\n void\nshell_new_columns(void)\n{\n if (firstwin == NULL)\t/* not initialized yet */\n\treturn;", " /* First try setting the widths of windows with 'winfixwidth'. If that\n * doesn't result in the right width, forget about that option. */\n frame_new_width(topframe, (int)Columns, FALSE, TRUE);\n if (!frame_check_width(topframe, Columns))\n\tframe_new_width(topframe, (int)Columns, FALSE, FALSE);", " (void)win_comp_pos();\t\t/* recompute w_winrow and w_wincol */\n#if 0\n /* Disabled: don't want making the screen smaller make a window larger. */\n if (p_ea)\n\twin_equal(curwin, FALSE, 'h');\n#endif\n}", "#if defined(FEAT_CMDWIN) || defined(PROTO)\n/*\n * Save the size of all windows in \"gap\".\n */\n void\nwin_size_save(garray_T *gap)", "{\n win_T\t*wp;", " ga_init2(gap, (int)sizeof(int), 1);\n if (ga_grow(gap, win_count() * 2) == OK)\n\tFOR_ALL_WINDOWS(wp)\n\t{\n\t ((int *)gap->ga_data)[gap->ga_len++] =\n\t\t\t\t\t wp->w_width + wp->w_vsep_width;\n\t ((int *)gap->ga_data)[gap->ga_len++] = wp->w_height;\n\t}\n}", "/*\n * Restore window sizes, but only if the number of windows is still the same.\n * Does not free the growarray.\n */\n void\nwin_size_restore(garray_T *gap)\n{\n win_T\t*wp;\n int\t\ti, j;", " if (win_count() * 2 == gap->ga_len)\n {\n\t/* The order matters, because frames contain other frames, but it's\n\t * difficult to get right. The easy way out is to do it twice. */\n\tfor (j = 0; j < 2; ++j)\n\t{\n\t i = 0;\n\t FOR_ALL_WINDOWS(wp)\n\t {\n\t\tframe_setwidth(wp->w_frame, ((int *)gap->ga_data)[i++]);\n\t\twin_setheight_win(((int *)gap->ga_data)[i++], wp);\n\t }\n\t}\n\t/* recompute the window positions */\n\t(void)win_comp_pos();\n }\n}\n#endif /* FEAT_CMDWIN */", "/*\n * Update the position for all windows, using the width and height of the\n * frames.\n * Returns the row just after the last window.\n */\n int\nwin_comp_pos(void)\n{\n int\t\trow = tabline_height();\n int\t\tcol = 0;", " frame_comp_pos(topframe, &row, &col);\n return row;\n}", "/*\n * Update the position of the windows in frame \"topfrp\", using the width and\n * height of the frames.\n * \"*row\" and \"*col\" are the top-left position of the frame. They are updated\n * to the bottom-right position plus one.\n */\n static void\nframe_comp_pos(frame_T *topfrp, int *row, int *col)\n{\n win_T\t*wp;\n frame_T\t*frp;\n int\t\tstartcol;\n int\t\tstartrow;\n int\t\th;", " wp = topfrp->fr_win;\n if (wp != NULL)\n {\n\tif (wp->w_winrow != *row || wp->w_wincol != *col)\n\t{\n\t /* position changed, redraw */\n\t wp->w_winrow = *row;\n\t wp->w_wincol = *col;\n\t redraw_win_later(wp, NOT_VALID);\n\t wp->w_redr_status = TRUE;\n\t}\n\t/* WinBar will not show if the window height is zero */\n\th = VISIBLE_HEIGHT(wp) + wp->w_status_height;\n\t*row += h > topfrp->fr_height ? topfrp->fr_height : h;\n\t*col += wp->w_width + wp->w_vsep_width;\n }\n else\n {\n\tstartrow = *row;\n\tstartcol = *col;\n\tFOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t{\n\t if (topfrp->fr_layout == FR_ROW)\n\t\t*row = startrow;\t/* all frames are at the same row */\n\t else\n\t\t*col = startcol;\t/* all frames are at the same col */\n\t frame_comp_pos(frp, row, col);\n\t}\n }\n}", "/*\n * Set current window height and take care of repositioning other windows to\n * fit around it.\n */\n void\nwin_setheight(int height)\n{\n win_setheight_win(height, curwin);\n}", "/*\n * Set the window height of window \"win\" and take care of repositioning other\n * windows to fit around it.\n */\n void\nwin_setheight_win(int height, win_T *win)\n{\n int\t\trow;", " if (win == curwin)\n {\n\t/* Always keep current window at least one line high, even when\n\t * 'winminheight' is zero. */\n\tif (height < p_wmh)\n\t height = p_wmh;\n\tif (height == 0)\n\t height = 1;\n\theight += WINBAR_HEIGHT(curwin);\n }", " frame_setheight(win->w_frame, height + win->w_status_height);", " /* recompute the window positions */\n row = win_comp_pos();", " /*\n * If there is extra space created between the last window and the command\n * line, clear it.\n */\n if (full_screen && msg_scrolled == 0 && row < cmdline_row)\n\tscreen_fill(row, cmdline_row, 0, (int)Columns, ' ', ' ', 0);\n cmdline_row = row;\n msg_row = row;\n msg_col = 0;", " redraw_all_later(NOT_VALID);\n}", "/*\n * Set the height of a frame to \"height\" and take care that all frames and\n * windows inside it are resized. Also resize frames on the left and right if\n * the are in the same FR_ROW frame.\n *\n * Strategy:\n * If the frame is part of a FR_COL frame, try fitting the frame in that\n * frame. If that doesn't work (the FR_COL frame is too small), recursively\n * go to containing frames to resize them and make room.\n * If the frame is part of a FR_ROW frame, all frames must be resized as well.\n * Check for the minimal height of the FR_ROW frame.\n * At the top level we can also use change the command line height.\n */\n static void\nframe_setheight(frame_T *curfrp, int height)\n{\n int\t\troom;\t\t/* total number of lines available */\n int\t\ttake;\t\t/* number of lines taken from other windows */\n int\t\troom_cmdline;\t/* lines available from cmdline */\n int\t\trun;\n frame_T\t*frp;\n int\t\th;\n int\t\troom_reserved;", " /* If the height already is the desired value, nothing to do. */\n if (curfrp->fr_height == height)\n\treturn;", " if (curfrp->fr_parent == NULL)\n {\n\t/* topframe: can only change the command line */\n\tif (height > ROWS_AVAIL)\n\t height = ROWS_AVAIL;\n\tif (height > 0)\n\t frame_new_height(curfrp, height, FALSE, FALSE);\n }\n else if (curfrp->fr_parent->fr_layout == FR_ROW)\n {\n\t/* Row of frames: Also need to resize frames left and right of this\n\t * one. First check for the minimal height of these. */\n\th = frame_minheight(curfrp->fr_parent, NULL);\n\tif (height < h)\n\t height = h;\n\tframe_setheight(curfrp->fr_parent, height);\n }\n else\n {\n\t/*\n\t * Column of frames: try to change only frames in this column.\n\t */\n\t/*\n\t * Do this twice:\n\t * 1: compute room available, if it's not enough try resizing the\n\t * containing frame.\n\t * 2: compute the room available and adjust the height to it.\n\t * Try not to reduce the height of a window with 'winfixheight' set.\n\t */\n\tfor (run = 1; run <= 2; ++run)\n\t{\n\t room = 0;\n\t room_reserved = 0;\n\t FOR_ALL_FRAMES(frp, curfrp->fr_parent->fr_child)\n\t {\n\t\tif (frp != curfrp\n\t\t\t&& frp->fr_win != NULL\n\t\t\t&& frp->fr_win->w_p_wfh)\n\t\t room_reserved += frp->fr_height;\n\t\troom += frp->fr_height;\n\t\tif (frp != curfrp)\n\t\t room -= frame_minheight(frp, NULL);\n\t }\n\t if (curfrp->fr_width != Columns)\n\t\troom_cmdline = 0;\n\t else\n\t {\n\t\troom_cmdline = Rows - p_ch - (lastwin->w_winrow\n\t\t\t\t\t\t+ VISIBLE_HEIGHT(lastwin)\n\t\t\t\t\t\t+ lastwin->w_status_height);\n\t\tif (room_cmdline < 0)\n\t\t room_cmdline = 0;\n\t }", "\t if (height <= room + room_cmdline)\n\t\tbreak;\n\t if (run == 2 || curfrp->fr_width == Columns)\n\t {\n\t\tif (height > room + room_cmdline)\n\t\t height = room + room_cmdline;\n\t\tbreak;\n\t }\n\t frame_setheight(curfrp->fr_parent, height\n\t\t+ frame_minheight(curfrp->fr_parent, NOWIN) - (int)p_wmh - 1);\n\t}", "\t/*\n\t * Compute the number of lines we will take from others frames (can be\n\t * negative!).\n\t */\n\ttake = height - curfrp->fr_height;", "\t/* If there is not enough room, also reduce the height of a window\n\t * with 'winfixheight' set. */\n\tif (height > room + room_cmdline - room_reserved)\n\t room_reserved = room + room_cmdline - height;\n\t/* If there is only a 'winfixheight' window and making the\n\t * window smaller, need to make the other window taller. */\n\tif (take < 0 && room - curfrp->fr_height < room_reserved)\n\t room_reserved = 0;", "\tif (take > 0 && room_cmdline > 0)\n\t{\n\t /* use lines from cmdline first */\n\t if (take < room_cmdline)\n\t\troom_cmdline = take;\n\t take -= room_cmdline;\n\t topframe->fr_height += room_cmdline;\n\t}", "\t/*\n\t * set the current frame to the new height\n\t */\n\tframe_new_height(curfrp, height, FALSE, FALSE);", "\t/*\n\t * First take lines from the frames after the current frame. If\n\t * that is not enough, takes lines from frames above the current\n\t * frame.\n\t */\n\tfor (run = 0; run < 2; ++run)\n\t{\n\t if (run == 0)\n\t\tfrp = curfrp->fr_next;\t/* 1st run: start with next window */\n\t else\n\t\tfrp = curfrp->fr_prev;\t/* 2nd run: start with prev window */\n\t while (frp != NULL && take != 0)\n\t {\n\t\th = frame_minheight(frp, NULL);\n\t\tif (room_reserved > 0\n\t\t\t&& frp->fr_win != NULL\n\t\t\t&& frp->fr_win->w_p_wfh)\n\t\t{\n\t\t if (room_reserved >= frp->fr_height)\n\t\t\troom_reserved -= frp->fr_height;\n\t\t else\n\t\t {\n\t\t\tif (frp->fr_height - room_reserved > take)\n\t\t\t room_reserved = frp->fr_height - take;\n\t\t\ttake -= frp->fr_height - room_reserved;\n\t\t\tframe_new_height(frp, room_reserved, FALSE, FALSE);\n\t\t\troom_reserved = 0;\n\t\t }\n\t\t}\n\t\telse\n\t\t{\n\t\t if (frp->fr_height - take < h)\n\t\t {\n\t\t\ttake -= frp->fr_height - h;\n\t\t\tframe_new_height(frp, h, FALSE, FALSE);\n\t\t }\n\t\t else\n\t\t {\n\t\t\tframe_new_height(frp, frp->fr_height - take,\n\t\t\t\t\t\t\t\tFALSE, FALSE);\n\t\t\ttake = 0;\n\t\t }\n\t\t}\n\t\tif (run == 0)\n\t\t frp = frp->fr_next;\n\t\telse\n\t\t frp = frp->fr_prev;\n\t }\n\t}\n }\n}", "/*\n * Set current window width and take care of repositioning other windows to\n * fit around it.\n */\n void\nwin_setwidth(int width)\n{\n win_setwidth_win(width, curwin);\n}", " void\nwin_setwidth_win(int width, win_T *wp)\n{\n /* Always keep current window at least one column wide, even when\n * 'winminwidth' is zero. */\n if (wp == curwin)\n {\n\tif (width < p_wmw)\n\t width = p_wmw;\n\tif (width == 0)\n\t width = 1;\n }", " frame_setwidth(wp->w_frame, width + wp->w_vsep_width);", " /* recompute the window positions */\n (void)win_comp_pos();", " redraw_all_later(NOT_VALID);\n}", "/*\n * Set the width of a frame to \"width\" and take care that all frames and\n * windows inside it are resized. Also resize frames above and below if the\n * are in the same FR_ROW frame.\n *\n * Strategy is similar to frame_setheight().\n */\n static void\nframe_setwidth(frame_T *curfrp, int width)\n{\n int\t\troom;\t\t/* total number of lines available */\n int\t\ttake;\t\t/* number of lines taken from other windows */\n int\t\trun;\n frame_T\t*frp;\n int\t\tw;\n int\t\troom_reserved;", " /* If the width already is the desired value, nothing to do. */\n if (curfrp->fr_width == width)\n\treturn;", " if (curfrp->fr_parent == NULL)\n\t/* topframe: can't change width */\n\treturn;", " if (curfrp->fr_parent->fr_layout == FR_COL)\n {\n\t/* Column of frames: Also need to resize frames above and below of\n\t * this one. First check for the minimal width of these. */\n\tw = frame_minwidth(curfrp->fr_parent, NULL);\n\tif (width < w)\n\t width = w;\n\tframe_setwidth(curfrp->fr_parent, width);\n }\n else\n {\n\t/*\n\t * Row of frames: try to change only frames in this row.\n\t *\n\t * Do this twice:\n\t * 1: compute room available, if it's not enough try resizing the\n\t * containing frame.\n\t * 2: compute the room available and adjust the width to it.\n\t */\n\tfor (run = 1; run <= 2; ++run)\n\t{\n\t room = 0;\n\t room_reserved = 0;\n\t FOR_ALL_FRAMES(frp, curfrp->fr_parent->fr_child)\n\t {\n\t\tif (frp != curfrp\n\t\t\t&& frp->fr_win != NULL\n\t\t\t&& frp->fr_win->w_p_wfw)\n\t\t room_reserved += frp->fr_width;\n\t\troom += frp->fr_width;\n\t\tif (frp != curfrp)\n\t\t room -= frame_minwidth(frp, NULL);\n\t }", "\t if (width <= room)\n\t\tbreak;\n\t if (run == 2 || curfrp->fr_height >= ROWS_AVAIL)\n\t {\n\t\tif (width > room)\n\t\t width = room;\n\t\tbreak;\n\t }\n\t frame_setwidth(curfrp->fr_parent, width\n\t\t + frame_minwidth(curfrp->fr_parent, NOWIN) - (int)p_wmw - 1);\n\t}", "\t/*\n\t * Compute the number of lines we will take from others frames (can be\n\t * negative!).\n\t */\n\ttake = width - curfrp->fr_width;", "\t/* If there is not enough room, also reduce the width of a window\n\t * with 'winfixwidth' set. */\n\tif (width > room - room_reserved)\n\t room_reserved = room - width;\n\t/* If there is only a 'winfixwidth' window and making the\n\t * window smaller, need to make the other window narrower. */\n\tif (take < 0 && room - curfrp->fr_width < room_reserved)\n\t room_reserved = 0;", "\t/*\n\t * set the current frame to the new width\n\t */\n\tframe_new_width(curfrp, width, FALSE, FALSE);", "\t/*\n\t * First take lines from the frames right of the current frame. If\n\t * that is not enough, takes lines from frames left of the current\n\t * frame.\n\t */\n\tfor (run = 0; run < 2; ++run)\n\t{\n\t if (run == 0)\n\t\tfrp = curfrp->fr_next;\t/* 1st run: start with next window */\n\t else\n\t\tfrp = curfrp->fr_prev;\t/* 2nd run: start with prev window */\n\t while (frp != NULL && take != 0)\n\t {\n\t\tw = frame_minwidth(frp, NULL);\n\t\tif (room_reserved > 0\n\t\t\t&& frp->fr_win != NULL\n\t\t\t&& frp->fr_win->w_p_wfw)\n\t\t{\n\t\t if (room_reserved >= frp->fr_width)\n\t\t\troom_reserved -= frp->fr_width;\n\t\t else\n\t\t {\n\t\t\tif (frp->fr_width - room_reserved > take)\n\t\t\t room_reserved = frp->fr_width - take;\n\t\t\ttake -= frp->fr_width - room_reserved;\n\t\t\tframe_new_width(frp, room_reserved, FALSE, FALSE);\n\t\t\troom_reserved = 0;\n\t\t }\n\t\t}\n\t\telse\n\t\t{\n\t\t if (frp->fr_width - take < w)\n\t\t {\n\t\t\ttake -= frp->fr_width - w;\n\t\t\tframe_new_width(frp, w, FALSE, FALSE);\n\t\t }\n\t\t else\n\t\t {\n\t\t\tframe_new_width(frp, frp->fr_width - take,\n\t\t\t\t\t\t\t\tFALSE, FALSE);\n\t\t\ttake = 0;\n\t\t }\n\t\t}\n\t\tif (run == 0)\n\t\t frp = frp->fr_next;\n\t\telse\n\t\t frp = frp->fr_prev;\n\t }\n\t}\n }\n}", "/*\n * Check 'winminheight' for a valid value and reduce it if needed.\n */\n void\nwin_setminheight(void)\n{\n int\t\troom;\n int\t\tneeded;\n int\t\tfirst = TRUE;", " // loop until there is a 'winminheight' that is possible\n while (p_wmh > 0)\n {\n\troom = Rows - p_ch;\n\tneeded = frame_minheight(topframe, NULL);\n\tif (room >= needed)\n\t break;\n\t--p_wmh;\n\tif (first)\n\t{\n\t emsg(_(e_noroom));\n\t first = FALSE;\n\t}\n }\n}", "/*\n * Check 'winminwidth' for a valid value and reduce it if needed.\n */\n void\nwin_setminwidth(void)\n{\n int\t\troom;\n int\t\tneeded;\n int\t\tfirst = TRUE;", " // loop until there is a 'winminheight' that is possible\n while (p_wmw > 0)\n {\n\troom = Columns;\n\tneeded = frame_minwidth(topframe, NULL);\n\tif (room >= needed)\n\t break;\n\t--p_wmw;\n\tif (first)\n\t{\n\t emsg(_(e_noroom));\n\t first = FALSE;\n\t}\n }\n}", "#if defined(FEAT_MOUSE) || defined(PROTO)", "/*\n * Status line of dragwin is dragged \"offset\" lines down (negative is up).\n */\n void\nwin_drag_status_line(win_T *dragwin, int offset)\n{\n frame_T\t*curfr;\n frame_T\t*fr;\n int\t\troom;\n int\t\trow;\n int\t\tup;\t/* if TRUE, drag status line up, otherwise down */\n int\t\tn;", " fr = dragwin->w_frame;\n curfr = fr;\n if (fr != topframe)\t\t/* more than one window */\n {\n\tfr = fr->fr_parent;\n\t/* When the parent frame is not a column of frames, its parent should\n\t * be. */\n\tif (fr->fr_layout != FR_COL)\n\t{\n\t curfr = fr;\n\t if (fr != topframe)\t/* only a row of windows, may drag statusline */\n\t\tfr = fr->fr_parent;\n\t}\n }", " /* If this is the last frame in a column, may want to resize the parent\n * frame instead (go two up to skip a row of frames). */\n while (curfr != topframe && curfr->fr_next == NULL)\n {\n\tif (fr != topframe)\n\t fr = fr->fr_parent;\n\tcurfr = fr;\n\tif (fr != topframe)\n\t fr = fr->fr_parent;\n }", " if (offset < 0) /* drag up */\n {\n\tup = TRUE;\n\toffset = -offset;\n\t/* sum up the room of the current frame and above it */\n\tif (fr == curfr)\n\t{\n\t /* only one window */\n\t room = fr->fr_height - frame_minheight(fr, NULL);\n\t}\n\telse\n\t{\n\t room = 0;\n\t for (fr = fr->fr_child; ; fr = fr->fr_next)\n\t {\n\t\troom += fr->fr_height - frame_minheight(fr, NULL);\n\t\tif (fr == curfr)\n\t\t break;\n\t }\n\t}\n\tfr = curfr->fr_next;\t\t/* put fr at frame that grows */\n }\n else /* drag down */\n {\n\tup = FALSE;\n\t/*\n\t * Only dragging the last status line can reduce p_ch.\n\t */\n\troom = Rows - cmdline_row;\n\tif (curfr->fr_next == NULL)\n\t room -= 1;\n\telse\n\t room -= p_ch;\n\tif (room < 0)\n\t room = 0;\n\t/* sum up the room of frames below of the current one */\n\tFOR_ALL_FRAMES(fr, curfr->fr_next)\n\t room += fr->fr_height - frame_minheight(fr, NULL);\n\tfr = curfr;\t\t\t/* put fr at window that grows */\n }", " if (room < offset)\t\t/* Not enough room */\n\toffset = room;\t\t/* Move as far as we can */\n if (offset <= 0)\n\treturn;", " /*\n * Grow frame fr by \"offset\" lines.\n * Doesn't happen when dragging the last status line up.\n */\n if (fr != NULL)\n\tframe_new_height(fr, fr->fr_height + offset, up, FALSE);", " if (up)\n\tfr = curfr;\t\t/* current frame gets smaller */\n else\n\tfr = curfr->fr_next;\t/* next frame gets smaller */", " /*\n * Now make the other frames smaller.\n */\n while (fr != NULL && offset > 0)\n {\n\tn = frame_minheight(fr, NULL);\n\tif (fr->fr_height - offset <= n)\n\t{\n\t offset -= fr->fr_height - n;\n\t frame_new_height(fr, n, !up, FALSE);\n\t}\n\telse\n\t{\n\t frame_new_height(fr, fr->fr_height - offset, !up, FALSE);\n\t break;\n\t}\n\tif (up)\n\t fr = fr->fr_prev;\n\telse\n\t fr = fr->fr_next;\n }\n row = win_comp_pos();\n screen_fill(row, cmdline_row, 0, (int)Columns, ' ', ' ', 0);\n cmdline_row = row;\n p_ch = Rows - cmdline_row;\n if (p_ch < 1)\n\tp_ch = 1;\n curtab->tp_ch_used = p_ch;\n redraw_all_later(SOME_VALID);\n showmode();\n}", "/*\n * Separator line of dragwin is dragged \"offset\" lines right (negative is left).\n */\n void\nwin_drag_vsep_line(win_T *dragwin, int offset)\n{\n frame_T\t*curfr;\n frame_T\t*fr;\n int\t\troom;\n int\t\tleft;\t/* if TRUE, drag separator line left, otherwise right */\n int\t\tn;", " fr = dragwin->w_frame;\n if (fr == topframe)\t\t/* only one window (cannot happen?) */\n\treturn;\n curfr = fr;\n fr = fr->fr_parent;\n /* When the parent frame is not a row of frames, its parent should be. */\n if (fr->fr_layout != FR_ROW)\n {\n\tif (fr == topframe)\t/* only a column of windows (cannot happen?) */\n\t return;\n\tcurfr = fr;\n\tfr = fr->fr_parent;\n }", " /* If this is the last frame in a row, may want to resize a parent\n * frame instead. */\n while (curfr->fr_next == NULL)\n {\n\tif (fr == topframe)\n\t break;\n\tcurfr = fr;\n\tfr = fr->fr_parent;\n\tif (fr != topframe)\n\t{\n\t curfr = fr;\n\t fr = fr->fr_parent;\n\t}\n }", " if (offset < 0) /* drag left */\n {\n\tleft = TRUE;\n\toffset = -offset;\n\t/* sum up the room of the current frame and left of it */\n\troom = 0;\n\tfor (fr = fr->fr_child; ; fr = fr->fr_next)\n\t{\n\t room += fr->fr_width - frame_minwidth(fr, NULL);\n\t if (fr == curfr)\n\t\tbreak;\n\t}\n\tfr = curfr->fr_next;\t\t/* put fr at frame that grows */\n }\n else /* drag right */\n {\n\tleft = FALSE;\n\t/* sum up the room of frames right of the current one */\n\troom = 0;\n\tFOR_ALL_FRAMES(fr, curfr->fr_next)\n\t room += fr->fr_width - frame_minwidth(fr, NULL);\n\tfr = curfr;\t\t\t/* put fr at window that grows */\n }", " if (room < offset)\t\t/* Not enough room */\n\toffset = room;\t\t/* Move as far as we can */\n if (offset <= 0)\t\t/* No room at all, quit. */\n\treturn;\n if (fr == NULL)\n\treturn;\t\t\t/* Safety check, should not happen. */", " /* grow frame fr by offset lines */\n frame_new_width(fr, fr->fr_width + offset, left, FALSE);", " /* shrink other frames: current and at the left or at the right */\n if (left)\n\tfr = curfr;\t\t/* current frame gets smaller */\n else\n\tfr = curfr->fr_next;\t/* next frame gets smaller */", " while (fr != NULL && offset > 0)\n {\n\tn = frame_minwidth(fr, NULL);\n\tif (fr->fr_width - offset <= n)\n\t{\n\t offset -= fr->fr_width - n;\n\t frame_new_width(fr, n, !left, FALSE);\n\t}\n\telse\n\t{\n\t frame_new_width(fr, fr->fr_width - offset, !left, FALSE);\n\t break;\n\t}\n\tif (left)\n\t fr = fr->fr_prev;\n\telse\n\t fr = fr->fr_next;\n }\n (void)win_comp_pos();\n redraw_all_later(NOT_VALID);\n}\n#endif /* FEAT_MOUSE */", "#define FRACTION_MULT\t16384L", "/*\n * Set wp->w_fraction for the current w_wrow and w_height.\n * Has no effect when the window is less than two lines.\n */\n void\nset_fraction(win_T *wp)\n{\n if (wp->w_height > 1)\n\t// When cursor is in the first line the percentage is computed as if\n\t// it's halfway that line. Thus with two lines it is 25%, with three\n\t// lines 17%, etc. Similarly for the last line: 75%, 83%, etc.\n\twp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT\n\t\t\t\t + FRACTION_MULT / 2) / (long)wp->w_height;\n}", "/*\n * Set the height of a window.\n * \"height\" excludes any window toolbar.\n * This takes care of the things inside the window, not what happens to the\n * window position, the frame or to other windows.\n */\n void\nwin_new_height(win_T *wp, int height)\n{\n int\t\tprev_height = wp->w_height;", " /* Don't want a negative height. Happens when splitting a tiny window.\n * Will equalize heights soon to fix it. */\n if (height < 0)\n\theight = 0;\n if (wp->w_height == height)\n\treturn;\t /* nothing to do */", " if (wp->w_height > 0)\n {\n\tif (wp == curwin)\n\t /* w_wrow needs to be valid. When setting 'laststatus' this may\n\t * call win_new_height() recursively. */\n\t validate_cursor();\n\tif (wp->w_height != prev_height)\n\t return; /* Recursive call already changed the size, bail out here\n\t\t\tto avoid the following to mess things up. */\n\tif (wp->w_wrow != wp->w_prev_fraction_row)\n\t set_fraction(wp);\n }", " wp->w_height = height;\n wp->w_skipcol = 0;", " /* There is no point in adjusting the scroll position when exiting. Some\n * values might be invalid. */\n if (!exiting)\n\tscroll_to_fraction(wp, prev_height);\n}", " void\nscroll_to_fraction(win_T *wp, int prev_height)\n{\n linenr_T\tlnum;\n int\t\tsline, line_size;\n int\t\theight = wp->w_height;", " // Don't change w_topline in any of these cases:\n // - window height is 0\n // - 'scrollbind' is set and this isn't the current window\n // - window height is sufficient to display the whole buffer and first line\n // is visible.\n if (height > 0\n && (!wp->w_p_scb || wp == curwin)\n && (height < wp->w_buffer->b_ml.ml_line_count || wp->w_topline > 1))\n {\n\t/*\n\t * Find a value for w_topline that shows the cursor at the same\n\t * relative position in the window as before (more or less).\n\t */\n\tlnum = wp->w_cursor.lnum;\n\tif (lnum < 1)\t\t/* can happen when starting up */\n\t lnum = 1;\n\twp->w_wrow = ((long)wp->w_fraction * (long)height - 1L)\n\t\t\t\t\t\t\t / FRACTION_MULT;\n\tline_size = plines_win_col(wp, lnum, (long)(wp->w_cursor.col)) - 1;\n\tsline = wp->w_wrow - line_size;", "\tif (sline >= 0)\n\t{\n\t /* Make sure the whole cursor line is visible, if possible. */\n\t int rows = plines_win(wp, lnum, FALSE);", "\t if (sline > wp->w_height - rows)\n\t {\n\t\tsline = wp->w_height - rows;\n\t\twp->w_wrow -= rows - line_size;\n\t }\n\t}", "\tif (sline < 0)\n\t{\n\t /*\n\t * Cursor line would go off top of screen if w_wrow was this high.\n\t * Make cursor line the first line in the window. If not enough\n\t * room use w_skipcol;\n\t */\n\t wp->w_wrow = line_size;\n\t if (wp->w_wrow >= wp->w_height\n\t\t\t\t && (wp->w_width - win_col_off(wp)) > 0)\n\t {\n\t\twp->w_skipcol += wp->w_width - win_col_off(wp);\n\t\t--wp->w_wrow;\n\t\twhile (wp->w_wrow >= wp->w_height)\n\t\t{\n\t\t wp->w_skipcol += wp->w_width - win_col_off(wp)\n\t\t\t\t\t\t\t + win_col_off2(wp);\n\t\t --wp->w_wrow;\n\t\t}\n\t }\n\t}\n\telse if (sline > 0)\n\t{\n\t while (sline > 0 && lnum > 1)\n\t {\n#ifdef FEAT_FOLDING\n\t\thasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL);\n\t\tif (lnum == 1)\n\t\t{\n\t\t /* first line in buffer is folded */\n\t\t line_size = 1;\n\t\t --sline;\n\t\t break;\n\t\t}\n#endif\n\t\t--lnum;\n#ifdef FEAT_DIFF\n\t\tif (lnum == wp->w_topline)\n\t\t line_size = plines_win_nofill(wp, lnum, TRUE)\n\t\t\t\t\t\t\t + wp->w_topfill;\n\t\telse\n#endif\n\t\t line_size = plines_win(wp, lnum, TRUE);\n\t\tsline -= line_size;\n\t }", "\t if (sline < 0)\n\t {\n\t\t/*\n\t\t * Line we want at top would go off top of screen. Use next\n\t\t * line instead.\n\t\t */\n#ifdef FEAT_FOLDING\n\t\thasFoldingWin(wp, lnum, NULL, &lnum, TRUE, NULL);\n#endif\n\t\tlnum++;\n\t\twp->w_wrow -= line_size + sline;\n\t }\n\t else if (sline > 0)\n\t {\n\t\t// First line of file reached, use that as topline.\n\t\tlnum = 1;\n\t\twp->w_wrow -= sline;\n\t }\n\t}\n\tset_topline(wp, lnum);\n }", " if (wp == curwin)\n {\n\tif (get_scrolloff_value())\n\t update_topline();\n\tcurs_columns(FALSE);\t/* validate w_wrow */\n }\n if (prev_height > 0)\n\twp->w_prev_fraction_row = wp->w_wrow;", " win_comp_scroll(wp);\n redraw_win_later(wp, SOME_VALID);\n wp->w_redr_status = TRUE;\n invalidate_botline_win(wp);\n}", "/*\n * Set the width of a window.\n */\n void\nwin_new_width(win_T *wp, int width)\n{\n wp->w_width = width;\n wp->w_lines_valid = 0;\n changed_line_abv_curs_win(wp);\n invalidate_botline_win(wp);\n if (wp == curwin)\n {\n\tupdate_topline();\n\tcurs_columns(TRUE);\t/* validate w_wrow */\n }\n redraw_win_later(wp, NOT_VALID);\n wp->w_redr_status = TRUE;\n}", " void\nwin_comp_scroll(win_T *wp)\n{\n wp->w_p_scr = ((unsigned)wp->w_height >> 1);\n if (wp->w_p_scr == 0)\n\twp->w_p_scr = 1;\n}", "/*\n * command_height: called whenever p_ch has been changed\n */\n void\ncommand_height(void)\n{\n int\t\th;\n frame_T\t*frp;\n int\t\told_p_ch = curtab->tp_ch_used;", " /* Use the value of p_ch that we remembered. This is needed for when the\n * GUI starts up, we can't be sure in what order things happen. And when\n * p_ch was changed in another tab page. */\n curtab->tp_ch_used = p_ch;", " /* Find bottom frame with width of screen. */\n frp = lastwin->w_frame;\n while (frp->fr_width != Columns && frp->fr_parent != NULL)\n\tfrp = frp->fr_parent;", " /* Avoid changing the height of a window with 'winfixheight' set. */\n while (frp->fr_prev != NULL && frp->fr_layout == FR_LEAF\n\t\t\t\t\t\t && frp->fr_win->w_p_wfh)\n\tfrp = frp->fr_prev;", " if (starting != NO_SCREEN)\n {\n\tcmdline_row = Rows - p_ch;", "\tif (p_ch > old_p_ch)\t\t /* p_ch got bigger */\n\t{\n\t while (p_ch > old_p_ch)\n\t {\n\t\tif (frp == NULL)\n\t\t{\n\t\t emsg(_(e_noroom));\n\t\t p_ch = old_p_ch;\n\t\t curtab->tp_ch_used = p_ch;\n\t\t cmdline_row = Rows - p_ch;\n\t\t break;\n\t\t}\n\t\th = frp->fr_height - frame_minheight(frp, NULL);\n\t\tif (h > p_ch - old_p_ch)\n\t\t h = p_ch - old_p_ch;\n\t\told_p_ch += h;\n\t\tframe_add_height(frp, -h);\n\t\tfrp = frp->fr_prev;\n\t }", "\t /* Recompute window positions. */\n\t (void)win_comp_pos();", "\t /* clear the lines added to cmdline */\n\t if (full_screen)\n\t\tscreen_fill((int)(cmdline_row), (int)Rows, 0,\n\t\t\t\t\t\t (int)Columns, ' ', ' ', 0);\n\t msg_row = cmdline_row;\n\t redraw_cmdline = TRUE;\n\t return;\n\t}", "\tif (msg_row < cmdline_row)\n\t msg_row = cmdline_row;\n\tredraw_cmdline = TRUE;\n }\n frame_add_height(frp, (int)(old_p_ch - p_ch));", " /* Recompute window positions. */\n if (frp != lastwin->w_frame)\n\t(void)win_comp_pos();\n}", "/*\n * Resize frame \"frp\" to be \"n\" lines higher (negative for less high).\n * Also resize the frames it is contained in.\n */\n static void\nframe_add_height(frame_T *frp, int n)\n{\n frame_new_height(frp, frp->fr_height + n, FALSE, FALSE);\n for (;;)\n {\n\tfrp = frp->fr_parent;\n\tif (frp == NULL)\n\t break;\n\tfrp->fr_height += n;\n }\n}", "/*\n * Add or remove a status line for the bottom window(s), according to the\n * value of 'laststatus'.\n */\n void\nlast_status(\n int\t\tmorewin)\t/* pretend there are two or more windows */\n{\n /* Don't make a difference between horizontal or vertical split. */\n last_status_rec(topframe, (p_ls == 2\n\t\t\t || (p_ls == 1 && (morewin || !ONE_WINDOW))));\n}", " static void\nlast_status_rec(frame_T *fr, int statusline)\n{\n frame_T\t*fp;\n win_T\t*wp;", " if (fr->fr_layout == FR_LEAF)\n {\n\twp = fr->fr_win;\n\tif (wp->w_status_height != 0 && !statusline)\n\t{\n\t /* remove status line */\n\t win_new_height(wp, wp->w_height + 1);\n\t wp->w_status_height = 0;\n\t comp_col();\n\t}\n\telse if (wp->w_status_height == 0 && statusline)\n\t{\n\t /* Find a frame to take a line from. */\n\t fp = fr;\n\t while (fp->fr_height <= frame_minheight(fp, NULL))\n\t {\n\t\tif (fp == topframe)\n\t\t{\n\t\t emsg(_(e_noroom));\n\t\t return;\n\t\t}\n\t\t/* In a column of frames: go to frame above. If already at\n\t\t * the top or in a row of frames: go to parent. */\n\t\tif (fp->fr_parent->fr_layout == FR_COL && fp->fr_prev != NULL)\n\t\t fp = fp->fr_prev;\n\t\telse\n\t\t fp = fp->fr_parent;\n\t }\n\t wp->w_status_height = 1;\n\t if (fp != fr)\n\t {\n\t\tframe_new_height(fp, fp->fr_height - 1, FALSE, FALSE);\n\t\tframe_fix_height(wp);\n\t\t(void)win_comp_pos();\n\t }\n\t else\n\t\twin_new_height(wp, wp->w_height - 1);\n\t comp_col();\n\t redraw_all_later(SOME_VALID);\n\t}\n }\n else if (fr->fr_layout == FR_ROW)\n {\n\t/* vertically split windows, set status line for each one */\n\tFOR_ALL_FRAMES(fp, fr->fr_child)\n\t last_status_rec(fp, statusline);\n }\n else\n {\n\t/* horizontally split window, set status line for last one */\n\tfor (fp = fr->fr_child; fp->fr_next != NULL; fp = fp->fr_next)\n\t ;\n\tlast_status_rec(fp, statusline);\n }\n}", "/*\n * Return the number of lines used by the tab page line.\n */\n int\ntabline_height(void)\n{\n#ifdef FEAT_GUI_TABLINE\n /* When the GUI has the tabline then this always returns zero. */\n if (gui_use_tabline())\n\treturn 0;\n#endif\n switch (p_stal)\n {\n\tcase 0: return 0;\n\tcase 1: return (first_tabpage->tp_next == NULL) ? 0 : 1;\n }\n return 1;\n}", "/*\n * Return the minimal number of rows that is needed on the screen to display\n * the current number of windows.\n */\n int\nmin_rows(void)\n{\n int\t\ttotal;\n tabpage_T\t*tp;\n int\t\tn;", " if (firstwin == NULL)\t/* not initialized yet */\n\treturn MIN_LINES;", " total = 0;\n FOR_ALL_TABPAGES(tp)\n {\n\tn = frame_minheight(tp->tp_topframe, NULL);\n\tif (total < n)\n\t total = n;\n }\n total += tabline_height();\n total += 1;\t\t/* count the room for the command line */\n return total;\n}", "/*\n * Return TRUE if there is only one window (in the current tab page), not\n * counting a help or preview window, unless it is the current window.\n * Does not count unlisted windows.\n */\n int\nonly_one_window(void)\n{\n int\t\tcount = 0;\n win_T\t*wp;", " /* If there is another tab page there always is another window. */\n if (first_tabpage->tp_next != NULL)\n\treturn FALSE;", " FOR_ALL_WINDOWS(wp)\n\tif (wp->w_buffer != NULL\n\t\t&& (!((bt_help(wp->w_buffer) && !bt_help(curbuf))\n# ifdef FEAT_QUICKFIX\n\t\t || wp->w_p_pvw\n# endif\n\t ) || wp == curwin) && wp != aucmd_win)\n\t ++count;\n return (count <= 1);\n}", "/*\n * Correct the cursor line number in other windows. Used after changing the\n * current buffer, and before applying autocommands.\n * When \"do_curwin\" is TRUE, also check current window.\n */\n void\ncheck_lnums(int do_curwin)\n{\n win_T\t*wp;\n tabpage_T\t*tp;", " FOR_ALL_TAB_WINDOWS(tp, wp)\n\tif ((do_curwin || wp != curwin) && wp->w_buffer == curbuf)\n\t{\n\t // save the original cursor position and topline\n\t wp->w_save_cursor.w_cursor_save = wp->w_cursor;\n\t wp->w_save_cursor.w_topline_save = wp->w_topline;", "\t if (wp->w_cursor.lnum > curbuf->b_ml.ml_line_count)\n\t\twp->w_cursor.lnum = curbuf->b_ml.ml_line_count;\n\t if (wp->w_topline > curbuf->b_ml.ml_line_count)\n\t\twp->w_topline = curbuf->b_ml.ml_line_count;", "\t // save the corrected cursor position and topline\n\t wp->w_save_cursor.w_cursor_corr = wp->w_cursor;\n\t wp->w_save_cursor.w_topline_corr = wp->w_topline;\n\t}\n}", "/*\n * Reset cursor and topline to its stored values from check_lnums().\n * check_lnums() must have been called first!\n */\n void\nreset_lnums()\n{\n win_T\t*wp;\n tabpage_T\t*tp;", " FOR_ALL_TAB_WINDOWS(tp, wp)\n\tif (wp->w_buffer == curbuf)\n\t{\n\t // Restore the value if the autocommand didn't change it.\n\t if (EQUAL_POS(wp->w_save_cursor.w_cursor_corr, wp->w_cursor))\n\t\twp->w_cursor = wp->w_save_cursor.w_cursor_save;\n\t if (wp->w_save_cursor.w_topline_corr == wp->w_topline)\n\t\twp->w_topline = wp->w_save_cursor.w_topline_save;\n\t}\n}", "/*\n * A snapshot of the window sizes, to restore them after closing the help\n * window.\n * Only these fields are used:\n * fr_layout\n * fr_width\n * fr_height\n * fr_next\n * fr_child\n * fr_win (only valid for the old curwin, NULL otherwise)\n */", "/*\n * Create a snapshot of the current frame sizes.\n */\n void\nmake_snapshot(int idx)\n{\n clear_snapshot(curtab, idx);\n make_snapshot_rec(topframe, &curtab->tp_snapshot[idx]);\n}", " static void\nmake_snapshot_rec(frame_T *fr, frame_T **frp)\n{\n *frp = ALLOC_CLEAR_ONE(frame_T);\n if (*frp == NULL)\n\treturn;\n (*frp)->fr_layout = fr->fr_layout;\n (*frp)->fr_width = fr->fr_width;\n (*frp)->fr_height = fr->fr_height;\n if (fr->fr_next != NULL)\n\tmake_snapshot_rec(fr->fr_next, &((*frp)->fr_next));\n if (fr->fr_child != NULL)\n\tmake_snapshot_rec(fr->fr_child, &((*frp)->fr_child));\n if (fr->fr_layout == FR_LEAF && fr->fr_win == curwin)\n\t(*frp)->fr_win = curwin;\n}", "/*\n * Remove any existing snapshot.\n */\n static void\nclear_snapshot(tabpage_T *tp, int idx)\n{\n clear_snapshot_rec(tp->tp_snapshot[idx]);\n tp->tp_snapshot[idx] = NULL;\n}", " static void\nclear_snapshot_rec(frame_T *fr)\n{\n if (fr != NULL)\n {\n\tclear_snapshot_rec(fr->fr_next);\n\tclear_snapshot_rec(fr->fr_child);\n\tvim_free(fr);\n }\n}", "/*\n * Restore a previously created snapshot, if there is any.\n * This is only done if the screen size didn't change and the window layout is\n * still the same.\n */\n void\nrestore_snapshot(\n int\t\tidx,\n int\t\tclose_curwin)\t /* closing current window */\n{\n win_T\t*wp;", " if (curtab->tp_snapshot[idx] != NULL\n\t && curtab->tp_snapshot[idx]->fr_width == topframe->fr_width\n\t && curtab->tp_snapshot[idx]->fr_height == topframe->fr_height\n\t && check_snapshot_rec(curtab->tp_snapshot[idx], topframe) == OK)\n {\n\twp = restore_snapshot_rec(curtab->tp_snapshot[idx], topframe);\n\twin_comp_pos();\n\tif (wp != NULL && close_curwin)\n\t win_goto(wp);\n\tredraw_all_later(NOT_VALID);\n }\n clear_snapshot(curtab, idx);\n}", "/*\n * Check if frames \"sn\" and \"fr\" have the same layout, same following frames\n * and same children. And the window pointer is valid.\n */\n static int\ncheck_snapshot_rec(frame_T *sn, frame_T *fr)\n{\n if (sn->fr_layout != fr->fr_layout\n\t || (sn->fr_next == NULL) != (fr->fr_next == NULL)\n\t || (sn->fr_child == NULL) != (fr->fr_child == NULL)\n\t || (sn->fr_next != NULL\n\t\t&& check_snapshot_rec(sn->fr_next, fr->fr_next) == FAIL)\n\t || (sn->fr_child != NULL\n\t\t&& check_snapshot_rec(sn->fr_child, fr->fr_child) == FAIL)\n\t || (sn->fr_win != NULL && !win_valid(sn->fr_win)))\n\treturn FAIL;\n return OK;\n}", "/*\n * Copy the size of snapshot frame \"sn\" to frame \"fr\". Do the same for all\n * following frames and children.\n * Returns a pointer to the old current window, or NULL.\n */\n static win_T *\nrestore_snapshot_rec(frame_T *sn, frame_T *fr)\n{\n win_T\t*wp = NULL;\n win_T\t*wp2;", " fr->fr_height = sn->fr_height;\n fr->fr_width = sn->fr_width;\n if (fr->fr_layout == FR_LEAF)\n {\n\tframe_new_height(fr, fr->fr_height, FALSE, FALSE);\n\tframe_new_width(fr, fr->fr_width, FALSE, FALSE);\n\twp = sn->fr_win;\n }\n if (sn->fr_next != NULL)\n {\n\twp2 = restore_snapshot_rec(sn->fr_next, fr->fr_next);\n\tif (wp2 != NULL)\n\t wp = wp2;\n }\n if (sn->fr_child != NULL)\n {\n\twp2 = restore_snapshot_rec(sn->fr_child, fr->fr_child);\n\tif (wp2 != NULL)\n\t wp = wp2;\n }\n return wp;\n}", "#if defined(FEAT_GUI) || defined(PROTO)\n/*\n * Return TRUE if there is any vertically split window.\n */\n int\nwin_hasvertsplit(void)\n{\n frame_T\t*fr;", " if (topframe->fr_layout == FR_ROW)\n\treturn TRUE;", " if (topframe->fr_layout == FR_COL)\n\tFOR_ALL_FRAMES(fr, topframe->fr_child)\n\t if (fr->fr_layout == FR_ROW)\n\t\treturn TRUE;", " return FALSE;\n}\n#endif", "#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) || defined(PROTO)\n int\nget_win_number(win_T *wp, win_T *first_win)\n{\n int\t\ti = 1;\n win_T\t*w;", " for (w = first_win; w != NULL && w != wp; w = W_NEXT(w))\n\t++i;", " if (w == NULL)\n\treturn 0;\n else\n\treturn i;\n}", " int\nget_tab_number(tabpage_T *tp UNUSED)\n{\n int\t\ti = 1;\n tabpage_T\t*t;", " for (t = first_tabpage; t != NULL && t != tp; t = t->tp_next)\n\t++i;", " if (t == NULL)\n\treturn 0;\n else\n\treturn i;\n}\n#endif", "/*\n * Return TRUE if \"topfrp\" and its children are at the right height.\n */\n static int\nframe_check_height(frame_T *topfrp, int height)\n{\n frame_T *frp;", " if (topfrp->fr_height != height)\n\treturn FALSE;", " if (topfrp->fr_layout == FR_ROW)\n\tFOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t if (frp->fr_height != height)\n\t\treturn FALSE;", " return TRUE;\n}", "/*\n * Return TRUE if \"topfrp\" and its children are at the right width.\n */\n static int\nframe_check_width(frame_T *topfrp, int width)\n{\n frame_T *frp;", " if (topfrp->fr_width != width)\n\treturn FALSE;", " if (topfrp->fr_layout == FR_COL)\n\tFOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t if (frp->fr_width != width)\n\t\treturn FALSE;", " return TRUE;\n}", "#if defined(FEAT_SYN_HL) || defined(PROTO)\n/*\n * Simple int comparison function for use with qsort()\n */\n static int\nint_cmp(const void *a, const void *b)\n{\n return *(const int *)a - *(const int *)b;\n}", "/*\n * Handle setting 'colorcolumn' or 'textwidth' in window \"wp\".\n * Returns error message, NULL if it's OK.\n */\n char *\ncheck_colorcolumn(win_T *wp)\n{\n char_u\t*s;\n int\t\tcol;\n int\t\tcount = 0;\n int\t\tcolor_cols[256];\n int\t\ti;\n int\t\tj = 0;", " if (wp->w_buffer == NULL)\n\treturn NULL; // buffer was closed", " for (s = wp->w_p_cc; *s != NUL && count < 255;)\n {\n\tif (*s == '-' || *s == '+')\n\t{\n\t // -N and +N: add to 'textwidth'\n\t col = (*s == '-') ? -1 : 1;\n\t ++s;\n\t if (!VIM_ISDIGIT(*s))\n\t\treturn e_invarg;\n\t col = col * getdigits(&s);\n\t if (wp->w_buffer->b_p_tw == 0)\n\t\tgoto skip; // 'textwidth' not set, skip this item\n\t col += wp->w_buffer->b_p_tw;\n\t if (col < 0)\n\t\tgoto skip;\n\t}\n\telse if (VIM_ISDIGIT(*s))\n\t col = getdigits(&s);\n\telse\n\t return e_invarg;\n\tcolor_cols[count++] = col - 1; // 1-based to 0-based\nskip:\n\tif (*s == NUL)\n\t break;\n\tif (*s != ',')\n\t return e_invarg;\n\tif (*++s == NUL)\n\t return e_invarg; // illegal trailing comma as in \"set cc=80,\"\n }", " vim_free(wp->w_p_cc_cols);\n if (count == 0)\n\twp->w_p_cc_cols = NULL;\n else\n {\n\twp->w_p_cc_cols = ALLOC_MULT(int, count + 1);\n\tif (wp->w_p_cc_cols != NULL)\n\t{\n\t // sort the columns for faster usage on screen redraw inside\n\t // win_line()\n\t qsort(color_cols, count, sizeof(int), int_cmp);", "\t for (i = 0; i < count; ++i)\n\t\t// skip duplicates\n\t\tif (j == 0 || wp->w_p_cc_cols[j - 1] != color_cols[i])\n\t\t wp->w_p_cc_cols[j++] = color_cols[i];\n\t wp->w_p_cc_cols[j] = -1; // end marker\n\t}\n }", " return NULL; // no error\n}\n#endif" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [2290, 755, 4659], "buggy_code_start_loc": [2290, 755, 4643], "filenames": ["src/testdir/test_autocmd.vim", "src/version.c", "src/window.c"], "fixing_code_end_loc": [2299, 758, 4660], "fixing_code_start_loc": [2291, 756, 4644], "message": "The autocmd feature in window.c in Vim before 8.1.2136 accesses freed memory.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:vim:vim:*:*:*:*:*:*:*:*", "matchCriteriaId": "8BA1A77F-AC6C-4A51-A1C0-873DE3A2BF19", "versionEndExcluding": "8.1.2136", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "8.1.2121", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:12.04:*:*:*:esm:*:*:*", "matchCriteriaId": "8D305F7A-D159-4716-AB26-5E38BB5CD991", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:14.04:*:*:*:esm:*:*:*", "matchCriteriaId": "815D70A8-47D3-459C-A32C-9FEACA0659D1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:lts:*:*:*", "matchCriteriaId": "F7016A2A-8365-4F1A-89A2-7A19F2BCAE5B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:19.10:*:*:*:*:*:*:*", "matchCriteriaId": "A31C8344-3E02-4EB8-8BD8-4C84B7959624", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The autocmd feature in window.c in Vim before 8.1.2136 accesses freed memory."}, {"lang": "es", "value": "La funcionalidad autocmd en el archivo window.c en Vim versiones anteriores a la versi\u00f3n 8.1.2136, accede a la memoria liberada."}], "evaluatorComment": null, "id": "CVE-2019-20079", "lastModified": "2020-10-20T16:04:08.370", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-12-30T01:15:12.290", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/commit/ec66c41d84e574baf8009dbc0bd088d2bc5b2421"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/compare/v8.1.2135...v8.1.2136"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "https://packetstormsecurity.com/files/154898"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4309-1/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-416"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/vim/vim/commit/ec66c41d84e574baf8009dbc0bd088d2bc5b2421"}, "type": "CWE-416"}
352
Determine whether the {function_name} code is vulnerable or not.
[ "/* vi:set ts=8 sts=4 sw=4 noet:\n *\n * VIM - Vi IMproved\tby Bram Moolenaar\n *\n * Do \":help uganda\" in Vim to read a list of people who contributed.\n * Do \":help credits\" in Vim to see a list of people who contributed.\n * See README.txt for an overview of the Vim source code.\n */", "#include \"vim.h\"", "static void cmd_with_count(char *cmd, char_u *bufp, size_t bufsize, long Prenum);\nstatic void win_init(win_T *newp, win_T *oldp, int flags);\nstatic void win_init_some(win_T *newp, win_T *oldp);\nstatic void frame_comp_pos(frame_T *topfrp, int *row, int *col);\nstatic void frame_setheight(frame_T *curfrp, int height);\nstatic void frame_setwidth(frame_T *curfrp, int width);\nstatic void win_exchange(long);\nstatic void win_rotate(int, int);\nstatic void win_totop(int size, int flags);\nstatic void win_equal_rec(win_T *next_curwin, int current, frame_T *topfr, int dir, int col, int row, int width, int height);\nstatic win_T *win_free_mem(win_T *win, int *dirp, tabpage_T *tp);\nstatic frame_T *win_altframe(win_T *win, tabpage_T *tp);\nstatic tabpage_T *alt_tabpage(void);\nstatic win_T *frame2win(frame_T *frp);\nstatic int frame_has_win(frame_T *frp, win_T *wp);\nstatic void frame_new_height(frame_T *topfrp, int height, int topfirst, int wfh);\nstatic int frame_fixed_height(frame_T *frp);\nstatic int frame_fixed_width(frame_T *frp);\nstatic void frame_add_statusline(frame_T *frp);\nstatic void frame_new_width(frame_T *topfrp, int width, int leftfirst, int wfw);\nstatic void frame_add_vsep(frame_T *frp);\nstatic int frame_minwidth(frame_T *topfrp, win_T *next_curwin);\nstatic void frame_fix_width(win_T *wp);\nstatic int win_alloc_firstwin(win_T *oldwin);\nstatic void new_frame(win_T *wp);\nstatic tabpage_T *alloc_tabpage(void);\nstatic int leave_tabpage(buf_T *new_curbuf, int trigger_leave_autocmds);\nstatic void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, int trigger_enter_autocmds, int trigger_leave_autocmds);\nstatic void frame_fix_height(win_T *wp);\nstatic int frame_minheight(frame_T *topfrp, win_T *next_curwin);\nstatic int may_open_tabpage(void);\nstatic void win_enter_ext(win_T *wp, int undo_sync, int no_curwin, int trigger_new_autocmds, int trigger_enter_autocmds, int trigger_leave_autocmds);\nstatic void win_free(win_T *wp, tabpage_T *tp);\nstatic int win_unlisted(win_T *wp);\nstatic void win_append(win_T *after, win_T *wp);\nstatic void frame_append(frame_T *after, frame_T *frp);\nstatic void frame_insert(frame_T *before, frame_T *frp);\nstatic void frame_remove(frame_T *frp);\nstatic void win_goto_ver(int up, long count);\nstatic void win_goto_hor(int left, long count);\nstatic void frame_add_height(frame_T *frp, int n);\nstatic void last_status_rec(frame_T *fr, int statusline);", "static void make_snapshot_rec(frame_T *fr, frame_T **frp);\nstatic void clear_snapshot(tabpage_T *tp, int idx);\nstatic void clear_snapshot_rec(frame_T *fr);\nstatic int check_snapshot_rec(frame_T *sn, frame_T *fr);\nstatic win_T *restore_snapshot_rec(frame_T *sn, frame_T *fr);", "static int frame_check_height(frame_T *topfrp, int height);\nstatic int frame_check_width(frame_T *topfrp, int width);", "static win_T *win_alloc(win_T *after, int hidden);", "#define NOWIN\t\t(win_T *)-1\t/* non-existing window */", "#define ROWS_AVAIL (Rows - p_ch - tabline_height())", "static char *m_onlyone = N_(\"Already only one window\");", "// When non-zero splitting a window is forbidden. Used to avoid that nasty\n// autocommands mess up the window structure.\nstatic int split_disallowed = 0;", "// #define WIN_DEBUG\n#ifdef WIN_DEBUG\n/*\n * Call this method to log the current window layout.\n */\n static void\nlog_frame_layout(frame_T *frame)\n{\n ch_log(NULL, \"layout %s, wi: %d, he: %d, wwi: %d, whe: %d, id: %d\",\n\t frame->fr_layout == FR_LEAF ? \"LEAF\"\n\t\t\t\t : frame->fr_layout == FR_ROW ? \"ROW\" : \"COL\",\n\t frame->fr_width,\n\t frame->fr_height,\n\t frame->fr_win == NULL ? -1 : frame->fr_win->w_width,\n\t frame->fr_win == NULL ? -1 : frame->fr_win->w_height,\n\t frame->fr_win == NULL ? -1 : frame->fr_win->w_id);\n if (frame->fr_child != NULL)\n {\n\tch_log(NULL, \"children\");\n\tlog_frame_layout(frame->fr_child);\n\tif (frame->fr_next != NULL)\n\t ch_log(NULL, \"END of children\");\n }\n if (frame->fr_next != NULL)\n\tlog_frame_layout(frame->fr_next);\n}\n#endif", "/*\n * All CTRL-W window commands are handled here, called from normal_cmd().\n */\n void\ndo_window(\n int\t\tnchar,\n long\tPrenum,\n int\t\txchar)\t /* extra char from \":wincmd gx\" or NUL */\n{\n long\tPrenum1;\n win_T\t*wp;\n#if defined(FEAT_SEARCHPATH) || defined(FEAT_FIND_ID)\n char_u\t*ptr;\n linenr_T lnum = -1;\n#endif\n#ifdef FEAT_FIND_ID\n int\t\ttype = FIND_DEFINE;\n int\t\tlen;\n#endif\n char_u\tcbuf[40];", " if (ERROR_IF_POPUP_WINDOW)\n\treturn;", "#ifdef FEAT_CMDWIN\n# define CHECK_CMDWIN \\\n do { \\\n\tif (cmdwin_type != 0) \\\n\t{ \\\n\t emsg(_(e_cmdwin)); \\\n\t return; \\\n\t} \\\n } while (0)\n#else\n# define CHECK_CMDWIN do { /**/ } while (0)\n#endif", " Prenum1 = Prenum == 0 ? 1 : Prenum;", " switch (nchar)\n {\n/* split current window in two parts, horizontally */\n case 'S':\n case Ctrl_S:\n case 's':\n\t\tCHECK_CMDWIN;\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n#ifdef FEAT_QUICKFIX\n\t\t/* When splitting the quickfix window open a new buffer in it,\n\t\t * don't replicate the quickfix buffer. */\n\t\tif (bt_quickfix(curbuf))\n\t\t goto newwindow;\n#endif\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\t(void)win_split((int)Prenum, 0);\n\t\tbreak;", "/* split current window in two parts, vertically */\n case Ctrl_V:\n case 'v':\n\t\tCHECK_CMDWIN;\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n#ifdef FEAT_QUICKFIX\n\t\t/* When splitting the quickfix window open a new buffer in it,\n\t\t * don't replicate the quickfix buffer. */\n\t\tif (bt_quickfix(curbuf))\n\t\t goto newwindow;\n#endif\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\t(void)win_split((int)Prenum, WSP_VERT);\n\t\tbreak;", "/* split current window and edit alternate file */\n case Ctrl_HAT:\n case '^':\n\t\tCHECK_CMDWIN;\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */", "\t\tif (buflist_findnr(Prenum == 0\n\t\t\t\t\t? curwin->w_alt_fnum : Prenum) == NULL)\n\t\t{\n\t\t if (Prenum == 0)\n\t\t\temsg(_(e_noalt));\n\t\t else\n\t\t\tsemsg(_(\"E92: Buffer %ld not found\"), Prenum);\n\t\t break;\n\t\t}", "\t\tif (!curbuf_locked() && win_split(0, 0) == OK)\n\t\t (void)buflist_getfile(\n\t\t\t Prenum == 0 ? curwin->w_alt_fnum : Prenum,\n\t\t\t (linenr_T)0, GETF_ALT, FALSE);\n\t\tbreak;", "/* open new window */\n case Ctrl_N:\n case 'n':\n\t\tCHECK_CMDWIN;\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n#ifdef FEAT_QUICKFIX\nnewwindow:\n#endif\n\t\tif (Prenum)\n\t\t /* window height */\n\t\t vim_snprintf((char *)cbuf, sizeof(cbuf) - 5, \"%ld\", Prenum);\n\t\telse\n\t\t cbuf[0] = NUL;\n#if defined(FEAT_QUICKFIX)\n\t\tif (nchar == 'v' || nchar == Ctrl_V)\n\t\t STRCAT(cbuf, \"v\");\n#endif\n\t\tSTRCAT(cbuf, \"new\");\n\t\tdo_cmdline_cmd(cbuf);\n\t\tbreak;", "/* quit current window */\n case Ctrl_Q:\n case 'q':\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n\t\tcmd_with_count(\"quit\", cbuf, sizeof(cbuf), Prenum);\n\t\tdo_cmdline_cmd(cbuf);\n\t\tbreak;", "/* close current window */\n case Ctrl_C:\n case 'c':\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n\t\tcmd_with_count(\"close\", cbuf, sizeof(cbuf), Prenum);\n\t\tdo_cmdline_cmd(cbuf);\n\t\tbreak;", "#if defined(FEAT_QUICKFIX)\n/* close preview window */\n case Ctrl_Z:\n case 'z':\n\t\tCHECK_CMDWIN;\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n\t\tdo_cmdline_cmd((char_u *)\"pclose\");\n\t\tbreak;", "/* cursor to preview window */\n case 'P':\n\t\tFOR_ALL_WINDOWS(wp)\n\t\t if (wp->w_p_pvw)\n\t\t\tbreak;\n\t\tif (wp == NULL)\n\t\t emsg(_(\"E441: There is no preview window\"));\n\t\telse\n\t\t win_goto(wp);\n\t\tbreak;\n#endif", "/* close all but current window */\n case Ctrl_O:\n case 'o':\n\t\tCHECK_CMDWIN;\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n\t\tcmd_with_count(\"only\", cbuf, sizeof(cbuf), Prenum);\n\t\tdo_cmdline_cmd(cbuf);\n\t\tbreak;", "/* cursor to next window with wrap around */\n case Ctrl_W:\n case 'w':\n/* cursor to previous window with wrap around */\n case 'W':\n\t\tCHECK_CMDWIN;\n\t\tif (ONE_WINDOW && Prenum != 1)\t/* just one window */\n\t\t beep_flush();\n\t\telse\n\t\t{\n\t\t if (Prenum)\t\t\t/* go to specified window */\n\t\t {\n\t\t\tfor (wp = firstwin; --Prenum > 0; )\n\t\t\t{\n\t\t\t if (wp->w_next == NULL)\n\t\t\t\tbreak;\n\t\t\t else\n\t\t\t\twp = wp->w_next;\n\t\t\t}\n\t\t }\n\t\t else\n\t\t {\n\t\t\tif (nchar == 'W')\t /* go to previous window */\n\t\t\t{\n\t\t\t wp = curwin->w_prev;\n\t\t\t if (wp == NULL)\n\t\t\t\twp = lastwin;\t /* wrap around */\n\t\t\t}\n\t\t\telse\t\t\t /* go to next window */\n\t\t\t{\n\t\t\t wp = curwin->w_next;\n\t\t\t if (wp == NULL)\n\t\t\t\twp = firstwin;\t /* wrap around */\n\t\t\t}\n\t\t }\n\t\t win_goto(wp);\n\t\t}\n\t\tbreak;", "/* cursor to window below */\n case 'j':\n case K_DOWN:\n case Ctrl_J:\n\t\tCHECK_CMDWIN;\n\t\twin_goto_ver(FALSE, Prenum1);\n\t\tbreak;", "/* cursor to window above */\n case 'k':\n case K_UP:\n case Ctrl_K:\n\t\tCHECK_CMDWIN;\n\t\twin_goto_ver(TRUE, Prenum1);\n\t\tbreak;", "/* cursor to left window */\n case 'h':\n case K_LEFT:\n case Ctrl_H:\n case K_BS:\n\t\tCHECK_CMDWIN;\n\t\twin_goto_hor(TRUE, Prenum1);\n\t\tbreak;", "/* cursor to right window */\n case 'l':\n case K_RIGHT:\n case Ctrl_L:\n\t\tCHECK_CMDWIN;\n\t\twin_goto_hor(FALSE, Prenum1);\n\t\tbreak;", "/* move window to new tab page */\n case 'T':\n\t\tif (one_window())\n\t\t msg(_(m_onlyone));\n\t\telse\n\t\t{\n\t\t tabpage_T\t*oldtab = curtab;\n\t\t tabpage_T\t*newtab;", "\t\t /* First create a new tab with the window, then go back to\n\t\t * the old tab and close the window there. */\n\t\t wp = curwin;\n\t\t if (win_new_tabpage((int)Prenum) == OK\n\t\t\t\t\t\t && valid_tabpage(oldtab))\n\t\t {\n\t\t\tnewtab = curtab;\n\t\t\tgoto_tabpage_tp(oldtab, TRUE, TRUE);\n\t\t\tif (curwin == wp)\n\t\t\t win_close(curwin, FALSE);\n\t\t\tif (valid_tabpage(newtab))\n\t\t\t goto_tabpage_tp(newtab, TRUE, TRUE);\n\t\t }\n\t\t}\n\t\tbreak;", "/* cursor to top-left window */\n case 't':\n case Ctrl_T:\n\t\twin_goto(firstwin);\n\t\tbreak;", "/* cursor to bottom-right window */\n case 'b':\n case Ctrl_B:\n\t\twin_goto(lastwin);\n\t\tbreak;", "/* cursor to last accessed (previous) window */\n case 'p':\n case Ctrl_P:\n\t\tif (!win_valid(prevwin))\n\t\t beep_flush();\n\t\telse\n\t\t win_goto(prevwin);\n\t\tbreak;", "/* exchange current and next window */\n case 'x':\n case Ctrl_X:\n\t\tCHECK_CMDWIN;\n\t\twin_exchange(Prenum);\n\t\tbreak;", "/* rotate windows downwards */\n case Ctrl_R:\n case 'r':\n\t\tCHECK_CMDWIN;\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n\t\twin_rotate(FALSE, (int)Prenum1); /* downwards */\n\t\tbreak;", "/* rotate windows upwards */\n case 'R':\n\t\tCHECK_CMDWIN;\n\t\treset_VIsual_and_resel();\t/* stop Visual mode */\n\t\twin_rotate(TRUE, (int)Prenum1);\t /* upwards */\n\t\tbreak;", "/* move window to the very top/bottom/left/right */\n case 'K':\n case 'J':\n case 'H':\n case 'L':\n\t\tCHECK_CMDWIN;\n\t\twin_totop((int)Prenum,\n\t\t\t((nchar == 'H' || nchar == 'L') ? WSP_VERT : 0)\n\t\t\t| ((nchar == 'H' || nchar == 'K') ? WSP_TOP : WSP_BOT));\n\t\tbreak;", "/* make all windows the same height */\n case '=':\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\twin_equal(NULL, FALSE, 'b');\n\t\tbreak;", "/* increase current window height */\n case '+':\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\twin_setheight(curwin->w_height + (int)Prenum1);\n\t\tbreak;", "/* decrease current window height */\n case '-':\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\twin_setheight(curwin->w_height - (int)Prenum1);\n\t\tbreak;", "/* set current window height */\n case Ctrl__:\n case '_':\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\twin_setheight(Prenum ? (int)Prenum : 9999);\n\t\tbreak;", "/* increase current window width */\n case '>':\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\twin_setwidth(curwin->w_width + (int)Prenum1);\n\t\tbreak;", "/* decrease current window width */\n case '<':\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\twin_setwidth(curwin->w_width - (int)Prenum1);\n\t\tbreak;", "/* set current window width */\n case '|':\n#ifdef FEAT_GUI\n\t\tneed_mouse_correct = TRUE;\n#endif\n\t\twin_setwidth(Prenum != 0 ? (int)Prenum : 9999);\n\t\tbreak;", "/* jump to tag and split window if tag exists (in preview window) */\n#if defined(FEAT_QUICKFIX)\n case '}':\n\t\tCHECK_CMDWIN;\n\t\tif (Prenum)\n\t\t g_do_tagpreview = Prenum;\n\t\telse\n\t\t g_do_tagpreview = p_pvh;\n#endif\n\t\t/* FALLTHROUGH */\n case ']':\n case Ctrl_RSB:\n\t\tCHECK_CMDWIN;\n\t\t/* keep Visual mode, can select words to use as a tag */\n\t\tif (Prenum)\n\t\t postponed_split = Prenum;\n\t\telse\n\t\t postponed_split = -1;\n#ifdef FEAT_QUICKFIX\n\t\tif (nchar != '}')\n\t\t g_do_tagpreview = 0;\n#endif", "\t\t/* Execute the command right here, required when \"wincmd ]\"\n\t\t * was used in a function. */\n\t\tdo_nv_ident(Ctrl_RSB, NUL);\n\t\tbreak;", "#ifdef FEAT_SEARCHPATH\n/* edit file name under cursor in a new window */\n case 'f':\n case 'F':\n case Ctrl_F:\nwingotofile:\n\t\tCHECK_CMDWIN;", "\t\tptr = grab_file_name(Prenum1, &lnum);\n\t\tif (ptr != NULL)\n\t\t{\n\t\t tabpage_T\t*oldtab = curtab;\n\t\t win_T\t*oldwin = curwin;\n# ifdef FEAT_GUI\n\t\t need_mouse_correct = TRUE;\n# endif\n\t\t setpcmark();\n\t\t if (win_split(0, 0) == OK)\n\t\t {\n\t\t\tRESET_BINDING(curwin);\n\t\t\tif (do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL,\n\t\t\t\t\t\t ECMD_HIDE, NULL) == FAIL)\n\t\t\t{\n\t\t\t /* Failed to open the file, close the window\n\t\t\t * opened for it. */\n\t\t\t win_close(curwin, FALSE);\n\t\t\t goto_tabpage_win(oldtab, oldwin);\n\t\t\t}\n\t\t\telse if (nchar == 'F' && lnum >= 0)\n\t\t\t{\n\t\t\t curwin->w_cursor.lnum = lnum;\n\t\t\t check_cursor_lnum();\n\t\t\t beginline(BL_SOL | BL_FIX);\n\t\t\t}\n\t\t }\n\t\t vim_free(ptr);\n\t\t}\n\t\tbreak;\n#endif", "#ifdef FEAT_FIND_ID\n/* Go to the first occurrence of the identifier under cursor along path in a\n * new window -- webb\n */\n case 'i':\t\t\t /* Go to any match */\n case Ctrl_I:\n\t\ttype = FIND_ANY;\n\t\t/* FALLTHROUGH */\n case 'd':\t\t\t /* Go to definition, using 'define' */\n case Ctrl_D:\n\t\tCHECK_CMDWIN;\n\t\tif ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0)\n\t\t break;\n\t\tfind_pattern_in_path(ptr, 0, len, TRUE,\n\t\t\tPrenum == 0 ? TRUE : FALSE, type,\n\t\t\tPrenum1, ACTION_SPLIT, (linenr_T)1, (linenr_T)MAXLNUM);\n\t\tcurwin->w_set_curswant = TRUE;\n\t\tbreak;\n#endif", "/* Quickfix window only: view the result under the cursor in a new split. */\n#if defined(FEAT_QUICKFIX)\n case K_KENTER:\n case CAR:\n\t\tif (bt_quickfix(curbuf))\n\t\t qf_view_result(TRUE);\n\t\tbreak;\n#endif", "/* CTRL-W g extended commands */\n case 'g':\n case Ctrl_G:\n\t\tCHECK_CMDWIN;\n#ifdef USE_ON_FLY_SCROLL\n\t\tdont_scroll = TRUE;\t\t/* disallow scrolling here */\n#endif\n\t\t++no_mapping;\n\t\t++allow_keys; /* no mapping for xchar, but allow key codes */\n\t\tif (xchar == NUL)\n\t\t xchar = plain_vgetc();\n\t\tLANGMAP_ADJUST(xchar, TRUE);\n\t\t--no_mapping;\n\t\t--allow_keys;\n#ifdef FEAT_CMDL_INFO\n\t\t(void)add_to_showcmd(xchar);\n#endif\n\t\tswitch (xchar)\n\t\t{\n#if defined(FEAT_QUICKFIX)\n\t\t case '}':\n\t\t\txchar = Ctrl_RSB;\n\t\t\tif (Prenum)\n\t\t\t g_do_tagpreview = Prenum;\n\t\t\telse\n\t\t\t g_do_tagpreview = p_pvh;\n#endif\n\t\t\t/* FALLTHROUGH */\n\t\t case ']':\n\t\t case Ctrl_RSB:\n\t\t\t/* keep Visual mode, can select words to use as a tag */\n\t\t\tif (Prenum)\n\t\t\t postponed_split = Prenum;\n\t\t\telse\n\t\t\t postponed_split = -1;", "\t\t\t/* Execute the command right here, required when\n\t\t\t * \"wincmd g}\" was used in a function. */\n\t\t\tdo_nv_ident('g', xchar);\n\t\t\tbreak;", "#ifdef FEAT_SEARCHPATH\n\t\t case 'f':\t /* CTRL-W gf: \"gf\" in a new tab page */\n\t\t case 'F':\t /* CTRL-W gF: \"gF\" in a new tab page */\n\t\t\tcmdmod.tab = tabpage_index(curtab) + 1;\n\t\t\tnchar = xchar;\n\t\t\tgoto wingotofile;\n#endif\n\t\t case 't':\t // CTRL-W gt: go to next tab page\n\t\t\tgoto_tabpage((int)Prenum);\n\t\t\tbreak;", "\t\t case 'T':\t // CTRL-W gT: go to previous tab page\n\t\t\tgoto_tabpage(-(int)Prenum1);\n\t\t\tbreak;", "\t\t default:\n\t\t\tbeep_flush();\n\t\t\tbreak;\n\t\t}\n\t\tbreak;", " default:\tbeep_flush();\n\t\tbreak;\n }\n}", "/*\n * Figure out the address type for \":wincmd\".\n */\n void\nget_wincmd_addr_type(char_u *arg, exarg_T *eap)\n{\n switch (*arg)\n {\n case 'S':\n case Ctrl_S:\n case 's':\n case Ctrl_N:\n case 'n':\n case 'j':\n case Ctrl_J:\n case 'k':\n case Ctrl_K:\n case 'T':\n case Ctrl_R:\n case 'r':\n case 'R':\n case 'K':\n case 'J':\n case '+':\n case '-':\n case Ctrl__:\n case '_':\n case '|':\n case ']':\n case Ctrl_RSB:\n case 'g':\n case Ctrl_G:\n case Ctrl_V:\n case 'v':\n case 'h':\n case Ctrl_H:\n case 'l':\n case Ctrl_L:\n case 'H':\n case 'L':\n case '>':\n case '<':\n#if defined(FEAT_QUICKFIX)\n case '}':\n#endif\n#ifdef FEAT_SEARCHPATH\n case 'f':\n case 'F':\n case Ctrl_F:\n#endif\n#ifdef FEAT_FIND_ID\n case 'i':\n case Ctrl_I:\n case 'd':\n case Ctrl_D:\n#endif\n\t\t// window size or any count\n\t\teap->addr_type = ADDR_OTHER;\n\t\tbreak;", " case Ctrl_HAT:\n case '^':\n\t\t// buffer number\n\t\teap->addr_type = ADDR_BUFFERS;\n\t\tbreak;", " case Ctrl_Q:\n case 'q':\n case Ctrl_C:\n case 'c':\n case Ctrl_O:\n case 'o':\n case Ctrl_W:\n case 'w':\n case 'W':\n case 'x':\n case Ctrl_X:\n\t\t// window number\n\t\teap->addr_type = ADDR_WINDOWS;\n\t\tbreak;", "#if defined(FEAT_QUICKFIX)\n case Ctrl_Z:\n case 'z':\n case 'P':\n#endif\n case 't':\n case Ctrl_T:\n case 'b':\n case Ctrl_B:\n case 'p':\n case Ctrl_P:\n case '=':\n case CAR:\n\t\t// no count\n\t\teap->addr_type = ADDR_NONE;\n\t\tbreak;\n }\n}", " static void\ncmd_with_count(\n char\t*cmd,\n char_u\t*bufp,\n size_t\tbufsize,\n long\tPrenum)\n{\n size_t\tlen = STRLEN(cmd);", " STRCPY(bufp, cmd);\n if (Prenum > 0)\n\tvim_snprintf((char *)bufp + len, bufsize - len, \"%ld\", Prenum);\n}", "/*\n * If \"split_disallowed\" is set given an error and return FAIL.\n * Otherwise return OK.\n */\n static int\ncheck_split_disallowed()\n{\n if (split_disallowed > 0)\n {\n\temsg(_(\"E242: Can't split a window while closing another\"));\n\treturn FAIL;\n }\n return OK;\n}", "/*\n * split the current window, implements CTRL-W s and :split\n *\n * \"size\" is the height or width for the new window, 0 to use half of current\n * height or width.\n *\n * \"flags\":\n * WSP_ROOM: require enough room for new window\n * WSP_VERT: vertical split.\n * WSP_TOP: open window at the top-left of the shell (help window).\n * WSP_BOT: open window at the bottom-right of the shell (quickfix window).\n * WSP_HELP: creating the help window, keep layout snapshot\n *\n * return FAIL for failure, OK otherwise\n */\n int\nwin_split(int size, int flags)\n{\n if (ERROR_IF_POPUP_WINDOW)\n\treturn FAIL;", " /* When the \":tab\" modifier was used open a new tab page instead. */\n if (may_open_tabpage() == OK)\n\treturn OK;", " /* Add flags from \":vertical\", \":topleft\" and \":botright\". */\n flags |= cmdmod.split;\n if ((flags & WSP_TOP) && (flags & WSP_BOT))\n {\n\temsg(_(\"E442: Can't split topleft and botright at the same time\"));\n\treturn FAIL;\n }\n if (check_split_disallowed() == FAIL)\n\treturn FAIL;", " /* When creating the help window make a snapshot of the window layout.\n * Otherwise clear the snapshot, it's now invalid. */\n if (flags & WSP_HELP)\n\tmake_snapshot(SNAP_HELP_IDX);\n else\n\tclear_snapshot(curtab, SNAP_HELP_IDX);", " return win_split_ins(size, flags, NULL, 0);\n}", "/*\n * When \"new_wp\" is NULL: split the current window in two.\n * When \"new_wp\" is not NULL: insert this window at the far\n * top/left/right/bottom.\n * return FAIL for failure, OK otherwise\n */\n int\nwin_split_ins(\n int\t\tsize,\n int\t\tflags,\n win_T\t*new_wp,\n int\t\tdir)\n{\n win_T\t*wp = new_wp;\n win_T\t*oldwin;\n int\t\tnew_size = size;\n int\t\ti;\n int\t\tneed_status = 0;\n int\t\tdo_equal = FALSE;\n int\t\tneeded;\n int\t\tavailable;\n int\t\toldwin_height = 0;\n int\t\tlayout;\n frame_T\t*frp, *curfrp, *frp2, *prevfrp;\n int\t\tbefore;\n int\t\tminheight;\n int\t\twmh1;\n int\t\tdid_set_fraction = FALSE;", " if (flags & WSP_TOP)\n\toldwin = firstwin;\n else if (flags & WSP_BOT)\n\toldwin = lastwin;\n else\n\toldwin = curwin;", " /* add a status line when p_ls == 1 and splitting the first window */\n if (ONE_WINDOW && p_ls == 1 && oldwin->w_status_height == 0)\n {\n\tif (VISIBLE_HEIGHT(oldwin) <= p_wmh && new_wp == NULL)\n\t{\n\t emsg(_(e_noroom));\n\t return FAIL;\n\t}\n\tneed_status = STATUS_HEIGHT;\n }", "#ifdef FEAT_GUI\n /* May be needed for the scrollbars that are going to change. */\n if (gui.in_use)\n\tout_flush();\n#endif", " if (flags & WSP_VERT)\n {\n\tint\twmw1;\n\tint\tminwidth;", "\tlayout = FR_ROW;", "\t/*\n\t * Check if we are able to split the current window and compute its\n\t * width.\n\t */\n\t/* Current window requires at least 1 space. */\n\twmw1 = (p_wmw == 0 ? 1 : p_wmw);\n\tneeded = wmw1 + 1;\n\tif (flags & WSP_ROOM)\n\t needed += p_wiw - wmw1;\n\tif (flags & (WSP_BOT | WSP_TOP))\n\t{\n\t minwidth = frame_minwidth(topframe, NOWIN);\n\t available = topframe->fr_width;\n\t needed += minwidth;\n\t}\n\telse if (p_ea)\n\t{\n\t minwidth = frame_minwidth(oldwin->w_frame, NOWIN);\n\t prevfrp = oldwin->w_frame;\n\t for (frp = oldwin->w_frame->fr_parent; frp != NULL;\n\t\t\t\t\t\t\tfrp = frp->fr_parent)\n\t {\n\t\tif (frp->fr_layout == FR_ROW)\n\t\t FOR_ALL_FRAMES(frp2, frp->fr_child)\n\t\t\tif (frp2 != prevfrp)\n\t\t\t minwidth += frame_minwidth(frp2, NOWIN);\n\t\tprevfrp = frp;\n\t }\n\t available = topframe->fr_width;\n\t needed += minwidth;\n\t}\n\telse\n\t{\n\t minwidth = frame_minwidth(oldwin->w_frame, NOWIN);\n\t available = oldwin->w_frame->fr_width;\n\t needed += minwidth;\n\t}\n\tif (available < needed && new_wp == NULL)\n\t{\n\t emsg(_(e_noroom));\n\t return FAIL;\n\t}\n\tif (new_size == 0)\n\t new_size = oldwin->w_width / 2;\n\tif (new_size > available - minwidth - 1)\n\t new_size = available - minwidth - 1;\n\tif (new_size < wmw1)\n\t new_size = wmw1;", "\t/* if it doesn't fit in the current window, need win_equal() */\n\tif (oldwin->w_width - new_size - 1 < p_wmw)\n\t do_equal = TRUE;", "\t/* We don't like to take lines for the new window from a\n\t * 'winfixwidth' window. Take them from a window to the left or right\n\t * instead, if possible. Add one for the separator. */\n\tif (oldwin->w_p_wfw)\n\t win_setwidth_win(oldwin->w_width + new_size + 1, oldwin);", "\t/* Only make all windows the same width if one of them (except oldwin)\n\t * is wider than one of the split windows. */\n\tif (!do_equal && p_ea && size == 0 && *p_ead != 'v'\n\t\t\t\t\t && oldwin->w_frame->fr_parent != NULL)\n\t{\n\t frp = oldwin->w_frame->fr_parent->fr_child;\n\t while (frp != NULL)\n\t {\n\t\tif (frp->fr_win != oldwin && frp->fr_win != NULL\n\t\t\t&& (frp->fr_win->w_width > new_size\n\t\t\t || frp->fr_win->w_width > oldwin->w_width\n\t\t\t\t\t\t\t - new_size - 1))\n\t\t{\n\t\t do_equal = TRUE;\n\t\t break;\n\t\t}\n\t\tfrp = frp->fr_next;\n\t }\n\t}\n }\n else\n {\n\tlayout = FR_COL;", "\t/*\n\t * Check if we are able to split the current window and compute its\n\t * height.\n\t */\n\t/* Current window requires at least 1 space. */\n\twmh1 = (p_wmh == 0 ? 1 : p_wmh) + WINBAR_HEIGHT(curwin);\n\tneeded = wmh1 + STATUS_HEIGHT;\n\tif (flags & WSP_ROOM)\n\t needed += p_wh - wmh1;\n\tif (flags & (WSP_BOT | WSP_TOP))\n\t{\n\t minheight = frame_minheight(topframe, NOWIN) + need_status;\n\t available = topframe->fr_height;\n\t needed += minheight;\n\t}\n\telse if (p_ea)\n\t{\n\t minheight = frame_minheight(oldwin->w_frame, NOWIN) + need_status;\n\t prevfrp = oldwin->w_frame;\n\t for (frp = oldwin->w_frame->fr_parent; frp != NULL;\n\t\t\t\t\t\t\tfrp = frp->fr_parent)\n\t {\n\t\tif (frp->fr_layout == FR_COL)\n\t\t FOR_ALL_FRAMES(frp2, frp->fr_child)\n\t\t\tif (frp2 != prevfrp)\n\t\t\t minheight += frame_minheight(frp2, NOWIN);\n\t\tprevfrp = frp;\n\t }\n\t available = topframe->fr_height;\n\t needed += minheight;\n\t}\n\telse\n\t{\n\t minheight = frame_minheight(oldwin->w_frame, NOWIN) + need_status;\n\t available = oldwin->w_frame->fr_height;\n\t needed += minheight;\n\t}\n\tif (available < needed && new_wp == NULL)\n\t{\n\t emsg(_(e_noroom));\n\t return FAIL;\n\t}\n\toldwin_height = oldwin->w_height;\n\tif (need_status)\n\t{\n\t oldwin->w_status_height = STATUS_HEIGHT;\n\t oldwin_height -= STATUS_HEIGHT;\n\t}\n\tif (new_size == 0)\n\t new_size = oldwin_height / 2;\n\tif (new_size > available - minheight - STATUS_HEIGHT)\n\t new_size = available - minheight - STATUS_HEIGHT;\n\tif (new_size < wmh1)\n\t new_size = wmh1;", "\t/* if it doesn't fit in the current window, need win_equal() */\n\tif (oldwin_height - new_size - STATUS_HEIGHT < p_wmh)\n\t do_equal = TRUE;", "\t/* We don't like to take lines for the new window from a\n\t * 'winfixheight' window. Take them from a window above or below\n\t * instead, if possible. */\n\tif (oldwin->w_p_wfh)\n\t{\n\t /* Set w_fraction now so that the cursor keeps the same relative\n\t * vertical position using the old height. */\n\t set_fraction(oldwin);\n\t did_set_fraction = TRUE;", "\t win_setheight_win(oldwin->w_height + new_size + STATUS_HEIGHT,\n\t\t\t\t\t\t\t\t oldwin);\n\t oldwin_height = oldwin->w_height;\n\t if (need_status)\n\t\toldwin_height -= STATUS_HEIGHT;\n\t}", "\t/* Only make all windows the same height if one of them (except oldwin)\n\t * is higher than one of the split windows. */\n\tif (!do_equal && p_ea && size == 0 && *p_ead != 'h'\n\t && oldwin->w_frame->fr_parent != NULL)\n\t{\n\t frp = oldwin->w_frame->fr_parent->fr_child;\n\t while (frp != NULL)\n\t {\n\t\tif (frp->fr_win != oldwin && frp->fr_win != NULL\n\t\t\t&& (frp->fr_win->w_height > new_size\n\t\t\t || frp->fr_win->w_height > oldwin_height - new_size\n\t\t\t\t\t\t\t - STATUS_HEIGHT))\n\t\t{\n\t\t do_equal = TRUE;\n\t\t break;\n\t\t}\n\t\tfrp = frp->fr_next;\n\t }\n\t}\n }", " /*\n * allocate new window structure and link it in the window list\n */\n if ((flags & WSP_TOP) == 0\n\t && ((flags & WSP_BOT)\n\t\t|| (flags & WSP_BELOW)\n\t\t|| (!(flags & WSP_ABOVE)\n\t\t && ( (flags & WSP_VERT) ? p_spr : p_sb))))\n {\n\t/* new window below/right of current one */\n\tif (new_wp == NULL)\n\t wp = win_alloc(oldwin, FALSE);\n\telse\n\t win_append(oldwin, wp);\n }\n else\n {\n\tif (new_wp == NULL)\n\t wp = win_alloc(oldwin->w_prev, FALSE);\n\telse\n\t win_append(oldwin->w_prev, wp);\n }", " if (new_wp == NULL)\n {\n\tif (wp == NULL)\n\t return FAIL;", "\tnew_frame(wp);\n\tif (wp->w_frame == NULL)\n\t{\n\t win_free(wp, NULL);\n\t return FAIL;\n\t}", "\t/* make the contents of the new window the same as the current one */\n\twin_init(wp, curwin, flags);\n }", " /*\n * Reorganise the tree of frames to insert the new window.\n */\n if (flags & (WSP_TOP | WSP_BOT))\n {\n\tif ((topframe->fr_layout == FR_COL && (flags & WSP_VERT) == 0)\n\t || (topframe->fr_layout == FR_ROW && (flags & WSP_VERT) != 0))\n\t{\n\t curfrp = topframe->fr_child;\n\t if (flags & WSP_BOT)\n\t\twhile (curfrp->fr_next != NULL)\n\t\t curfrp = curfrp->fr_next;\n\t}\n\telse\n\t curfrp = topframe;\n\tbefore = (flags & WSP_TOP);\n }\n else\n {\n\tcurfrp = oldwin->w_frame;\n\tif (flags & WSP_BELOW)\n\t before = FALSE;\n\telse if (flags & WSP_ABOVE)\n\t before = TRUE;\n\telse if (flags & WSP_VERT)\n\t before = !p_spr;\n\telse\n\t before = !p_sb;\n }\n if (curfrp->fr_parent == NULL || curfrp->fr_parent->fr_layout != layout)\n {\n\t/* Need to create a new frame in the tree to make a branch. */\n\tfrp = ALLOC_CLEAR_ONE(frame_T);\n\t*frp = *curfrp;\n\tcurfrp->fr_layout = layout;\n\tfrp->fr_parent = curfrp;\n\tfrp->fr_next = NULL;\n\tfrp->fr_prev = NULL;\n\tcurfrp->fr_child = frp;\n\tcurfrp->fr_win = NULL;\n\tcurfrp = frp;\n\tif (frp->fr_win != NULL)\n\t oldwin->w_frame = frp;\n\telse\n\t FOR_ALL_FRAMES(frp, frp->fr_child)\n\t\tfrp->fr_parent = curfrp;\n }", " if (new_wp == NULL)\n\tfrp = wp->w_frame;\n else\n\tfrp = new_wp->w_frame;\n frp->fr_parent = curfrp->fr_parent;", " /* Insert the new frame at the right place in the frame list. */\n if (before)\n\tframe_insert(curfrp, frp);\n else\n\tframe_append(curfrp, frp);", " /* Set w_fraction now so that the cursor keeps the same relative\n * vertical position. */\n if (!did_set_fraction)\n\tset_fraction(oldwin);\n wp->w_fraction = oldwin->w_fraction;", " if (flags & WSP_VERT)\n {\n\twp->w_p_scr = curwin->w_p_scr;", "\tif (need_status)\n\t{\n\t win_new_height(oldwin, oldwin->w_height - 1);\n\t oldwin->w_status_height = need_status;\n\t}\n\tif (flags & (WSP_TOP | WSP_BOT))\n\t{\n\t /* set height and row of new window to full height */\n\t wp->w_winrow = tabline_height();\n\t win_new_height(wp, curfrp->fr_height - (p_ls > 0)\n\t\t\t\t\t\t\t - WINBAR_HEIGHT(wp));\n\t wp->w_status_height = (p_ls > 0);\n\t}\n\telse\n\t{\n\t /* height and row of new window is same as current window */\n\t wp->w_winrow = oldwin->w_winrow;\n\t win_new_height(wp, VISIBLE_HEIGHT(oldwin));\n\t wp->w_status_height = oldwin->w_status_height;\n\t}\n\tfrp->fr_height = curfrp->fr_height;", "\t/* \"new_size\" of the current window goes to the new window, use\n\t * one column for the vertical separator */\n\twin_new_width(wp, new_size);\n\tif (before)\n\t wp->w_vsep_width = 1;\n\telse\n\t{\n\t wp->w_vsep_width = oldwin->w_vsep_width;\n\t oldwin->w_vsep_width = 1;\n\t}\n\tif (flags & (WSP_TOP | WSP_BOT))\n\t{\n\t if (flags & WSP_BOT)\n\t\tframe_add_vsep(curfrp);\n\t /* Set width of neighbor frame */\n\t frame_new_width(curfrp, curfrp->fr_width\n\t\t - (new_size + ((flags & WSP_TOP) != 0)), flags & WSP_TOP,\n\t\t\t\t\t\t\t\t FALSE);\n\t}\n\telse\n\t win_new_width(oldwin, oldwin->w_width - (new_size + 1));\n\tif (before)\t/* new window left of current one */\n\t{\n\t wp->w_wincol = oldwin->w_wincol;\n\t oldwin->w_wincol += new_size + 1;\n\t}\n\telse\t\t/* new window right of current one */\n\t wp->w_wincol = oldwin->w_wincol + oldwin->w_width + 1;\n\tframe_fix_width(oldwin);\n\tframe_fix_width(wp);\n }\n else\n {\n\t/* width and column of new window is same as current window */\n\tif (flags & (WSP_TOP | WSP_BOT))\n\t{\n\t wp->w_wincol = 0;\n\t win_new_width(wp, Columns);\n\t wp->w_vsep_width = 0;\n\t}\n\telse\n\t{\n\t wp->w_wincol = oldwin->w_wincol;\n\t win_new_width(wp, oldwin->w_width);\n\t wp->w_vsep_width = oldwin->w_vsep_width;\n\t}\n\tfrp->fr_width = curfrp->fr_width;", "\t/* \"new_size\" of the current window goes to the new window, use\n\t * one row for the status line */\n\twin_new_height(wp, new_size);\n\tif (flags & (WSP_TOP | WSP_BOT))\n\t{\n\t int new_fr_height = curfrp->fr_height - new_size\n\t\t\t\t\t\t\t + WINBAR_HEIGHT(wp) ;", "\t if (!((flags & WSP_BOT) && p_ls == 0))\n\t\tnew_fr_height -= STATUS_HEIGHT;\n\t frame_new_height(curfrp, new_fr_height, flags & WSP_TOP, FALSE);\n\t}\n\telse\n\t win_new_height(oldwin, oldwin_height - (new_size + STATUS_HEIGHT));\n\tif (before)\t/* new window above current one */\n\t{\n\t wp->w_winrow = oldwin->w_winrow;\n\t wp->w_status_height = STATUS_HEIGHT;\n\t oldwin->w_winrow += wp->w_height + STATUS_HEIGHT;\n\t}\n\telse\t\t/* new window below current one */\n\t{\n\t wp->w_winrow = oldwin->w_winrow + VISIBLE_HEIGHT(oldwin)\n\t\t\t\t\t\t\t + STATUS_HEIGHT;\n\t wp->w_status_height = oldwin->w_status_height;\n\t if (!(flags & WSP_BOT))\n\t\toldwin->w_status_height = STATUS_HEIGHT;\n\t}\n\tif (flags & WSP_BOT)\n\t frame_add_statusline(curfrp);\n\tframe_fix_height(wp);\n\tframe_fix_height(oldwin);\n }", " if (flags & (WSP_TOP | WSP_BOT))\n\t(void)win_comp_pos();", " /*\n * Both windows need redrawing\n */\n redraw_win_later(wp, NOT_VALID);\n wp->w_redr_status = TRUE;\n redraw_win_later(oldwin, NOT_VALID);\n oldwin->w_redr_status = TRUE;", " if (need_status)\n {\n\tmsg_row = Rows - 1;\n\tmsg_col = sc_col;\n\tmsg_clr_eos_force();\t/* Old command/ruler may still be there */\n\tcomp_col();\n\tmsg_row = Rows - 1;\n\tmsg_col = 0;\t/* put position back at start of line */\n }", " /*\n * equalize the window sizes.\n */\n if (do_equal || dir != 0)\n\twin_equal(wp, TRUE,\n\t\t(flags & WSP_VERT) ? (dir == 'v' ? 'b' : 'h')\n\t\t: dir == 'h' ? 'b' : 'v');", " /* Don't change the window height/width to 'winheight' / 'winwidth' if a\n * size was given. */\n if (flags & WSP_VERT)\n {\n\ti = p_wiw;\n\tif (size != 0)\n\t p_wiw = size;", "# ifdef FEAT_GUI\n\t/* When 'guioptions' includes 'L' or 'R' may have to add scrollbars. */\n\tif (gui.in_use)\n\t gui_init_which_components(NULL);\n# endif\n }\n else\n {\n\ti = p_wh;\n\tif (size != 0)\n\t p_wh = size;\n }", "#ifdef FEAT_JUMPLIST\n /* Keep same changelist position in new window. */\n wp->w_changelistidx = oldwin->w_changelistidx;\n#endif", " /*\n * make the new window the current window\n */\n win_enter_ext(wp, FALSE, FALSE, TRUE, TRUE, TRUE);\n if (flags & WSP_VERT)\n\tp_wiw = i;\n else\n\tp_wh = i;", " return OK;\n}", "\n/*\n * Initialize window \"newp\" from window \"oldp\".\n * Used when splitting a window and when creating a new tab page.\n * The windows will both edit the same buffer.\n * WSP_NEWLOC may be specified in flags to prevent the location list from\n * being copied.\n */\n static void\nwin_init(win_T *newp, win_T *oldp, int flags UNUSED)\n{\n int\t\ti;", " newp->w_buffer = oldp->w_buffer;\n#ifdef FEAT_SYN_HL\n newp->w_s = &(oldp->w_buffer->b_s);\n#endif\n oldp->w_buffer->b_nwindows++;\n newp->w_cursor = oldp->w_cursor;\n newp->w_valid = 0;\n newp->w_curswant = oldp->w_curswant;\n newp->w_set_curswant = oldp->w_set_curswant;\n newp->w_topline = oldp->w_topline;\n#ifdef FEAT_DIFF\n newp->w_topfill = oldp->w_topfill;\n#endif\n newp->w_leftcol = oldp->w_leftcol;\n newp->w_pcmark = oldp->w_pcmark;\n newp->w_prev_pcmark = oldp->w_prev_pcmark;\n newp->w_alt_fnum = oldp->w_alt_fnum;\n newp->w_wrow = oldp->w_wrow;\n newp->w_fraction = oldp->w_fraction;\n newp->w_prev_fraction_row = oldp->w_prev_fraction_row;\n#ifdef FEAT_JUMPLIST\n copy_jumplist(oldp, newp);\n#endif\n#ifdef FEAT_QUICKFIX\n if (flags & WSP_NEWLOC)\n {\n\t/* Don't copy the location list. */\n\tnewp->w_llist = NULL;\n\tnewp->w_llist_ref = NULL;\n }\n else\n\tcopy_loclist_stack(oldp, newp);\n#endif\n newp->w_localdir = (oldp->w_localdir == NULL)\n\t\t\t\t ? NULL : vim_strsave(oldp->w_localdir);", " /* copy tagstack and folds */\n for (i = 0; i < oldp->w_tagstacklen; i++)\n {\n\ttaggy_T\t*tag = &newp->w_tagstack[i];\n\t*tag = oldp->w_tagstack[i];\n\tif (tag->tagname != NULL)\n\t tag->tagname = vim_strsave(tag->tagname);\n\tif (tag->user_data != NULL)\n\t tag->user_data = vim_strsave(tag->user_data);\n }\n newp->w_tagstackidx = oldp->w_tagstackidx;\n newp->w_tagstacklen = oldp->w_tagstacklen;\n#ifdef FEAT_FOLDING\n copyFoldingState(oldp, newp);\n#endif", " win_init_some(newp, oldp);", "#ifdef FEAT_SYN_HL\n check_colorcolumn(newp);\n#endif\n}", "/*\n * Initialize window \"newp\" from window \"old\".\n * Only the essential things are copied.\n */\n static void\nwin_init_some(win_T *newp, win_T *oldp)\n{\n /* Use the same argument list. */\n newp->w_alist = oldp->w_alist;\n ++newp->w_alist->al_refcount;\n newp->w_arg_idx = oldp->w_arg_idx;", " /* copy options from existing window */\n win_copy_options(oldp, newp);\n}", "/*\n * Return TRUE if \"win\" is a global popup or a popup in the current tab page.\n */\n int\nwin_valid_popup(win_T *win UNUSED)\n{\n#ifdef FEAT_TEXT_PROP\n win_T\t*wp;", " for (wp = first_popupwin; wp != NULL; wp = wp->w_next)\n\tif (wp == win)\n\t return TRUE;\n for (wp = curtab->tp_first_popupwin; wp != NULL; wp = wp->w_next)\n\tif (wp == win)\n\t return TRUE;\n#endif\n return FALSE;\n}", "/*\n * Check if \"win\" is a pointer to an existing window in the current tab page.\n */\n int\nwin_valid(win_T *win)\n{\n win_T\t*wp;", " if (win == NULL)\n\treturn FALSE;\n FOR_ALL_WINDOWS(wp)\n\tif (wp == win)\n\t return TRUE;\n return win_valid_popup(win);\n}", "/*\n * Check if \"win\" is a pointer to an existing window in any tab page.\n */\n int\nwin_valid_any_tab(win_T *win)\n{\n win_T\t*wp;\n tabpage_T\t*tp;", " if (win == NULL)\n\treturn FALSE;\n FOR_ALL_TABPAGES(tp)\n {\n\tFOR_ALL_WINDOWS_IN_TAB(tp, wp)\n\t{\n\t if (wp == win)\n\t\treturn TRUE;\n\t}\n#ifdef FEAT_TEXT_PROP\n\tfor (wp = tp->tp_first_popupwin; wp != NULL; wp = wp->w_next)\n\t if (wp == win)\n\t\treturn TRUE;\n#endif\n }\n return win_valid_popup(win);\n}", "/*\n * Return the number of windows.\n */\n int\nwin_count(void)\n{\n win_T\t*wp;\n int\t\tcount = 0;", " FOR_ALL_WINDOWS(wp)\n\t++count;\n return count;\n}", "/*\n * Make \"count\" windows on the screen.\n * Return actual number of windows on the screen.\n * Must be called when there is just one window, filling the whole screen\n * (excluding the command line).\n */\n int\nmake_windows(\n int\t\tcount,\n int\t\tvertical UNUSED) /* split windows vertically if TRUE */\n{\n int\t\tmaxcount;\n int\t\ttodo;", " if (vertical)\n {\n\t/* Each windows needs at least 'winminwidth' lines and a separator\n\t * column. */\n\tmaxcount = (curwin->w_width + curwin->w_vsep_width\n\t\t\t\t\t - (p_wiw - p_wmw)) / (p_wmw + 1);\n }\n else\n {\n\t/* Each window needs at least 'winminheight' lines and a status line. */\n\tmaxcount = (VISIBLE_HEIGHT(curwin) + curwin->w_status_height\n\t\t\t\t - (p_wh - p_wmh)) / (p_wmh + STATUS_HEIGHT);\n }", " if (maxcount < 2)\n\tmaxcount = 2;\n if (count > maxcount)\n\tcount = maxcount;", " /*\n * add status line now, otherwise first window will be too big\n */\n if (count > 1)\n\tlast_status(TRUE);", " /*\n * Don't execute autocommands while creating the windows. Must do that\n * when putting the buffers in the windows.\n */\n block_autocmds();", " /* todo is number of windows left to create */\n for (todo = count - 1; todo > 0; --todo)\n\tif (vertical)\n\t{\n\t if (win_split(curwin->w_width - (curwin->w_width - todo)\n\t\t\t/ (todo + 1) - 1, WSP_VERT | WSP_ABOVE) == FAIL)\n\t\tbreak;\n\t}\n\telse\n\t{\n\t if (win_split(curwin->w_height - (curwin->w_height - todo\n\t\t\t * STATUS_HEIGHT) / (todo + 1)\n\t\t\t- STATUS_HEIGHT, WSP_ABOVE) == FAIL)\n\t\tbreak;\n\t}", " unblock_autocmds();", " /* return actual number of windows */\n return (count - todo);\n}", "/*\n * Exchange current and next window\n */\n static void\nwin_exchange(long Prenum)\n{\n frame_T\t*frp;\n frame_T\t*frp2;\n win_T\t*wp;\n win_T\t*wp2;\n int\t\ttemp;", " if (ERROR_IF_POPUP_WINDOW)\n\treturn;\n if (ONE_WINDOW)\t // just one window\n {\n\tbeep_flush();\n\treturn;\n }", "#ifdef FEAT_GUI\n need_mouse_correct = TRUE;\n#endif", " /*\n * find window to exchange with\n */\n if (Prenum)\n {\n\tfrp = curwin->w_frame->fr_parent->fr_child;\n\twhile (frp != NULL && --Prenum > 0)\n\t frp = frp->fr_next;\n }\n else if (curwin->w_frame->fr_next != NULL)\t/* Swap with next */\n\tfrp = curwin->w_frame->fr_next;\n else /* Swap last window in row/col with previous */\n\tfrp = curwin->w_frame->fr_prev;", " /* We can only exchange a window with another window, not with a frame\n * containing windows. */\n if (frp == NULL || frp->fr_win == NULL || frp->fr_win == curwin)\n\treturn;\n wp = frp->fr_win;", "/*\n * 1. remove curwin from the list. Remember after which window it was in wp2\n * 2. insert curwin before wp in the list\n * if wp != wp2\n * 3. remove wp from the list\n * 4. insert wp after wp2\n * 5. exchange the status line height and vsep width.\n */\n wp2 = curwin->w_prev;\n frp2 = curwin->w_frame->fr_prev;\n if (wp->w_prev != curwin)\n {\n\twin_remove(curwin, NULL);\n\tframe_remove(curwin->w_frame);\n\twin_append(wp->w_prev, curwin);\n\tframe_insert(frp, curwin->w_frame);\n }\n if (wp != wp2)\n {\n\twin_remove(wp, NULL);\n\tframe_remove(wp->w_frame);\n\twin_append(wp2, wp);\n\tif (frp2 == NULL)\n\t frame_insert(wp->w_frame->fr_parent->fr_child, wp->w_frame);\n\telse\n\t frame_append(frp2, wp->w_frame);\n }\n temp = curwin->w_status_height;\n curwin->w_status_height = wp->w_status_height;\n wp->w_status_height = temp;\n temp = curwin->w_vsep_width;\n curwin->w_vsep_width = wp->w_vsep_width;\n wp->w_vsep_width = temp;", " /* If the windows are not in the same frame, exchange the sizes to avoid\n * messing up the window layout. Otherwise fix the frame sizes. */\n if (curwin->w_frame->fr_parent != wp->w_frame->fr_parent)\n {\n\ttemp = curwin->w_height;\n\tcurwin->w_height = wp->w_height;\n\twp->w_height = temp;\n\ttemp = curwin->w_width;\n\tcurwin->w_width = wp->w_width;\n\twp->w_width = temp;\n }\n else\n {\n\tframe_fix_height(curwin);\n\tframe_fix_height(wp);\n\tframe_fix_width(curwin);\n\tframe_fix_width(wp);\n }", " (void)win_comp_pos();\t\t/* recompute window positions */", " win_enter(wp, TRUE);\n redraw_all_later(NOT_VALID);\n}", "/*\n * rotate windows: if upwards TRUE the second window becomes the first one\n *\t\t if upwards FALSE the first window becomes the second one\n */\n static void\nwin_rotate(int upwards, int count)\n{\n win_T\t*wp1;\n win_T\t*wp2;\n frame_T\t*frp;\n int\t\tn;", " if (ONE_WINDOW)\t\t/* nothing to do */\n {\n\tbeep_flush();\n\treturn;\n }", "#ifdef FEAT_GUI\n need_mouse_correct = TRUE;\n#endif", " /* Check if all frames in this row/col have one window. */\n FOR_ALL_FRAMES(frp, curwin->w_frame->fr_parent->fr_child)\n\tif (frp->fr_win == NULL)\n\t{\n\t emsg(_(\"E443: Cannot rotate when another window is split\"));\n\t return;\n\t}", " while (count--)\n {\n\tif (upwards)\t\t/* first window becomes last window */\n\t{\n\t /* remove first window/frame from the list */\n\t frp = curwin->w_frame->fr_parent->fr_child;\n\t wp1 = frp->fr_win;\n\t win_remove(wp1, NULL);\n\t frame_remove(frp);", "\t /* find last frame and append removed window/frame after it */\n\t for ( ; frp->fr_next != NULL; frp = frp->fr_next)\n\t\t;\n\t win_append(frp->fr_win, wp1);\n\t frame_append(frp, wp1->w_frame);", "\t wp2 = frp->fr_win;\t\t/* previously last window */\n\t}\n\telse\t\t\t/* last window becomes first window */\n\t{\n\t /* find last window/frame in the list and remove it */\n\t for (frp = curwin->w_frame; frp->fr_next != NULL;\n\t\t\t\t\t\t\t frp = frp->fr_next)\n\t\t;\n\t wp1 = frp->fr_win;\n\t wp2 = wp1->w_prev;\t\t /* will become last window */\n\t win_remove(wp1, NULL);\n\t frame_remove(frp);", "\t /* append the removed window/frame before the first in the list */\n\t win_append(frp->fr_parent->fr_child->fr_win->w_prev, wp1);\n\t frame_insert(frp->fr_parent->fr_child, frp);\n\t}", "\t/* exchange status height and vsep width of old and new last window */\n\tn = wp2->w_status_height;\n\twp2->w_status_height = wp1->w_status_height;\n\twp1->w_status_height = n;\n\tframe_fix_height(wp1);\n\tframe_fix_height(wp2);\n\tn = wp2->w_vsep_width;\n\twp2->w_vsep_width = wp1->w_vsep_width;\n\twp1->w_vsep_width = n;\n\tframe_fix_width(wp1);\n\tframe_fix_width(wp2);", "\t/* recompute w_winrow and w_wincol for all windows */\n\t(void)win_comp_pos();\n }", " redraw_all_later(NOT_VALID);\n}", "/*\n * Move the current window to the very top/bottom/left/right of the screen.\n */\n static void\nwin_totop(int size, int flags)\n{\n int\t\tdir;\n int\t\theight = curwin->w_height;", " if (ONE_WINDOW)\n {\n\tbeep_flush();\n\treturn;\n }\n if (check_split_disallowed() == FAIL)\n\treturn;", " /* Remove the window and frame from the tree of frames. */\n (void)winframe_remove(curwin, &dir, NULL);\n win_remove(curwin, NULL);\n last_status(FALSE);\t /* may need to remove last status line */\n (void)win_comp_pos(); /* recompute window positions */", " /* Split a window on the desired side and put the window there. */\n (void)win_split_ins(size, flags, curwin, dir);\n if (!(flags & WSP_VERT))\n {\n\twin_setheight(height);\n\tif (p_ea)\n\t win_equal(curwin, TRUE, 'v');\n }", "#if defined(FEAT_GUI)\n /* When 'guioptions' includes 'L' or 'R' may have to remove or add\n * scrollbars. Have to update them anyway. */\n gui_may_update_scrollbars();\n#endif\n}", "/*\n * Move window \"win1\" to below/right of \"win2\" and make \"win1\" the current\n * window. Only works within the same frame!\n */\n void\nwin_move_after(win_T *win1, win_T *win2)\n{\n int\t\theight;", " /* check if the arguments are reasonable */\n if (win1 == win2)\n\treturn;", " /* check if there is something to do */\n if (win2->w_next != win1)\n {\n\tif (win1->w_frame->fr_parent != win2->w_frame->fr_parent)\n\t{\n\t iemsg(\"INTERNAL: trying to move a window into another frame\");\n\t return;\n\t}", "\t/* may need move the status line/vertical separator of the last window\n\t * */\n\tif (win1 == lastwin)\n\t{\n\t height = win1->w_prev->w_status_height;\n\t win1->w_prev->w_status_height = win1->w_status_height;\n\t win1->w_status_height = height;\n\t if (win1->w_prev->w_vsep_width == 1)\n\t {\n\t\t/* Remove the vertical separator from the last-but-one window,\n\t\t * add it to the last window. Adjust the frame widths. */\n\t\twin1->w_prev->w_vsep_width = 0;\n\t\twin1->w_prev->w_frame->fr_width -= 1;\n\t\twin1->w_vsep_width = 1;\n\t\twin1->w_frame->fr_width += 1;\n\t }\n\t}\n\telse if (win2 == lastwin)\n\t{\n\t height = win1->w_status_height;\n\t win1->w_status_height = win2->w_status_height;\n\t win2->w_status_height = height;\n\t if (win1->w_vsep_width == 1)\n\t {\n\t\t/* Remove the vertical separator from win1, add it to the last\n\t\t * window, win2. Adjust the frame widths. */\n\t\twin2->w_vsep_width = 1;\n\t\twin2->w_frame->fr_width += 1;\n\t\twin1->w_vsep_width = 0;\n\t\twin1->w_frame->fr_width -= 1;\n\t }\n\t}\n\twin_remove(win1, NULL);\n\tframe_remove(win1->w_frame);\n\twin_append(win2, win1);\n\tframe_append(win2->w_frame, win1->w_frame);", "\t(void)win_comp_pos();\t/* recompute w_winrow for all windows */\n\tredraw_later(NOT_VALID);\n }\n win_enter(win1, FALSE);\n}", "/*\n * Make all windows the same height.\n * 'next_curwin' will soon be the current window, make sure it has enough\n * rows.\n */\n void\nwin_equal(\n win_T\t*next_curwin,\t/* pointer to current window to be or NULL */\n int\t\tcurrent,\t/* do only frame with current window */\n int\t\tdir)\t\t/* 'v' for vertically, 'h' for horizontally,\n\t\t\t\t 'b' for both, 0 for using p_ead */\n{\n if (dir == 0)\n\tdir = *p_ead;\n win_equal_rec(next_curwin == NULL ? curwin : next_curwin, current,\n\t\t topframe, dir, 0, tabline_height(),\n\t\t\t\t\t (int)Columns, topframe->fr_height);\n}", "/*\n * Set a frame to a new position and height, spreading the available room\n * equally over contained frames.\n * The window \"next_curwin\" (if not NULL) should at least get the size from\n * 'winheight' and 'winwidth' if possible.\n */\n static void\nwin_equal_rec(\n win_T\t*next_curwin,\t/* pointer to current window to be or NULL */\n int\t\tcurrent,\t/* do only frame with current window */\n frame_T\t*topfr,\t\t/* frame to set size off */\n int\t\tdir,\t\t/* 'v', 'h' or 'b', see win_equal() */\n int\t\tcol,\t\t/* horizontal position for frame */\n int\t\trow,\t\t/* vertical position for frame */\n int\t\twidth,\t\t/* new width of frame */\n int\t\theight)\t\t/* new height of frame */\n{\n int\t\tn, m;\n int\t\textra_sep = 0;\n int\t\twincount, totwincount = 0;\n frame_T\t*fr;\n int\t\tnext_curwin_size = 0;\n int\t\troom = 0;\n int\t\tnew_size;\n int\t\thas_next_curwin = 0;\n int\t\thnc;", " if (topfr->fr_layout == FR_LEAF)\n {\n\t/* Set the width/height of this frame.\n\t * Redraw when size or position changes */\n\tif (topfr->fr_height != height || topfr->fr_win->w_winrow != row\n\t\t|| topfr->fr_width != width || topfr->fr_win->w_wincol != col\n\t )\n\t{\n\t topfr->fr_win->w_winrow = row;\n\t frame_new_height(topfr, height, FALSE, FALSE);\n\t topfr->fr_win->w_wincol = col;\n\t frame_new_width(topfr, width, FALSE, FALSE);\n\t redraw_all_later(NOT_VALID);\n\t}\n }\n else if (topfr->fr_layout == FR_ROW)\n {\n\ttopfr->fr_width = width;\n\ttopfr->fr_height = height;", "\tif (dir != 'v')\t\t\t/* equalize frame widths */\n\t{\n\t /* Compute the maximum number of windows horizontally in this\n\t * frame. */\n\t n = frame_minwidth(topfr, NOWIN);\n\t /* add one for the rightmost window, it doesn't have a separator */\n\t if (col + width == Columns)\n\t\textra_sep = 1;\n\t else\n\t\textra_sep = 0;\n\t totwincount = (n + extra_sep) / (p_wmw + 1);\n\t has_next_curwin = frame_has_win(topfr, next_curwin);", "\t /*\n\t * Compute width for \"next_curwin\" window and room available for\n\t * other windows.\n\t * \"m\" is the minimal width when counting p_wiw for \"next_curwin\".\n\t */\n\t m = frame_minwidth(topfr, next_curwin);\n\t room = width - m;\n\t if (room < 0)\n\t {\n\t\tnext_curwin_size = p_wiw + room;\n\t\troom = 0;\n\t }\n\t else\n\t {\n\t\tnext_curwin_size = -1;\n\t\tFOR_ALL_FRAMES(fr, topfr->fr_child)\n\t\t{\n\t\t /* If 'winfixwidth' set keep the window width if\n\t\t * possible.\n\t\t * Watch out for this window being the next_curwin. */\n\t\t if (frame_fixed_width(fr))\n\t\t {\n\t\t\tn = frame_minwidth(fr, NOWIN);\n\t\t\tnew_size = fr->fr_width;\n\t\t\tif (frame_has_win(fr, next_curwin))\n\t\t\t{\n\t\t\t room += p_wiw - p_wmw;\n\t\t\t next_curwin_size = 0;\n\t\t\t if (new_size < p_wiw)\n\t\t\t\tnew_size = p_wiw;\n\t\t\t}\n\t\t\telse\n\t\t\t /* These windows don't use up room. */\n\t\t\t totwincount -= (n + (fr->fr_next == NULL\n\t\t\t\t\t ? extra_sep : 0)) / (p_wmw + 1);\n\t\t\troom -= new_size - n;\n\t\t\tif (room < 0)\n\t\t\t{\n\t\t\t new_size += room;\n\t\t\t room = 0;\n\t\t\t}\n\t\t\tfr->fr_newwidth = new_size;\n\t\t }\n\t\t}\n\t\tif (next_curwin_size == -1)\n\t\t{\n\t\t if (!has_next_curwin)\n\t\t\tnext_curwin_size = 0;\n\t\t else if (totwincount > 1\n\t\t\t && (room + (totwincount - 2))\n\t\t\t\t\t\t / (totwincount - 1) > p_wiw)\n\t\t {\n\t\t\t/* Can make all windows wider than 'winwidth', spread\n\t\t\t * the room equally. */\n\t\t\tnext_curwin_size = (room + p_wiw\n\t\t\t\t\t + (totwincount - 1) * p_wmw\n\t\t\t\t\t + (totwincount - 1)) / totwincount;\n\t\t\troom -= next_curwin_size - p_wiw;\n\t\t }\n\t\t else\n\t\t\tnext_curwin_size = p_wiw;\n\t\t}\n\t }", "\t if (has_next_curwin)\n\t\t--totwincount;\t\t/* don't count curwin */\n\t}", "\tFOR_ALL_FRAMES(fr, topfr->fr_child)\n\t{\n\t wincount = 1;\n\t if (fr->fr_next == NULL)\n\t\t/* last frame gets all that remains (avoid roundoff error) */\n\t\tnew_size = width;\n\t else if (dir == 'v')\n\t\tnew_size = fr->fr_width;\n\t else if (frame_fixed_width(fr))\n\t {\n\t\tnew_size = fr->fr_newwidth;\n\t\twincount = 0;\t /* doesn't count as a sizeable window */\n\t }\n\t else\n\t {\n\t\t/* Compute the maximum number of windows horiz. in \"fr\". */\n\t\tn = frame_minwidth(fr, NOWIN);\n\t\twincount = (n + (fr->fr_next == NULL ? extra_sep : 0))\n\t\t\t\t\t\t\t\t/ (p_wmw + 1);\n\t\tm = frame_minwidth(fr, next_curwin);\n\t\tif (has_next_curwin)\n\t\t hnc = frame_has_win(fr, next_curwin);\n\t\telse\n\t\t hnc = FALSE;\n\t\tif (hnc)\t /* don't count next_curwin */\n\t\t --wincount;\n\t\tif (totwincount == 0)\n\t\t new_size = room;\n\t\telse\n\t\t new_size = (wincount * room + ((unsigned)totwincount >> 1))\n\t\t\t\t\t\t\t\t/ totwincount;\n\t\tif (hnc)\t /* add next_curwin size */\n\t\t{\n\t\t next_curwin_size -= p_wiw - (m - n);\n\t\t new_size += next_curwin_size;\n\t\t room -= new_size - next_curwin_size;\n\t\t}\n\t\telse\n\t\t room -= new_size;\n\t\tnew_size += n;\n\t }", "\t /* Skip frame that is full width when splitting or closing a\n\t * window, unless equalizing all frames. */\n\t if (!current || dir != 'v' || topfr->fr_parent != NULL\n\t\t || (new_size != fr->fr_width)\n\t\t || frame_has_win(fr, next_curwin))\n\t\twin_equal_rec(next_curwin, current, fr, dir, col, row,\n\t\t\t\t\t\t\t new_size, height);\n\t col += new_size;\n\t width -= new_size;\n\t totwincount -= wincount;\n\t}\n }\n else /* topfr->fr_layout == FR_COL */\n {\n\ttopfr->fr_width = width;\n\ttopfr->fr_height = height;", "\tif (dir != 'h')\t\t\t/* equalize frame heights */\n\t{\n\t /* Compute maximum number of windows vertically in this frame. */\n\t n = frame_minheight(topfr, NOWIN);\n\t /* add one for the bottom window if it doesn't have a statusline */\n\t if (row + height == cmdline_row && p_ls == 0)\n\t\textra_sep = 1;\n\t else\n\t\textra_sep = 0;\n\t totwincount = (n + extra_sep) / (p_wmh + 1);\n\t has_next_curwin = frame_has_win(topfr, next_curwin);", "\t /*\n\t * Compute height for \"next_curwin\" window and room available for\n\t * other windows.\n\t * \"m\" is the minimal height when counting p_wh for \"next_curwin\".\n\t */\n\t m = frame_minheight(topfr, next_curwin);\n\t room = height - m;\n\t if (room < 0)\n\t {\n\t\t/* The room is less then 'winheight', use all space for the\n\t\t * current window. */\n\t\tnext_curwin_size = p_wh + room;\n\t\troom = 0;\n\t }\n\t else\n\t {\n\t\tnext_curwin_size = -1;\n\t\tFOR_ALL_FRAMES(fr, topfr->fr_child)\n\t\t{\n\t\t /* If 'winfixheight' set keep the window height if\n\t\t * possible.\n\t\t * Watch out for this window being the next_curwin. */\n\t\t if (frame_fixed_height(fr))\n\t\t {\n\t\t\tn = frame_minheight(fr, NOWIN);\n\t\t\tnew_size = fr->fr_height;\n\t\t\tif (frame_has_win(fr, next_curwin))\n\t\t\t{\n\t\t\t room += p_wh - p_wmh;\n\t\t\t next_curwin_size = 0;\n\t\t\t if (new_size < p_wh)\n\t\t\t\tnew_size = p_wh;\n\t\t\t}\n\t\t\telse\n\t\t\t /* These windows don't use up room. */\n\t\t\t totwincount -= (n + (fr->fr_next == NULL\n\t\t\t\t\t ? extra_sep : 0)) / (p_wmh + 1);\n\t\t\troom -= new_size - n;\n\t\t\tif (room < 0)\n\t\t\t{\n\t\t\t new_size += room;\n\t\t\t room = 0;\n\t\t\t}\n\t\t\tfr->fr_newheight = new_size;\n\t\t }\n\t\t}\n\t\tif (next_curwin_size == -1)\n\t\t{\n\t\t if (!has_next_curwin)\n\t\t\tnext_curwin_size = 0;\n\t\t else if (totwincount > 1\n\t\t\t && (room + (totwincount - 2))\n\t\t\t\t\t\t / (totwincount - 1) > p_wh)\n\t\t {\n\t\t\t/* can make all windows higher than 'winheight',\n\t\t\t * spread the room equally. */\n\t\t\tnext_curwin_size = (room + p_wh\n\t\t\t\t\t + (totwincount - 1) * p_wmh\n\t\t\t\t\t + (totwincount - 1)) / totwincount;\n\t\t\troom -= next_curwin_size - p_wh;\n\t\t }\n\t\t else\n\t\t\tnext_curwin_size = p_wh;\n\t\t}\n\t }", "\t if (has_next_curwin)\n\t\t--totwincount;\t\t/* don't count curwin */\n\t}", "\tFOR_ALL_FRAMES(fr, topfr->fr_child)\n\t{\n\t wincount = 1;\n\t if (fr->fr_next == NULL)\n\t\t/* last frame gets all that remains (avoid roundoff error) */\n\t\tnew_size = height;\n\t else if (dir == 'h')\n\t\tnew_size = fr->fr_height;\n\t else if (frame_fixed_height(fr))\n\t {\n\t\tnew_size = fr->fr_newheight;\n\t\twincount = 0;\t /* doesn't count as a sizeable window */\n\t }\n\t else\n\t {\n\t\t/* Compute the maximum number of windows vert. in \"fr\". */\n\t\tn = frame_minheight(fr, NOWIN);\n\t\twincount = (n + (fr->fr_next == NULL ? extra_sep : 0))\n\t\t\t\t\t\t\t\t/ (p_wmh + 1);\n\t\tm = frame_minheight(fr, next_curwin);\n\t\tif (has_next_curwin)\n\t\t hnc = frame_has_win(fr, next_curwin);\n\t\telse\n\t\t hnc = FALSE;\n\t\tif (hnc)\t /* don't count next_curwin */\n\t\t --wincount;\n\t\tif (totwincount == 0)\n\t\t new_size = room;\n\t\telse\n\t\t new_size = (wincount * room + ((unsigned)totwincount >> 1))\n\t\t\t\t\t\t\t\t/ totwincount;\n\t\tif (hnc)\t /* add next_curwin size */\n\t\t{\n\t\t next_curwin_size -= p_wh - (m - n);\n\t\t new_size += next_curwin_size;\n\t\t room -= new_size - next_curwin_size;\n\t\t}\n\t\telse\n\t\t room -= new_size;\n\t\tnew_size += n;\n\t }\n\t /* Skip frame that is full width when splitting or closing a\n\t * window, unless equalizing all frames. */\n\t if (!current || dir != 'h' || topfr->fr_parent != NULL\n\t\t || (new_size != fr->fr_height)\n\t\t || frame_has_win(fr, next_curwin))\n\t\twin_equal_rec(next_curwin, current, fr, dir, col, row,\n\t\t\t\t\t\t\t width, new_size);\n\t row += new_size;\n\t height -= new_size;\n\t totwincount -= wincount;\n\t}\n }\n}", "#ifdef FEAT_JOB_CHANNEL\n static void\nleaving_window(win_T *win)\n{\n // Only matters for a prompt window.\n if (!bt_prompt(win->w_buffer))\n\treturn;", " // When leaving a prompt window stop Insert mode and perhaps restart\n // it when entering that window again.\n win->w_buffer->b_prompt_insert = restart_edit;\n if (restart_edit != 0 && mode_displayed)\n\tclear_cmdline = TRUE;\t\t/* unshow mode later */\n restart_edit = NUL;", " // When leaving the window (or closing the window) was done from a\n // callback we need to break out of the Insert mode loop and restart Insert\n // mode when entering the window again.\n if (State & INSERT)\n {\n\tstop_insert_mode = TRUE;\n\tif (win->w_buffer->b_prompt_insert == NUL)\n\t win->w_buffer->b_prompt_insert = 'A';\n }\n}", " static void\nentering_window(win_T *win)\n{\n // Only matters for a prompt window.\n if (!bt_prompt(win->w_buffer))\n\treturn;", " // When switching to a prompt buffer that was in Insert mode, don't stop\n // Insert mode, it may have been set in leaving_window().\n if (win->w_buffer->b_prompt_insert != NUL)\n\tstop_insert_mode = FALSE;", " // When entering the prompt window restart Insert mode if we were in Insert\n // mode when we left it.\n restart_edit = win->w_buffer->b_prompt_insert;\n}\n#endif", "/*\n * Close all windows for buffer \"buf\".\n */\n void\nclose_windows(\n buf_T\t*buf,\n int\t\tkeep_curwin)\t /* don't close \"curwin\" */\n{\n win_T\t*wp;\n tabpage_T *tp, *nexttp;\n int\t\th = tabline_height();\n int\t\tcount = tabpage_index(NULL);", " ++RedrawingDisabled;", " for (wp = firstwin; wp != NULL && !ONE_WINDOW; )\n {\n\tif (wp->w_buffer == buf && (!keep_curwin || wp != curwin)\n\t\t&& !(wp->w_closing || wp->w_buffer->b_locked > 0))\n\t{\n\t if (win_close(wp, FALSE) == FAIL)\n\t\t/* If closing the window fails give up, to avoid looping\n\t\t * forever. */\n\t\tbreak;", "\t /* Start all over, autocommands may change the window layout. */\n\t wp = firstwin;\n\t}\n\telse\n\t wp = wp->w_next;\n }", " /* Also check windows in other tab pages. */\n for (tp = first_tabpage; tp != NULL; tp = nexttp)\n {\n\tnexttp = tp->tp_next;\n\tif (tp != curtab)\n\t for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next)\n\t\tif (wp->w_buffer == buf\n\t\t && !(wp->w_closing || wp->w_buffer->b_locked > 0))\n\t\t{\n\t\t win_close_othertab(wp, FALSE, tp);", "\t\t /* Start all over, the tab page may be closed and\n\t\t * autocommands may change the window layout. */\n\t\t nexttp = first_tabpage;\n\t\t break;\n\t\t}\n }", " --RedrawingDisabled;", " if (count != tabpage_index(NULL))\n\tapply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf);", " redraw_tabline = TRUE;\n if (h != tabline_height())\n\tshell_new_rows();\n}", "/*\n * Return TRUE if the current window is the only window that exists (ignoring\n * \"aucmd_win\").\n * Returns FALSE if there is a window, possibly in another tab page.\n */\n static int\nlast_window(void)\n{\n return (one_window() && first_tabpage->tp_next == NULL);\n}", "/*\n * Return TRUE if there is only one window other than \"aucmd_win\" in the\n * current tab page.\n */\n int\none_window(void)\n{\n win_T\t*wp;\n int\t\tseen_one = FALSE;", " FOR_ALL_WINDOWS(wp)\n {\n\tif (wp != aucmd_win)\n\t{\n\t if (seen_one)\n\t\treturn FALSE;\n\t seen_one = TRUE;\n\t}\n }\n return TRUE;\n}", "/*\n * Close the possibly last window in a tab page.\n * Returns TRUE when the window was closed already.\n */\n static int\nclose_last_window_tabpage(\n win_T\t*win,\n int\t\tfree_buf,\n tabpage_T *prev_curtab)\n{\n if (ONE_WINDOW)\n {\n\tbuf_T\t*old_curbuf = curbuf;", "\t/*\n\t * Closing the last window in a tab page. First go to another tab\n\t * page and then close the window and the tab page. This avoids that\n\t * curwin and curtab are invalid while we are freeing memory, they may\n\t * be used in GUI events.\n\t * Don't trigger autocommands yet, they may use wrong values, so do\n\t * that below.\n\t */\n\tgoto_tabpage_tp(alt_tabpage(), FALSE, TRUE);\n\tredraw_tabline = TRUE;", "\t/* Safety check: Autocommands may have closed the window when jumping\n\t * to the other tab page. */\n\tif (valid_tabpage(prev_curtab) && prev_curtab->tp_firstwin == win)\n\t{\n\t int\t h = tabline_height();", "\t win_close_othertab(win, free_buf, prev_curtab);\n\t if (h != tabline_height())\n\t\tshell_new_rows();\n\t}\n#ifdef FEAT_JOB_CHANNEL\n\tentering_window(curwin);\n#endif\n\t/* Since goto_tabpage_tp above did not trigger *Enter autocommands, do\n\t * that now. */\n\tapply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf);\n\tapply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);\n\tapply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);\n\tif (old_curbuf != curbuf)\n\t apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);\n\treturn TRUE;\n }\n return FALSE;\n}", "/*\n * Close the buffer of \"win\" and unload it if \"action\" is DOBUF_UNLOAD.\n * \"action\" can also be zero (do nothing) or DOBUF_WIPE.\n * \"abort_if_last\" is passed to close_buffer(): abort closing if all other\n * windows are closed.\n */\n static void\nwin_close_buffer(win_T *win, int action, int abort_if_last)\n{\n#ifdef FEAT_SYN_HL\n // Free independent synblock before the buffer is freed.\n if (win->w_buffer != NULL)\n\treset_synblock(win);\n#endif", "#ifdef FEAT_QUICKFIX\n // When the quickfix/location list window is closed, unlist the buffer.\n if (win->w_buffer != NULL && bt_quickfix(win->w_buffer))\n\twin->w_buffer->b_p_bl = FALSE;\n#endif", " // Close the link to the buffer.\n if (win->w_buffer != NULL)\n {\n\tbufref_T bufref;", "\tset_bufref(&bufref, curbuf);\n\twin->w_closing = TRUE;\n\tclose_buffer(win, win->w_buffer, action, abort_if_last);\n\tif (win_valid_any_tab(win))\n\t win->w_closing = FALSE;\n\t// Make sure curbuf is valid. It can become invalid if 'bufhidden' is\n\t// \"wipe\".\n\tif (!bufref_valid(&bufref))\n\t curbuf = firstbuf;\n }\n}", "/*\n * Close window \"win\". Only works for the current tab page.\n * If \"free_buf\" is TRUE related buffer may be unloaded.\n *\n * Called by :quit, :close, :xit, :wq and findtag().\n * Returns FAIL when the window was not closed.\n */\n int\nwin_close(win_T *win, int free_buf)\n{\n win_T\t*wp;\n int\t\tother_buffer = FALSE;\n int\t\tclose_curwin = FALSE;\n int\t\tdir;\n int\t\thelp_window = FALSE;\n tabpage_T *prev_curtab = curtab;\n frame_T\t*win_frame = win->w_frame->fr_parent;", " if (ERROR_IF_POPUP_WINDOW)\n\treturn FAIL;", " if (last_window())\n {\n\temsg(_(\"E444: Cannot close last window\"));\n\treturn FAIL;\n }", " if (win->w_closing || (win->w_buffer != NULL\n\t\t\t\t\t && win->w_buffer->b_locked > 0))\n\treturn FAIL; /* window is already being closed */\n if (win_unlisted(win))\n {\n\temsg(_(\"E813: Cannot close autocmd or popup window\"));\n\treturn FAIL;\n }\n if ((firstwin == aucmd_win || lastwin == aucmd_win) && one_window())\n {\n\temsg(_(\"E814: Cannot close window, only autocmd window would remain\"));\n\treturn FAIL;\n }", " /* When closing the last window in a tab page first go to another tab page\n * and then close the window and the tab page to avoid that curwin and\n * curtab are invalid while we are freeing memory. */\n if (close_last_window_tabpage(win, free_buf, prev_curtab))\n return FAIL;", " /* When closing the help window, try restoring a snapshot after closing\n * the window. Otherwise clear the snapshot, it's now invalid. */\n if (bt_help(win->w_buffer))\n\thelp_window = TRUE;\n else\n\tclear_snapshot(curtab, SNAP_HELP_IDX);", " if (win == curwin)\n {\n#ifdef FEAT_JOB_CHANNEL\n\tleaving_window(curwin);\n#endif\n\t/*\n\t * Guess which window is going to be the new current window.\n\t * This may change because of the autocommands (sigh).\n\t */\n\twp = frame2win(win_altframe(win, NULL));", "\t/*\n\t * Be careful: If autocommands delete the window or cause this window\n\t * to be the last one left, return now.\n\t */\n\tif (wp->w_buffer != curbuf)\n\t{\n\t other_buffer = TRUE;\n\t win->w_closing = TRUE;\n\t apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);\n\t if (!win_valid(win))\n\t\treturn FAIL;\n\t win->w_closing = FALSE;\n\t if (last_window())\n\t\treturn FAIL;\n\t}\n\twin->w_closing = TRUE;\n\tapply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf);\n\tif (!win_valid(win))\n\t return FAIL;\n\twin->w_closing = FALSE;\n\tif (last_window())\n\t return FAIL;\n#ifdef FEAT_EVAL\n\t/* autocmds may abort script processing */\n\tif (aborting())\n\t return FAIL;\n#endif\n }", "#ifdef FEAT_GUI\n // Avoid trouble with scrollbars that are going to be deleted in\n // win_free().\n if (gui.in_use)\n\tout_flush();\n#endif", "#ifdef FEAT_TEXT_PROP\n if (popup_win_closed(win) && !win_valid(win))\n\treturn FAIL;\n#endif\n win_close_buffer(win, free_buf ? DOBUF_UNLOAD : 0, TRUE);", " if (only_one_window() && win_valid(win) && win->w_buffer == NULL\n\t && (last_window() || curtab != prev_curtab\n\t\t|| close_last_window_tabpage(win, free_buf, prev_curtab)))\n {\n\t/* Autocommands have closed all windows, quit now. Restore\n\t * curwin->w_buffer, otherwise writing viminfo may fail. */\n\tif (curwin->w_buffer == NULL)\n\t curwin->w_buffer = curbuf;\n\tgetout(0);\n }", " /* Autocommands may have moved to another tab page. */\n if (curtab != prev_curtab && win_valid_any_tab(win)\n\t\t\t\t\t\t && win->w_buffer == NULL)\n {\n\t/* Need to close the window anyway, since the buffer is NULL. */\n\twin_close_othertab(win, FALSE, prev_curtab);\n\treturn FAIL;\n }", " /* Autocommands may have closed the window already or closed the only\n * other window. */\n if (!win_valid(win) || last_window()\n\t || close_last_window_tabpage(win, free_buf, prev_curtab))\n\treturn FAIL;", " // Now we are really going to close the window. Disallow any autocommand\n // to split a window to avoid trouble.\n ++split_disallowed;", " /* Free the memory used for the window and get the window that received\n * the screen space. */\n wp = win_free_mem(win, &dir, NULL);", " /* Make sure curwin isn't invalid. It can cause severe trouble when\n * printing an error message. For win_equal() curbuf needs to be valid\n * too. */\n if (win == curwin)\n {\n\tcurwin = wp;\n#ifdef FEAT_QUICKFIX\n\tif (wp->w_p_pvw || bt_quickfix(wp->w_buffer))\n\t{\n\t /*\n\t * If the cursor goes to the preview or the quickfix window, try\n\t * finding another window to go to.\n\t */\n\t for (;;)\n\t {\n\t\tif (wp->w_next == NULL)\n\t\t wp = firstwin;\n\t\telse\n\t\t wp = wp->w_next;\n\t\tif (wp == curwin)\n\t\t break;\n\t\tif (!wp->w_p_pvw && !bt_quickfix(wp->w_buffer))\n\t\t{\n\t\t curwin = wp;\n\t\t break;\n\t\t}\n\t }\n\t}\n#endif\n\tcurbuf = curwin->w_buffer;\n\tclose_curwin = TRUE;", "\t/* The cursor position may be invalid if the buffer changed after last\n\t * using the window. */\n\tcheck_cursor();\n }\n if (p_ea && (*p_ead == 'b' || *p_ead == dir))\n\t/* If the frame of the closed window contains the new current window,\n\t * only resize that frame. Otherwise resize all windows. */\n\twin_equal(curwin, curwin->w_frame->fr_parent == win_frame, dir);\n else\n\twin_comp_pos();\n if (close_curwin)\n {\n\twin_enter_ext(wp, FALSE, TRUE, FALSE, TRUE, TRUE);\n\tif (other_buffer)\n\t /* careful: after this wp and win may be invalid! */\n\t apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);\n }", " --split_disallowed;", " /*\n * If last window has a status line now and we don't want one,\n * remove the status line.\n */\n last_status(FALSE);", " /* After closing the help window, try restoring the window layout from\n * before it was opened. */\n if (help_window)\n\trestore_snapshot(SNAP_HELP_IDX, close_curwin);", "#if defined(FEAT_GUI)\n /* When 'guioptions' includes 'L' or 'R' may have to remove scrollbars. */\n if (gui.in_use && !win_hasvertsplit())\n\tgui_init_which_components(NULL);\n#endif", " redraw_all_later(NOT_VALID);\n return OK;\n}", "/*\n * Close window \"win\" in tab page \"tp\", which is not the current tab page.\n * This may be the last window in that tab page and result in closing the tab,\n * thus \"tp\" may become invalid!\n * Caller must check if buffer is hidden and whether the tabline needs to be\n * updated.\n */\n void\nwin_close_othertab(win_T *win, int free_buf, tabpage_T *tp)\n{\n win_T\t*wp;\n int\t\tdir;\n tabpage_T *ptp = NULL;\n int\t\tfree_tp = FALSE;", " /* Get here with win->w_buffer == NULL when win_close() detects the tab\n * page changed. */\n if (win->w_closing || (win->w_buffer != NULL\n\t\t\t\t\t && win->w_buffer->b_locked > 0))\n\treturn; /* window is already being closed */", " if (win->w_buffer != NULL)\n\t/* Close the link to the buffer. */\n\tclose_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, FALSE);", " /* Careful: Autocommands may have closed the tab page or made it the\n * current tab page. */\n for (ptp = first_tabpage; ptp != NULL && ptp != tp; ptp = ptp->tp_next)\n\t;\n if (ptp == NULL || tp == curtab)\n\treturn;", " /* Autocommands may have closed the window already. */\n for (wp = tp->tp_firstwin; wp != NULL && wp != win; wp = wp->w_next)\n\t;\n if (wp == NULL)\n\treturn;", " /* When closing the last window in a tab page remove the tab page. */\n if (tp->tp_firstwin == tp->tp_lastwin)\n {\n\tif (tp == first_tabpage)\n\t first_tabpage = tp->tp_next;\n\telse\n\t{\n\t for (ptp = first_tabpage; ptp != NULL && ptp->tp_next != tp;\n\t\t\t\t\t\t\t ptp = ptp->tp_next)\n\t\t;\n\t if (ptp == NULL)\n\t {\n\t\tinternal_error(\"win_close_othertab()\");\n\t\treturn;\n\t }\n\t ptp->tp_next = tp->tp_next;\n\t}\n\tfree_tp = TRUE;\n }", " /* Free the memory used for the window. */\n win_free_mem(win, &dir, tp);", " if (free_tp)\n\tfree_tabpage(tp);\n}", "/*\n * Free the memory used for a window.\n * Returns a pointer to the window that got the freed up space.\n */\n static win_T *\nwin_free_mem(\n win_T\t*win,\n int\t\t*dirp,\t\t/* set to 'v' or 'h' for direction if 'ea' */\n tabpage_T\t*tp)\t\t/* tab page \"win\" is in, NULL for current */\n{\n frame_T\t*frp;\n win_T\t*wp;", " /* Remove the window and its frame from the tree of frames. */\n frp = win->w_frame;\n wp = winframe_remove(win, dirp, tp);\n vim_free(frp);\n win_free(win, tp);", " /* When deleting the current window of another tab page select a new\n * current window. */\n if (tp != NULL && win == tp->tp_curwin)\n\ttp->tp_curwin = wp;", " return wp;\n}", "#if defined(EXITFREE) || defined(PROTO)\n void\nwin_free_all(void)\n{\n int\t\tdummy;", " while (first_tabpage->tp_next != NULL)\n\ttabpage_close(TRUE);", " if (aucmd_win != NULL)\n {\n\t(void)win_free_mem(aucmd_win, &dummy, NULL);\n\taucmd_win = NULL;\n }\n# ifdef FEAT_TEXT_PROP\n close_all_popups();\n# endif", " while (firstwin != NULL)\n\t(void)win_free_mem(firstwin, &dummy, NULL);", " /* No window should be used after this. Set curwin to NULL to crash\n * instead of using freed memory. */\n curwin = NULL;\n}\n#endif", "/*\n * Remove a window and its frame from the tree of frames.\n * Returns a pointer to the window that got the freed up space.\n */\n win_T *\nwinframe_remove(\n win_T\t*win,\n int\t\t*dirp UNUSED,\t/* set to 'v' or 'h' for direction if 'ea' */\n tabpage_T\t*tp)\t\t/* tab page \"win\" is in, NULL for current */\n{\n frame_T\t*frp, *frp2, *frp3;\n frame_T\t*frp_close = win->w_frame;\n win_T\t*wp;", " /*\n * If there is only one window there is nothing to remove.\n */\n if (tp == NULL ? ONE_WINDOW : tp->tp_firstwin == tp->tp_lastwin)\n\treturn NULL;", " /*\n * Remove the window from its frame.\n */\n frp2 = win_altframe(win, tp);\n wp = frame2win(frp2);", " /* Remove this frame from the list of frames. */\n frame_remove(frp_close);", " if (frp_close->fr_parent->fr_layout == FR_COL)\n {\n\t/* When 'winfixheight' is set, try to find another frame in the column\n\t * (as close to the closed frame as possible) to distribute the height\n\t * to. */\n\tif (frp2->fr_win != NULL && frp2->fr_win->w_p_wfh)\n\t{\n\t frp = frp_close->fr_prev;\n\t frp3 = frp_close->fr_next;\n\t while (frp != NULL || frp3 != NULL)\n\t {\n\t\tif (frp != NULL)\n\t\t{\n\t\t if (!frame_fixed_height(frp))\n\t\t {\n\t\t\tfrp2 = frp;\n\t\t\twp = frame2win(frp2);\n\t\t\tbreak;\n\t\t }\n\t\t frp = frp->fr_prev;\n\t\t}\n\t\tif (frp3 != NULL)\n\t\t{\n\t\t if (frp3->fr_win != NULL && !frp3->fr_win->w_p_wfh)\n\t\t {\n\t\t\tfrp2 = frp3;\n\t\t\twp = frp3->fr_win;\n\t\t\tbreak;\n\t\t }\n\t\t frp3 = frp3->fr_next;\n\t\t}\n\t }\n\t}\n\tframe_new_height(frp2, frp2->fr_height + frp_close->fr_height,\n\t\t\t frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE);\n\t*dirp = 'v';\n }\n else\n {\n\t/* When 'winfixwidth' is set, try to find another frame in the column\n\t * (as close to the closed frame as possible) to distribute the width\n\t * to. */\n\tif (frp2->fr_win != NULL && frp2->fr_win->w_p_wfw)\n\t{\n\t frp = frp_close->fr_prev;\n\t frp3 = frp_close->fr_next;\n\t while (frp != NULL || frp3 != NULL)\n\t {\n\t\tif (frp != NULL)\n\t\t{\n\t\t if (!frame_fixed_width(frp))\n\t\t {\n\t\t\tfrp2 = frp;\n\t\t\twp = frame2win(frp2);\n\t\t\tbreak;\n\t\t }\n\t\t frp = frp->fr_prev;\n\t\t}\n\t\tif (frp3 != NULL)\n\t\t{\n\t\t if (frp3->fr_win != NULL && !frp3->fr_win->w_p_wfw)\n\t\t {\n\t\t\tfrp2 = frp3;\n\t\t\twp = frp3->fr_win;\n\t\t\tbreak;\n\t\t }\n\t\t frp3 = frp3->fr_next;\n\t\t}\n\t }\n\t}\n\tframe_new_width(frp2, frp2->fr_width + frp_close->fr_width,\n\t\t\t frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE);\n\t*dirp = 'h';\n }", " /* If rows/columns go to a window below/right its positions need to be\n * updated. Can only be done after the sizes have been updated. */\n if (frp2 == frp_close->fr_next)\n {\n\tint row = win->w_winrow;\n\tint col = win->w_wincol;", "\tframe_comp_pos(frp2, &row, &col);\n }", " if (frp2->fr_next == NULL && frp2->fr_prev == NULL)\n {\n\t/* There is no other frame in this list, move its info to the parent\n\t * and remove it. */\n\tfrp2->fr_parent->fr_layout = frp2->fr_layout;\n\tfrp2->fr_parent->fr_child = frp2->fr_child;\n\tFOR_ALL_FRAMES(frp, frp2->fr_child)\n\t frp->fr_parent = frp2->fr_parent;\n\tfrp2->fr_parent->fr_win = frp2->fr_win;\n\tif (frp2->fr_win != NULL)\n\t frp2->fr_win->w_frame = frp2->fr_parent;\n\tfrp = frp2->fr_parent;\n\tif (topframe->fr_child == frp2)\n\t topframe->fr_child = frp;\n\tvim_free(frp2);", "\tfrp2 = frp->fr_parent;\n\tif (frp2 != NULL && frp2->fr_layout == frp->fr_layout)\n\t{\n\t /* The frame above the parent has the same layout, have to merge\n\t * the frames into this list. */\n\t if (frp2->fr_child == frp)\n\t\tfrp2->fr_child = frp->fr_child;\n\t frp->fr_child->fr_prev = frp->fr_prev;\n\t if (frp->fr_prev != NULL)\n\t\tfrp->fr_prev->fr_next = frp->fr_child;\n\t for (frp3 = frp->fr_child; ; frp3 = frp3->fr_next)\n\t {\n\t\tfrp3->fr_parent = frp2;\n\t\tif (frp3->fr_next == NULL)\n\t\t{\n\t\t frp3->fr_next = frp->fr_next;\n\t\t if (frp->fr_next != NULL)\n\t\t\tfrp->fr_next->fr_prev = frp3;\n\t\t break;\n\t\t}\n\t }\n\t if (topframe->fr_child == frp)\n\t\ttopframe->fr_child = frp2;\n\t vim_free(frp);\n\t}\n }", " return wp;\n}", "/*\n * Return a pointer to the frame that will receive the empty screen space that\n * is left over after \"win\" is closed.\n *\n * If 'splitbelow' or 'splitright' is set, the space goes above or to the left\n * by default. Otherwise, the free space goes below or to the right. The\n * result is that opening a window and then immediately closing it will\n * preserve the initial window layout. The 'wfh' and 'wfw' settings are\n * respected when possible.\n */\n static frame_T *\nwin_altframe(\n win_T\t*win,\n tabpage_T\t*tp)\t\t/* tab page \"win\" is in, NULL for current */\n{\n frame_T\t*frp;\n frame_T\t*other_fr, *target_fr;", " if (tp == NULL ? ONE_WINDOW : tp->tp_firstwin == tp->tp_lastwin)\n\treturn alt_tabpage()->tp_curwin->w_frame;", " frp = win->w_frame;", " if (frp->fr_prev == NULL)\n\treturn frp->fr_next;\n if (frp->fr_next == NULL)\n\treturn frp->fr_prev;", " target_fr = frp->fr_next;\n other_fr = frp->fr_prev;\n if (p_spr || p_sb)\n {\n\ttarget_fr = frp->fr_prev;\n\tother_fr = frp->fr_next;\n }", " /* If 'wfh' or 'wfw' is set for the target and not for the alternate\n * window, reverse the selection. */\n if (frp->fr_parent != NULL && frp->fr_parent->fr_layout == FR_ROW)\n {\n\tif (frame_fixed_width(target_fr) && !frame_fixed_width(other_fr))\n\t target_fr = other_fr;\n }\n else\n {\n\tif (frame_fixed_height(target_fr) && !frame_fixed_height(other_fr))\n\t target_fr = other_fr;\n }", " return target_fr;\n}", "/*\n * Return the tabpage that will be used if the current one is closed.\n */\n static tabpage_T *\nalt_tabpage(void)\n{\n tabpage_T\t*tp;", " /* Use the next tab page if possible. */\n if (curtab->tp_next != NULL)\n\treturn curtab->tp_next;", " /* Find the last but one tab page. */\n for (tp = first_tabpage; tp->tp_next != curtab; tp = tp->tp_next)\n\t;\n return tp;\n}", "/*\n * Find the left-upper window in frame \"frp\".\n */\n static win_T *\nframe2win(frame_T *frp)\n{\n while (frp->fr_win == NULL)\n\tfrp = frp->fr_child;\n return frp->fr_win;\n}", "/*\n * Return TRUE if frame \"frp\" contains window \"wp\".\n */\n static int\nframe_has_win(frame_T *frp, win_T *wp)\n{\n frame_T\t*p;", " if (frp->fr_layout == FR_LEAF)\n\treturn frp->fr_win == wp;", " FOR_ALL_FRAMES(p, frp->fr_child)\n\tif (frame_has_win(p, wp))\n\t return TRUE;\n return FALSE;\n}", "/*\n * Set a new height for a frame. Recursively sets the height for contained\n * frames and windows. Caller must take care of positions.\n */\n static void\nframe_new_height(\n frame_T\t*topfrp,\n int\t\theight,\n int\t\ttopfirst,\t/* resize topmost contained frame first */\n int\t\twfh)\t\t/* obey 'winfixheight' when there is a choice;\n\t\t\t\t may cause the height not to be set */\n{\n frame_T\t*frp;\n int\t\textra_lines;\n int\t\th;", " if (topfrp->fr_win != NULL)\n {\n\t/* Simple case: just one window. */\n\twin_new_height(topfrp->fr_win,\n\t\t\t\t height - topfrp->fr_win->w_status_height\n\t\t\t\t\t - WINBAR_HEIGHT(topfrp->fr_win));\n }\n else if (topfrp->fr_layout == FR_ROW)\n {\n\tdo\n\t{\n\t /* All frames in this row get the same new height. */\n\t FOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t {\n\t\tframe_new_height(frp, height, topfirst, wfh);\n\t\tif (frp->fr_height > height)\n\t\t{\n\t\t /* Could not fit the windows, make the whole row higher. */\n\t\t height = frp->fr_height;\n\t\t break;\n\t\t}\n\t }\n\t}\n\twhile (frp != NULL);\n }\n else /* fr_layout == FR_COL */\n {\n\t/* Complicated case: Resize a column of frames. Resize the bottom\n\t * frame first, frames above that when needed. */", "\tfrp = topfrp->fr_child;\n\tif (wfh)\n\t /* Advance past frames with one window with 'wfh' set. */\n\t while (frame_fixed_height(frp))\n\t {\n\t\tfrp = frp->fr_next;\n\t\tif (frp == NULL)\n\t\t return;\t /* no frame without 'wfh', give up */\n\t }\n\tif (!topfirst)\n\t{\n\t /* Find the bottom frame of this column */\n\t while (frp->fr_next != NULL)\n\t\tfrp = frp->fr_next;\n\t if (wfh)\n\t\t/* Advance back for frames with one window with 'wfh' set. */\n\t\twhile (frame_fixed_height(frp))\n\t\t frp = frp->fr_prev;\n\t}", "\textra_lines = height - topfrp->fr_height;\n\tif (extra_lines < 0)\n\t{\n\t /* reduce height of contained frames, bottom or top frame first */\n\t while (frp != NULL)\n\t {\n\t\th = frame_minheight(frp, NULL);\n\t\tif (frp->fr_height + extra_lines < h)\n\t\t{\n\t\t extra_lines += frp->fr_height - h;\n\t\t frame_new_height(frp, h, topfirst, wfh);\n\t\t}\n\t\telse\n\t\t{\n\t\t frame_new_height(frp, frp->fr_height + extra_lines,\n\t\t\t\t\t\t\t topfirst, wfh);\n\t\t break;\n\t\t}\n\t\tif (topfirst)\n\t\t{\n\t\t do\n\t\t\tfrp = frp->fr_next;\n\t\t while (wfh && frp != NULL && frame_fixed_height(frp));\n\t\t}\n\t\telse\n\t\t{\n\t\t do\n\t\t\tfrp = frp->fr_prev;\n\t\t while (wfh && frp != NULL && frame_fixed_height(frp));\n\t\t}\n\t\t/* Increase \"height\" if we could not reduce enough frames. */\n\t\tif (frp == NULL)\n\t\t height -= extra_lines;\n\t }\n\t}\n\telse if (extra_lines > 0)\n\t{\n\t /* increase height of bottom or top frame */\n\t frame_new_height(frp, frp->fr_height + extra_lines, topfirst, wfh);\n\t}\n }\n topfrp->fr_height = height;\n}", "/*\n * Return TRUE if height of frame \"frp\" should not be changed because of\n * the 'winfixheight' option.\n */\n static int\nframe_fixed_height(frame_T *frp)\n{\n /* frame with one window: fixed height if 'winfixheight' set. */\n if (frp->fr_win != NULL)\n\treturn frp->fr_win->w_p_wfh;", " if (frp->fr_layout == FR_ROW)\n {\n\t/* The frame is fixed height if one of the frames in the row is fixed\n\t * height. */\n\tFOR_ALL_FRAMES(frp, frp->fr_child)\n\t if (frame_fixed_height(frp))\n\t\treturn TRUE;\n\treturn FALSE;\n }", " /* frp->fr_layout == FR_COL: The frame is fixed height if all of the\n * frames in the row are fixed height. */\n FOR_ALL_FRAMES(frp, frp->fr_child)\n\tif (!frame_fixed_height(frp))\n\t return FALSE;\n return TRUE;\n}", "/*\n * Return TRUE if width of frame \"frp\" should not be changed because of\n * the 'winfixwidth' option.\n */\n static int\nframe_fixed_width(frame_T *frp)\n{\n /* frame with one window: fixed width if 'winfixwidth' set. */\n if (frp->fr_win != NULL)\n\treturn frp->fr_win->w_p_wfw;", " if (frp->fr_layout == FR_COL)\n {\n\t/* The frame is fixed width if one of the frames in the row is fixed\n\t * width. */\n\tFOR_ALL_FRAMES(frp, frp->fr_child)\n\t if (frame_fixed_width(frp))\n\t\treturn TRUE;\n\treturn FALSE;\n }", " /* frp->fr_layout == FR_ROW: The frame is fixed width if all of the\n * frames in the row are fixed width. */\n FOR_ALL_FRAMES(frp, frp->fr_child)\n\tif (!frame_fixed_width(frp))\n\t return FALSE;\n return TRUE;\n}", "/*\n * Add a status line to windows at the bottom of \"frp\".\n * Note: Does not check if there is room!\n */\n static void\nframe_add_statusline(frame_T *frp)\n{\n win_T\t*wp;", " if (frp->fr_layout == FR_LEAF)\n {\n\twp = frp->fr_win;\n\tif (wp->w_status_height == 0)\n\t{\n\t if (wp->w_height > 0)\t/* don't make it negative */\n\t\t--wp->w_height;\n\t wp->w_status_height = STATUS_HEIGHT;\n\t}\n }\n else if (frp->fr_layout == FR_ROW)\n {\n\t/* Handle all the frames in the row. */\n\tFOR_ALL_FRAMES(frp, frp->fr_child)\n\t frame_add_statusline(frp);\n }\n else /* frp->fr_layout == FR_COL */\n {\n\t/* Only need to handle the last frame in the column. */\n\tfor (frp = frp->fr_child; frp->fr_next != NULL; frp = frp->fr_next)\n\t ;\n\tframe_add_statusline(frp);\n }\n}", "/*\n * Set width of a frame. Handles recursively going through contained frames.\n * May remove separator line for windows at the right side (for win_close()).\n */\n static void\nframe_new_width(\n frame_T\t*topfrp,\n int\t\twidth,\n int\t\tleftfirst,\t/* resize leftmost contained frame first */\n int\t\twfw)\t\t/* obey 'winfixwidth' when there is a choice;\n\t\t\t\t may cause the width not to be set */\n{\n frame_T\t*frp;\n int\t\textra_cols;\n int\t\tw;\n win_T\t*wp;", " if (topfrp->fr_layout == FR_LEAF)\n {\n\t/* Simple case: just one window. */\n\twp = topfrp->fr_win;\n\t/* Find out if there are any windows right of this one. */\n\tfor (frp = topfrp; frp->fr_parent != NULL; frp = frp->fr_parent)\n\t if (frp->fr_parent->fr_layout == FR_ROW && frp->fr_next != NULL)\n\t\tbreak;\n\tif (frp->fr_parent == NULL)\n\t wp->w_vsep_width = 0;\n\twin_new_width(wp, width - wp->w_vsep_width);\n }\n else if (topfrp->fr_layout == FR_COL)\n {\n\tdo\n\t{\n\t /* All frames in this column get the same new width. */\n\t FOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t {\n\t\tframe_new_width(frp, width, leftfirst, wfw);\n\t\tif (frp->fr_width > width)\n\t\t{\n\t\t /* Could not fit the windows, make whole column wider. */\n\t\t width = frp->fr_width;\n\t\t break;\n\t\t}\n\t }\n\t} while (frp != NULL);\n }\n else /* fr_layout == FR_ROW */\n {\n\t/* Complicated case: Resize a row of frames. Resize the rightmost\n\t * frame first, frames left of it when needed. */", "\tfrp = topfrp->fr_child;\n\tif (wfw)\n\t /* Advance past frames with one window with 'wfw' set. */\n\t while (frame_fixed_width(frp))\n\t {\n\t\tfrp = frp->fr_next;\n\t\tif (frp == NULL)\n\t\t return;\t /* no frame without 'wfw', give up */\n\t }\n\tif (!leftfirst)\n\t{\n\t /* Find the rightmost frame of this row */\n\t while (frp->fr_next != NULL)\n\t\tfrp = frp->fr_next;\n\t if (wfw)\n\t\t/* Advance back for frames with one window with 'wfw' set. */\n\t\twhile (frame_fixed_width(frp))\n\t\t frp = frp->fr_prev;\n\t}", "\textra_cols = width - topfrp->fr_width;\n\tif (extra_cols < 0)\n\t{\n\t /* reduce frame width, rightmost frame first */\n\t while (frp != NULL)\n\t {\n\t\tw = frame_minwidth(frp, NULL);\n\t\tif (frp->fr_width + extra_cols < w)\n\t\t{\n\t\t extra_cols += frp->fr_width - w;\n\t\t frame_new_width(frp, w, leftfirst, wfw);\n\t\t}\n\t\telse\n\t\t{\n\t\t frame_new_width(frp, frp->fr_width + extra_cols,\n\t\t\t\t\t\t\t leftfirst, wfw);\n\t\t break;\n\t\t}\n\t\tif (leftfirst)\n\t\t{\n\t\t do\n\t\t\tfrp = frp->fr_next;\n\t\t while (wfw && frp != NULL && frame_fixed_width(frp));\n\t\t}\n\t\telse\n\t\t{\n\t\t do\n\t\t\tfrp = frp->fr_prev;\n\t\t while (wfw && frp != NULL && frame_fixed_width(frp));\n\t\t}\n\t\t/* Increase \"width\" if we could not reduce enough frames. */\n\t\tif (frp == NULL)\n\t\t width -= extra_cols;\n\t }\n\t}\n\telse if (extra_cols > 0)\n\t{\n\t /* increase width of rightmost frame */\n\t frame_new_width(frp, frp->fr_width + extra_cols, leftfirst, wfw);\n\t}\n }\n topfrp->fr_width = width;\n}", "/*\n * Add the vertical separator to windows at the right side of \"frp\".\n * Note: Does not check if there is room!\n */\n static void\nframe_add_vsep(frame_T *frp)\n{\n win_T\t*wp;", " if (frp->fr_layout == FR_LEAF)\n {\n\twp = frp->fr_win;\n\tif (wp->w_vsep_width == 0)\n\t{\n\t if (wp->w_width > 0)\t/* don't make it negative */\n\t\t--wp->w_width;\n\t wp->w_vsep_width = 1;\n\t}\n }\n else if (frp->fr_layout == FR_COL)\n {\n\t/* Handle all the frames in the column. */\n\tFOR_ALL_FRAMES(frp, frp->fr_child)\n\t frame_add_vsep(frp);\n }\n else /* frp->fr_layout == FR_ROW */\n {\n\t/* Only need to handle the last frame in the row. */\n\tfrp = frp->fr_child;\n\twhile (frp->fr_next != NULL)\n\t frp = frp->fr_next;\n\tframe_add_vsep(frp);\n }\n}", "/*\n * Set frame width from the window it contains.\n */\n static void\nframe_fix_width(win_T *wp)\n{\n wp->w_frame->fr_width = wp->w_width + wp->w_vsep_width;\n}", "/*\n * Set frame height from the window it contains.\n */\n static void\nframe_fix_height(win_T *wp)\n{\n wp->w_frame->fr_height = VISIBLE_HEIGHT(wp) + wp->w_status_height;\n}", "/*\n * Compute the minimal height for frame \"topfrp\".\n * Uses the 'winminheight' option.\n * When \"next_curwin\" isn't NULL, use p_wh for this window.\n * When \"next_curwin\" is NOWIN, don't use at least one line for the current\n * window.\n */\n static int\nframe_minheight(frame_T *topfrp, win_T *next_curwin)\n{\n frame_T\t*frp;\n int\t\tm;\n int\t\tn;", " if (topfrp->fr_win != NULL)\n {\n\tif (topfrp->fr_win == next_curwin)\n\t m = p_wh + topfrp->fr_win->w_status_height;\n\telse\n\t{\n\t /* window: minimal height of the window plus status line */\n\t m = p_wmh + topfrp->fr_win->w_status_height;\n\t if (topfrp->fr_win == curwin && next_curwin == NULL)\n\t {\n\t\t/* Current window is minimal one line high and WinBar is\n\t\t * visible. */\n\t\tif (p_wmh == 0)\n\t\t ++m;\n\t\tm += WINBAR_HEIGHT(curwin);\n\t }\n\t}\n }\n else if (topfrp->fr_layout == FR_ROW)\n {\n\t/* get the minimal height from each frame in this row */\n\tm = 0;\n\tFOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t{\n\t n = frame_minheight(frp, next_curwin);\n\t if (n > m)\n\t\tm = n;\n\t}\n }\n else\n {\n\t/* Add up the minimal heights for all frames in this column. */\n\tm = 0;\n\tFOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t m += frame_minheight(frp, next_curwin);\n }", " return m;\n}", "/*\n * Compute the minimal width for frame \"topfrp\".\n * When \"next_curwin\" isn't NULL, use p_wiw for this window.\n * When \"next_curwin\" is NOWIN, don't use at least one column for the current\n * window.\n */\n static int\nframe_minwidth(\n frame_T\t*topfrp,\n win_T\t*next_curwin)\t/* use p_wh and p_wiw for next_curwin */\n{\n frame_T\t*frp;\n int\t\tm, n;", " if (topfrp->fr_win != NULL)\n {\n\tif (topfrp->fr_win == next_curwin)\n\t m = p_wiw + topfrp->fr_win->w_vsep_width;\n\telse\n\t{\n\t /* window: minimal width of the window plus separator column */\n\t m = p_wmw + topfrp->fr_win->w_vsep_width;\n\t /* Current window is minimal one column wide */\n\t if (p_wmw == 0 && topfrp->fr_win == curwin && next_curwin == NULL)\n\t\t++m;\n\t}\n }\n else if (topfrp->fr_layout == FR_COL)\n {\n\t/* get the minimal width from each frame in this column */\n\tm = 0;\n\tFOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t{\n\t n = frame_minwidth(frp, next_curwin);\n\t if (n > m)\n\t\tm = n;\n\t}\n }\n else\n {\n\t/* Add up the minimal widths for all frames in this row. */\n\tm = 0;\n\tFOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t m += frame_minwidth(frp, next_curwin);\n }", " return m;\n}", "\n/*\n * Try to close all windows except current one.\n * Buffers in the other windows become hidden if 'hidden' is set, or '!' is\n * used and the buffer was modified.\n *\n * Used by \":bdel\" and \":only\".\n */\n void\nclose_others(\n int\t\tmessage,\n int\t\tforceit)\t /* always hide all other windows */\n{\n win_T\t*wp;\n win_T\t*nextwp;\n int\t\tr;", " if (one_window())\n {\n\tif (message && !autocmd_busy)\n\t msg(_(m_onlyone));\n\treturn;\n }", " /* Be very careful here: autocommands may change the window layout. */\n for (wp = firstwin; win_valid(wp); wp = nextwp)\n {\n\tnextwp = wp->w_next;\n\tif (wp != curwin)\t\t/* don't close current window */\n\t{", "\t /* Check if it's allowed to abandon this window */\n\t r = can_abandon(wp->w_buffer, forceit);\n\t if (!win_valid(wp))\t\t/* autocommands messed wp up */\n\t {\n\t\tnextwp = firstwin;\n\t\tcontinue;\n\t }\n\t if (!r)\n\t {\n#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)\n\t\tif (message && (p_confirm || cmdmod.confirm) && p_write)\n\t\t{\n\t\t dialog_changed(wp->w_buffer, FALSE);\n\t\t if (!win_valid(wp))\t\t/* autocommands messed wp up */\n\t\t {\n\t\t\tnextwp = firstwin;\n\t\t\tcontinue;\n\t\t }\n\t\t}\n\t\tif (bufIsChanged(wp->w_buffer))\n#endif\n\t\t continue;\n\t }\n\t win_close(wp, !buf_hide(wp->w_buffer)\n\t\t\t\t\t && !bufIsChanged(wp->w_buffer));\n\t}\n }", " if (message && !ONE_WINDOW)\n\temsg(_(\"E445: Other window contains changes\"));\n}", " static void\nwin_init_empty(win_T *wp)\n{\n redraw_win_later(wp, NOT_VALID);\n wp->w_lines_valid = 0;\n wp->w_cursor.lnum = 1;\n wp->w_curswant = wp->w_cursor.col = 0;\n wp->w_cursor.coladd = 0;\n wp->w_pcmark.lnum = 1;\t/* pcmark not cleared but set to line 1 */\n wp->w_pcmark.col = 0;\n wp->w_prev_pcmark.lnum = 0;\n wp->w_prev_pcmark.col = 0;\n wp->w_topline = 1;\n#ifdef FEAT_DIFF\n wp->w_topfill = 0;\n#endif\n wp->w_botline = 2;\n#if defined(FEAT_SYN_HL) || defined(FEAT_SPELL)\n wp->w_s = &wp->w_buffer->b_s;\n#endif\n}", "/*\n * Init the current window \"curwin\".\n * Called when a new file is being edited.\n */\n void\ncurwin_init(void)\n{\n win_init_empty(curwin);\n}", "/*\n * Allocate the first window and put an empty buffer in it.\n * Called from main().\n * Return FAIL when something goes wrong (out of memory).\n */\n int\nwin_alloc_first(void)\n{\n if (win_alloc_firstwin(NULL) == FAIL)\n\treturn FAIL;", " first_tabpage = alloc_tabpage();\n if (first_tabpage == NULL)\n\treturn FAIL;\n first_tabpage->tp_topframe = topframe;\n curtab = first_tabpage;", " return OK;\n}", "/*\n * Allocate and init a window that is not a regular window.\n * This can only be done after the first window is fully initialized, thus it\n * can't be in win_alloc_first().\n */\n win_T *\nwin_alloc_popup_win(void)\n{\n win_T *wp;", " wp = win_alloc(NULL, TRUE);\n if (wp != NULL)\n {\n\t// We need to initialize options with something, using the current\n\t// window makes most sense.\n\twin_init_some(wp, curwin);", "\tRESET_BINDING(wp);\n\tnew_frame(wp);\n }\n return wp;\n}", "/*\n * Initialize window \"wp\" to display buffer \"buf\".\n */\n void\nwin_init_popup_win(win_T *wp, buf_T *buf)\n{\n wp->w_buffer = buf;\n ++buf->b_nwindows;\n win_init_empty(wp); // set cursor and topline to safe values", " // Make sure w_localdir and globaldir are NULL to avoid a chdir() in\n // win_enter_ext().\n VIM_CLEAR(wp->w_localdir);\n}", "/*\n * Allocate the first window or the first window in a new tab page.\n * When \"oldwin\" is NULL create an empty buffer for it.\n * When \"oldwin\" is not NULL copy info from it to the new window.\n * Return FAIL when something goes wrong (out of memory).\n */\n static int\nwin_alloc_firstwin(win_T *oldwin)\n{\n curwin = win_alloc(NULL, FALSE);\n if (oldwin == NULL)\n {\n\t/* Very first window, need to create an empty buffer for it and\n\t * initialize from scratch. */\n\tcurbuf = buflist_new(NULL, NULL, 1L, BLN_LISTED);\n\tif (curwin == NULL || curbuf == NULL)\n\t return FAIL;\n\tcurwin->w_buffer = curbuf;\n#ifdef FEAT_SYN_HL\n\tcurwin->w_s = &(curbuf->b_s);\n#endif\n\tcurbuf->b_nwindows = 1;\t/* there is one window */\n\tcurwin->w_alist = &global_alist;\n\tcurwin_init();\t\t/* init current window */\n }\n else\n {\n\t/* First window in new tab page, initialize it from \"oldwin\". */\n\twin_init(curwin, oldwin, 0);", "\t/* We don't want cursor- and scroll-binding in the first window. */\n\tRESET_BINDING(curwin);\n }", " new_frame(curwin);\n if (curwin->w_frame == NULL)\n\treturn FAIL;\n topframe = curwin->w_frame;\n topframe->fr_width = Columns;\n topframe->fr_height = Rows - p_ch;", " return OK;\n}", "/*\n * Create a frame for window \"wp\".\n */\n static void\nnew_frame(win_T *wp)\n{\n frame_T *frp = ALLOC_CLEAR_ONE(frame_T);", " wp->w_frame = frp;\n if (frp != NULL)\n {\n\tfrp->fr_layout = FR_LEAF;\n\tfrp->fr_win = wp;\n }\n}", "/*\n * Initialize the window and frame size to the maximum.\n */\n void\nwin_init_size(void)\n{\n firstwin->w_height = ROWS_AVAIL;\n topframe->fr_height = ROWS_AVAIL;\n firstwin->w_width = Columns;\n topframe->fr_width = Columns;\n}", "/*\n * Allocate a new tabpage_T and init the values.\n * Returns NULL when out of memory.\n */\n static tabpage_T *\nalloc_tabpage(void)\n{\n tabpage_T\t*tp;\n# ifdef FEAT_GUI\n int\t\ti;\n# endif", "\n tp = ALLOC_CLEAR_ONE(tabpage_T);\n if (tp == NULL)\n\treturn NULL;", "# ifdef FEAT_EVAL\n /* init t: variables */\n tp->tp_vars = dict_alloc();\n if (tp->tp_vars == NULL)\n {\n\tvim_free(tp);\n\treturn NULL;\n }\n init_var_dict(tp->tp_vars, &tp->tp_winvar, VAR_SCOPE);\n# endif", "# ifdef FEAT_GUI\n for (i = 0; i < 3; i++)\n\ttp->tp_prev_which_scrollbars[i] = -1;\n# endif\n# ifdef FEAT_DIFF\n tp->tp_diff_invalid = TRUE;\n# endif\n tp->tp_ch_used = p_ch;", " return tp;\n}", " void\nfree_tabpage(tabpage_T *tp)\n{\n int idx;", "# ifdef FEAT_DIFF\n diff_clear(tp);\n# endif\n# ifdef FEAT_TEXT_PROP\n while (tp->tp_first_popupwin != NULL)\n\tpopup_close_tabpage(tp, tp->tp_first_popupwin->w_id);\n#endif\n for (idx = 0; idx < SNAP_COUNT; ++idx)\n\tclear_snapshot(tp, idx);\n#ifdef FEAT_EVAL\n vars_clear(&tp->tp_vars->dv_hashtab);\t/* free all t: variables */\n hash_init(&tp->tp_vars->dv_hashtab);\n unref_var_dict(tp->tp_vars);\n#endif", " vim_free(tp->tp_localdir);", "#ifdef FEAT_PYTHON\n python_tabpage_free(tp);\n#endif", "#ifdef FEAT_PYTHON3\n python3_tabpage_free(tp);\n#endif", " vim_free(tp);\n}", "/*\n * Create a new Tab page with one window.\n * It will edit the current buffer, like after \":split\".\n * When \"after\" is 0 put it just after the current Tab page.\n * Otherwise put it just before tab page \"after\".\n * Return FAIL or OK.\n */\n int\nwin_new_tabpage(int after)\n{\n tabpage_T\t*tp = curtab;\n tabpage_T\t*newtp;\n int\t\tn;", " newtp = alloc_tabpage();\n if (newtp == NULL)\n\treturn FAIL;", " /* Remember the current windows in this Tab page. */\n if (leave_tabpage(curbuf, TRUE) == FAIL)\n {\n\tvim_free(newtp);\n\treturn FAIL;\n }\n curtab = newtp;", " newtp->tp_localdir = (tp->tp_localdir == NULL)\n\t\t\t\t ? NULL : vim_strsave(tp->tp_localdir);\n /* Create a new empty window. */\n if (win_alloc_firstwin(tp->tp_curwin) == OK)\n {\n\t/* Make the new Tab page the new topframe. */\n\tif (after == 1)\n\t{\n\t /* New tab page becomes the first one. */\n\t newtp->tp_next = first_tabpage;\n\t first_tabpage = newtp;\n\t}\n\telse\n\t{\n\t if (after > 0)\n\t {\n\t\t/* Put new tab page before tab page \"after\". */\n\t\tn = 2;\n\t\tfor (tp = first_tabpage; tp->tp_next != NULL\n\t\t\t\t\t && n < after; tp = tp->tp_next)\n\t\t ++n;\n\t }\n\t newtp->tp_next = tp->tp_next;\n\t tp->tp_next = newtp;\n\t}\n\twin_init_size();\n\tfirstwin->w_winrow = tabline_height();\n\twin_comp_scroll(curwin);", "\tnewtp->tp_topframe = topframe;\n\tlast_status(FALSE);", "#if defined(FEAT_GUI)\n\t/* When 'guioptions' includes 'L' or 'R' may have to remove or add\n\t * scrollbars. Have to update them anyway. */\n\tgui_may_update_scrollbars();\n#endif\n#ifdef FEAT_JOB_CHANNEL\n\tentering_window(curwin);\n#endif", "\tredraw_all_later(NOT_VALID);\n\tapply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf);\n\tapply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);\n\tapply_autocmds(EVENT_TABNEW, NULL, NULL, FALSE, curbuf);\n\tapply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);\n\treturn OK;\n }", " /* Failed, get back the previous Tab page */\n enter_tabpage(curtab, curbuf, TRUE, TRUE);\n return FAIL;\n}", "/*\n * Open a new tab page if \":tab cmd\" was used. It will edit the same buffer,\n * like with \":split\".\n * Returns OK if a new tab page was created, FAIL otherwise.\n */\n static int\nmay_open_tabpage(void)\n{\n int\t\tn = (cmdmod.tab == 0) ? postponed_split_tab : cmdmod.tab;", " if (n != 0)\n {\n\tcmdmod.tab = 0;\t /* reset it to avoid doing it twice */\n\tpostponed_split_tab = 0;\n\treturn win_new_tabpage(n);\n }\n return FAIL;\n}", "/*\n * Create up to \"maxcount\" tabpages with empty windows.\n * Returns the number of resulting tab pages.\n */\n int\nmake_tabpages(int maxcount)\n{\n int\t\tcount = maxcount;\n int\t\ttodo;", " /* Limit to 'tabpagemax' tabs. */\n if (count > p_tpm)\n\tcount = p_tpm;", " /*\n * Don't execute autocommands while creating the tab pages. Must do that\n * when putting the buffers in the windows.\n */\n block_autocmds();", " for (todo = count - 1; todo > 0; --todo)\n\tif (win_new_tabpage(0) == FAIL)\n\t break;", " unblock_autocmds();", " /* return actual number of tab pages */\n return (count - todo);\n}", "/*\n * Return TRUE when \"tpc\" points to a valid tab page.\n */\n int\nvalid_tabpage(tabpage_T *tpc)\n{\n tabpage_T\t*tp;", " FOR_ALL_TABPAGES(tp)\n\tif (tp == tpc)\n\t return TRUE;\n return FALSE;\n}", "/*\n * Return TRUE when \"tpc\" points to a valid tab page and at least one window is\n * valid.\n */\n int\nvalid_tabpage_win(tabpage_T *tpc)\n{\n tabpage_T\t*tp;\n win_T\t*wp;", " FOR_ALL_TABPAGES(tp)\n {\n\tif (tp == tpc)\n\t{\n\t FOR_ALL_WINDOWS_IN_TAB(tp, wp)\n\t {\n\t\tif (win_valid_any_tab(wp))\n\t\t return TRUE;\n\t }\n\t return FALSE;\n\t}\n }\n /* shouldn't happen */\n return FALSE;\n}", "/*\n * Close tabpage \"tab\", assuming it has no windows in it.\n * There must be another tabpage or this will crash.\n */\n void\nclose_tabpage(tabpage_T *tab)\n{\n tabpage_T\t*ptp;", " if (tab == first_tabpage)\n {\n\tfirst_tabpage = tab->tp_next;\n\tptp = first_tabpage;\n }\n else\n {\n\tfor (ptp = first_tabpage; ptp != NULL && ptp->tp_next != tab;\n\t\t\t\t\t\t\t ptp = ptp->tp_next)\n\t ;\n\tassert(ptp != NULL);\n\tptp->tp_next = tab->tp_next;\n }", " goto_tabpage_tp(ptp, FALSE, FALSE);\n free_tabpage(tab);\n}", "/*\n * Find tab page \"n\" (first one is 1). Returns NULL when not found.\n */\n tabpage_T *\nfind_tabpage(int n)\n{\n tabpage_T\t*tp;\n int\t\ti = 1;", " if (n == 0)\n\treturn curtab;", " for (tp = first_tabpage; tp != NULL && i != n; tp = tp->tp_next)\n\t++i;\n return tp;\n}", "/*\n * Get index of tab page \"tp\". First one has index 1.\n * When not found returns number of tab pages plus one.\n */\n int\ntabpage_index(tabpage_T *ftp)\n{\n int\t\ti = 1;\n tabpage_T\t*tp;", " for (tp = first_tabpage; tp != NULL && tp != ftp; tp = tp->tp_next)\n\t++i;\n return i;\n}", "/*\n * Prepare for leaving the current tab page.\n * When autocommands change \"curtab\" we don't leave the tab page and return\n * FAIL.\n * Careful: When OK is returned need to get a new tab page very very soon!\n */\n static int\nleave_tabpage(\n buf_T\t*new_curbuf UNUSED, /* what is going to be the new curbuf,\n\t\t\t\t NULL if unknown */\n int\t\ttrigger_leave_autocmds UNUSED)\n{\n tabpage_T\t*tp = curtab;", "#ifdef FEAT_JOB_CHANNEL\n leaving_window(curwin);\n#endif\n reset_VIsual_and_resel();\t/* stop Visual mode */\n if (trigger_leave_autocmds)\n {\n\tif (new_curbuf != curbuf)\n\t{\n\t apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);\n\t if (curtab != tp)\n\t\treturn FAIL;\n\t}\n\tapply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf);\n\tif (curtab != tp)\n\t return FAIL;\n\tapply_autocmds(EVENT_TABLEAVE, NULL, NULL, FALSE, curbuf);\n\tif (curtab != tp)\n\t return FAIL;\n }\n#if defined(FEAT_GUI)\n /* Remove the scrollbars. They may be added back later. */\n if (gui.in_use)\n\tgui_remove_scrollbars();\n#endif\n tp->tp_curwin = curwin;\n tp->tp_prevwin = prevwin;\n tp->tp_firstwin = firstwin;\n tp->tp_lastwin = lastwin;\n tp->tp_old_Rows = Rows;\n tp->tp_old_Columns = Columns;\n firstwin = NULL;\n lastwin = NULL;\n return OK;\n}", "/*\n * Start using tab page \"tp\".\n * Only to be used after leave_tabpage() or freeing the current tab page.\n * Only trigger *Enter autocommands when trigger_enter_autocmds is TRUE.\n * Only trigger *Leave autocommands when trigger_leave_autocmds is TRUE.\n */\n static void\nenter_tabpage(\n tabpage_T\t*tp,\n buf_T\t*old_curbuf UNUSED,\n int\t\ttrigger_enter_autocmds,\n int\t\ttrigger_leave_autocmds)\n{\n int\t\told_off = tp->tp_firstwin->w_winrow;\n win_T\t*next_prevwin = tp->tp_prevwin;", " curtab = tp;\n firstwin = tp->tp_firstwin;\n lastwin = tp->tp_lastwin;\n topframe = tp->tp_topframe;", " /* We would like doing the TabEnter event first, but we don't have a\n * valid current window yet, which may break some commands.\n * This triggers autocommands, thus may make \"tp\" invalid. */\n win_enter_ext(tp->tp_curwin, FALSE, TRUE, FALSE,\n\t\t\t trigger_enter_autocmds, trigger_leave_autocmds);\n prevwin = next_prevwin;", " last_status(FALSE);\t\t/* status line may appear or disappear */\n (void)win_comp_pos();\t/* recompute w_winrow for all windows */\n#ifdef FEAT_DIFF\n diff_need_scrollbind = TRUE;\n#endif", " /* The tabpage line may have appeared or disappeared, may need to resize\n * the frames for that. When the Vim window was resized need to update\n * frame sizes too. Use the stored value of p_ch, so that it can be\n * different for each tab page. */\n if (p_ch != curtab->tp_ch_used)\n\tclear_cmdline = TRUE;\n p_ch = curtab->tp_ch_used;\n if (curtab->tp_old_Rows != Rows || (old_off != firstwin->w_winrow\n#ifdef FEAT_GUI_TABLINE\n\t\t\t && !gui_use_tabline()\n#endif\n\t\t))\n\tshell_new_rows();\n if (curtab->tp_old_Columns != Columns && starting == 0)\n\tshell_new_columns();\t/* update window widths */", "#if defined(FEAT_GUI)\n /* When 'guioptions' includes 'L' or 'R' may have to remove or add\n * scrollbars. Have to update them anyway. */\n gui_may_update_scrollbars();\n#endif", " /* Apply autocommands after updating the display, when 'rows' and\n * 'columns' have been set correctly. */\n if (trigger_enter_autocmds)\n {\n\tapply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);\n\tif (old_curbuf != curbuf)\n\t apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);\n }", " redraw_all_later(NOT_VALID);\n}", "/*\n * Go to tab page \"n\". For \":tab N\" and \"Ngt\".\n * When \"n\" is 9999 go to the last tab page.\n */\n void\ngoto_tabpage(int n)\n{\n tabpage_T\t*tp = NULL; // shut up compiler\n tabpage_T\t*ttp;\n int\t\ti;", " if (text_locked())\n {\n\t/* Not allowed when editing the command line. */\n\ttext_locked_msg();\n\treturn;\n }", " /* If there is only one it can't work. */\n if (first_tabpage->tp_next == NULL)\n {\n\tif (n > 1)\n\t beep_flush();\n\treturn;\n }", " if (n == 0)\n {\n\t/* No count, go to next tab page, wrap around end. */\n\tif (curtab->tp_next == NULL)\n\t tp = first_tabpage;\n\telse\n\t tp = curtab->tp_next;\n }\n else if (n < 0)\n {\n\t/* \"gT\": go to previous tab page, wrap around end. \"N gT\" repeats\n\t * this N times. */\n\tttp = curtab;\n\tfor (i = n; i < 0; ++i)\n\t{\n\t for (tp = first_tabpage; tp->tp_next != ttp && tp->tp_next != NULL;\n\t\t tp = tp->tp_next)\n\t\t;\n\t ttp = tp;\n\t}\n }\n else if (n == 9999)\n {\n\t/* Go to last tab page. */\n\tfor (tp = first_tabpage; tp->tp_next != NULL; tp = tp->tp_next)\n\t ;\n }\n else\n {\n\t/* Go to tab page \"n\". */\n\ttp = find_tabpage(n);\n\tif (tp == NULL)\n\t{\n\t beep_flush();\n\t return;\n\t}\n }", " goto_tabpage_tp(tp, TRUE, TRUE);", "#ifdef FEAT_GUI_TABLINE\n if (gui_use_tabline())\n\tgui_mch_set_curtab(tabpage_index(curtab));\n#endif\n}", "/*\n * Go to tabpage \"tp\".\n * Only trigger *Enter autocommands when trigger_enter_autocmds is TRUE.\n * Only trigger *Leave autocommands when trigger_leave_autocmds is TRUE.\n * Note: doesn't update the GUI tab.\n */\n void\ngoto_tabpage_tp(\n tabpage_T\t*tp,\n int\t\ttrigger_enter_autocmds,\n int\t\ttrigger_leave_autocmds)\n{\n /* Don't repeat a message in another tab page. */\n set_keep_msg(NULL, 0);", " if (tp != curtab && leave_tabpage(tp->tp_curwin->w_buffer,\n\t\t\t\t\ttrigger_leave_autocmds) == OK)\n {\n\tif (valid_tabpage(tp))\n\t enter_tabpage(tp, curbuf, trigger_enter_autocmds,\n\t\t trigger_leave_autocmds);\n\telse\n\t enter_tabpage(curtab, curbuf, trigger_enter_autocmds,\n\t\t trigger_leave_autocmds);\n }\n}", "/*\n * Enter window \"wp\" in tab page \"tp\".\n * Also updates the GUI tab.\n */\n void\ngoto_tabpage_win(tabpage_T *tp, win_T *wp)\n{\n goto_tabpage_tp(tp, TRUE, TRUE);\n if (curtab == tp && win_valid(wp))\n {\n\twin_enter(wp, TRUE);\n# ifdef FEAT_GUI_TABLINE\n\tif (gui_use_tabline())\n\t gui_mch_set_curtab(tabpage_index(curtab));\n# endif\n }\n}", "/*\n * Move the current tab page to after tab page \"nr\".\n */\n void\ntabpage_move(int nr)\n{\n int\t\tn = 1;\n tabpage_T\t*tp, *tp_dst;", " if (first_tabpage->tp_next == NULL)\n\treturn;", " for (tp = first_tabpage; tp->tp_next != NULL && n < nr; tp = tp->tp_next)\n\t++n;", " if (tp == curtab || (nr > 0 && tp->tp_next != NULL\n\t\t\t\t\t\t && tp->tp_next == curtab))\n\treturn;", " tp_dst = tp;", " /* Remove the current tab page from the list of tab pages. */\n if (curtab == first_tabpage)\n\tfirst_tabpage = curtab->tp_next;\n else\n {\n\tFOR_ALL_TABPAGES(tp)\n\t if (tp->tp_next == curtab)\n\t\tbreak;\n\tif (tp == NULL)\t/* \"cannot happen\" */\n\t return;\n\ttp->tp_next = curtab->tp_next;\n }", " /* Re-insert it at the specified position. */\n if (nr <= 0)\n {\n\tcurtab->tp_next = first_tabpage;\n\tfirst_tabpage = curtab;\n }\n else\n {\n\tcurtab->tp_next = tp_dst->tp_next;\n\ttp_dst->tp_next = curtab;\n }", " /* Need to redraw the tabline. Tab page contents doesn't change. */\n redraw_tabline = TRUE;\n}", "\n/*\n * Go to another window.\n * When jumping to another buffer, stop Visual mode. Do this before\n * changing windows so we can yank the selection into the '*' register.\n * When jumping to another window on the same buffer, adjust its cursor\n * position to keep the same Visual area.\n */\n void\nwin_goto(win_T *wp)\n{\n#ifdef FEAT_CONCEAL\n win_T\t*owp = curwin;\n#endif", " if (ERROR_IF_POPUP_WINDOW)\n\treturn;\n if (text_locked())\n {\n\tbeep_flush();\n\ttext_locked_msg();\n\treturn;\n }\n if (curbuf_locked())\n\treturn;", " if (wp->w_buffer != curbuf)\n\treset_VIsual_and_resel();\n else if (VIsual_active)\n\twp->w_cursor = curwin->w_cursor;", "#ifdef FEAT_GUI\n need_mouse_correct = TRUE;\n#endif\n win_enter(wp, TRUE);", "#ifdef FEAT_CONCEAL\n // Conceal cursor line in previous window, unconceal in current window.\n if (win_valid(owp) && owp->w_p_cole > 0 && !msg_scrolled)\n\tredrawWinline(owp, owp->w_cursor.lnum);\n if (curwin->w_p_cole > 0 && !msg_scrolled)\n\tneed_cursor_line_redraw = TRUE;\n#endif\n}", "#if defined(FEAT_PERL) || defined(PROTO)\n/*\n * Find window number \"winnr\" (counting top to bottom).\n */\n win_T *\nwin_find_nr(int winnr)\n{\n win_T\t*wp;", " FOR_ALL_WINDOWS(wp)\n\tif (--winnr == 0)\n\t break;\n return wp;\n}\n#endif", "#if ((defined(FEAT_PYTHON) || defined(FEAT_PYTHON3))) || defined(PROTO)\n/*\n * Find the tabpage for window \"win\".\n */\n tabpage_T *\nwin_find_tabpage(win_T *win)\n{\n win_T\t*wp;\n tabpage_T\t*tp;", " FOR_ALL_TAB_WINDOWS(tp, wp)\n\t if (wp == win)\n\t\treturn tp;\n return NULL;\n}\n#endif", "/*\n * Get the above or below neighbor window of the specified window.\n * up - TRUE for the above neighbor\n * count - nth neighbor window\n * Returns the specified window if the neighbor is not found.\n */\n win_T *\nwin_vert_neighbor(tabpage_T *tp, win_T *wp, int up, long count)\n{\n frame_T\t*fr;\n frame_T\t*nfr;\n frame_T\t*foundfr;", " foundfr = wp->w_frame;\n while (count--)\n {\n\t/*\n\t * First go upwards in the tree of frames until we find a upwards or\n\t * downwards neighbor.\n\t */\n\tfr = foundfr;\n\tfor (;;)\n\t{\n\t if (fr == tp->tp_topframe)\n\t\tgoto end;\n\t if (up)\n\t\tnfr = fr->fr_prev;\n\t else\n\t\tnfr = fr->fr_next;\n\t if (fr->fr_parent->fr_layout == FR_COL && nfr != NULL)\n\t\tbreak;\n\t fr = fr->fr_parent;\n\t}", "\t/*\n\t * Now go downwards to find the bottom or top frame in it.\n\t */\n\tfor (;;)\n\t{\n\t if (nfr->fr_layout == FR_LEAF)\n\t {\n\t\tfoundfr = nfr;\n\t\tbreak;\n\t }\n\t fr = nfr->fr_child;\n\t if (nfr->fr_layout == FR_ROW)\n\t {\n\t\t/* Find the frame at the cursor row. */\n\t\twhile (fr->fr_next != NULL\n\t\t\t&& frame2win(fr)->w_wincol + fr->fr_width\n\t\t\t\t\t <= wp->w_wincol + wp->w_wcol)\n\t\t fr = fr->fr_next;\n\t }\n\t if (nfr->fr_layout == FR_COL && up)\n\t\twhile (fr->fr_next != NULL)\n\t\t fr = fr->fr_next;\n\t nfr = fr;\n\t}\n }\nend:\n return foundfr != NULL ? foundfr->fr_win : NULL;\n}", "/*\n * Move to window above or below \"count\" times.\n */\n static void\nwin_goto_ver(\n int\t\tup,\t\t// TRUE to go to win above\n long\tcount)\n{\n win_T\t*win;", " win = win_vert_neighbor(curtab, curwin, up, count);\n if (win != NULL)\n\twin_goto(win);\n}", "/*\n * Get the left or right neighbor window of the specified window.\n * left - TRUE for the left neighbor\n * count - nth neighbor window\n * Returns the specified window if the neighbor is not found.\n */\n win_T *\nwin_horz_neighbor(tabpage_T *tp, win_T *wp, int left, long count)\n{\n frame_T\t*fr;\n frame_T\t*nfr;\n frame_T\t*foundfr;", " foundfr = wp->w_frame;\n while (count--)\n {\n\t/*\n\t * First go upwards in the tree of frames until we find a left or\n\t * right neighbor.\n\t */\n\tfr = foundfr;\n\tfor (;;)\n\t{\n\t if (fr == tp->tp_topframe)\n\t\tgoto end;\n\t if (left)\n\t\tnfr = fr->fr_prev;\n\t else\n\t\tnfr = fr->fr_next;\n\t if (fr->fr_parent->fr_layout == FR_ROW && nfr != NULL)\n\t\tbreak;\n\t fr = fr->fr_parent;\n\t}", "\t/*\n\t * Now go downwards to find the leftmost or rightmost frame in it.\n\t */\n\tfor (;;)\n\t{\n\t if (nfr->fr_layout == FR_LEAF)\n\t {\n\t\tfoundfr = nfr;\n\t\tbreak;\n\t }\n\t fr = nfr->fr_child;\n\t if (nfr->fr_layout == FR_COL)\n\t {\n\t\t/* Find the frame at the cursor row. */\n\t\twhile (fr->fr_next != NULL\n\t\t\t&& frame2win(fr)->w_winrow + fr->fr_height\n\t\t\t\t\t <= wp->w_winrow + wp->w_wrow)\n\t\t fr = fr->fr_next;\n\t }\n\t if (nfr->fr_layout == FR_ROW && left)\n\t\twhile (fr->fr_next != NULL)\n\t\t fr = fr->fr_next;\n\t nfr = fr;\n\t}\n }\nend:\n return foundfr != NULL ? foundfr->fr_win : NULL;\n}", "/*\n * Move to left or right window.\n */\n static void\nwin_goto_hor(\n int\t\tleft,\t\t// TRUE to go to left win\n long\tcount)\n{\n win_T\t*win;", " win = win_horz_neighbor(curtab, curwin, left, count);\n if (win != NULL)\n\twin_goto(win);\n}", "/*\n * Make window \"wp\" the current window.\n */\n void\nwin_enter(win_T *wp, int undo_sync)\n{\n win_enter_ext(wp, undo_sync, FALSE, FALSE, TRUE, TRUE);\n}", "/*\n * Make window wp the current window.\n * Can be called with \"curwin_invalid\" TRUE, which means that curwin has just\n * been closed and isn't valid.\n */\n static void\nwin_enter_ext(\n win_T\t*wp,\n int\t\tundo_sync,\n int\t\tcurwin_invalid,\n int\t\ttrigger_new_autocmds,\n int\t\ttrigger_enter_autocmds,\n int\t\ttrigger_leave_autocmds)\n{\n int\t\tother_buffer = FALSE;", " if (wp == curwin && !curwin_invalid)\t/* nothing to do */\n\treturn;", "#ifdef FEAT_JOB_CHANNEL\n if (!curwin_invalid)\n\tleaving_window(curwin);\n#endif", " if (!curwin_invalid && trigger_leave_autocmds)\n {\n\t/*\n\t * Be careful: If autocommands delete the window, return now.\n\t */\n\tif (wp->w_buffer != curbuf)\n\t{\n\t apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);\n\t other_buffer = TRUE;\n\t if (!win_valid(wp))\n\t\treturn;\n\t}\n\tapply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf);\n\tif (!win_valid(wp))\n\t return;\n#ifdef FEAT_EVAL\n\t/* autocmds may abort script processing */\n\tif (aborting())\n\t return;\n#endif\n }", " /* sync undo before leaving the current buffer */\n if (undo_sync && curbuf != wp->w_buffer)\n\tu_sync(FALSE);", " /* Might need to scroll the old window before switching, e.g., when the\n * cursor was moved. */\n update_topline();", " /* may have to copy the buffer options when 'cpo' contains 'S' */\n if (wp->w_buffer != curbuf)\n\tbuf_copy_options(wp->w_buffer, BCO_ENTER | BCO_NOHELP);\n if (!curwin_invalid)\n {\n\tprevwin = curwin;\t/* remember for CTRL-W p */\n\tcurwin->w_redr_status = TRUE;\n }\n curwin = wp;\n curbuf = wp->w_buffer;\n check_cursor();\n if (!virtual_active())\n\tcurwin->w_cursor.coladd = 0;\n changed_line_abv_curs();\t/* assume cursor position needs updating */", " if (curwin->w_localdir != NULL || curtab->tp_localdir != NULL)\n {\n\tchar_u\t*dirname;", "\t// Window or tab has a local directory: Save current directory as\n\t// global directory (unless that was done already) and change to the\n\t// local directory.\n\tif (globaldir == NULL)\n\t{\n\t char_u\tcwd[MAXPATHL];", "\t if (mch_dirname(cwd, MAXPATHL) == OK)\n\t\tglobaldir = vim_strsave(cwd);\n\t}\n\tif (curwin->w_localdir != NULL)\n\t dirname = curwin->w_localdir;\n\telse\n\t dirname = curtab->tp_localdir;", "\tif (mch_chdir((char *)dirname) == 0)\n\t shorten_fnames(TRUE);\n }\n else if (globaldir != NULL)\n {\n\t/* Window doesn't have a local directory and we are not in the global\n\t * directory: Change to the global directory. */\n\tvim_ignored = mch_chdir((char *)globaldir);\n\tVIM_CLEAR(globaldir);\n\tshorten_fnames(TRUE);\n }", "#ifdef FEAT_JOB_CHANNEL\n entering_window(curwin);\n#endif", " // Careful: autocommands may close the window and make \"wp\" invalid", " if (trigger_new_autocmds)\n\tapply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf);\n if (trigger_enter_autocmds)\n {\n\tapply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);\n\tif (other_buffer)\n\t apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);\n }", "#ifdef FEAT_TITLE\n maketitle();\n#endif\n curwin->w_redr_status = TRUE;\n#ifdef FEAT_TERMINAL", " if (bt_terminal(curwin->w_buffer))", "\t// terminal is likely in another mode\n\tredraw_mode = TRUE;\n#endif\n redraw_tabline = TRUE;\n if (restart_edit)\n\tredraw_later(VALID);\t/* causes status line redraw */", " /* set window height to desired minimal value */\n if (curwin->w_height < p_wh && !curwin->w_p_wfh\n#ifdef FEAT_TEXT_PROP\n\t && !popup_is_popup(curwin)\n#endif\n\t )\n\twin_setheight((int)p_wh);\n else if (curwin->w_height == 0)\n\twin_setheight(1);", " /* set window width to desired minimal value */\n if (curwin->w_width < p_wiw && !curwin->w_p_wfw)\n\twin_setwidth((int)p_wiw);", " setmouse();\t\t\t// in case jumped to/from help buffer", " /* Change directories when the 'acd' option is set. */\n DO_AUTOCHDIR;\n}", "\n/*\n * Jump to the first open window that contains buffer \"buf\", if one exists.\n * Returns a pointer to the window found, otherwise NULL.\n */\n win_T *\nbuf_jump_open_win(buf_T *buf)\n{\n win_T\t*wp = NULL;", " if (curwin->w_buffer == buf)\n\twp = curwin;\n else\n\tFOR_ALL_WINDOWS(wp)\n\t if (wp->w_buffer == buf)\n\t\tbreak;\n if (wp != NULL)\n\twin_enter(wp, FALSE);\n return wp;\n}", "/*\n * Jump to the first open window in any tab page that contains buffer \"buf\",\n * if one exists.\n * Returns a pointer to the window found, otherwise NULL.\n */\n win_T *\nbuf_jump_open_tab(buf_T *buf)\n{\n win_T\t*wp = buf_jump_open_win(buf);\n tabpage_T\t*tp;", " if (wp != NULL)\n\treturn wp;", " FOR_ALL_TABPAGES(tp)\n\tif (tp != curtab)\n\t{\n\t for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next)\n\t\tif (wp->w_buffer == buf)\n\t\t break;\n\t if (wp != NULL)\n\t {\n\t\tgoto_tabpage_win(tp, wp);\n\t\tif (curwin != wp)\n\t\t wp = NULL;\t/* something went wrong */\n\t\tbreak;\n\t }\n\t}\n return wp;\n}", "static int last_win_id = LOWEST_WIN_ID - 1;", "/*\n * Allocate a window structure and link it in the window list when \"hidden\" is\n * FALSE.\n */\n static win_T *\nwin_alloc(win_T *after UNUSED, int hidden UNUSED)\n{\n win_T\t*new_wp;", " /*\n * allocate window structure and linesizes arrays\n */\n new_wp = ALLOC_CLEAR_ONE(win_T);\n if (new_wp == NULL)\n\treturn NULL;", " if (win_alloc_lines(new_wp) == FAIL)\n {\n\tvim_free(new_wp);\n\treturn NULL;\n }", " new_wp->w_id = ++last_win_id;", "#ifdef FEAT_EVAL\n /* init w: variables */\n new_wp->w_vars = dict_alloc();\n if (new_wp->w_vars == NULL)\n {\n\twin_free_lsize(new_wp);\n\tvim_free(new_wp);\n\treturn NULL;\n }\n init_var_dict(new_wp->w_vars, &new_wp->w_winvar, VAR_SCOPE);\n#endif", " /* Don't execute autocommands while the window is not properly\n * initialized yet. gui_create_scrollbar() may trigger a FocusGained\n * event. */\n block_autocmds();", " /*\n * link the window in the window list\n */\n if (!hidden)\n\twin_append(after, new_wp);\n new_wp->w_wincol = 0;\n new_wp->w_width = Columns;", " /* position the display and the cursor at the top of the file. */\n new_wp->w_topline = 1;\n#ifdef FEAT_DIFF\n new_wp->w_topfill = 0;\n#endif\n new_wp->w_botline = 2;\n new_wp->w_cursor.lnum = 1;\n new_wp->w_scbind_pos = 1;", " // use global option value for global-local options\n new_wp->w_p_so = -1;\n new_wp->w_p_siso = -1;", " /* We won't calculate w_fraction until resizing the window */\n new_wp->w_fraction = 0;\n new_wp->w_prev_fraction_row = -1;", "#ifdef FEAT_GUI\n if (gui.in_use)\n {\n\tgui_create_scrollbar(&new_wp->w_scrollbars[SBAR_LEFT],\n\t\tSBAR_LEFT, new_wp);\n\tgui_create_scrollbar(&new_wp->w_scrollbars[SBAR_RIGHT],\n\t\tSBAR_RIGHT, new_wp);\n }\n#endif\n#ifdef FEAT_FOLDING\n foldInitWin(new_wp);\n#endif\n unblock_autocmds();\n#ifdef FEAT_SEARCH_EXTRA\n new_wp->w_match_head = NULL;\n new_wp->w_next_match_id = 4;\n#endif\n return new_wp;\n}", "/*\n * Remove window 'wp' from the window list and free the structure.\n */\n static void\nwin_free(\n win_T\t*wp,\n tabpage_T\t*tp)\t\t/* tab page \"win\" is in, NULL for current */\n{\n int\t\ti;\n buf_T\t*buf;\n wininfo_T\t*wip;", "#ifdef FEAT_FOLDING\n clearFolding(wp);\n#endif", " /* reduce the reference count to the argument list. */\n alist_unlink(wp->w_alist);", " /* Don't execute autocommands while the window is halfway being deleted.\n * gui_mch_destroy_scrollbar() may trigger a FocusGained event. */\n block_autocmds();", "#ifdef FEAT_LUA\n lua_window_free(wp);\n#endif", "#ifdef FEAT_MZSCHEME\n mzscheme_window_free(wp);\n#endif", "#ifdef FEAT_PERL\n perl_win_free(wp);\n#endif", "#ifdef FEAT_PYTHON\n python_window_free(wp);\n#endif", "#ifdef FEAT_PYTHON3\n python3_window_free(wp);\n#endif", "#ifdef FEAT_TCL\n tcl_window_free(wp);\n#endif", "#ifdef FEAT_RUBY\n ruby_window_free(wp);\n#endif", " clear_winopt(&wp->w_onebuf_opt);\n clear_winopt(&wp->w_allbuf_opt);", "#ifdef FEAT_EVAL\n vars_clear(&wp->w_vars->dv_hashtab);\t/* free all w: variables */\n hash_init(&wp->w_vars->dv_hashtab);\n unref_var_dict(wp->w_vars);\n#endif", " {\n\ttabpage_T\t*ttp;", "\tif (prevwin == wp)\n\t prevwin = NULL;\n\tFOR_ALL_TABPAGES(ttp)\n\t if (ttp->tp_prevwin == wp)\n\t\tttp->tp_prevwin = NULL;\n }\n win_free_lsize(wp);", " for (i = 0; i < wp->w_tagstacklen; ++i)\n {\n\tvim_free(wp->w_tagstack[i].tagname);\n\tvim_free(wp->w_tagstack[i].user_data);\n }\n vim_free(wp->w_localdir);", " /* Remove the window from the b_wininfo lists, it may happen that the\n * freed memory is re-used for another window. */\n FOR_ALL_BUFFERS(buf)\n\tfor (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)\n\t if (wip->wi_win == wp)\n\t\twip->wi_win = NULL;", "#ifdef FEAT_SEARCH_EXTRA\n clear_matches(wp);\n#endif", "#ifdef FEAT_JUMPLIST\n free_jumplist(wp);\n#endif", "#ifdef FEAT_QUICKFIX\n qf_free_all(wp);\n#endif", "#ifdef FEAT_GUI\n if (gui.in_use)\n {\n\tgui_mch_destroy_scrollbar(&wp->w_scrollbars[SBAR_LEFT]);\n\tgui_mch_destroy_scrollbar(&wp->w_scrollbars[SBAR_RIGHT]);\n }\n#endif /* FEAT_GUI */", "#ifdef FEAT_MENU\n remove_winbar(wp);\n#endif\n#ifdef FEAT_TEXT_PROP\n free_callback(&wp->w_close_cb);\n free_callback(&wp->w_filter_cb);\n for (i = 0; i < 4; ++i)\n\tVIM_CLEAR(wp->w_border_highlight[i]);\n vim_free(wp->w_scrollbar_highlight);\n vim_free(wp->w_thumb_highlight);\n vim_free(wp->w_popup_title);\n list_unref(wp->w_popup_mask);\n vim_free(wp->w_popup_mask_cells);\n#endif", "#ifdef FEAT_SYN_HL\n vim_free(wp->w_p_cc_cols);\n#endif", " if (win_valid_any_tab(wp))\n\twin_remove(wp, tp);\n if (autocmd_busy)\n {\n\twp->w_next = au_pending_free_win;\n\tau_pending_free_win = wp;\n }\n else\n\tvim_free(wp);", " unblock_autocmds();\n}", "/*\n * Return TRUE if \"wp\" is not in the list of windows: the autocmd window or a\n * popup window.\n */\n static int\nwin_unlisted(win_T *wp)\n{\n return wp == aucmd_win || WIN_IS_POPUP(wp);\n}", "#if defined(FEAT_TEXT_PROP) || defined(PROTO)\n/*\n * Free a popup window. This does not take the window out of the window list\n * and assumes there is only one toplevel frame, no split.\n */\n void\nwin_free_popup(win_T *win)\n{\n if (bt_popup(win->w_buffer))\n\twin_close_buffer(win, DOBUF_WIPE_REUSE, FALSE);\n else\n\tclose_buffer(win, win->w_buffer, 0, FALSE);\n# if defined(FEAT_TIMERS)\n if (win->w_popup_timer != NULL)\n\tstop_timer(win->w_popup_timer);\n# endif\n vim_free(win->w_frame);\n win_free(win, NULL);\n}\n#endif", "/*\n * Append window \"wp\" in the window list after window \"after\".\n */\n static void\nwin_append(win_T *after, win_T *wp)\n{\n win_T\t*before;", " if (after == NULL)\t /* after NULL is in front of the first */\n\tbefore = firstwin;\n else\n\tbefore = after->w_next;", " wp->w_next = before;\n wp->w_prev = after;\n if (after == NULL)\n\tfirstwin = wp;\n else\n\tafter->w_next = wp;\n if (before == NULL)\n\tlastwin = wp;\n else\n\tbefore->w_prev = wp;\n}", "/*\n * Remove a window from the window list.\n */\n void\nwin_remove(\n win_T\t*wp,\n tabpage_T\t*tp)\t\t/* tab page \"win\" is in, NULL for current */\n{\n if (wp->w_prev != NULL)\n\twp->w_prev->w_next = wp->w_next;\n else if (tp == NULL)\n\tfirstwin = curtab->tp_firstwin = wp->w_next;\n else\n\ttp->tp_firstwin = wp->w_next;", " if (wp->w_next != NULL)\n\twp->w_next->w_prev = wp->w_prev;\n else if (tp == NULL)\n\tlastwin = curtab->tp_lastwin = wp->w_prev;\n else\n\ttp->tp_lastwin = wp->w_prev;\n}", "/*\n * Append frame \"frp\" in a frame list after frame \"after\".\n */\n static void\nframe_append(frame_T *after, frame_T *frp)\n{\n frp->fr_next = after->fr_next;\n after->fr_next = frp;\n if (frp->fr_next != NULL)\n\tfrp->fr_next->fr_prev = frp;\n frp->fr_prev = after;\n}", "/*\n * Insert frame \"frp\" in a frame list before frame \"before\".\n */\n static void\nframe_insert(frame_T *before, frame_T *frp)\n{\n frp->fr_next = before;\n frp->fr_prev = before->fr_prev;\n before->fr_prev = frp;\n if (frp->fr_prev != NULL)\n\tfrp->fr_prev->fr_next = frp;\n else\n\tfrp->fr_parent->fr_child = frp;\n}", "/*\n * Remove a frame from a frame list.\n */\n static void\nframe_remove(frame_T *frp)\n{\n if (frp->fr_prev != NULL)\n\tfrp->fr_prev->fr_next = frp->fr_next;\n else\n {\n\tfrp->fr_parent->fr_child = frp->fr_next;\n\t/* special case: topframe->fr_child == frp */\n\tif (topframe->fr_child == frp)\n\t topframe->fr_child = frp->fr_next;\n }\n if (frp->fr_next != NULL)\n\tfrp->fr_next->fr_prev = frp->fr_prev;\n}", "/*\n * Allocate w_lines[] for window \"wp\".\n * Return FAIL for failure, OK for success.\n */\n int\nwin_alloc_lines(win_T *wp)\n{\n wp->w_lines_valid = 0;\n wp->w_lines = ALLOC_CLEAR_MULT(wline_T, Rows );\n if (wp->w_lines == NULL)\n\treturn FAIL;\n return OK;\n}", "/*\n * free lsize arrays for a window\n */\n void\nwin_free_lsize(win_T *wp)\n{\n /* TODO: why would wp be NULL here? */\n if (wp != NULL)\n\tVIM_CLEAR(wp->w_lines);\n}", "/*\n * Called from win_new_shellsize() after Rows changed.\n * This only does the current tab page, others must be done when made active.\n */\n void\nshell_new_rows(void)\n{\n int\t\th = (int)ROWS_AVAIL;", " if (firstwin == NULL)\t/* not initialized yet */\n\treturn;\n if (h < frame_minheight(topframe, NULL))\n\th = frame_minheight(topframe, NULL);", " /* First try setting the heights of windows with 'winfixheight'. If\n * that doesn't result in the right height, forget about that option. */\n frame_new_height(topframe, h, FALSE, TRUE);\n if (!frame_check_height(topframe, h))\n\tframe_new_height(topframe, h, FALSE, FALSE);", " (void)win_comp_pos();\t\t/* recompute w_winrow and w_wincol */\n compute_cmdrow();\n curtab->tp_ch_used = p_ch;", "#if 0\n /* Disabled: don't want making the screen smaller make a window larger. */\n if (p_ea)\n\twin_equal(curwin, FALSE, 'v');\n#endif\n}", "/*\n * Called from win_new_shellsize() after Columns changed.\n */\n void\nshell_new_columns(void)\n{\n if (firstwin == NULL)\t/* not initialized yet */\n\treturn;", " /* First try setting the widths of windows with 'winfixwidth'. If that\n * doesn't result in the right width, forget about that option. */\n frame_new_width(topframe, (int)Columns, FALSE, TRUE);\n if (!frame_check_width(topframe, Columns))\n\tframe_new_width(topframe, (int)Columns, FALSE, FALSE);", " (void)win_comp_pos();\t\t/* recompute w_winrow and w_wincol */\n#if 0\n /* Disabled: don't want making the screen smaller make a window larger. */\n if (p_ea)\n\twin_equal(curwin, FALSE, 'h');\n#endif\n}", "#if defined(FEAT_CMDWIN) || defined(PROTO)\n/*\n * Save the size of all windows in \"gap\".\n */\n void\nwin_size_save(garray_T *gap)", "{\n win_T\t*wp;", " ga_init2(gap, (int)sizeof(int), 1);\n if (ga_grow(gap, win_count() * 2) == OK)\n\tFOR_ALL_WINDOWS(wp)\n\t{\n\t ((int *)gap->ga_data)[gap->ga_len++] =\n\t\t\t\t\t wp->w_width + wp->w_vsep_width;\n\t ((int *)gap->ga_data)[gap->ga_len++] = wp->w_height;\n\t}\n}", "/*\n * Restore window sizes, but only if the number of windows is still the same.\n * Does not free the growarray.\n */\n void\nwin_size_restore(garray_T *gap)\n{\n win_T\t*wp;\n int\t\ti, j;", " if (win_count() * 2 == gap->ga_len)\n {\n\t/* The order matters, because frames contain other frames, but it's\n\t * difficult to get right. The easy way out is to do it twice. */\n\tfor (j = 0; j < 2; ++j)\n\t{\n\t i = 0;\n\t FOR_ALL_WINDOWS(wp)\n\t {\n\t\tframe_setwidth(wp->w_frame, ((int *)gap->ga_data)[i++]);\n\t\twin_setheight_win(((int *)gap->ga_data)[i++], wp);\n\t }\n\t}\n\t/* recompute the window positions */\n\t(void)win_comp_pos();\n }\n}\n#endif /* FEAT_CMDWIN */", "/*\n * Update the position for all windows, using the width and height of the\n * frames.\n * Returns the row just after the last window.\n */\n int\nwin_comp_pos(void)\n{\n int\t\trow = tabline_height();\n int\t\tcol = 0;", " frame_comp_pos(topframe, &row, &col);\n return row;\n}", "/*\n * Update the position of the windows in frame \"topfrp\", using the width and\n * height of the frames.\n * \"*row\" and \"*col\" are the top-left position of the frame. They are updated\n * to the bottom-right position plus one.\n */\n static void\nframe_comp_pos(frame_T *topfrp, int *row, int *col)\n{\n win_T\t*wp;\n frame_T\t*frp;\n int\t\tstartcol;\n int\t\tstartrow;\n int\t\th;", " wp = topfrp->fr_win;\n if (wp != NULL)\n {\n\tif (wp->w_winrow != *row || wp->w_wincol != *col)\n\t{\n\t /* position changed, redraw */\n\t wp->w_winrow = *row;\n\t wp->w_wincol = *col;\n\t redraw_win_later(wp, NOT_VALID);\n\t wp->w_redr_status = TRUE;\n\t}\n\t/* WinBar will not show if the window height is zero */\n\th = VISIBLE_HEIGHT(wp) + wp->w_status_height;\n\t*row += h > topfrp->fr_height ? topfrp->fr_height : h;\n\t*col += wp->w_width + wp->w_vsep_width;\n }\n else\n {\n\tstartrow = *row;\n\tstartcol = *col;\n\tFOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t{\n\t if (topfrp->fr_layout == FR_ROW)\n\t\t*row = startrow;\t/* all frames are at the same row */\n\t else\n\t\t*col = startcol;\t/* all frames are at the same col */\n\t frame_comp_pos(frp, row, col);\n\t}\n }\n}", "/*\n * Set current window height and take care of repositioning other windows to\n * fit around it.\n */\n void\nwin_setheight(int height)\n{\n win_setheight_win(height, curwin);\n}", "/*\n * Set the window height of window \"win\" and take care of repositioning other\n * windows to fit around it.\n */\n void\nwin_setheight_win(int height, win_T *win)\n{\n int\t\trow;", " if (win == curwin)\n {\n\t/* Always keep current window at least one line high, even when\n\t * 'winminheight' is zero. */\n\tif (height < p_wmh)\n\t height = p_wmh;\n\tif (height == 0)\n\t height = 1;\n\theight += WINBAR_HEIGHT(curwin);\n }", " frame_setheight(win->w_frame, height + win->w_status_height);", " /* recompute the window positions */\n row = win_comp_pos();", " /*\n * If there is extra space created between the last window and the command\n * line, clear it.\n */\n if (full_screen && msg_scrolled == 0 && row < cmdline_row)\n\tscreen_fill(row, cmdline_row, 0, (int)Columns, ' ', ' ', 0);\n cmdline_row = row;\n msg_row = row;\n msg_col = 0;", " redraw_all_later(NOT_VALID);\n}", "/*\n * Set the height of a frame to \"height\" and take care that all frames and\n * windows inside it are resized. Also resize frames on the left and right if\n * the are in the same FR_ROW frame.\n *\n * Strategy:\n * If the frame is part of a FR_COL frame, try fitting the frame in that\n * frame. If that doesn't work (the FR_COL frame is too small), recursively\n * go to containing frames to resize them and make room.\n * If the frame is part of a FR_ROW frame, all frames must be resized as well.\n * Check for the minimal height of the FR_ROW frame.\n * At the top level we can also use change the command line height.\n */\n static void\nframe_setheight(frame_T *curfrp, int height)\n{\n int\t\troom;\t\t/* total number of lines available */\n int\t\ttake;\t\t/* number of lines taken from other windows */\n int\t\troom_cmdline;\t/* lines available from cmdline */\n int\t\trun;\n frame_T\t*frp;\n int\t\th;\n int\t\troom_reserved;", " /* If the height already is the desired value, nothing to do. */\n if (curfrp->fr_height == height)\n\treturn;", " if (curfrp->fr_parent == NULL)\n {\n\t/* topframe: can only change the command line */\n\tif (height > ROWS_AVAIL)\n\t height = ROWS_AVAIL;\n\tif (height > 0)\n\t frame_new_height(curfrp, height, FALSE, FALSE);\n }\n else if (curfrp->fr_parent->fr_layout == FR_ROW)\n {\n\t/* Row of frames: Also need to resize frames left and right of this\n\t * one. First check for the minimal height of these. */\n\th = frame_minheight(curfrp->fr_parent, NULL);\n\tif (height < h)\n\t height = h;\n\tframe_setheight(curfrp->fr_parent, height);\n }\n else\n {\n\t/*\n\t * Column of frames: try to change only frames in this column.\n\t */\n\t/*\n\t * Do this twice:\n\t * 1: compute room available, if it's not enough try resizing the\n\t * containing frame.\n\t * 2: compute the room available and adjust the height to it.\n\t * Try not to reduce the height of a window with 'winfixheight' set.\n\t */\n\tfor (run = 1; run <= 2; ++run)\n\t{\n\t room = 0;\n\t room_reserved = 0;\n\t FOR_ALL_FRAMES(frp, curfrp->fr_parent->fr_child)\n\t {\n\t\tif (frp != curfrp\n\t\t\t&& frp->fr_win != NULL\n\t\t\t&& frp->fr_win->w_p_wfh)\n\t\t room_reserved += frp->fr_height;\n\t\troom += frp->fr_height;\n\t\tif (frp != curfrp)\n\t\t room -= frame_minheight(frp, NULL);\n\t }\n\t if (curfrp->fr_width != Columns)\n\t\troom_cmdline = 0;\n\t else\n\t {\n\t\troom_cmdline = Rows - p_ch - (lastwin->w_winrow\n\t\t\t\t\t\t+ VISIBLE_HEIGHT(lastwin)\n\t\t\t\t\t\t+ lastwin->w_status_height);\n\t\tif (room_cmdline < 0)\n\t\t room_cmdline = 0;\n\t }", "\t if (height <= room + room_cmdline)\n\t\tbreak;\n\t if (run == 2 || curfrp->fr_width == Columns)\n\t {\n\t\tif (height > room + room_cmdline)\n\t\t height = room + room_cmdline;\n\t\tbreak;\n\t }\n\t frame_setheight(curfrp->fr_parent, height\n\t\t+ frame_minheight(curfrp->fr_parent, NOWIN) - (int)p_wmh - 1);\n\t}", "\t/*\n\t * Compute the number of lines we will take from others frames (can be\n\t * negative!).\n\t */\n\ttake = height - curfrp->fr_height;", "\t/* If there is not enough room, also reduce the height of a window\n\t * with 'winfixheight' set. */\n\tif (height > room + room_cmdline - room_reserved)\n\t room_reserved = room + room_cmdline - height;\n\t/* If there is only a 'winfixheight' window and making the\n\t * window smaller, need to make the other window taller. */\n\tif (take < 0 && room - curfrp->fr_height < room_reserved)\n\t room_reserved = 0;", "\tif (take > 0 && room_cmdline > 0)\n\t{\n\t /* use lines from cmdline first */\n\t if (take < room_cmdline)\n\t\troom_cmdline = take;\n\t take -= room_cmdline;\n\t topframe->fr_height += room_cmdline;\n\t}", "\t/*\n\t * set the current frame to the new height\n\t */\n\tframe_new_height(curfrp, height, FALSE, FALSE);", "\t/*\n\t * First take lines from the frames after the current frame. If\n\t * that is not enough, takes lines from frames above the current\n\t * frame.\n\t */\n\tfor (run = 0; run < 2; ++run)\n\t{\n\t if (run == 0)\n\t\tfrp = curfrp->fr_next;\t/* 1st run: start with next window */\n\t else\n\t\tfrp = curfrp->fr_prev;\t/* 2nd run: start with prev window */\n\t while (frp != NULL && take != 0)\n\t {\n\t\th = frame_minheight(frp, NULL);\n\t\tif (room_reserved > 0\n\t\t\t&& frp->fr_win != NULL\n\t\t\t&& frp->fr_win->w_p_wfh)\n\t\t{\n\t\t if (room_reserved >= frp->fr_height)\n\t\t\troom_reserved -= frp->fr_height;\n\t\t else\n\t\t {\n\t\t\tif (frp->fr_height - room_reserved > take)\n\t\t\t room_reserved = frp->fr_height - take;\n\t\t\ttake -= frp->fr_height - room_reserved;\n\t\t\tframe_new_height(frp, room_reserved, FALSE, FALSE);\n\t\t\troom_reserved = 0;\n\t\t }\n\t\t}\n\t\telse\n\t\t{\n\t\t if (frp->fr_height - take < h)\n\t\t {\n\t\t\ttake -= frp->fr_height - h;\n\t\t\tframe_new_height(frp, h, FALSE, FALSE);\n\t\t }\n\t\t else\n\t\t {\n\t\t\tframe_new_height(frp, frp->fr_height - take,\n\t\t\t\t\t\t\t\tFALSE, FALSE);\n\t\t\ttake = 0;\n\t\t }\n\t\t}\n\t\tif (run == 0)\n\t\t frp = frp->fr_next;\n\t\telse\n\t\t frp = frp->fr_prev;\n\t }\n\t}\n }\n}", "/*\n * Set current window width and take care of repositioning other windows to\n * fit around it.\n */\n void\nwin_setwidth(int width)\n{\n win_setwidth_win(width, curwin);\n}", " void\nwin_setwidth_win(int width, win_T *wp)\n{\n /* Always keep current window at least one column wide, even when\n * 'winminwidth' is zero. */\n if (wp == curwin)\n {\n\tif (width < p_wmw)\n\t width = p_wmw;\n\tif (width == 0)\n\t width = 1;\n }", " frame_setwidth(wp->w_frame, width + wp->w_vsep_width);", " /* recompute the window positions */\n (void)win_comp_pos();", " redraw_all_later(NOT_VALID);\n}", "/*\n * Set the width of a frame to \"width\" and take care that all frames and\n * windows inside it are resized. Also resize frames above and below if the\n * are in the same FR_ROW frame.\n *\n * Strategy is similar to frame_setheight().\n */\n static void\nframe_setwidth(frame_T *curfrp, int width)\n{\n int\t\troom;\t\t/* total number of lines available */\n int\t\ttake;\t\t/* number of lines taken from other windows */\n int\t\trun;\n frame_T\t*frp;\n int\t\tw;\n int\t\troom_reserved;", " /* If the width already is the desired value, nothing to do. */\n if (curfrp->fr_width == width)\n\treturn;", " if (curfrp->fr_parent == NULL)\n\t/* topframe: can't change width */\n\treturn;", " if (curfrp->fr_parent->fr_layout == FR_COL)\n {\n\t/* Column of frames: Also need to resize frames above and below of\n\t * this one. First check for the minimal width of these. */\n\tw = frame_minwidth(curfrp->fr_parent, NULL);\n\tif (width < w)\n\t width = w;\n\tframe_setwidth(curfrp->fr_parent, width);\n }\n else\n {\n\t/*\n\t * Row of frames: try to change only frames in this row.\n\t *\n\t * Do this twice:\n\t * 1: compute room available, if it's not enough try resizing the\n\t * containing frame.\n\t * 2: compute the room available and adjust the width to it.\n\t */\n\tfor (run = 1; run <= 2; ++run)\n\t{\n\t room = 0;\n\t room_reserved = 0;\n\t FOR_ALL_FRAMES(frp, curfrp->fr_parent->fr_child)\n\t {\n\t\tif (frp != curfrp\n\t\t\t&& frp->fr_win != NULL\n\t\t\t&& frp->fr_win->w_p_wfw)\n\t\t room_reserved += frp->fr_width;\n\t\troom += frp->fr_width;\n\t\tif (frp != curfrp)\n\t\t room -= frame_minwidth(frp, NULL);\n\t }", "\t if (width <= room)\n\t\tbreak;\n\t if (run == 2 || curfrp->fr_height >= ROWS_AVAIL)\n\t {\n\t\tif (width > room)\n\t\t width = room;\n\t\tbreak;\n\t }\n\t frame_setwidth(curfrp->fr_parent, width\n\t\t + frame_minwidth(curfrp->fr_parent, NOWIN) - (int)p_wmw - 1);\n\t}", "\t/*\n\t * Compute the number of lines we will take from others frames (can be\n\t * negative!).\n\t */\n\ttake = width - curfrp->fr_width;", "\t/* If there is not enough room, also reduce the width of a window\n\t * with 'winfixwidth' set. */\n\tif (width > room - room_reserved)\n\t room_reserved = room - width;\n\t/* If there is only a 'winfixwidth' window and making the\n\t * window smaller, need to make the other window narrower. */\n\tif (take < 0 && room - curfrp->fr_width < room_reserved)\n\t room_reserved = 0;", "\t/*\n\t * set the current frame to the new width\n\t */\n\tframe_new_width(curfrp, width, FALSE, FALSE);", "\t/*\n\t * First take lines from the frames right of the current frame. If\n\t * that is not enough, takes lines from frames left of the current\n\t * frame.\n\t */\n\tfor (run = 0; run < 2; ++run)\n\t{\n\t if (run == 0)\n\t\tfrp = curfrp->fr_next;\t/* 1st run: start with next window */\n\t else\n\t\tfrp = curfrp->fr_prev;\t/* 2nd run: start with prev window */\n\t while (frp != NULL && take != 0)\n\t {\n\t\tw = frame_minwidth(frp, NULL);\n\t\tif (room_reserved > 0\n\t\t\t&& frp->fr_win != NULL\n\t\t\t&& frp->fr_win->w_p_wfw)\n\t\t{\n\t\t if (room_reserved >= frp->fr_width)\n\t\t\troom_reserved -= frp->fr_width;\n\t\t else\n\t\t {\n\t\t\tif (frp->fr_width - room_reserved > take)\n\t\t\t room_reserved = frp->fr_width - take;\n\t\t\ttake -= frp->fr_width - room_reserved;\n\t\t\tframe_new_width(frp, room_reserved, FALSE, FALSE);\n\t\t\troom_reserved = 0;\n\t\t }\n\t\t}\n\t\telse\n\t\t{\n\t\t if (frp->fr_width - take < w)\n\t\t {\n\t\t\ttake -= frp->fr_width - w;\n\t\t\tframe_new_width(frp, w, FALSE, FALSE);\n\t\t }\n\t\t else\n\t\t {\n\t\t\tframe_new_width(frp, frp->fr_width - take,\n\t\t\t\t\t\t\t\tFALSE, FALSE);\n\t\t\ttake = 0;\n\t\t }\n\t\t}\n\t\tif (run == 0)\n\t\t frp = frp->fr_next;\n\t\telse\n\t\t frp = frp->fr_prev;\n\t }\n\t}\n }\n}", "/*\n * Check 'winminheight' for a valid value and reduce it if needed.\n */\n void\nwin_setminheight(void)\n{\n int\t\troom;\n int\t\tneeded;\n int\t\tfirst = TRUE;", " // loop until there is a 'winminheight' that is possible\n while (p_wmh > 0)\n {\n\troom = Rows - p_ch;\n\tneeded = frame_minheight(topframe, NULL);\n\tif (room >= needed)\n\t break;\n\t--p_wmh;\n\tif (first)\n\t{\n\t emsg(_(e_noroom));\n\t first = FALSE;\n\t}\n }\n}", "/*\n * Check 'winminwidth' for a valid value and reduce it if needed.\n */\n void\nwin_setminwidth(void)\n{\n int\t\troom;\n int\t\tneeded;\n int\t\tfirst = TRUE;", " // loop until there is a 'winminheight' that is possible\n while (p_wmw > 0)\n {\n\troom = Columns;\n\tneeded = frame_minwidth(topframe, NULL);\n\tif (room >= needed)\n\t break;\n\t--p_wmw;\n\tif (first)\n\t{\n\t emsg(_(e_noroom));\n\t first = FALSE;\n\t}\n }\n}", "#if defined(FEAT_MOUSE) || defined(PROTO)", "/*\n * Status line of dragwin is dragged \"offset\" lines down (negative is up).\n */\n void\nwin_drag_status_line(win_T *dragwin, int offset)\n{\n frame_T\t*curfr;\n frame_T\t*fr;\n int\t\troom;\n int\t\trow;\n int\t\tup;\t/* if TRUE, drag status line up, otherwise down */\n int\t\tn;", " fr = dragwin->w_frame;\n curfr = fr;\n if (fr != topframe)\t\t/* more than one window */\n {\n\tfr = fr->fr_parent;\n\t/* When the parent frame is not a column of frames, its parent should\n\t * be. */\n\tif (fr->fr_layout != FR_COL)\n\t{\n\t curfr = fr;\n\t if (fr != topframe)\t/* only a row of windows, may drag statusline */\n\t\tfr = fr->fr_parent;\n\t}\n }", " /* If this is the last frame in a column, may want to resize the parent\n * frame instead (go two up to skip a row of frames). */\n while (curfr != topframe && curfr->fr_next == NULL)\n {\n\tif (fr != topframe)\n\t fr = fr->fr_parent;\n\tcurfr = fr;\n\tif (fr != topframe)\n\t fr = fr->fr_parent;\n }", " if (offset < 0) /* drag up */\n {\n\tup = TRUE;\n\toffset = -offset;\n\t/* sum up the room of the current frame and above it */\n\tif (fr == curfr)\n\t{\n\t /* only one window */\n\t room = fr->fr_height - frame_minheight(fr, NULL);\n\t}\n\telse\n\t{\n\t room = 0;\n\t for (fr = fr->fr_child; ; fr = fr->fr_next)\n\t {\n\t\troom += fr->fr_height - frame_minheight(fr, NULL);\n\t\tif (fr == curfr)\n\t\t break;\n\t }\n\t}\n\tfr = curfr->fr_next;\t\t/* put fr at frame that grows */\n }\n else /* drag down */\n {\n\tup = FALSE;\n\t/*\n\t * Only dragging the last status line can reduce p_ch.\n\t */\n\troom = Rows - cmdline_row;\n\tif (curfr->fr_next == NULL)\n\t room -= 1;\n\telse\n\t room -= p_ch;\n\tif (room < 0)\n\t room = 0;\n\t/* sum up the room of frames below of the current one */\n\tFOR_ALL_FRAMES(fr, curfr->fr_next)\n\t room += fr->fr_height - frame_minheight(fr, NULL);\n\tfr = curfr;\t\t\t/* put fr at window that grows */\n }", " if (room < offset)\t\t/* Not enough room */\n\toffset = room;\t\t/* Move as far as we can */\n if (offset <= 0)\n\treturn;", " /*\n * Grow frame fr by \"offset\" lines.\n * Doesn't happen when dragging the last status line up.\n */\n if (fr != NULL)\n\tframe_new_height(fr, fr->fr_height + offset, up, FALSE);", " if (up)\n\tfr = curfr;\t\t/* current frame gets smaller */\n else\n\tfr = curfr->fr_next;\t/* next frame gets smaller */", " /*\n * Now make the other frames smaller.\n */\n while (fr != NULL && offset > 0)\n {\n\tn = frame_minheight(fr, NULL);\n\tif (fr->fr_height - offset <= n)\n\t{\n\t offset -= fr->fr_height - n;\n\t frame_new_height(fr, n, !up, FALSE);\n\t}\n\telse\n\t{\n\t frame_new_height(fr, fr->fr_height - offset, !up, FALSE);\n\t break;\n\t}\n\tif (up)\n\t fr = fr->fr_prev;\n\telse\n\t fr = fr->fr_next;\n }\n row = win_comp_pos();\n screen_fill(row, cmdline_row, 0, (int)Columns, ' ', ' ', 0);\n cmdline_row = row;\n p_ch = Rows - cmdline_row;\n if (p_ch < 1)\n\tp_ch = 1;\n curtab->tp_ch_used = p_ch;\n redraw_all_later(SOME_VALID);\n showmode();\n}", "/*\n * Separator line of dragwin is dragged \"offset\" lines right (negative is left).\n */\n void\nwin_drag_vsep_line(win_T *dragwin, int offset)\n{\n frame_T\t*curfr;\n frame_T\t*fr;\n int\t\troom;\n int\t\tleft;\t/* if TRUE, drag separator line left, otherwise right */\n int\t\tn;", " fr = dragwin->w_frame;\n if (fr == topframe)\t\t/* only one window (cannot happen?) */\n\treturn;\n curfr = fr;\n fr = fr->fr_parent;\n /* When the parent frame is not a row of frames, its parent should be. */\n if (fr->fr_layout != FR_ROW)\n {\n\tif (fr == topframe)\t/* only a column of windows (cannot happen?) */\n\t return;\n\tcurfr = fr;\n\tfr = fr->fr_parent;\n }", " /* If this is the last frame in a row, may want to resize a parent\n * frame instead. */\n while (curfr->fr_next == NULL)\n {\n\tif (fr == topframe)\n\t break;\n\tcurfr = fr;\n\tfr = fr->fr_parent;\n\tif (fr != topframe)\n\t{\n\t curfr = fr;\n\t fr = fr->fr_parent;\n\t}\n }", " if (offset < 0) /* drag left */\n {\n\tleft = TRUE;\n\toffset = -offset;\n\t/* sum up the room of the current frame and left of it */\n\troom = 0;\n\tfor (fr = fr->fr_child; ; fr = fr->fr_next)\n\t{\n\t room += fr->fr_width - frame_minwidth(fr, NULL);\n\t if (fr == curfr)\n\t\tbreak;\n\t}\n\tfr = curfr->fr_next;\t\t/* put fr at frame that grows */\n }\n else /* drag right */\n {\n\tleft = FALSE;\n\t/* sum up the room of frames right of the current one */\n\troom = 0;\n\tFOR_ALL_FRAMES(fr, curfr->fr_next)\n\t room += fr->fr_width - frame_minwidth(fr, NULL);\n\tfr = curfr;\t\t\t/* put fr at window that grows */\n }", " if (room < offset)\t\t/* Not enough room */\n\toffset = room;\t\t/* Move as far as we can */\n if (offset <= 0)\t\t/* No room at all, quit. */\n\treturn;\n if (fr == NULL)\n\treturn;\t\t\t/* Safety check, should not happen. */", " /* grow frame fr by offset lines */\n frame_new_width(fr, fr->fr_width + offset, left, FALSE);", " /* shrink other frames: current and at the left or at the right */\n if (left)\n\tfr = curfr;\t\t/* current frame gets smaller */\n else\n\tfr = curfr->fr_next;\t/* next frame gets smaller */", " while (fr != NULL && offset > 0)\n {\n\tn = frame_minwidth(fr, NULL);\n\tif (fr->fr_width - offset <= n)\n\t{\n\t offset -= fr->fr_width - n;\n\t frame_new_width(fr, n, !left, FALSE);\n\t}\n\telse\n\t{\n\t frame_new_width(fr, fr->fr_width - offset, !left, FALSE);\n\t break;\n\t}\n\tif (left)\n\t fr = fr->fr_prev;\n\telse\n\t fr = fr->fr_next;\n }\n (void)win_comp_pos();\n redraw_all_later(NOT_VALID);\n}\n#endif /* FEAT_MOUSE */", "#define FRACTION_MULT\t16384L", "/*\n * Set wp->w_fraction for the current w_wrow and w_height.\n * Has no effect when the window is less than two lines.\n */\n void\nset_fraction(win_T *wp)\n{\n if (wp->w_height > 1)\n\t// When cursor is in the first line the percentage is computed as if\n\t// it's halfway that line. Thus with two lines it is 25%, with three\n\t// lines 17%, etc. Similarly for the last line: 75%, 83%, etc.\n\twp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT\n\t\t\t\t + FRACTION_MULT / 2) / (long)wp->w_height;\n}", "/*\n * Set the height of a window.\n * \"height\" excludes any window toolbar.\n * This takes care of the things inside the window, not what happens to the\n * window position, the frame or to other windows.\n */\n void\nwin_new_height(win_T *wp, int height)\n{\n int\t\tprev_height = wp->w_height;", " /* Don't want a negative height. Happens when splitting a tiny window.\n * Will equalize heights soon to fix it. */\n if (height < 0)\n\theight = 0;\n if (wp->w_height == height)\n\treturn;\t /* nothing to do */", " if (wp->w_height > 0)\n {\n\tif (wp == curwin)\n\t /* w_wrow needs to be valid. When setting 'laststatus' this may\n\t * call win_new_height() recursively. */\n\t validate_cursor();\n\tif (wp->w_height != prev_height)\n\t return; /* Recursive call already changed the size, bail out here\n\t\t\tto avoid the following to mess things up. */\n\tif (wp->w_wrow != wp->w_prev_fraction_row)\n\t set_fraction(wp);\n }", " wp->w_height = height;\n wp->w_skipcol = 0;", " /* There is no point in adjusting the scroll position when exiting. Some\n * values might be invalid. */\n if (!exiting)\n\tscroll_to_fraction(wp, prev_height);\n}", " void\nscroll_to_fraction(win_T *wp, int prev_height)\n{\n linenr_T\tlnum;\n int\t\tsline, line_size;\n int\t\theight = wp->w_height;", " // Don't change w_topline in any of these cases:\n // - window height is 0\n // - 'scrollbind' is set and this isn't the current window\n // - window height is sufficient to display the whole buffer and first line\n // is visible.\n if (height > 0\n && (!wp->w_p_scb || wp == curwin)\n && (height < wp->w_buffer->b_ml.ml_line_count || wp->w_topline > 1))\n {\n\t/*\n\t * Find a value for w_topline that shows the cursor at the same\n\t * relative position in the window as before (more or less).\n\t */\n\tlnum = wp->w_cursor.lnum;\n\tif (lnum < 1)\t\t/* can happen when starting up */\n\t lnum = 1;\n\twp->w_wrow = ((long)wp->w_fraction * (long)height - 1L)\n\t\t\t\t\t\t\t / FRACTION_MULT;\n\tline_size = plines_win_col(wp, lnum, (long)(wp->w_cursor.col)) - 1;\n\tsline = wp->w_wrow - line_size;", "\tif (sline >= 0)\n\t{\n\t /* Make sure the whole cursor line is visible, if possible. */\n\t int rows = plines_win(wp, lnum, FALSE);", "\t if (sline > wp->w_height - rows)\n\t {\n\t\tsline = wp->w_height - rows;\n\t\twp->w_wrow -= rows - line_size;\n\t }\n\t}", "\tif (sline < 0)\n\t{\n\t /*\n\t * Cursor line would go off top of screen if w_wrow was this high.\n\t * Make cursor line the first line in the window. If not enough\n\t * room use w_skipcol;\n\t */\n\t wp->w_wrow = line_size;\n\t if (wp->w_wrow >= wp->w_height\n\t\t\t\t && (wp->w_width - win_col_off(wp)) > 0)\n\t {\n\t\twp->w_skipcol += wp->w_width - win_col_off(wp);\n\t\t--wp->w_wrow;\n\t\twhile (wp->w_wrow >= wp->w_height)\n\t\t{\n\t\t wp->w_skipcol += wp->w_width - win_col_off(wp)\n\t\t\t\t\t\t\t + win_col_off2(wp);\n\t\t --wp->w_wrow;\n\t\t}\n\t }\n\t}\n\telse if (sline > 0)\n\t{\n\t while (sline > 0 && lnum > 1)\n\t {\n#ifdef FEAT_FOLDING\n\t\thasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL);\n\t\tif (lnum == 1)\n\t\t{\n\t\t /* first line in buffer is folded */\n\t\t line_size = 1;\n\t\t --sline;\n\t\t break;\n\t\t}\n#endif\n\t\t--lnum;\n#ifdef FEAT_DIFF\n\t\tif (lnum == wp->w_topline)\n\t\t line_size = plines_win_nofill(wp, lnum, TRUE)\n\t\t\t\t\t\t\t + wp->w_topfill;\n\t\telse\n#endif\n\t\t line_size = plines_win(wp, lnum, TRUE);\n\t\tsline -= line_size;\n\t }", "\t if (sline < 0)\n\t {\n\t\t/*\n\t\t * Line we want at top would go off top of screen. Use next\n\t\t * line instead.\n\t\t */\n#ifdef FEAT_FOLDING\n\t\thasFoldingWin(wp, lnum, NULL, &lnum, TRUE, NULL);\n#endif\n\t\tlnum++;\n\t\twp->w_wrow -= line_size + sline;\n\t }\n\t else if (sline > 0)\n\t {\n\t\t// First line of file reached, use that as topline.\n\t\tlnum = 1;\n\t\twp->w_wrow -= sline;\n\t }\n\t}\n\tset_topline(wp, lnum);\n }", " if (wp == curwin)\n {\n\tif (get_scrolloff_value())\n\t update_topline();\n\tcurs_columns(FALSE);\t/* validate w_wrow */\n }\n if (prev_height > 0)\n\twp->w_prev_fraction_row = wp->w_wrow;", " win_comp_scroll(wp);\n redraw_win_later(wp, SOME_VALID);\n wp->w_redr_status = TRUE;\n invalidate_botline_win(wp);\n}", "/*\n * Set the width of a window.\n */\n void\nwin_new_width(win_T *wp, int width)\n{\n wp->w_width = width;\n wp->w_lines_valid = 0;\n changed_line_abv_curs_win(wp);\n invalidate_botline_win(wp);\n if (wp == curwin)\n {\n\tupdate_topline();\n\tcurs_columns(TRUE);\t/* validate w_wrow */\n }\n redraw_win_later(wp, NOT_VALID);\n wp->w_redr_status = TRUE;\n}", " void\nwin_comp_scroll(win_T *wp)\n{\n wp->w_p_scr = ((unsigned)wp->w_height >> 1);\n if (wp->w_p_scr == 0)\n\twp->w_p_scr = 1;\n}", "/*\n * command_height: called whenever p_ch has been changed\n */\n void\ncommand_height(void)\n{\n int\t\th;\n frame_T\t*frp;\n int\t\told_p_ch = curtab->tp_ch_used;", " /* Use the value of p_ch that we remembered. This is needed for when the\n * GUI starts up, we can't be sure in what order things happen. And when\n * p_ch was changed in another tab page. */\n curtab->tp_ch_used = p_ch;", " /* Find bottom frame with width of screen. */\n frp = lastwin->w_frame;\n while (frp->fr_width != Columns && frp->fr_parent != NULL)\n\tfrp = frp->fr_parent;", " /* Avoid changing the height of a window with 'winfixheight' set. */\n while (frp->fr_prev != NULL && frp->fr_layout == FR_LEAF\n\t\t\t\t\t\t && frp->fr_win->w_p_wfh)\n\tfrp = frp->fr_prev;", " if (starting != NO_SCREEN)\n {\n\tcmdline_row = Rows - p_ch;", "\tif (p_ch > old_p_ch)\t\t /* p_ch got bigger */\n\t{\n\t while (p_ch > old_p_ch)\n\t {\n\t\tif (frp == NULL)\n\t\t{\n\t\t emsg(_(e_noroom));\n\t\t p_ch = old_p_ch;\n\t\t curtab->tp_ch_used = p_ch;\n\t\t cmdline_row = Rows - p_ch;\n\t\t break;\n\t\t}\n\t\th = frp->fr_height - frame_minheight(frp, NULL);\n\t\tif (h > p_ch - old_p_ch)\n\t\t h = p_ch - old_p_ch;\n\t\told_p_ch += h;\n\t\tframe_add_height(frp, -h);\n\t\tfrp = frp->fr_prev;\n\t }", "\t /* Recompute window positions. */\n\t (void)win_comp_pos();", "\t /* clear the lines added to cmdline */\n\t if (full_screen)\n\t\tscreen_fill((int)(cmdline_row), (int)Rows, 0,\n\t\t\t\t\t\t (int)Columns, ' ', ' ', 0);\n\t msg_row = cmdline_row;\n\t redraw_cmdline = TRUE;\n\t return;\n\t}", "\tif (msg_row < cmdline_row)\n\t msg_row = cmdline_row;\n\tredraw_cmdline = TRUE;\n }\n frame_add_height(frp, (int)(old_p_ch - p_ch));", " /* Recompute window positions. */\n if (frp != lastwin->w_frame)\n\t(void)win_comp_pos();\n}", "/*\n * Resize frame \"frp\" to be \"n\" lines higher (negative for less high).\n * Also resize the frames it is contained in.\n */\n static void\nframe_add_height(frame_T *frp, int n)\n{\n frame_new_height(frp, frp->fr_height + n, FALSE, FALSE);\n for (;;)\n {\n\tfrp = frp->fr_parent;\n\tif (frp == NULL)\n\t break;\n\tfrp->fr_height += n;\n }\n}", "/*\n * Add or remove a status line for the bottom window(s), according to the\n * value of 'laststatus'.\n */\n void\nlast_status(\n int\t\tmorewin)\t/* pretend there are two or more windows */\n{\n /* Don't make a difference between horizontal or vertical split. */\n last_status_rec(topframe, (p_ls == 2\n\t\t\t || (p_ls == 1 && (morewin || !ONE_WINDOW))));\n}", " static void\nlast_status_rec(frame_T *fr, int statusline)\n{\n frame_T\t*fp;\n win_T\t*wp;", " if (fr->fr_layout == FR_LEAF)\n {\n\twp = fr->fr_win;\n\tif (wp->w_status_height != 0 && !statusline)\n\t{\n\t /* remove status line */\n\t win_new_height(wp, wp->w_height + 1);\n\t wp->w_status_height = 0;\n\t comp_col();\n\t}\n\telse if (wp->w_status_height == 0 && statusline)\n\t{\n\t /* Find a frame to take a line from. */\n\t fp = fr;\n\t while (fp->fr_height <= frame_minheight(fp, NULL))\n\t {\n\t\tif (fp == topframe)\n\t\t{\n\t\t emsg(_(e_noroom));\n\t\t return;\n\t\t}\n\t\t/* In a column of frames: go to frame above. If already at\n\t\t * the top or in a row of frames: go to parent. */\n\t\tif (fp->fr_parent->fr_layout == FR_COL && fp->fr_prev != NULL)\n\t\t fp = fp->fr_prev;\n\t\telse\n\t\t fp = fp->fr_parent;\n\t }\n\t wp->w_status_height = 1;\n\t if (fp != fr)\n\t {\n\t\tframe_new_height(fp, fp->fr_height - 1, FALSE, FALSE);\n\t\tframe_fix_height(wp);\n\t\t(void)win_comp_pos();\n\t }\n\t else\n\t\twin_new_height(wp, wp->w_height - 1);\n\t comp_col();\n\t redraw_all_later(SOME_VALID);\n\t}\n }\n else if (fr->fr_layout == FR_ROW)\n {\n\t/* vertically split windows, set status line for each one */\n\tFOR_ALL_FRAMES(fp, fr->fr_child)\n\t last_status_rec(fp, statusline);\n }\n else\n {\n\t/* horizontally split window, set status line for last one */\n\tfor (fp = fr->fr_child; fp->fr_next != NULL; fp = fp->fr_next)\n\t ;\n\tlast_status_rec(fp, statusline);\n }\n}", "/*\n * Return the number of lines used by the tab page line.\n */\n int\ntabline_height(void)\n{\n#ifdef FEAT_GUI_TABLINE\n /* When the GUI has the tabline then this always returns zero. */\n if (gui_use_tabline())\n\treturn 0;\n#endif\n switch (p_stal)\n {\n\tcase 0: return 0;\n\tcase 1: return (first_tabpage->tp_next == NULL) ? 0 : 1;\n }\n return 1;\n}", "/*\n * Return the minimal number of rows that is needed on the screen to display\n * the current number of windows.\n */\n int\nmin_rows(void)\n{\n int\t\ttotal;\n tabpage_T\t*tp;\n int\t\tn;", " if (firstwin == NULL)\t/* not initialized yet */\n\treturn MIN_LINES;", " total = 0;\n FOR_ALL_TABPAGES(tp)\n {\n\tn = frame_minheight(tp->tp_topframe, NULL);\n\tif (total < n)\n\t total = n;\n }\n total += tabline_height();\n total += 1;\t\t/* count the room for the command line */\n return total;\n}", "/*\n * Return TRUE if there is only one window (in the current tab page), not\n * counting a help or preview window, unless it is the current window.\n * Does not count unlisted windows.\n */\n int\nonly_one_window(void)\n{\n int\t\tcount = 0;\n win_T\t*wp;", " /* If there is another tab page there always is another window. */\n if (first_tabpage->tp_next != NULL)\n\treturn FALSE;", " FOR_ALL_WINDOWS(wp)\n\tif (wp->w_buffer != NULL\n\t\t&& (!((bt_help(wp->w_buffer) && !bt_help(curbuf))\n# ifdef FEAT_QUICKFIX\n\t\t || wp->w_p_pvw\n# endif\n\t ) || wp == curwin) && wp != aucmd_win)\n\t ++count;\n return (count <= 1);\n}", "/*\n * Correct the cursor line number in other windows. Used after changing the\n * current buffer, and before applying autocommands.\n * When \"do_curwin\" is TRUE, also check current window.\n */\n void\ncheck_lnums(int do_curwin)\n{\n win_T\t*wp;\n tabpage_T\t*tp;", " FOR_ALL_TAB_WINDOWS(tp, wp)\n\tif ((do_curwin || wp != curwin) && wp->w_buffer == curbuf)\n\t{\n\t // save the original cursor position and topline\n\t wp->w_save_cursor.w_cursor_save = wp->w_cursor;\n\t wp->w_save_cursor.w_topline_save = wp->w_topline;", "\t if (wp->w_cursor.lnum > curbuf->b_ml.ml_line_count)\n\t\twp->w_cursor.lnum = curbuf->b_ml.ml_line_count;\n\t if (wp->w_topline > curbuf->b_ml.ml_line_count)\n\t\twp->w_topline = curbuf->b_ml.ml_line_count;", "\t // save the corrected cursor position and topline\n\t wp->w_save_cursor.w_cursor_corr = wp->w_cursor;\n\t wp->w_save_cursor.w_topline_corr = wp->w_topline;\n\t}\n}", "/*\n * Reset cursor and topline to its stored values from check_lnums().\n * check_lnums() must have been called first!\n */\n void\nreset_lnums()\n{\n win_T\t*wp;\n tabpage_T\t*tp;", " FOR_ALL_TAB_WINDOWS(tp, wp)\n\tif (wp->w_buffer == curbuf)\n\t{\n\t // Restore the value if the autocommand didn't change it.\n\t if (EQUAL_POS(wp->w_save_cursor.w_cursor_corr, wp->w_cursor))\n\t\twp->w_cursor = wp->w_save_cursor.w_cursor_save;\n\t if (wp->w_save_cursor.w_topline_corr == wp->w_topline)\n\t\twp->w_topline = wp->w_save_cursor.w_topline_save;\n\t}\n}", "/*\n * A snapshot of the window sizes, to restore them after closing the help\n * window.\n * Only these fields are used:\n * fr_layout\n * fr_width\n * fr_height\n * fr_next\n * fr_child\n * fr_win (only valid for the old curwin, NULL otherwise)\n */", "/*\n * Create a snapshot of the current frame sizes.\n */\n void\nmake_snapshot(int idx)\n{\n clear_snapshot(curtab, idx);\n make_snapshot_rec(topframe, &curtab->tp_snapshot[idx]);\n}", " static void\nmake_snapshot_rec(frame_T *fr, frame_T **frp)\n{\n *frp = ALLOC_CLEAR_ONE(frame_T);\n if (*frp == NULL)\n\treturn;\n (*frp)->fr_layout = fr->fr_layout;\n (*frp)->fr_width = fr->fr_width;\n (*frp)->fr_height = fr->fr_height;\n if (fr->fr_next != NULL)\n\tmake_snapshot_rec(fr->fr_next, &((*frp)->fr_next));\n if (fr->fr_child != NULL)\n\tmake_snapshot_rec(fr->fr_child, &((*frp)->fr_child));\n if (fr->fr_layout == FR_LEAF && fr->fr_win == curwin)\n\t(*frp)->fr_win = curwin;\n}", "/*\n * Remove any existing snapshot.\n */\n static void\nclear_snapshot(tabpage_T *tp, int idx)\n{\n clear_snapshot_rec(tp->tp_snapshot[idx]);\n tp->tp_snapshot[idx] = NULL;\n}", " static void\nclear_snapshot_rec(frame_T *fr)\n{\n if (fr != NULL)\n {\n\tclear_snapshot_rec(fr->fr_next);\n\tclear_snapshot_rec(fr->fr_child);\n\tvim_free(fr);\n }\n}", "/*\n * Restore a previously created snapshot, if there is any.\n * This is only done if the screen size didn't change and the window layout is\n * still the same.\n */\n void\nrestore_snapshot(\n int\t\tidx,\n int\t\tclose_curwin)\t /* closing current window */\n{\n win_T\t*wp;", " if (curtab->tp_snapshot[idx] != NULL\n\t && curtab->tp_snapshot[idx]->fr_width == topframe->fr_width\n\t && curtab->tp_snapshot[idx]->fr_height == topframe->fr_height\n\t && check_snapshot_rec(curtab->tp_snapshot[idx], topframe) == OK)\n {\n\twp = restore_snapshot_rec(curtab->tp_snapshot[idx], topframe);\n\twin_comp_pos();\n\tif (wp != NULL && close_curwin)\n\t win_goto(wp);\n\tredraw_all_later(NOT_VALID);\n }\n clear_snapshot(curtab, idx);\n}", "/*\n * Check if frames \"sn\" and \"fr\" have the same layout, same following frames\n * and same children. And the window pointer is valid.\n */\n static int\ncheck_snapshot_rec(frame_T *sn, frame_T *fr)\n{\n if (sn->fr_layout != fr->fr_layout\n\t || (sn->fr_next == NULL) != (fr->fr_next == NULL)\n\t || (sn->fr_child == NULL) != (fr->fr_child == NULL)\n\t || (sn->fr_next != NULL\n\t\t&& check_snapshot_rec(sn->fr_next, fr->fr_next) == FAIL)\n\t || (sn->fr_child != NULL\n\t\t&& check_snapshot_rec(sn->fr_child, fr->fr_child) == FAIL)\n\t || (sn->fr_win != NULL && !win_valid(sn->fr_win)))\n\treturn FAIL;\n return OK;\n}", "/*\n * Copy the size of snapshot frame \"sn\" to frame \"fr\". Do the same for all\n * following frames and children.\n * Returns a pointer to the old current window, or NULL.\n */\n static win_T *\nrestore_snapshot_rec(frame_T *sn, frame_T *fr)\n{\n win_T\t*wp = NULL;\n win_T\t*wp2;", " fr->fr_height = sn->fr_height;\n fr->fr_width = sn->fr_width;\n if (fr->fr_layout == FR_LEAF)\n {\n\tframe_new_height(fr, fr->fr_height, FALSE, FALSE);\n\tframe_new_width(fr, fr->fr_width, FALSE, FALSE);\n\twp = sn->fr_win;\n }\n if (sn->fr_next != NULL)\n {\n\twp2 = restore_snapshot_rec(sn->fr_next, fr->fr_next);\n\tif (wp2 != NULL)\n\t wp = wp2;\n }\n if (sn->fr_child != NULL)\n {\n\twp2 = restore_snapshot_rec(sn->fr_child, fr->fr_child);\n\tif (wp2 != NULL)\n\t wp = wp2;\n }\n return wp;\n}", "#if defined(FEAT_GUI) || defined(PROTO)\n/*\n * Return TRUE if there is any vertically split window.\n */\n int\nwin_hasvertsplit(void)\n{\n frame_T\t*fr;", " if (topframe->fr_layout == FR_ROW)\n\treturn TRUE;", " if (topframe->fr_layout == FR_COL)\n\tFOR_ALL_FRAMES(fr, topframe->fr_child)\n\t if (fr->fr_layout == FR_ROW)\n\t\treturn TRUE;", " return FALSE;\n}\n#endif", "#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) || defined(PROTO)\n int\nget_win_number(win_T *wp, win_T *first_win)\n{\n int\t\ti = 1;\n win_T\t*w;", " for (w = first_win; w != NULL && w != wp; w = W_NEXT(w))\n\t++i;", " if (w == NULL)\n\treturn 0;\n else\n\treturn i;\n}", " int\nget_tab_number(tabpage_T *tp UNUSED)\n{\n int\t\ti = 1;\n tabpage_T\t*t;", " for (t = first_tabpage; t != NULL && t != tp; t = t->tp_next)\n\t++i;", " if (t == NULL)\n\treturn 0;\n else\n\treturn i;\n}\n#endif", "/*\n * Return TRUE if \"topfrp\" and its children are at the right height.\n */\n static int\nframe_check_height(frame_T *topfrp, int height)\n{\n frame_T *frp;", " if (topfrp->fr_height != height)\n\treturn FALSE;", " if (topfrp->fr_layout == FR_ROW)\n\tFOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t if (frp->fr_height != height)\n\t\treturn FALSE;", " return TRUE;\n}", "/*\n * Return TRUE if \"topfrp\" and its children are at the right width.\n */\n static int\nframe_check_width(frame_T *topfrp, int width)\n{\n frame_T *frp;", " if (topfrp->fr_width != width)\n\treturn FALSE;", " if (topfrp->fr_layout == FR_COL)\n\tFOR_ALL_FRAMES(frp, topfrp->fr_child)\n\t if (frp->fr_width != width)\n\t\treturn FALSE;", " return TRUE;\n}", "#if defined(FEAT_SYN_HL) || defined(PROTO)\n/*\n * Simple int comparison function for use with qsort()\n */\n static int\nint_cmp(const void *a, const void *b)\n{\n return *(const int *)a - *(const int *)b;\n}", "/*\n * Handle setting 'colorcolumn' or 'textwidth' in window \"wp\".\n * Returns error message, NULL if it's OK.\n */\n char *\ncheck_colorcolumn(win_T *wp)\n{\n char_u\t*s;\n int\t\tcol;\n int\t\tcount = 0;\n int\t\tcolor_cols[256];\n int\t\ti;\n int\t\tj = 0;", " if (wp->w_buffer == NULL)\n\treturn NULL; // buffer was closed", " for (s = wp->w_p_cc; *s != NUL && count < 255;)\n {\n\tif (*s == '-' || *s == '+')\n\t{\n\t // -N and +N: add to 'textwidth'\n\t col = (*s == '-') ? -1 : 1;\n\t ++s;\n\t if (!VIM_ISDIGIT(*s))\n\t\treturn e_invarg;\n\t col = col * getdigits(&s);\n\t if (wp->w_buffer->b_p_tw == 0)\n\t\tgoto skip; // 'textwidth' not set, skip this item\n\t col += wp->w_buffer->b_p_tw;\n\t if (col < 0)\n\t\tgoto skip;\n\t}\n\telse if (VIM_ISDIGIT(*s))\n\t col = getdigits(&s);\n\telse\n\t return e_invarg;\n\tcolor_cols[count++] = col - 1; // 1-based to 0-based\nskip:\n\tif (*s == NUL)\n\t break;\n\tif (*s != ',')\n\t return e_invarg;\n\tif (*++s == NUL)\n\t return e_invarg; // illegal trailing comma as in \"set cc=80,\"\n }", " vim_free(wp->w_p_cc_cols);\n if (count == 0)\n\twp->w_p_cc_cols = NULL;\n else\n {\n\twp->w_p_cc_cols = ALLOC_MULT(int, count + 1);\n\tif (wp->w_p_cc_cols != NULL)\n\t{\n\t // sort the columns for faster usage on screen redraw inside\n\t // win_line()\n\t qsort(color_cols, count, sizeof(int), int_cmp);", "\t for (i = 0; i < count; ++i)\n\t\t// skip duplicates\n\t\tif (j == 0 || wp->w_p_cc_cols[j - 1] != color_cols[i])\n\t\t wp->w_p_cc_cols[j++] = color_cols[i];\n\t wp->w_p_cc_cols[j] = -1; // end marker\n\t}\n }", " return NULL; // no error\n}\n#endif" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [2290, 755, 4659], "buggy_code_start_loc": [2290, 755, 4643], "filenames": ["src/testdir/test_autocmd.vim", "src/version.c", "src/window.c"], "fixing_code_end_loc": [2299, 758, 4660], "fixing_code_start_loc": [2291, 756, 4644], "message": "The autocmd feature in window.c in Vim before 8.1.2136 accesses freed memory.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:vim:vim:*:*:*:*:*:*:*:*", "matchCriteriaId": "8BA1A77F-AC6C-4A51-A1C0-873DE3A2BF19", "versionEndExcluding": "8.1.2136", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "8.1.2121", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:12.04:*:*:*:esm:*:*:*", "matchCriteriaId": "8D305F7A-D159-4716-AB26-5E38BB5CD991", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:14.04:*:*:*:esm:*:*:*", "matchCriteriaId": "815D70A8-47D3-459C-A32C-9FEACA0659D1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:lts:*:*:*", "matchCriteriaId": "F7016A2A-8365-4F1A-89A2-7A19F2BCAE5B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:19.10:*:*:*:*:*:*:*", "matchCriteriaId": "A31C8344-3E02-4EB8-8BD8-4C84B7959624", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The autocmd feature in window.c in Vim before 8.1.2136 accesses freed memory."}, {"lang": "es", "value": "La funcionalidad autocmd en el archivo window.c en Vim versiones anteriores a la versi\u00f3n 8.1.2136, accede a la memoria liberada."}], "evaluatorComment": null, "id": "CVE-2019-20079", "lastModified": "2020-10-20T16:04:08.370", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-12-30T01:15:12.290", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/commit/ec66c41d84e574baf8009dbc0bd088d2bc5b2421"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/compare/v8.1.2135...v8.1.2136"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory", "VDB Entry"], "url": "https://packetstormsecurity.com/files/154898"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4309-1/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-416"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/vim/vim/commit/ec66c41d84e574baf8009dbc0bd088d2bc5b2421"}, "type": "CWE-416"}
352
Determine whether the {function_name} code is vulnerable or not.
[ "# Copyright 2021 The Matrix.org Foundation C.I.C.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nimport codecs", "import itertools", "import logging\nimport re", "from typing import TYPE_CHECKING, Dict, Generator, Iterable, Optional, Set, Union", "\nif TYPE_CHECKING:\n from lxml import etree", "logger = logging.getLogger(__name__)", "_charset_match = re.compile(\n rb'<\\s*meta[^>]*charset\\s*=\\s*\"?([a-z0-9_-]+)\"?', flags=re.I\n)\n_xml_encoding_match = re.compile(\n rb'\\s*<\\s*\\?\\s*xml[^>]*encoding=\"([a-z0-9_-]+)\"', flags=re.I\n)\n_content_type_match = re.compile(r'.*; *charset=\"?(.*?)\"?(;|$)', flags=re.I)", "# Certain elements aren't meant for display.\nARIA_ROLES_TO_IGNORE = {\"directory\", \"menu\", \"menubar\", \"toolbar\"}", "\ndef _normalise_encoding(encoding: str) -> Optional[str]:\n \"\"\"Use the Python codec's name as the normalised entry.\"\"\"\n try:\n return codecs.lookup(encoding).name\n except LookupError:\n return None", "\ndef _get_html_media_encodings(\n body: bytes, content_type: Optional[str]\n) -> Iterable[str]:\n \"\"\"\n Get potential encoding of the body based on the (presumably) HTML body or the content-type header.", " The precedence used for finding a character encoding is:", " 1. <meta> tag with a charset declared.\n 2. The XML document's character encoding attribute.\n 3. The Content-Type header.\n 4. Fallback to utf-8.\n 5. Fallback to windows-1252.", " This roughly follows the algorithm used by BeautifulSoup's bs4.dammit.EncodingDetector.", " Args:\n body: The HTML document, as bytes.\n content_type: The Content-Type header.", " Returns:\n The character encoding of the body, as a string.\n \"\"\"\n # There's no point in returning an encoding more than once.\n attempted_encodings: Set[str] = set()", " # Limit searches to the first 1kb, since it ought to be at the top.\n body_start = body[:1024]", " # Check if it has an encoding set in a meta tag.\n match = _charset_match.search(body_start)\n if match:\n encoding = _normalise_encoding(match.group(1).decode(\"ascii\"))\n if encoding:\n attempted_encodings.add(encoding)\n yield encoding", " # TODO Support <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>", " # Check if it has an XML document with an encoding.\n match = _xml_encoding_match.match(body_start)\n if match:\n encoding = _normalise_encoding(match.group(1).decode(\"ascii\"))\n if encoding and encoding not in attempted_encodings:\n attempted_encodings.add(encoding)\n yield encoding", " # Check the HTTP Content-Type header for a character set.\n if content_type:\n content_match = _content_type_match.match(content_type)\n if content_match:\n encoding = _normalise_encoding(content_match.group(1))\n if encoding and encoding not in attempted_encodings:\n attempted_encodings.add(encoding)\n yield encoding", " # Finally, fallback to UTF-8, then windows-1252.\n for fallback in (\"utf-8\", \"cp1252\"):\n if fallback not in attempted_encodings:\n yield fallback", "\ndef decode_body(\n body: bytes, uri: str, content_type: Optional[str] = None\n) -> Optional[\"etree.Element\"]:\n \"\"\"\n This uses lxml to parse the HTML document.", " Args:\n body: The HTML document, as bytes.\n uri: The URI used to download the body.\n content_type: The Content-Type header.", " Returns:\n The parsed HTML body, or None if an error occurred during processed.\n \"\"\"\n # If there's no body, nothing useful is going to be found.\n if not body:\n return None", " # The idea here is that multiple encodings are tried until one works.\n # Unfortunately the result is never used and then LXML will decode the string\n # again with the found encoding.\n for encoding in _get_html_media_encodings(body, content_type):\n try:\n body.decode(encoding)\n except Exception:\n pass\n else:\n break\n else:\n logger.warning(\"Unable to decode HTML body for %s\", uri)\n return None", " from lxml import etree", " # Create an HTML parser.\n parser = etree.HTMLParser(recover=True, encoding=encoding)", " # Attempt to parse the body. Returns None if the body was successfully\n # parsed, but no tree was found.\n return etree.fromstring(body, parser)", "\ndef parse_html_to_open_graph(tree: \"etree.Element\") -> Dict[str, Optional[str]]:\n \"\"\"\n Parse the HTML document into an Open Graph response.", " This uses lxml to search the HTML document for Open Graph data (or\n synthesizes it from the document).", " Args:\n tree: The parsed HTML document.", " Returns:\n The Open Graph response as a dictionary.\n \"\"\"", " # if we see any image URLs in the OG response, then spider them\n # (although the client could choose to do this by asking for previews of those\n # URLs to avoid DoSing the server)", " # \"og:type\" : \"video\",\n # \"og:url\" : \"https://www.youtube.com/watch?v=LXDBoHyjmtw\",\n # \"og:site_name\" : \"YouTube\",\n # \"og:video:type\" : \"application/x-shockwave-flash\",\n # \"og:description\" : \"Fun stuff happening here\",\n # \"og:title\" : \"RemoteJam - Matrix team hack for Disrupt Europe Hackathon\",\n # \"og:image\" : \"https://i.ytimg.com/vi/LXDBoHyjmtw/maxresdefault.jpg\",\n # \"og:video:url\" : \"http://www.youtube.com/v/LXDBoHyjmtw?version=3&autohide=1\",\n # \"og:video:width\" : \"1280\"\n # \"og:video:height\" : \"720\",\n # \"og:video:secure_url\": \"https://www.youtube.com/v/LXDBoHyjmtw?version=3\",", " og: Dict[str, Optional[str]] = {}\n for tag in tree.xpath(\n \"//*/meta[starts-with(@property, 'og:')][@content][not(@content='')]\"\n ):\n # if we've got more than 50 tags, someone is taking the piss\n if len(og) >= 50:\n logger.warning(\"Skipping OG for page with too many 'og:' tags\")\n return {}", " og[tag.attrib[\"property\"]] = tag.attrib[\"content\"]", " # TODO: grab article: meta tags too, e.g.:", " # \"article:publisher\" : \"https://www.facebook.com/thethudonline\" />\n # \"article:author\" content=\"https://www.facebook.com/thethudonline\" />\n # \"article:tag\" content=\"baby\" />\n # \"article:section\" content=\"Breaking News\" />\n # \"article:published_time\" content=\"2016-03-31T19:58:24+00:00\" />\n # \"article:modified_time\" content=\"2016-04-01T18:31:53+00:00\" />", " if \"og:title\" not in og:\n # Attempt to find a title from the title tag, or the biggest header on the page.\n title = tree.xpath(\"((//title)[1] | (//h1)[1] | (//h2)[1] | (//h3)[1])/text()\")\n if title:\n og[\"og:title\"] = title[0].strip()\n else:\n og[\"og:title\"] = None", " if \"og:image\" not in og:\n meta_image = tree.xpath(\n \"//*/meta[translate(@itemprop, 'IMAGE', 'image')='image'][not(@content='')]/@content[1]\"\n )\n # If a meta image is found, use it.\n if meta_image:\n og[\"og:image\"] = meta_image[0]\n else:\n # Try to find images which are larger than 10px by 10px.\n #\n # TODO: consider inlined CSS styles as well as width & height attribs\n images = tree.xpath(\"//img[@src][number(@width)>10][number(@height)>10]\")\n images = sorted(\n images,\n key=lambda i: (\n -1 * float(i.attrib[\"width\"]) * float(i.attrib[\"height\"])\n ),\n )\n # If no images were found, try to find *any* images.\n if not images:\n images = tree.xpath(\"//img[@src][1]\")\n if images:\n og[\"og:image\"] = images[0].attrib[\"src\"]", " # Finally, fallback to the favicon if nothing else.\n else:\n favicons = tree.xpath(\"//link[@href][contains(@rel, 'icon')]/@href[1]\")\n if favicons:\n og[\"og:image\"] = favicons[0]", " if \"og:description\" not in og:\n # Check the first meta description tag for content.\n meta_description = tree.xpath(\n \"//*/meta[translate(@name, 'DESCRIPTION', 'description')='description'][not(@content='')]/@content[1]\"\n )\n # If a meta description is found with content, use it.\n if meta_description:\n og[\"og:description\"] = meta_description[0]\n else:\n og[\"og:description\"] = parse_html_description(tree)\n elif og[\"og:description\"]:\n # This must be a non-empty string at this point.\n assert isinstance(og[\"og:description\"], str)\n og[\"og:description\"] = summarize_paragraphs([og[\"og:description\"]])", " # TODO: delete the url downloads to stop diskfilling,\n # as we only ever cared about its OG\n return og", "\ndef parse_html_description(tree: \"etree.Element\") -> Optional[str]:\n \"\"\"\n Calculate a text description based on an HTML document.", " Grabs any text nodes which are inside the <body/> tag, unless they are within\n an HTML5 semantic markup tag (<header/>, <nav/>, <aside/>, <footer/>), or\n if they are within a <script/>, <svg/> or <style/> tag, or if they are within\n a tag whose content is usually only shown to old browsers\n (<iframe/>, <video/>, <canvas/>, <picture/>).", " This is a very very very coarse approximation to a plain text render of the page.", " Args:\n tree: The parsed HTML document.", " Returns:\n The plain text description, or None if one cannot be generated.\n \"\"\"\n # We don't just use XPATH here as that is slow on some machines.", " from lxml import etree\n", " TAGS_TO_REMOVE = (", " \"header\",\n \"nav\",\n \"aside\",\n \"footer\",\n \"script\",\n \"noscript\",\n \"style\",\n \"svg\",\n \"iframe\",\n \"video\",\n \"canvas\",\n \"img\",\n \"picture\",\n etree.Comment,", " )", "\n # Split all the text nodes into paragraphs (by splitting on new\n # lines)\n text_nodes = (\n re.sub(r\"\\s+\", \"\\n\", el).strip()", " for el in _iterate_over_text(tree.find(\"body\"), *TAGS_TO_REMOVE)", " )\n return summarize_paragraphs(text_nodes)", "\ndef _iterate_over_text(", " tree: \"etree.Element\", *tags_to_ignore: Union[str, \"etree.Comment\"]", ") -> Generator[str, None, None]:\n \"\"\"Iterate over the tree returning text nodes in a depth first fashion,\n skipping text nodes inside certain tags.", " \"\"\"\n # This is basically a stack that we extend using itertools.chain.\n # This will either consist of an element to iterate over *or* a string", " # to be returned.", " elements = iter([tree])\n while True:\n el = next(elements, None)\n if el is None:\n return", "\n if isinstance(el, str):\n yield el\n elif el.tag not in tags_to_ignore:\n # If the element isn't meant for display, ignore it.\n if el.get(\"role\") in ARIA_ROLES_TO_IGNORE:\n continue", " # el.text is the text before the first child, so we can immediately\n # return it if the text exists.\n if el.text:\n yield el.text\n", " # We add to the stack all the elements children, interspersed with\n # each child's tail text (if it exists). The tail text of a node\n # is text that comes *after* the node, so we always include it even\n # if we ignore the child node.\n elements = itertools.chain(\n itertools.chain.from_iterable( # Basically a flatmap\n [child, child.tail] if child.tail else [child]\n for child in el.iterchildren()\n ),\n elements,\n )", "", "def summarize_paragraphs(\n text_nodes: Iterable[str], min_size: int = 200, max_size: int = 500\n) -> Optional[str]:\n \"\"\"\n Try to get a summary respecting first paragraph and then word boundaries.", " Args:\n text_nodes: The paragraphs to summarize.\n min_size: The minimum number of words to include.\n max_size: The maximum number of words to include.", " Returns:\n A summary of the text nodes, or None if that was not possible.\n \"\"\"", " # TODO: Respect sentences?", " description = \"\"", " # Keep adding paragraphs until we get to the MIN_SIZE.\n for text_node in text_nodes:\n if len(description) < min_size:\n text_node = re.sub(r\"[\\t \\r\\n]+\", \" \", text_node)\n description += text_node + \"\\n\\n\"\n else:\n break", " description = description.strip()\n description = re.sub(r\"[\\t ]+\", \" \", description)\n description = re.sub(r\"[\\t \\r\\n]*[\\r\\n]+\", \"\\n\\n\", description)", " # If the concatenation of paragraphs to get above MIN_SIZE\n # took us over MAX_SIZE, then we need to truncate mid paragraph\n if len(description) > max_size:\n new_desc = \"\"", " # This splits the paragraph into words, but keeping the\n # (preceding) whitespace intact so we can easily concat\n # words back together.\n for match in re.finditer(r\"\\s*\\S+\", description):\n word = match.group()", " # Keep adding words while the total length is less than\n # MAX_SIZE.\n if len(word) + len(new_desc) < max_size:\n new_desc += word\n else:\n # At this point the next word *will* take us over\n # MAX_SIZE, but we also want to ensure that its not\n # a huge word. If it is add it anyway and we'll\n # truncate later.\n if len(new_desc) < min_size:\n new_desc += word\n break", " # Double check that we're not over the limit\n if len(new_desc) > max_size:\n new_desc = new_desc[:max_size]", " # We always add an ellipsis because at the very least\n # we chopped mid paragraph.\n description = new_desc.strip() + \"…\"\n return description if description else None" ]
[ 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [343, 372], "buggy_code_start_loc": [15, 372], "filenames": ["synapse/rest/media/v1/preview_html.py", "tests/rest/media/v1/test_html_preview.py"], "fixing_code_end_loc": [358, 390], "fixing_code_start_loc": [14, 373], "message": "Synapse is an open source home server implementation for the Matrix chat network. In versions prior to 1.61.1 URL previews of some web pages can exhaust the available stack space for the Synapse process due to unbounded recursion. This is sometimes recoverable and leads to an error for the request causing the problem, but in other cases the Synapse process may crash altogether. It is possible to exploit this maliciously, either by malicious users on the homeserver, or by remote users sending URLs that a local user's client may automatically request a URL preview for. Remote users are not able to exploit this directly, because the URL preview endpoint is authenticated. Deployments with `url_preview_enabled: false` set in configuration are not affected. Deployments with `url_preview_enabled: true` set in configuration **are** affected. Deployments with no configuration value set for `url_preview_enabled` are not affected, because the default is `false`. Administrators of homeservers with URL previews enabled are advised to upgrade to v1.61.1 or higher. Users unable to upgrade should set `url_preview_enabled` to false.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:matrix:synapse:*:*:*:*:*:*:*:*", "matchCriteriaId": "52787569-D73B-46A3-99E8-EEB0D5971C69", "versionEndExcluding": "1.61.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*", "matchCriteriaId": "80E516C0-98A4-4ADE-B69F-66A772E2BAAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:*", "matchCriteriaId": "5C675112-476C-4D7C-BCB9-A2FB2D0BC9FD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Synapse is an open source home server implementation for the Matrix chat network. In versions prior to 1.61.1 URL previews of some web pages can exhaust the available stack space for the Synapse process due to unbounded recursion. This is sometimes recoverable and leads to an error for the request causing the problem, but in other cases the Synapse process may crash altogether. It is possible to exploit this maliciously, either by malicious users on the homeserver, or by remote users sending URLs that a local user's client may automatically request a URL preview for. Remote users are not able to exploit this directly, because the URL preview endpoint is authenticated. Deployments with `url_preview_enabled: false` set in configuration are not affected. Deployments with `url_preview_enabled: true` set in configuration **are** affected. Deployments with no configuration value set for `url_preview_enabled` are not affected, because the default is `false`. Administrators of homeservers with URL previews enabled are advised to upgrade to v1.61.1 or higher. Users unable to upgrade should set `url_preview_enabled` to false."}, {"lang": "es", "value": "Synapse es una implementaci\u00f3n de servidor dom\u00e9stico de c\u00f3digo abierto para la red de chat Matrix. En versiones anteriores a 1.61.1, las previsualizaciones de URL de algunas p\u00e1ginas web pueden agotar el espacio de pila disponible para el proceso de Synapse debido a una recursi\u00f3n sin l\u00edmites. Esto a veces es recuperable y conlleva a un error para la petici\u00f3n que causa el problema, pero en otros casos el proceso de Synapse puede bloquearse por completo. Es posible explotar esto de forma maliciosa, ya sea por usuarios maliciosos en el servidor dom\u00e9stico, o por usuarios remotos que env\u00edan URLs para las que el cliente de un usuario local puede solicitar autom\u00e1ticamente una visualizaci\u00f3n previa de la URL. Los usuarios remotos no son capaces de explotar esto directamente, porque el endpoint de la visualizaci\u00f3n previa de la URL est\u00e1 autenticado. Los despliegues con \"url_preview_enabled: false\" establecidos en la configuraci\u00f3n no est\u00e1n afectados. Los despliegues con \"url_preview_enabled: true\" establecido en la configuraci\u00f3n **est\u00e1n** afectados. Los despliegues sin valor de configuraci\u00f3n para \"url_preview_enabled\" no est\u00e1n afectados, porque el valor por defecto es \"false\". Es recomendado a administradores de servidores dom\u00e9sticos con visualizaciones previas de URL habilitadas que actualicen a versi\u00f3n v1.61.1 o superior. Los usuarios que no puedan actualizarse deben establecer \"url_preview_enabled\" en false"}], "evaluatorComment": null, "id": "CVE-2022-31052", "lastModified": "2022-07-09T00:15:29.740", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 3.5, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:S/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-06-28T17:15:08.217", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/matrix-org/synapse/commit/fa1308061802ac7b7d20e954ba7372c5ac292333"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/matrix-org/synapse/security/advisories/GHSA-22p3-qrh9-cx32"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/7EARKKJZ2W7WUITFDT4EG4NVATFYJQHF/"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QGSDQ4YAITCUACAB7SXQZDJIU3IQ4CJD/"}, {"source": "security-advisories@github.com", "tags": ["Vendor Advisory"], "url": "https://spec.matrix.org/v1.2/client-server-api/#get_matrixmediav3preview_url"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-674"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/matrix-org/synapse/commit/fa1308061802ac7b7d20e954ba7372c5ac292333"}, "type": "CWE-674"}
353
Determine whether the {function_name} code is vulnerable or not.
[ "# Copyright 2021 The Matrix.org Foundation C.I.C.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nimport codecs", "", "import logging\nimport re", "from typing import TYPE_CHECKING, Dict, Generator, Iterable, List, Optional, Set, Union", "\nif TYPE_CHECKING:\n from lxml import etree", "logger = logging.getLogger(__name__)", "_charset_match = re.compile(\n rb'<\\s*meta[^>]*charset\\s*=\\s*\"?([a-z0-9_-]+)\"?', flags=re.I\n)\n_xml_encoding_match = re.compile(\n rb'\\s*<\\s*\\?\\s*xml[^>]*encoding=\"([a-z0-9_-]+)\"', flags=re.I\n)\n_content_type_match = re.compile(r'.*; *charset=\"?(.*?)\"?(;|$)', flags=re.I)", "# Certain elements aren't meant for display.\nARIA_ROLES_TO_IGNORE = {\"directory\", \"menu\", \"menubar\", \"toolbar\"}", "\ndef _normalise_encoding(encoding: str) -> Optional[str]:\n \"\"\"Use the Python codec's name as the normalised entry.\"\"\"\n try:\n return codecs.lookup(encoding).name\n except LookupError:\n return None", "\ndef _get_html_media_encodings(\n body: bytes, content_type: Optional[str]\n) -> Iterable[str]:\n \"\"\"\n Get potential encoding of the body based on the (presumably) HTML body or the content-type header.", " The precedence used for finding a character encoding is:", " 1. <meta> tag with a charset declared.\n 2. The XML document's character encoding attribute.\n 3. The Content-Type header.\n 4. Fallback to utf-8.\n 5. Fallback to windows-1252.", " This roughly follows the algorithm used by BeautifulSoup's bs4.dammit.EncodingDetector.", " Args:\n body: The HTML document, as bytes.\n content_type: The Content-Type header.", " Returns:\n The character encoding of the body, as a string.\n \"\"\"\n # There's no point in returning an encoding more than once.\n attempted_encodings: Set[str] = set()", " # Limit searches to the first 1kb, since it ought to be at the top.\n body_start = body[:1024]", " # Check if it has an encoding set in a meta tag.\n match = _charset_match.search(body_start)\n if match:\n encoding = _normalise_encoding(match.group(1).decode(\"ascii\"))\n if encoding:\n attempted_encodings.add(encoding)\n yield encoding", " # TODO Support <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>", " # Check if it has an XML document with an encoding.\n match = _xml_encoding_match.match(body_start)\n if match:\n encoding = _normalise_encoding(match.group(1).decode(\"ascii\"))\n if encoding and encoding not in attempted_encodings:\n attempted_encodings.add(encoding)\n yield encoding", " # Check the HTTP Content-Type header for a character set.\n if content_type:\n content_match = _content_type_match.match(content_type)\n if content_match:\n encoding = _normalise_encoding(content_match.group(1))\n if encoding and encoding not in attempted_encodings:\n attempted_encodings.add(encoding)\n yield encoding", " # Finally, fallback to UTF-8, then windows-1252.\n for fallback in (\"utf-8\", \"cp1252\"):\n if fallback not in attempted_encodings:\n yield fallback", "\ndef decode_body(\n body: bytes, uri: str, content_type: Optional[str] = None\n) -> Optional[\"etree.Element\"]:\n \"\"\"\n This uses lxml to parse the HTML document.", " Args:\n body: The HTML document, as bytes.\n uri: The URI used to download the body.\n content_type: The Content-Type header.", " Returns:\n The parsed HTML body, or None if an error occurred during processed.\n \"\"\"\n # If there's no body, nothing useful is going to be found.\n if not body:\n return None", " # The idea here is that multiple encodings are tried until one works.\n # Unfortunately the result is never used and then LXML will decode the string\n # again with the found encoding.\n for encoding in _get_html_media_encodings(body, content_type):\n try:\n body.decode(encoding)\n except Exception:\n pass\n else:\n break\n else:\n logger.warning(\"Unable to decode HTML body for %s\", uri)\n return None", " from lxml import etree", " # Create an HTML parser.\n parser = etree.HTMLParser(recover=True, encoding=encoding)", " # Attempt to parse the body. Returns None if the body was successfully\n # parsed, but no tree was found.\n return etree.fromstring(body, parser)", "\ndef parse_html_to_open_graph(tree: \"etree.Element\") -> Dict[str, Optional[str]]:\n \"\"\"\n Parse the HTML document into an Open Graph response.", " This uses lxml to search the HTML document for Open Graph data (or\n synthesizes it from the document).", " Args:\n tree: The parsed HTML document.", " Returns:\n The Open Graph response as a dictionary.\n \"\"\"", " # if we see any image URLs in the OG response, then spider them\n # (although the client could choose to do this by asking for previews of those\n # URLs to avoid DoSing the server)", " # \"og:type\" : \"video\",\n # \"og:url\" : \"https://www.youtube.com/watch?v=LXDBoHyjmtw\",\n # \"og:site_name\" : \"YouTube\",\n # \"og:video:type\" : \"application/x-shockwave-flash\",\n # \"og:description\" : \"Fun stuff happening here\",\n # \"og:title\" : \"RemoteJam - Matrix team hack for Disrupt Europe Hackathon\",\n # \"og:image\" : \"https://i.ytimg.com/vi/LXDBoHyjmtw/maxresdefault.jpg\",\n # \"og:video:url\" : \"http://www.youtube.com/v/LXDBoHyjmtw?version=3&autohide=1\",\n # \"og:video:width\" : \"1280\"\n # \"og:video:height\" : \"720\",\n # \"og:video:secure_url\": \"https://www.youtube.com/v/LXDBoHyjmtw?version=3\",", " og: Dict[str, Optional[str]] = {}\n for tag in tree.xpath(\n \"//*/meta[starts-with(@property, 'og:')][@content][not(@content='')]\"\n ):\n # if we've got more than 50 tags, someone is taking the piss\n if len(og) >= 50:\n logger.warning(\"Skipping OG for page with too many 'og:' tags\")\n return {}", " og[tag.attrib[\"property\"]] = tag.attrib[\"content\"]", " # TODO: grab article: meta tags too, e.g.:", " # \"article:publisher\" : \"https://www.facebook.com/thethudonline\" />\n # \"article:author\" content=\"https://www.facebook.com/thethudonline\" />\n # \"article:tag\" content=\"baby\" />\n # \"article:section\" content=\"Breaking News\" />\n # \"article:published_time\" content=\"2016-03-31T19:58:24+00:00\" />\n # \"article:modified_time\" content=\"2016-04-01T18:31:53+00:00\" />", " if \"og:title\" not in og:\n # Attempt to find a title from the title tag, or the biggest header on the page.\n title = tree.xpath(\"((//title)[1] | (//h1)[1] | (//h2)[1] | (//h3)[1])/text()\")\n if title:\n og[\"og:title\"] = title[0].strip()\n else:\n og[\"og:title\"] = None", " if \"og:image\" not in og:\n meta_image = tree.xpath(\n \"//*/meta[translate(@itemprop, 'IMAGE', 'image')='image'][not(@content='')]/@content[1]\"\n )\n # If a meta image is found, use it.\n if meta_image:\n og[\"og:image\"] = meta_image[0]\n else:\n # Try to find images which are larger than 10px by 10px.\n #\n # TODO: consider inlined CSS styles as well as width & height attribs\n images = tree.xpath(\"//img[@src][number(@width)>10][number(@height)>10]\")\n images = sorted(\n images,\n key=lambda i: (\n -1 * float(i.attrib[\"width\"]) * float(i.attrib[\"height\"])\n ),\n )\n # If no images were found, try to find *any* images.\n if not images:\n images = tree.xpath(\"//img[@src][1]\")\n if images:\n og[\"og:image\"] = images[0].attrib[\"src\"]", " # Finally, fallback to the favicon if nothing else.\n else:\n favicons = tree.xpath(\"//link[@href][contains(@rel, 'icon')]/@href[1]\")\n if favicons:\n og[\"og:image\"] = favicons[0]", " if \"og:description\" not in og:\n # Check the first meta description tag for content.\n meta_description = tree.xpath(\n \"//*/meta[translate(@name, 'DESCRIPTION', 'description')='description'][not(@content='')]/@content[1]\"\n )\n # If a meta description is found with content, use it.\n if meta_description:\n og[\"og:description\"] = meta_description[0]\n else:\n og[\"og:description\"] = parse_html_description(tree)\n elif og[\"og:description\"]:\n # This must be a non-empty string at this point.\n assert isinstance(og[\"og:description\"], str)\n og[\"og:description\"] = summarize_paragraphs([og[\"og:description\"]])", " # TODO: delete the url downloads to stop diskfilling,\n # as we only ever cared about its OG\n return og", "\ndef parse_html_description(tree: \"etree.Element\") -> Optional[str]:\n \"\"\"\n Calculate a text description based on an HTML document.", " Grabs any text nodes which are inside the <body/> tag, unless they are within\n an HTML5 semantic markup tag (<header/>, <nav/>, <aside/>, <footer/>), or\n if they are within a <script/>, <svg/> or <style/> tag, or if they are within\n a tag whose content is usually only shown to old browsers\n (<iframe/>, <video/>, <canvas/>, <picture/>).", " This is a very very very coarse approximation to a plain text render of the page.", " Args:\n tree: The parsed HTML document.", " Returns:\n The plain text description, or None if one cannot be generated.\n \"\"\"\n # We don't just use XPATH here as that is slow on some machines.", " from lxml import etree\n", " TAGS_TO_REMOVE = {", " \"header\",\n \"nav\",\n \"aside\",\n \"footer\",\n \"script\",\n \"noscript\",\n \"style\",\n \"svg\",\n \"iframe\",\n \"video\",\n \"canvas\",\n \"img\",\n \"picture\",\n etree.Comment,", " }", "\n # Split all the text nodes into paragraphs (by splitting on new\n # lines)\n text_nodes = (\n re.sub(r\"\\s+\", \"\\n\", el).strip()", " for el in _iterate_over_text(tree.find(\"body\"), TAGS_TO_REMOVE)", " )\n return summarize_paragraphs(text_nodes)", "\ndef _iterate_over_text(", " tree: Optional[\"etree.Element\"],\n tags_to_ignore: Set[Union[str, \"etree.Comment\"]],\n stack_limit: int = 1024,", ") -> Generator[str, None, None]:\n \"\"\"Iterate over the tree returning text nodes in a depth first fashion,\n skipping text nodes inside certain tags.", "\n Args:\n tree: The parent element to iterate. Can be None if there isn't one.\n tags_to_ignore: Set of tags to ignore\n stack_limit: Maximum stack size limit for depth-first traversal.\n Nodes will be dropped if this limit is hit, which may truncate the\n textual result.\n Intended to limit the maximum working memory when generating a preview.\n \"\"\"", " if tree is None:\n return", " # This is a stack whose items are elements to iterate over *or* strings", " # to be returned.", " elements: List[Union[str, \"etree.Element\"]] = [tree]\n while elements:\n el = elements.pop()", "\n if isinstance(el, str):\n yield el\n elif el.tag not in tags_to_ignore:\n # If the element isn't meant for display, ignore it.\n if el.get(\"role\") in ARIA_ROLES_TO_IGNORE:\n continue", " # el.text is the text before the first child, so we can immediately\n # return it if the text exists.\n if el.text:\n yield el.text\n", " # We add to the stack all the element's children, interspersed with\n # each child's tail text (if it exists).\n #\n # We iterate in reverse order so that earlier pieces of text appear\n # closer to the top of the stack.\n for child in el.iterchildren(reversed=True):\n if len(elements) > stack_limit:\n # We've hit our limit for working memory\n break", " if child.tail:\n # The tail text of a node is text that comes *after* the node,\n # so we always include it even if we ignore the child node.\n elements.append(child.tail)", " elements.append(child)", "", "def summarize_paragraphs(\n text_nodes: Iterable[str], min_size: int = 200, max_size: int = 500\n) -> Optional[str]:\n \"\"\"\n Try to get a summary respecting first paragraph and then word boundaries.", " Args:\n text_nodes: The paragraphs to summarize.\n min_size: The minimum number of words to include.\n max_size: The maximum number of words to include.", " Returns:\n A summary of the text nodes, or None if that was not possible.\n \"\"\"", " # TODO: Respect sentences?", " description = \"\"", " # Keep adding paragraphs until we get to the MIN_SIZE.\n for text_node in text_nodes:\n if len(description) < min_size:\n text_node = re.sub(r\"[\\t \\r\\n]+\", \" \", text_node)\n description += text_node + \"\\n\\n\"\n else:\n break", " description = description.strip()\n description = re.sub(r\"[\\t ]+\", \" \", description)\n description = re.sub(r\"[\\t \\r\\n]*[\\r\\n]+\", \"\\n\\n\", description)", " # If the concatenation of paragraphs to get above MIN_SIZE\n # took us over MAX_SIZE, then we need to truncate mid paragraph\n if len(description) > max_size:\n new_desc = \"\"", " # This splits the paragraph into words, but keeping the\n # (preceding) whitespace intact so we can easily concat\n # words back together.\n for match in re.finditer(r\"\\s*\\S+\", description):\n word = match.group()", " # Keep adding words while the total length is less than\n # MAX_SIZE.\n if len(word) + len(new_desc) < max_size:\n new_desc += word\n else:\n # At this point the next word *will* take us over\n # MAX_SIZE, but we also want to ensure that its not\n # a huge word. If it is add it anyway and we'll\n # truncate later.\n if len(new_desc) < min_size:\n new_desc += word\n break", " # Double check that we're not over the limit\n if len(new_desc) > max_size:\n new_desc = new_desc[:max_size]", " # We always add an ellipsis because at the very least\n # we chopped mid paragraph.\n description = new_desc.strip() + \"…\"\n return description if description else None" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [343, 372], "buggy_code_start_loc": [15, 372], "filenames": ["synapse/rest/media/v1/preview_html.py", "tests/rest/media/v1/test_html_preview.py"], "fixing_code_end_loc": [358, 390], "fixing_code_start_loc": [14, 373], "message": "Synapse is an open source home server implementation for the Matrix chat network. In versions prior to 1.61.1 URL previews of some web pages can exhaust the available stack space for the Synapse process due to unbounded recursion. This is sometimes recoverable and leads to an error for the request causing the problem, but in other cases the Synapse process may crash altogether. It is possible to exploit this maliciously, either by malicious users on the homeserver, or by remote users sending URLs that a local user's client may automatically request a URL preview for. Remote users are not able to exploit this directly, because the URL preview endpoint is authenticated. Deployments with `url_preview_enabled: false` set in configuration are not affected. Deployments with `url_preview_enabled: true` set in configuration **are** affected. Deployments with no configuration value set for `url_preview_enabled` are not affected, because the default is `false`. Administrators of homeservers with URL previews enabled are advised to upgrade to v1.61.1 or higher. Users unable to upgrade should set `url_preview_enabled` to false.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:matrix:synapse:*:*:*:*:*:*:*:*", "matchCriteriaId": "52787569-D73B-46A3-99E8-EEB0D5971C69", "versionEndExcluding": "1.61.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*", "matchCriteriaId": "80E516C0-98A4-4ADE-B69F-66A772E2BAAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:*", "matchCriteriaId": "5C675112-476C-4D7C-BCB9-A2FB2D0BC9FD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Synapse is an open source home server implementation for the Matrix chat network. In versions prior to 1.61.1 URL previews of some web pages can exhaust the available stack space for the Synapse process due to unbounded recursion. This is sometimes recoverable and leads to an error for the request causing the problem, but in other cases the Synapse process may crash altogether. It is possible to exploit this maliciously, either by malicious users on the homeserver, or by remote users sending URLs that a local user's client may automatically request a URL preview for. Remote users are not able to exploit this directly, because the URL preview endpoint is authenticated. Deployments with `url_preview_enabled: false` set in configuration are not affected. Deployments with `url_preview_enabled: true` set in configuration **are** affected. Deployments with no configuration value set for `url_preview_enabled` are not affected, because the default is `false`. Administrators of homeservers with URL previews enabled are advised to upgrade to v1.61.1 or higher. Users unable to upgrade should set `url_preview_enabled` to false."}, {"lang": "es", "value": "Synapse es una implementaci\u00f3n de servidor dom\u00e9stico de c\u00f3digo abierto para la red de chat Matrix. En versiones anteriores a 1.61.1, las previsualizaciones de URL de algunas p\u00e1ginas web pueden agotar el espacio de pila disponible para el proceso de Synapse debido a una recursi\u00f3n sin l\u00edmites. Esto a veces es recuperable y conlleva a un error para la petici\u00f3n que causa el problema, pero en otros casos el proceso de Synapse puede bloquearse por completo. Es posible explotar esto de forma maliciosa, ya sea por usuarios maliciosos en el servidor dom\u00e9stico, o por usuarios remotos que env\u00edan URLs para las que el cliente de un usuario local puede solicitar autom\u00e1ticamente una visualizaci\u00f3n previa de la URL. Los usuarios remotos no son capaces de explotar esto directamente, porque el endpoint de la visualizaci\u00f3n previa de la URL est\u00e1 autenticado. Los despliegues con \"url_preview_enabled: false\" establecidos en la configuraci\u00f3n no est\u00e1n afectados. Los despliegues con \"url_preview_enabled: true\" establecido en la configuraci\u00f3n **est\u00e1n** afectados. Los despliegues sin valor de configuraci\u00f3n para \"url_preview_enabled\" no est\u00e1n afectados, porque el valor por defecto es \"false\". Es recomendado a administradores de servidores dom\u00e9sticos con visualizaciones previas de URL habilitadas que actualicen a versi\u00f3n v1.61.1 o superior. Los usuarios que no puedan actualizarse deben establecer \"url_preview_enabled\" en false"}], "evaluatorComment": null, "id": "CVE-2022-31052", "lastModified": "2022-07-09T00:15:29.740", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 3.5, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:S/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-06-28T17:15:08.217", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/matrix-org/synapse/commit/fa1308061802ac7b7d20e954ba7372c5ac292333"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/matrix-org/synapse/security/advisories/GHSA-22p3-qrh9-cx32"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/7EARKKJZ2W7WUITFDT4EG4NVATFYJQHF/"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QGSDQ4YAITCUACAB7SXQZDJIU3IQ4CJD/"}, {"source": "security-advisories@github.com", "tags": ["Vendor Advisory"], "url": "https://spec.matrix.org/v1.2/client-server-api/#get_matrixmediav3preview_url"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-674"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/matrix-org/synapse/commit/fa1308061802ac7b7d20e954ba7372c5ac292333"}, "type": "CWE-674"}
353
Determine whether the {function_name} code is vulnerable or not.
[ "# Copyright 2014-2016 OpenMarket Ltd\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.", "from synapse.rest.media.v1.preview_html import (\n _get_html_media_encodings,\n decode_body,\n parse_html_to_open_graph,\n summarize_paragraphs,\n)", "from tests import unittest", "try:\n import lxml\nexcept ImportError:\n lxml = None", "\nclass SummarizeTestCase(unittest.TestCase):\n if not lxml:\n skip = \"url preview feature requires lxml\"", " def test_long_summarize(self) -> None:\n example_paras = [\n \"\"\"Tromsø (Norwegian pronunciation: [ˈtrʊmsœ] ( listen); Northern Sami:\n Romsa; Finnish: Tromssa[2] Kven: Tromssa) is a city and municipality in\n Troms county, Norway. The administrative centre of the municipality is\n the city of Tromsø. Outside of Norway, Tromso and Tromsö are\n alternative spellings of the city.Tromsø is considered the northernmost\n city in the world with a population above 50,000. The most populous town\n north of it is Alta, Norway, with a population of 14,272 (2013).\"\"\",\n \"\"\"Tromsø lies in Northern Norway. The municipality has a population of\n (2015) 72,066, but with an annual influx of students it has over 75,000\n most of the year. It is the largest urban area in Northern Norway and the\n third largest north of the Arctic Circle (following Murmansk and Norilsk).\n Most of Tromsø, including the city centre, is located on the island of\n Tromsøya, 350 kilometres (217 mi) north of the Arctic Circle. In 2012,\n Tromsøya had a population of 36,088. Substantial parts of the urban area\n are also situated on the mainland to the east, and on parts of Kvaløya—a\n large island to the west. Tromsøya is connected to the mainland by the Tromsø\n Bridge and the Tromsøysund Tunnel, and to the island of Kvaløya by the\n Sandnessund Bridge. Tromsø Airport connects the city to many destinations\n in Europe. The city is warmer than most other places located on the same\n latitude, due to the warming effect of the Gulf Stream.\"\"\",\n \"\"\"The city centre of Tromsø contains the highest number of old wooden\n houses in Northern Norway, the oldest house dating from 1789. The Arctic\n Cathedral, a modern church from 1965, is probably the most famous landmark\n in Tromsø. The city is a cultural centre for its region, with several\n festivals taking place in the summer. Some of Norway's best-known\n musicians, Torbjørn Brundtland and Svein Berge of the electronica duo\n Röyksopp and Lene Marlin grew up and started their careers in Tromsø.\n Noted electronic musician Geir Jenssen also hails from Tromsø.\"\"\",\n ]", " desc = summarize_paragraphs(example_paras, min_size=200, max_size=500)", " self.assertEqual(\n desc,\n \"Tromsø (Norwegian pronunciation: [ˈtrʊmsœ] ( listen); Northern Sami:\"\n \" Romsa; Finnish: Tromssa[2] Kven: Tromssa) is a city and municipality in\"\n \" Troms county, Norway. The administrative centre of the municipality is\"\n \" the city of Tromsø. Outside of Norway, Tromso and Tromsö are\"\n \" alternative spellings of the city.Tromsø is considered the northernmost\"\n \" city in the world with a population above 50,000. The most populous town\"\n \" north of it is Alta, Norway, with a population of 14,272 (2013).\",\n )", " desc = summarize_paragraphs(example_paras[1:], min_size=200, max_size=500)", " self.assertEqual(\n desc,\n \"Tromsø lies in Northern Norway. The municipality has a population of\"\n \" (2015) 72,066, but with an annual influx of students it has over 75,000\"\n \" most of the year. It is the largest urban area in Northern Norway and the\"\n \" third largest north of the Arctic Circle (following Murmansk and Norilsk).\"\n \" Most of Tromsø, including the city centre, is located on the island of\"\n \" Tromsøya, 350 kilometres (217 mi) north of the Arctic Circle. In 2012,\"\n \" Tromsøya had a population of 36,088. Substantial parts of the urban…\",\n )", " def test_short_summarize(self) -> None:\n example_paras = [\n \"Tromsø (Norwegian pronunciation: [ˈtrʊmsœ] ( listen); Northern Sami:\"\n \" Romsa; Finnish: Tromssa[2] Kven: Tromssa) is a city and municipality in\"\n \" Troms county, Norway.\",\n \"Tromsø lies in Northern Norway. The municipality has a population of\"\n \" (2015) 72,066, but with an annual influx of students it has over 75,000\"\n \" most of the year.\",\n \"The city centre of Tromsø contains the highest number of old wooden\"\n \" houses in Northern Norway, the oldest house dating from 1789. The Arctic\"\n \" Cathedral, a modern church from 1965, is probably the most famous landmark\"\n \" in Tromsø.\",\n ]", " desc = summarize_paragraphs(example_paras, min_size=200, max_size=500)", " self.assertEqual(\n desc,\n \"Tromsø (Norwegian pronunciation: [ˈtrʊmsœ] ( listen); Northern Sami:\"\n \" Romsa; Finnish: Tromssa[2] Kven: Tromssa) is a city and municipality in\"\n \" Troms county, Norway.\\n\"\n \"\\n\"\n \"Tromsø lies in Northern Norway. The municipality has a population of\"\n \" (2015) 72,066, but with an annual influx of students it has over 75,000\"\n \" most of the year.\",\n )", " def test_small_then_large_summarize(self) -> None:\n example_paras = [\n \"Tromsø (Norwegian pronunciation: [ˈtrʊmsœ] ( listen); Northern Sami:\"\n \" Romsa; Finnish: Tromssa[2] Kven: Tromssa) is a city and municipality in\"\n \" Troms county, Norway.\",\n \"Tromsø lies in Northern Norway. The municipality has a population of\"\n \" (2015) 72,066, but with an annual influx of students it has over 75,000\"\n \" most of the year.\"\n \" The city centre of Tromsø contains the highest number of old wooden\"\n \" houses in Northern Norway, the oldest house dating from 1789. The Arctic\"\n \" Cathedral, a modern church from 1965, is probably the most famous landmark\"\n \" in Tromsø.\",\n ]", " desc = summarize_paragraphs(example_paras, min_size=200, max_size=500)\n self.assertEqual(\n desc,\n \"Tromsø (Norwegian pronunciation: [ˈtrʊmsœ] ( listen); Northern Sami:\"\n \" Romsa; Finnish: Tromssa[2] Kven: Tromssa) is a city and municipality in\"\n \" Troms county, Norway.\\n\"\n \"\\n\"\n \"Tromsø lies in Northern Norway. The municipality has a population of\"\n \" (2015) 72,066, but with an annual influx of students it has over 75,000\"\n \" most of the year. The city centre of Tromsø contains the highest number\"\n \" of old wooden houses in Northern Norway, the oldest house dating from\"\n \" 1789. The Arctic Cathedral, a modern church from…\",\n )", "\nclass OpenGraphFromHtmlTestCase(unittest.TestCase):\n if not lxml:\n skip = \"url preview feature requires lxml\"", " def test_simple(self) -> None:\n html = b\"\"\"\n <html>\n <head><title>Foo</title></head>\n <body>\n Some text.\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(og, {\"og:title\": \"Foo\", \"og:description\": \"Some text.\"})", " def test_comment(self) -> None:\n html = b\"\"\"\n <html>\n <head><title>Foo</title></head>\n <body>\n <!-- HTML comment -->\n Some text.\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(og, {\"og:title\": \"Foo\", \"og:description\": \"Some text.\"})", " def test_comment2(self) -> None:\n html = b\"\"\"\n <html>\n <head><title>Foo</title></head>\n <body>\n Some text.\n <!-- HTML comment -->\n Some more text.\n <p>Text</p>\n More text\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(\n og,\n {\n \"og:title\": \"Foo\",\n \"og:description\": \"Some text.\\n\\nSome more text.\\n\\nText\\n\\nMore text\",\n },\n )", " def test_script(self) -> None:\n html = b\"\"\"\n <html>\n <head><title>Foo</title></head>\n <body>\n <script> (function() {})() </script>\n Some text.\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(og, {\"og:title\": \"Foo\", \"og:description\": \"Some text.\"})", " def test_missing_title(self) -> None:\n html = b\"\"\"\n <html>\n <body>\n Some text.\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(og, {\"og:title\": None, \"og:description\": \"Some text.\"})", " # Another variant is a title with no content.\n html = b\"\"\"\n <html>\n <head><title></title></head>\n <body>\n <h1>Title</h1>\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(og, {\"og:title\": \"Title\", \"og:description\": \"Title\"})", " def test_h1_as_title(self) -> None:\n html = b\"\"\"\n <html>\n <meta property=\"og:description\" content=\"Some text.\"/>\n <body>\n <h1>Title</h1>\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(og, {\"og:title\": \"Title\", \"og:description\": \"Some text.\"})", " def test_empty_description(self) -> None:\n \"\"\"Description tags with empty content should be ignored.\"\"\"\n html = b\"\"\"\n <html>\n <meta property=\"og:description\" content=\"\"/>\n <meta property=\"og:description\"/>\n <meta name=\"description\" content=\"\"/>\n <meta name=\"description\"/>\n <meta name=\"description\" content=\"Finally!\"/>\n <body>\n <h1>Title</h1>\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(og, {\"og:title\": \"Title\", \"og:description\": \"Finally!\"})", " def test_missing_title_and_broken_h1(self) -> None:\n html = b\"\"\"\n <html>\n <body>\n <h1><a href=\"foo\"/></h1>\n Some text.\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(og, {\"og:title\": None, \"og:description\": \"Some text.\"})", " def test_empty(self) -> None:\n \"\"\"Test a body with no data in it.\"\"\"\n html = b\"\"\n tree = decode_body(html, \"http://example.com/test.html\")\n self.assertIsNone(tree)", " def test_no_tree(self) -> None:\n \"\"\"A valid body with no tree in it.\"\"\"\n html = b\"\\x00\"\n tree = decode_body(html, \"http://example.com/test.html\")\n self.assertIsNone(tree)", " def test_xml(self) -> None:\n \"\"\"Test decoding XML and ensure it works properly.\"\"\"\n # Note that the strip() call is important to ensure the xml tag starts\n # at the initial byte.\n html = b\"\"\"\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>", " <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n <head><title>Foo</title></head><body>Some text.</body></html>\n \"\"\".strip()\n tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)\n self.assertEqual(og, {\"og:title\": \"Foo\", \"og:description\": \"Some text.\"})", " def test_invalid_encoding(self) -> None:\n \"\"\"An invalid character encoding should be ignored and treated as UTF-8, if possible.\"\"\"\n html = b\"\"\"\n <html>\n <head><title>Foo</title></head>\n <body>\n Some text.\n </body>\n </html>\n \"\"\"\n tree = decode_body(html, \"http://example.com/test.html\", \"invalid-encoding\")\n og = parse_html_to_open_graph(tree)\n self.assertEqual(og, {\"og:title\": \"Foo\", \"og:description\": \"Some text.\"})", " def test_invalid_encoding2(self) -> None:\n \"\"\"A body which doesn't match the sent character encoding.\"\"\"\n # Note that this contains an invalid UTF-8 sequence in the title.\n html = b\"\"\"\n <html>\n <head><title>\\xff\\xff Foo</title></head>\n <body>\n Some text.\n </body>\n </html>\n \"\"\"\n tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)\n self.assertEqual(og, {\"og:title\": \"ÿÿ Foo\", \"og:description\": \"Some text.\"})", " def test_windows_1252(self) -> None:\n \"\"\"A body which uses cp1252, but doesn't declare that.\"\"\"\n html = b\"\"\"\n <html>\n <head><title>\\xf3</title></head>\n <body>\n Some text.\n </body>\n </html>\n \"\"\"\n tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)\n self.assertEqual(og, {\"og:title\": \"ó\", \"og:description\": \"Some text.\"})\n", "", "\nclass MediaEncodingTestCase(unittest.TestCase):\n def test_meta_charset(self) -> None:\n \"\"\"A character encoding is found via the meta tag.\"\"\"\n encodings = _get_html_media_encodings(\n b\"\"\"\n <html>\n <head><meta charset=\"ascii\">\n </head>\n </html>\n \"\"\",\n \"text/html\",\n )\n self.assertEqual(list(encodings), [\"ascii\", \"utf-8\", \"cp1252\"])", " # A less well-formed version.\n encodings = _get_html_media_encodings(\n b\"\"\"\n <html>\n <head>< meta charset = ascii>\n </head>\n </html>\n \"\"\",\n \"text/html\",\n )\n self.assertEqual(list(encodings), [\"ascii\", \"utf-8\", \"cp1252\"])", " def test_meta_charset_underscores(self) -> None:\n \"\"\"A character encoding contains underscore.\"\"\"\n encodings = _get_html_media_encodings(\n b\"\"\"\n <html>\n <head><meta charset=\"Shift_JIS\">\n </head>\n </html>\n \"\"\",\n \"text/html\",\n )\n self.assertEqual(list(encodings), [\"shift_jis\", \"utf-8\", \"cp1252\"])", " def test_xml_encoding(self) -> None:\n \"\"\"A character encoding is found via the meta tag.\"\"\"\n encodings = _get_html_media_encodings(\n b\"\"\"\n <?xml version=\"1.0\" encoding=\"ascii\"?>\n <html>\n </html>\n \"\"\",\n \"text/html\",\n )\n self.assertEqual(list(encodings), [\"ascii\", \"utf-8\", \"cp1252\"])", " def test_meta_xml_encoding(self) -> None:\n \"\"\"Meta tags take precedence over XML encoding.\"\"\"\n encodings = _get_html_media_encodings(\n b\"\"\"\n <?xml version=\"1.0\" encoding=\"ascii\"?>\n <html>\n <head><meta charset=\"UTF-16\">\n </head>\n </html>\n \"\"\",\n \"text/html\",\n )\n self.assertEqual(list(encodings), [\"utf-16\", \"ascii\", \"utf-8\", \"cp1252\"])", " def test_content_type(self) -> None:\n \"\"\"A character encoding is found via the Content-Type header.\"\"\"\n # Test a few variations of the header.\n headers = (\n 'text/html; charset=\"ascii\";',\n \"text/html;charset=ascii;\",\n 'text/html; charset=\"ascii\"',\n \"text/html; charset=ascii\",\n 'text/html; charset=\"ascii;',\n 'text/html; charset=ascii\";',\n )\n for header in headers:\n encodings = _get_html_media_encodings(b\"\", header)\n self.assertEqual(list(encodings), [\"ascii\", \"utf-8\", \"cp1252\"])", " def test_fallback(self) -> None:\n \"\"\"A character encoding cannot be found in the body or header.\"\"\"\n encodings = _get_html_media_encodings(b\"\", \"text/html\")\n self.assertEqual(list(encodings), [\"utf-8\", \"cp1252\"])", " def test_duplicates(self) -> None:\n \"\"\"Ensure each encoding is only attempted once.\"\"\"\n encodings = _get_html_media_encodings(\n b\"\"\"\n <?xml version=\"1.0\" encoding=\"utf8\"?>\n <html>\n <head><meta charset=\"UTF-8\">\n </head>\n </html>\n \"\"\",\n 'text/html; charset=\"UTF_8\"',\n )\n self.assertEqual(list(encodings), [\"utf-8\", \"cp1252\"])", " def test_unknown_invalid(self) -> None:\n \"\"\"A character encoding should be ignored if it is unknown or invalid.\"\"\"\n encodings = _get_html_media_encodings(\n b\"\"\"\n <html>\n <head><meta charset=\"invalid\">\n </head>\n </html>\n \"\"\",\n 'text/html; charset=\"invalid\"',\n )\n self.assertEqual(list(encodings), [\"utf-8\", \"cp1252\"])" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [343, 372], "buggy_code_start_loc": [15, 372], "filenames": ["synapse/rest/media/v1/preview_html.py", "tests/rest/media/v1/test_html_preview.py"], "fixing_code_end_loc": [358, 390], "fixing_code_start_loc": [14, 373], "message": "Synapse is an open source home server implementation for the Matrix chat network. In versions prior to 1.61.1 URL previews of some web pages can exhaust the available stack space for the Synapse process due to unbounded recursion. This is sometimes recoverable and leads to an error for the request causing the problem, but in other cases the Synapse process may crash altogether. It is possible to exploit this maliciously, either by malicious users on the homeserver, or by remote users sending URLs that a local user's client may automatically request a URL preview for. Remote users are not able to exploit this directly, because the URL preview endpoint is authenticated. Deployments with `url_preview_enabled: false` set in configuration are not affected. Deployments with `url_preview_enabled: true` set in configuration **are** affected. Deployments with no configuration value set for `url_preview_enabled` are not affected, because the default is `false`. Administrators of homeservers with URL previews enabled are advised to upgrade to v1.61.1 or higher. Users unable to upgrade should set `url_preview_enabled` to false.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:matrix:synapse:*:*:*:*:*:*:*:*", "matchCriteriaId": "52787569-D73B-46A3-99E8-EEB0D5971C69", "versionEndExcluding": "1.61.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*", "matchCriteriaId": "80E516C0-98A4-4ADE-B69F-66A772E2BAAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:*", "matchCriteriaId": "5C675112-476C-4D7C-BCB9-A2FB2D0BC9FD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Synapse is an open source home server implementation for the Matrix chat network. In versions prior to 1.61.1 URL previews of some web pages can exhaust the available stack space for the Synapse process due to unbounded recursion. This is sometimes recoverable and leads to an error for the request causing the problem, but in other cases the Synapse process may crash altogether. It is possible to exploit this maliciously, either by malicious users on the homeserver, or by remote users sending URLs that a local user's client may automatically request a URL preview for. Remote users are not able to exploit this directly, because the URL preview endpoint is authenticated. Deployments with `url_preview_enabled: false` set in configuration are not affected. Deployments with `url_preview_enabled: true` set in configuration **are** affected. Deployments with no configuration value set for `url_preview_enabled` are not affected, because the default is `false`. Administrators of homeservers with URL previews enabled are advised to upgrade to v1.61.1 or higher. Users unable to upgrade should set `url_preview_enabled` to false."}, {"lang": "es", "value": "Synapse es una implementaci\u00f3n de servidor dom\u00e9stico de c\u00f3digo abierto para la red de chat Matrix. En versiones anteriores a 1.61.1, las previsualizaciones de URL de algunas p\u00e1ginas web pueden agotar el espacio de pila disponible para el proceso de Synapse debido a una recursi\u00f3n sin l\u00edmites. Esto a veces es recuperable y conlleva a un error para la petici\u00f3n que causa el problema, pero en otros casos el proceso de Synapse puede bloquearse por completo. Es posible explotar esto de forma maliciosa, ya sea por usuarios maliciosos en el servidor dom\u00e9stico, o por usuarios remotos que env\u00edan URLs para las que el cliente de un usuario local puede solicitar autom\u00e1ticamente una visualizaci\u00f3n previa de la URL. Los usuarios remotos no son capaces de explotar esto directamente, porque el endpoint de la visualizaci\u00f3n previa de la URL est\u00e1 autenticado. Los despliegues con \"url_preview_enabled: false\" establecidos en la configuraci\u00f3n no est\u00e1n afectados. Los despliegues con \"url_preview_enabled: true\" establecido en la configuraci\u00f3n **est\u00e1n** afectados. Los despliegues sin valor de configuraci\u00f3n para \"url_preview_enabled\" no est\u00e1n afectados, porque el valor por defecto es \"false\". Es recomendado a administradores de servidores dom\u00e9sticos con visualizaciones previas de URL habilitadas que actualicen a versi\u00f3n v1.61.1 o superior. Los usuarios que no puedan actualizarse deben establecer \"url_preview_enabled\" en false"}], "evaluatorComment": null, "id": "CVE-2022-31052", "lastModified": "2022-07-09T00:15:29.740", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 3.5, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:S/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-06-28T17:15:08.217", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/matrix-org/synapse/commit/fa1308061802ac7b7d20e954ba7372c5ac292333"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/matrix-org/synapse/security/advisories/GHSA-22p3-qrh9-cx32"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/7EARKKJZ2W7WUITFDT4EG4NVATFYJQHF/"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QGSDQ4YAITCUACAB7SXQZDJIU3IQ4CJD/"}, {"source": "security-advisories@github.com", "tags": ["Vendor Advisory"], "url": "https://spec.matrix.org/v1.2/client-server-api/#get_matrixmediav3preview_url"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-674"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/matrix-org/synapse/commit/fa1308061802ac7b7d20e954ba7372c5ac292333"}, "type": "CWE-674"}
353
Determine whether the {function_name} code is vulnerable or not.
[ "# Copyright 2014-2016 OpenMarket Ltd\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.", "from synapse.rest.media.v1.preview_html import (\n _get_html_media_encodings,\n decode_body,\n parse_html_to_open_graph,\n summarize_paragraphs,\n)", "from tests import unittest", "try:\n import lxml\nexcept ImportError:\n lxml = None", "\nclass SummarizeTestCase(unittest.TestCase):\n if not lxml:\n skip = \"url preview feature requires lxml\"", " def test_long_summarize(self) -> None:\n example_paras = [\n \"\"\"Tromsø (Norwegian pronunciation: [ˈtrʊmsœ] ( listen); Northern Sami:\n Romsa; Finnish: Tromssa[2] Kven: Tromssa) is a city and municipality in\n Troms county, Norway. The administrative centre of the municipality is\n the city of Tromsø. Outside of Norway, Tromso and Tromsö are\n alternative spellings of the city.Tromsø is considered the northernmost\n city in the world with a population above 50,000. The most populous town\n north of it is Alta, Norway, with a population of 14,272 (2013).\"\"\",\n \"\"\"Tromsø lies in Northern Norway. The municipality has a population of\n (2015) 72,066, but with an annual influx of students it has over 75,000\n most of the year. It is the largest urban area in Northern Norway and the\n third largest north of the Arctic Circle (following Murmansk and Norilsk).\n Most of Tromsø, including the city centre, is located on the island of\n Tromsøya, 350 kilometres (217 mi) north of the Arctic Circle. In 2012,\n Tromsøya had a population of 36,088. Substantial parts of the urban area\n are also situated on the mainland to the east, and on parts of Kvaløya—a\n large island to the west. Tromsøya is connected to the mainland by the Tromsø\n Bridge and the Tromsøysund Tunnel, and to the island of Kvaløya by the\n Sandnessund Bridge. Tromsø Airport connects the city to many destinations\n in Europe. The city is warmer than most other places located on the same\n latitude, due to the warming effect of the Gulf Stream.\"\"\",\n \"\"\"The city centre of Tromsø contains the highest number of old wooden\n houses in Northern Norway, the oldest house dating from 1789. The Arctic\n Cathedral, a modern church from 1965, is probably the most famous landmark\n in Tromsø. The city is a cultural centre for its region, with several\n festivals taking place in the summer. Some of Norway's best-known\n musicians, Torbjørn Brundtland and Svein Berge of the electronica duo\n Röyksopp and Lene Marlin grew up and started their careers in Tromsø.\n Noted electronic musician Geir Jenssen also hails from Tromsø.\"\"\",\n ]", " desc = summarize_paragraphs(example_paras, min_size=200, max_size=500)", " self.assertEqual(\n desc,\n \"Tromsø (Norwegian pronunciation: [ˈtrʊmsœ] ( listen); Northern Sami:\"\n \" Romsa; Finnish: Tromssa[2] Kven: Tromssa) is a city and municipality in\"\n \" Troms county, Norway. The administrative centre of the municipality is\"\n \" the city of Tromsø. Outside of Norway, Tromso and Tromsö are\"\n \" alternative spellings of the city.Tromsø is considered the northernmost\"\n \" city in the world with a population above 50,000. The most populous town\"\n \" north of it is Alta, Norway, with a population of 14,272 (2013).\",\n )", " desc = summarize_paragraphs(example_paras[1:], min_size=200, max_size=500)", " self.assertEqual(\n desc,\n \"Tromsø lies in Northern Norway. The municipality has a population of\"\n \" (2015) 72,066, but with an annual influx of students it has over 75,000\"\n \" most of the year. It is the largest urban area in Northern Norway and the\"\n \" third largest north of the Arctic Circle (following Murmansk and Norilsk).\"\n \" Most of Tromsø, including the city centre, is located on the island of\"\n \" Tromsøya, 350 kilometres (217 mi) north of the Arctic Circle. In 2012,\"\n \" Tromsøya had a population of 36,088. Substantial parts of the urban…\",\n )", " def test_short_summarize(self) -> None:\n example_paras = [\n \"Tromsø (Norwegian pronunciation: [ˈtrʊmsœ] ( listen); Northern Sami:\"\n \" Romsa; Finnish: Tromssa[2] Kven: Tromssa) is a city and municipality in\"\n \" Troms county, Norway.\",\n \"Tromsø lies in Northern Norway. The municipality has a population of\"\n \" (2015) 72,066, but with an annual influx of students it has over 75,000\"\n \" most of the year.\",\n \"The city centre of Tromsø contains the highest number of old wooden\"\n \" houses in Northern Norway, the oldest house dating from 1789. The Arctic\"\n \" Cathedral, a modern church from 1965, is probably the most famous landmark\"\n \" in Tromsø.\",\n ]", " desc = summarize_paragraphs(example_paras, min_size=200, max_size=500)", " self.assertEqual(\n desc,\n \"Tromsø (Norwegian pronunciation: [ˈtrʊmsœ] ( listen); Northern Sami:\"\n \" Romsa; Finnish: Tromssa[2] Kven: Tromssa) is a city and municipality in\"\n \" Troms county, Norway.\\n\"\n \"\\n\"\n \"Tromsø lies in Northern Norway. The municipality has a population of\"\n \" (2015) 72,066, but with an annual influx of students it has over 75,000\"\n \" most of the year.\",\n )", " def test_small_then_large_summarize(self) -> None:\n example_paras = [\n \"Tromsø (Norwegian pronunciation: [ˈtrʊmsœ] ( listen); Northern Sami:\"\n \" Romsa; Finnish: Tromssa[2] Kven: Tromssa) is a city and municipality in\"\n \" Troms county, Norway.\",\n \"Tromsø lies in Northern Norway. The municipality has a population of\"\n \" (2015) 72,066, but with an annual influx of students it has over 75,000\"\n \" most of the year.\"\n \" The city centre of Tromsø contains the highest number of old wooden\"\n \" houses in Northern Norway, the oldest house dating from 1789. The Arctic\"\n \" Cathedral, a modern church from 1965, is probably the most famous landmark\"\n \" in Tromsø.\",\n ]", " desc = summarize_paragraphs(example_paras, min_size=200, max_size=500)\n self.assertEqual(\n desc,\n \"Tromsø (Norwegian pronunciation: [ˈtrʊmsœ] ( listen); Northern Sami:\"\n \" Romsa; Finnish: Tromssa[2] Kven: Tromssa) is a city and municipality in\"\n \" Troms county, Norway.\\n\"\n \"\\n\"\n \"Tromsø lies in Northern Norway. The municipality has a population of\"\n \" (2015) 72,066, but with an annual influx of students it has over 75,000\"\n \" most of the year. The city centre of Tromsø contains the highest number\"\n \" of old wooden houses in Northern Norway, the oldest house dating from\"\n \" 1789. The Arctic Cathedral, a modern church from…\",\n )", "\nclass OpenGraphFromHtmlTestCase(unittest.TestCase):\n if not lxml:\n skip = \"url preview feature requires lxml\"", " def test_simple(self) -> None:\n html = b\"\"\"\n <html>\n <head><title>Foo</title></head>\n <body>\n Some text.\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(og, {\"og:title\": \"Foo\", \"og:description\": \"Some text.\"})", " def test_comment(self) -> None:\n html = b\"\"\"\n <html>\n <head><title>Foo</title></head>\n <body>\n <!-- HTML comment -->\n Some text.\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(og, {\"og:title\": \"Foo\", \"og:description\": \"Some text.\"})", " def test_comment2(self) -> None:\n html = b\"\"\"\n <html>\n <head><title>Foo</title></head>\n <body>\n Some text.\n <!-- HTML comment -->\n Some more text.\n <p>Text</p>\n More text\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(\n og,\n {\n \"og:title\": \"Foo\",\n \"og:description\": \"Some text.\\n\\nSome more text.\\n\\nText\\n\\nMore text\",\n },\n )", " def test_script(self) -> None:\n html = b\"\"\"\n <html>\n <head><title>Foo</title></head>\n <body>\n <script> (function() {})() </script>\n Some text.\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(og, {\"og:title\": \"Foo\", \"og:description\": \"Some text.\"})", " def test_missing_title(self) -> None:\n html = b\"\"\"\n <html>\n <body>\n Some text.\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(og, {\"og:title\": None, \"og:description\": \"Some text.\"})", " # Another variant is a title with no content.\n html = b\"\"\"\n <html>\n <head><title></title></head>\n <body>\n <h1>Title</h1>\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(og, {\"og:title\": \"Title\", \"og:description\": \"Title\"})", " def test_h1_as_title(self) -> None:\n html = b\"\"\"\n <html>\n <meta property=\"og:description\" content=\"Some text.\"/>\n <body>\n <h1>Title</h1>\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(og, {\"og:title\": \"Title\", \"og:description\": \"Some text.\"})", " def test_empty_description(self) -> None:\n \"\"\"Description tags with empty content should be ignored.\"\"\"\n html = b\"\"\"\n <html>\n <meta property=\"og:description\" content=\"\"/>\n <meta property=\"og:description\"/>\n <meta name=\"description\" content=\"\"/>\n <meta name=\"description\"/>\n <meta name=\"description\" content=\"Finally!\"/>\n <body>\n <h1>Title</h1>\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(og, {\"og:title\": \"Title\", \"og:description\": \"Finally!\"})", " def test_missing_title_and_broken_h1(self) -> None:\n html = b\"\"\"\n <html>\n <body>\n <h1><a href=\"foo\"/></h1>\n Some text.\n </body>\n </html>\n \"\"\"", " tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)", " self.assertEqual(og, {\"og:title\": None, \"og:description\": \"Some text.\"})", " def test_empty(self) -> None:\n \"\"\"Test a body with no data in it.\"\"\"\n html = b\"\"\n tree = decode_body(html, \"http://example.com/test.html\")\n self.assertIsNone(tree)", " def test_no_tree(self) -> None:\n \"\"\"A valid body with no tree in it.\"\"\"\n html = b\"\\x00\"\n tree = decode_body(html, \"http://example.com/test.html\")\n self.assertIsNone(tree)", " def test_xml(self) -> None:\n \"\"\"Test decoding XML and ensure it works properly.\"\"\"\n # Note that the strip() call is important to ensure the xml tag starts\n # at the initial byte.\n html = b\"\"\"\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>", " <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n <head><title>Foo</title></head><body>Some text.</body></html>\n \"\"\".strip()\n tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)\n self.assertEqual(og, {\"og:title\": \"Foo\", \"og:description\": \"Some text.\"})", " def test_invalid_encoding(self) -> None:\n \"\"\"An invalid character encoding should be ignored and treated as UTF-8, if possible.\"\"\"\n html = b\"\"\"\n <html>\n <head><title>Foo</title></head>\n <body>\n Some text.\n </body>\n </html>\n \"\"\"\n tree = decode_body(html, \"http://example.com/test.html\", \"invalid-encoding\")\n og = parse_html_to_open_graph(tree)\n self.assertEqual(og, {\"og:title\": \"Foo\", \"og:description\": \"Some text.\"})", " def test_invalid_encoding2(self) -> None:\n \"\"\"A body which doesn't match the sent character encoding.\"\"\"\n # Note that this contains an invalid UTF-8 sequence in the title.\n html = b\"\"\"\n <html>\n <head><title>\\xff\\xff Foo</title></head>\n <body>\n Some text.\n </body>\n </html>\n \"\"\"\n tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)\n self.assertEqual(og, {\"og:title\": \"ÿÿ Foo\", \"og:description\": \"Some text.\"})", " def test_windows_1252(self) -> None:\n \"\"\"A body which uses cp1252, but doesn't declare that.\"\"\"\n html = b\"\"\"\n <html>\n <head><title>\\xf3</title></head>\n <body>\n Some text.\n </body>\n </html>\n \"\"\"\n tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)\n self.assertEqual(og, {\"og:title\": \"ó\", \"og:description\": \"Some text.\"})\n", " def test_nested_nodes(self) -> None:\n \"\"\"A body with some nested nodes. Tests that we iterate over children\n in the right order (and don't reverse the order of the text).\"\"\"\n html = b\"\"\"\n <a href=\"somewhere\">Welcome <b>the bold <u>and underlined text <svg>\n with a cheeky SVG</svg></u> and <strong>some</strong> tail text</b></a>\n \"\"\"\n tree = decode_body(html, \"http://example.com/test.html\")\n og = parse_html_to_open_graph(tree)\n self.assertEqual(\n og,\n {\n \"og:title\": None,\n \"og:description\": \"Welcome\\n\\nthe bold\\n\\nand underlined text\\n\\nand\\n\\nsome\\n\\ntail text\",\n },\n )\n", "\nclass MediaEncodingTestCase(unittest.TestCase):\n def test_meta_charset(self) -> None:\n \"\"\"A character encoding is found via the meta tag.\"\"\"\n encodings = _get_html_media_encodings(\n b\"\"\"\n <html>\n <head><meta charset=\"ascii\">\n </head>\n </html>\n \"\"\",\n \"text/html\",\n )\n self.assertEqual(list(encodings), [\"ascii\", \"utf-8\", \"cp1252\"])", " # A less well-formed version.\n encodings = _get_html_media_encodings(\n b\"\"\"\n <html>\n <head>< meta charset = ascii>\n </head>\n </html>\n \"\"\",\n \"text/html\",\n )\n self.assertEqual(list(encodings), [\"ascii\", \"utf-8\", \"cp1252\"])", " def test_meta_charset_underscores(self) -> None:\n \"\"\"A character encoding contains underscore.\"\"\"\n encodings = _get_html_media_encodings(\n b\"\"\"\n <html>\n <head><meta charset=\"Shift_JIS\">\n </head>\n </html>\n \"\"\",\n \"text/html\",\n )\n self.assertEqual(list(encodings), [\"shift_jis\", \"utf-8\", \"cp1252\"])", " def test_xml_encoding(self) -> None:\n \"\"\"A character encoding is found via the meta tag.\"\"\"\n encodings = _get_html_media_encodings(\n b\"\"\"\n <?xml version=\"1.0\" encoding=\"ascii\"?>\n <html>\n </html>\n \"\"\",\n \"text/html\",\n )\n self.assertEqual(list(encodings), [\"ascii\", \"utf-8\", \"cp1252\"])", " def test_meta_xml_encoding(self) -> None:\n \"\"\"Meta tags take precedence over XML encoding.\"\"\"\n encodings = _get_html_media_encodings(\n b\"\"\"\n <?xml version=\"1.0\" encoding=\"ascii\"?>\n <html>\n <head><meta charset=\"UTF-16\">\n </head>\n </html>\n \"\"\",\n \"text/html\",\n )\n self.assertEqual(list(encodings), [\"utf-16\", \"ascii\", \"utf-8\", \"cp1252\"])", " def test_content_type(self) -> None:\n \"\"\"A character encoding is found via the Content-Type header.\"\"\"\n # Test a few variations of the header.\n headers = (\n 'text/html; charset=\"ascii\";',\n \"text/html;charset=ascii;\",\n 'text/html; charset=\"ascii\"',\n \"text/html; charset=ascii\",\n 'text/html; charset=\"ascii;',\n 'text/html; charset=ascii\";',\n )\n for header in headers:\n encodings = _get_html_media_encodings(b\"\", header)\n self.assertEqual(list(encodings), [\"ascii\", \"utf-8\", \"cp1252\"])", " def test_fallback(self) -> None:\n \"\"\"A character encoding cannot be found in the body or header.\"\"\"\n encodings = _get_html_media_encodings(b\"\", \"text/html\")\n self.assertEqual(list(encodings), [\"utf-8\", \"cp1252\"])", " def test_duplicates(self) -> None:\n \"\"\"Ensure each encoding is only attempted once.\"\"\"\n encodings = _get_html_media_encodings(\n b\"\"\"\n <?xml version=\"1.0\" encoding=\"utf8\"?>\n <html>\n <head><meta charset=\"UTF-8\">\n </head>\n </html>\n \"\"\",\n 'text/html; charset=\"UTF_8\"',\n )\n self.assertEqual(list(encodings), [\"utf-8\", \"cp1252\"])", " def test_unknown_invalid(self) -> None:\n \"\"\"A character encoding should be ignored if it is unknown or invalid.\"\"\"\n encodings = _get_html_media_encodings(\n b\"\"\"\n <html>\n <head><meta charset=\"invalid\">\n </head>\n </html>\n \"\"\",\n 'text/html; charset=\"invalid\"',\n )\n self.assertEqual(list(encodings), [\"utf-8\", \"cp1252\"])" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [343, 372], "buggy_code_start_loc": [15, 372], "filenames": ["synapse/rest/media/v1/preview_html.py", "tests/rest/media/v1/test_html_preview.py"], "fixing_code_end_loc": [358, 390], "fixing_code_start_loc": [14, 373], "message": "Synapse is an open source home server implementation for the Matrix chat network. In versions prior to 1.61.1 URL previews of some web pages can exhaust the available stack space for the Synapse process due to unbounded recursion. This is sometimes recoverable and leads to an error for the request causing the problem, but in other cases the Synapse process may crash altogether. It is possible to exploit this maliciously, either by malicious users on the homeserver, or by remote users sending URLs that a local user's client may automatically request a URL preview for. Remote users are not able to exploit this directly, because the URL preview endpoint is authenticated. Deployments with `url_preview_enabled: false` set in configuration are not affected. Deployments with `url_preview_enabled: true` set in configuration **are** affected. Deployments with no configuration value set for `url_preview_enabled` are not affected, because the default is `false`. Administrators of homeservers with URL previews enabled are advised to upgrade to v1.61.1 or higher. Users unable to upgrade should set `url_preview_enabled` to false.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:matrix:synapse:*:*:*:*:*:*:*:*", "matchCriteriaId": "52787569-D73B-46A3-99E8-EEB0D5971C69", "versionEndExcluding": "1.61.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*", "matchCriteriaId": "80E516C0-98A4-4ADE-B69F-66A772E2BAAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:*", "matchCriteriaId": "5C675112-476C-4D7C-BCB9-A2FB2D0BC9FD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Synapse is an open source home server implementation for the Matrix chat network. In versions prior to 1.61.1 URL previews of some web pages can exhaust the available stack space for the Synapse process due to unbounded recursion. This is sometimes recoverable and leads to an error for the request causing the problem, but in other cases the Synapse process may crash altogether. It is possible to exploit this maliciously, either by malicious users on the homeserver, or by remote users sending URLs that a local user's client may automatically request a URL preview for. Remote users are not able to exploit this directly, because the URL preview endpoint is authenticated. Deployments with `url_preview_enabled: false` set in configuration are not affected. Deployments with `url_preview_enabled: true` set in configuration **are** affected. Deployments with no configuration value set for `url_preview_enabled` are not affected, because the default is `false`. Administrators of homeservers with URL previews enabled are advised to upgrade to v1.61.1 or higher. Users unable to upgrade should set `url_preview_enabled` to false."}, {"lang": "es", "value": "Synapse es una implementaci\u00f3n de servidor dom\u00e9stico de c\u00f3digo abierto para la red de chat Matrix. En versiones anteriores a 1.61.1, las previsualizaciones de URL de algunas p\u00e1ginas web pueden agotar el espacio de pila disponible para el proceso de Synapse debido a una recursi\u00f3n sin l\u00edmites. Esto a veces es recuperable y conlleva a un error para la petici\u00f3n que causa el problema, pero en otros casos el proceso de Synapse puede bloquearse por completo. Es posible explotar esto de forma maliciosa, ya sea por usuarios maliciosos en el servidor dom\u00e9stico, o por usuarios remotos que env\u00edan URLs para las que el cliente de un usuario local puede solicitar autom\u00e1ticamente una visualizaci\u00f3n previa de la URL. Los usuarios remotos no son capaces de explotar esto directamente, porque el endpoint de la visualizaci\u00f3n previa de la URL est\u00e1 autenticado. Los despliegues con \"url_preview_enabled: false\" establecidos en la configuraci\u00f3n no est\u00e1n afectados. Los despliegues con \"url_preview_enabled: true\" establecido en la configuraci\u00f3n **est\u00e1n** afectados. Los despliegues sin valor de configuraci\u00f3n para \"url_preview_enabled\" no est\u00e1n afectados, porque el valor por defecto es \"false\". Es recomendado a administradores de servidores dom\u00e9sticos con visualizaciones previas de URL habilitadas que actualicen a versi\u00f3n v1.61.1 o superior. Los usuarios que no puedan actualizarse deben establecer \"url_preview_enabled\" en false"}], "evaluatorComment": null, "id": "CVE-2022-31052", "lastModified": "2022-07-09T00:15:29.740", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "PARTIAL", "baseScore": 3.5, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:S/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-06-28T17:15:08.217", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/matrix-org/synapse/commit/fa1308061802ac7b7d20e954ba7372c5ac292333"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/matrix-org/synapse/security/advisories/GHSA-22p3-qrh9-cx32"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/7EARKKJZ2W7WUITFDT4EG4NVATFYJQHF/"}, {"source": "security-advisories@github.com", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QGSDQ4YAITCUACAB7SXQZDJIU3IQ4CJD/"}, {"source": "security-advisories@github.com", "tags": ["Vendor Advisory"], "url": "https://spec.matrix.org/v1.2/client-server-api/#get_matrixmediav3preview_url"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-674"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/matrix-org/synapse/commit/fa1308061802ac7b7d20e954ba7372c5ac292333"}, "type": "CWE-674"}
353
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n/**\n * ---------------------------------------------------------------------\n * GLPI - Gestionnaire Libre de Parc Informatique\n * Copyright (C) 2015-2018 Teclib' and contributors.\n *\n * http://glpi-project.org\n *\n * based on GLPI - Gestionnaire Libre de Parc Informatique\n * Copyright (C) 2003-2014 by the INDEPNET Development Team.\n *\n * ---------------------------------------------------------------------\n *\n * LICENSE\n *\n * This file is part of GLPI.\n *\n * GLPI is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * GLPI is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with GLPI. If not, see <http://www.gnu.org/licenses/>.\n * ---------------------------------------------------------------------\n */", "if (!defined('GLPI_ROOT')) {\n die(\"Sorry. You can't access this file directly\");\n}", "use Sabre\\VObject;\nuse Glpi\\Exception\\ForgetPasswordException;\nuse Glpi\\Exception\\PasswordTooWeakException;", "class User extends CommonDBTM {", " // From CommonDBTM\n public $dohistory = true;\n public $history_blacklist = ['date_mod', 'date_sync', 'last_login',\n 'publicbookmarkorder', 'privatebookmarkorder'];", " // NAME FIRSTNAME ORDER TYPE\n const REALNAME_BEFORE = 0;\n const FIRSTNAME_BEFORE = 1;", " const IMPORTEXTAUTHUSERS = 1024;\n const READAUTHENT = 2048;\n const UPDATEAUTHENT = 4096;", " static $rightname = 'user';", " private $entities = null;", "\n static function getTypeName($nb = 0) {\n return _n('User', 'Users', $nb);\n }", " static function getMenuShorcut() {\n return 'u';\n }", " static function getAdditionalMenuOptions() {", " if (Session::haveRight('user', self::IMPORTEXTAUTHUSERS)) {\n return [\n 'ldap' => [\n 'title' => AuthLDAP::getTypeName(Session::getPluralNumber()),\n 'page' => '/front/ldap.php',\n ],\n ];\n }\n return false;\n }", "\n function canViewItem() {\n if (Session::canViewAllEntities()\n || Session::haveAccessToOneOfEntities($this->getEntities())) {\n return true;\n }\n return false;\n }", "\n function canCreateItem() {", " // Will be created from form, with selected entity/profile\n if (isset($this->input['_profiles_id']) && ($this->input['_profiles_id'] > 0)\n && Profile::currentUserHaveMoreRightThan([$this->input['_profiles_id']])\n && isset($this->input['_entities_id'])\n && Session::haveAccessToEntity($this->input['_entities_id'])) {\n return true;\n }\n // Will be created with default value\n if (Session::haveAccessToEntity(0) // Access to root entity (required when no default profile)\n || (Profile::getDefault() > 0)) {\n return true;\n }", " if (($_SESSION['glpiactive_entity'] > 0)\n && (Profile::getDefault() == 0)) {\n echo \"<div class='tab_cadre_fixe warning'>\".\n __('You must define a default profile to create a new user').\"</div>\";\n }", " return false;\n }", "\n function canUpdateItem() {", " $entities = Profile_User::getUserEntities($this->fields['id'], false);\n if (Session::canViewAllEntities()\n || Session::haveAccessToOneOfEntities($entities)) {\n return true;\n }\n return false;\n }", "\n function canDeleteItem() {\n if (Session::canViewAllEntities()\n || Session::haveAccessToAllOfEntities($this->getEntities())) {\n return true;\n }\n return false;\n }", "\n function canPurgeItem() {\n return $this->canDeleteItem();\n }", "\n function isEntityAssign() {\n // glpi_users.entities_id is only a pref.\n return false;\n }", "\n /**\n * Compute preferences for the current user mixing config and user data.\n *\n * @return void\n */\n function computePreferences() {\n global $CFG_GLPI;", " if (isset($this->fields['id'])) {\n foreach ($CFG_GLPI['user_pref_field'] as $f) {\n if (is_null($this->fields[$f]) || !Session::haveRight('personalization', UPDATE)) {\n $this->fields[$f] = $CFG_GLPI[$f];\n }\n }\n }\n /// Specific case for show_count_on_tabs : global config can forbid\n if ($CFG_GLPI['show_count_on_tabs'] == -1) {\n $this->fields['show_count_on_tabs'] = 0;\n }\n }", "\n /**\n * Load minimal session for user.\n *\n * @param integer $entities_id Entity to use\n * @param boolean $is_recursive Whether to load entities recursivly or not\n *\n * @return void\n *\n * @since 0.83.7\n */\n function loadMinimalSession($entities_id, $is_recursive) {\n global $CFG_GLPI;", " if (isset($this->fields['id']) && !isset($_SESSION[\"glpiID\"])) {\n Session::destroy();\n Session::start();\n $_SESSION[\"glpiID\"] = $this->fields['id'];\n $_SESSION[\"glpi_use_mode\"] = Session::NORMAL_MODE;\n $_SESSION[\"glpiactive_entity\"] = $entities_id;\n $_SESSION[\"glpiactive_entity_recursive\"] = $is_recursive;\n if ($is_recursive) {\n $entities = getSonsOf(\"glpi_entities\", $entities_id);\n } else {\n $entities = [$entities_id];\n }\n $_SESSION['glpiactiveentities'] = $entities;\n $_SESSION['glpiactiveentities_string'] = \"'\".implode(\"', '\", $entities).\"'\";\n $this->computePreferences();\n foreach ($CFG_GLPI['user_pref_field'] as $field) {\n if (isset($this->fields[$field])) {\n $_SESSION[\"glpi$field\"] = $this->fields[$field];\n }\n }\n Session::loadGroups();\n Session::loadLanguage();\n }\n }", "\n function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {", " switch ($item->getType()) {\n case __CLASS__ :\n $ong = [];\n $ong[1] = __('Used items');\n $ong[2] = __('Managed items');\n return $ong;", " case 'Preference' :\n return __('Main');\n }\n return '';\n }", "\n static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {\n global $CFG_GLPI;", " switch ($item->getType()) {\n case __CLASS__ :\n $item->showItems($tabnum==2);\n return true;", " case 'Preference' :\n $user = new self();\n $user->showMyForm($CFG_GLPI['root_doc'].\"/front/preference.php\",\n Session::getLoginUserID());\n return true;\n }\n return false;\n }", "\n function defineTabs($options = []) {", " $ong = [];\n $this->addDefaultFormTab($ong);\n $this->addStandardTab('Profile_User', $ong, $options);\n $this->addStandardTab('Group_User', $ong, $options);\n $this->addStandardTab('Config', $ong, $options);\n $this->addStandardTab(__CLASS__, $ong, $options);\n $this->addStandardTab('Ticket', $ong, $options);\n $this->addStandardTab('Item_Problem', $ong, $options);\n $this->addStandardTab('Change_Item', $ong, $options);\n $this->addStandardTab('Document_Item', $ong, $options);\n $this->addStandardTab('Reservation', $ong, $options);\n $this->addStandardTab('Auth', $ong, $options);\n $this->addStandardTab('Link', $ong, $options);\n $this->addStandardTab('Certificate_Item', $ong, $options);\n $this->addStandardTab('Log', $ong, $options);", " return $ong;\n }", "\n function post_getEmpty() {\n global $CFG_GLPI;", " $this->fields[\"is_active\"] = 1;\n if (isset($CFG_GLPI[\"language\"])) {\n $this->fields['language'] = $CFG_GLPI[\"language\"];\n } else {\n $this->fields['language'] = \"en_GB\";\n }\n }", " static public function unsetUndisclosedFields(&$fields) {\n unset($fields['password']);\n }", " function pre_deleteItem() {\n global $DB;", " $entities = $this->getEntities();\n $view_all = Session::canViewAllEntities();\n // Have right on all entities ?\n $all = true;\n if (!$view_all) {\n foreach ($entities as $ent) {\n if (!Session::haveAccessToEntity($ent)) {\n $all = false;\n }\n }\n }\n if ($all) { // Mark as deleted\n return true;\n }\n // only delete profile\n foreach ($entities as $ent) {\n if (Session::haveAccessToEntity($ent)) {\n $all = false;\n $DB->delete(\n 'glpi_profiles_users', [\n 'users_id' => $this->fields['id'],\n 'entities_id' => $ent\n ]\n );\n }\n return false;\n }\n }", "\n function cleanDBonPurge() {", " global $DB;", " // ObjectLock does not extends CommonDBConnexity\n $ol = new ObjectLock();\n $ol->deleteByCriteria(['users_id' => $this->fields['id']]);", " // Reminder does not extends CommonDBConnexity\n $r = new Reminder();\n $r->deleteByCriteria(['users_id' => $this->fields['id']]);", " // Delete private bookmark\n $ss = new SavedSearch();\n $ss->deleteByCriteria(\n [\n 'users_id' => $this->fields['id'],\n 'is_private' => 1,\n ]\n );", " // Set no user to public bookmark\n $DB->update(\n SavedSearch::getTable(), [\n 'users_id' => 0\n ], [\n 'users_id' => $this->fields['id']\n ]\n );", " // Set no user to consumables\n $DB->update(\n 'glpi_consumables', [\n 'items_id' => 0,\n 'itemtype' => 'NULL',\n 'date_out' => 'NULL'\n ], [\n 'items_id' => $this->fields['id'],\n 'itemtype' => 'User'\n ]\n );", " $this->deleteChildrenAndRelationsFromDb(\n [\n Certificate_Item::class,\n Change_User::class,\n Group_User::class,\n KnowbaseItem_User::class,\n Problem_User::class,\n Profile_User::class,\n ProjectTaskTeam::class,\n ProjectTeam::class,\n Reminder_User::class,\n RSSFeed_User::class,\n SavedSearch_User::class,\n Ticket_User::class,\n UserEmail::class,\n ]\n );", " if ($this->fields['id'] > 0) { // Security\n // DisplayPreference does not extends CommonDBConnexity\n $dp = new DisplayPreference();\n $dp->deleteByCriteria(['users_id' => $this->fields['id']]);\n }", " $this->dropPictureFiles($this->fields['picture']);", " // Ticket rules use various _users_id_*\n Rule::cleanForItemAction($this, '_users_id%');\n Rule::cleanForItemCriteria($this, '_users_id%');\n }", "\n /**\n * Retrieve a user from the database using its login.\n *\n * @param string $name Login of the user\n *\n * @return boolean\n */\n function getFromDBbyName($name) {\n return $this->getFromDBByCrit(['name' => $name]);\n }", " /**\n * Retrieve a user from the database using its login.\n *\n * @param string $name Login of the user\n * @param integer $authtype Auth type (see Auth constants)\n * @param integer $auths_id ID of auth server\n *\n * @return boolean\n */\n function getFromDBbyNameAndAuth($name, $authtype, $auths_id) {\n return $this->getFromDBByCrit([\n 'name' => $name,\n 'authtype' => $authtype,\n 'auths_id' => $auths_id\n ]);\n }", " /**\n * Retrieve a user from the database using value of the sync field.\n *\n * @param string $value Value of the sync field\n *\n * @return boolean\n */\n function getFromDBbySyncField($value) {\n return $this->getFromDBByCrit(['sync_field' => $value]);\n }", " /**\n * Retrieve a user from the database using it's dn.\n *\n * @since 0.84\n *\n * @param string $user_dn dn of the user\n *\n * @return boolean\n */\n function getFromDBbyDn($user_dn) {\n return $this->getFromDBByCrit(['user_dn' => $user_dn]);\n }", "\n /**\n * Retrieve a user from the database using its email.\n *\n * @since 9.3 Can pass condition as a parameter\n *\n * @param string $email user email\n * @param array $condition add condition\n *\n * @return boolean\n */\n function getFromDBbyEmail($email, $condition = []) {\n global $DB;", " $crit = [\n 'SELECT' => $this->getTable() . '.id',\n 'FROM' => $this->getTable(),\n 'LEFT JOIN' => [\n 'glpi_useremails' => [\n 'FKEY' => [\n $this->getTable() => 'id',\n 'glpi_useremails' => 'users_id'\n ]\n ]\n ],\n 'WHERE' => ['glpi_useremails.email' => $email] + $condition\n ];", " $iter = $DB->request($crit);\n if ($iter->numrows()==1) {\n $row = $iter->next();\n return $this->getFromDB($row['id']);\n }\n return false;\n }", "\n /**\n * Get the default email of the user.\n *\n * @return string\n */\n function getDefaultEmail() {", " if (!isset($this->fields['id'])) {\n return '';\n }", " return UserEmail::getDefaultForUser($this->fields['id']);\n }", "\n /**\n * Get all emails of the user.\n *\n * @return string[]\n */\n function getAllEmails() {", " if (!isset($this->fields['id'])) {\n return [];\n }\n return UserEmail::getAllForUser($this->fields['id']);\n }", "\n /**\n * Check if the email is attached to the current user.\n *\n * @param string $email\n *\n * @return boolean\n */\n function isEmail($email) {", " if (!isset($this->fields['id'])) {\n return false;\n }\n return UserEmail::isEmailForUser($this->fields['id'], $email);\n }", "\n /**\n * Retrieve a user from the database using its personal token.\n *\n * @param string $token user token\n * @param string $field the field storing the token\n *\n * @return boolean\n */\n function getFromDBbyToken($token, $field = 'personal_token') {\n $fields = ['personal_token', 'api_token'];\n if (!in_array($field, $fields)) {\n Toolbox::logWarning('User::getFromDBbyToken() can only be called with $field parameter with theses values: \\'' . implode('\\', \\'', $fields) . '\\'');\n return false;\n }", " return $this->getFromDBByCrit([$this->getTable() . \".$field\" => $token]);\n }", "\n function prepareInputForAdd($input) {\n global $DB;", " if (isset($input['_stop_import'])) {\n return false;\n }", " if (!Auth::isValidLogin($input['name'])) {\n Session::addMessageAfterRedirect(__('The login is not valid. Unable to add the user.'),\n false, ERROR);\n return false;\n }", " if (!isset($input[\"authtype\"])) {\n $input[\"authtype\"] = Auth::DB_GLPI;\n }", " if (!isset($input[\"auths_id\"])) {\n $input[\"auths_id\"] = 0;\n }", " // Check if user does not exists\n $iterator = $DB->request([\n 'FROM' => $this->getTable(),\n 'WHERE' => [\n 'name' => $input['name'],\n 'authtype' => $input['authtype'],\n 'auths_id' => $input['auths_id']\n ],\n 'LIMIT' => 1\n ]);", " if (count($iterator)) {\n Session::addMessageAfterRedirect(__('Unable to add. The user already exists.'),\n false, ERROR);\n return false;\n }", " if (isset($input[\"password2\"])) {\n if (empty($input[\"password\"])) {\n unset ($input[\"password\"]);", " } else {\n if ($input[\"password\"] == $input[\"password2\"]) {\n if (Config::validatePassword($input[\"password\"])) {\n $input[\"password\"]\n = Auth::getPasswordHash(Toolbox::unclean_cross_side_scripting_deep(stripslashes($input[\"password\"])));\n } else {\n unset($input[\"password\"]);\n }\n unset($input[\"password2\"]);\n } else {\n Session::addMessageAfterRedirect(__('Error: the two passwords do not match'),\n false, ERROR);\n return false;\n }\n }\n }", " if (isset($input[\"_extauth\"])) {\n $input[\"password\"] = \"\";\n }", " // Force DB default values : not really needed\n if (!isset($input[\"is_active\"])) {\n $input[\"is_active\"] = 1;\n }", " if (!isset($input[\"is_deleted\"])) {\n $input[\"is_deleted\"] = 0;\n }", " if (!isset($input[\"entities_id\"])) {\n $input[\"entities_id\"] = 0;\n }", " if (!isset($input[\"profiles_id\"])) {\n $input[\"profiles_id\"] = 0;\n }", " return $input;\n }", "\n function post_addItem() {", " $this->updateUserEmails();\n $this->syncLdapGroups();\n $this->syncDynamicEmails();", " $rulesplayed = $this->applyRightRules();\n $picture = $this->syncLdapPhoto();", " //add picture in user fields\n if (!empty($picture)) {\n $this->update(['id' => $this->fields['id'],\n 'picture' => $picture]);\n }", " // Add default profile\n if (!$rulesplayed) {\n $affectation = [];\n if (isset($this->input['_profiles_id']) && $this->input['_profiles_id']\n && Profile::currentUserHaveMoreRightThan([$this->input['_profiles_id']])\n ) {\n $profile = $this->input['_profiles_id'];\n // Choosen in form, so not dynamic\n $affectation['is_dynamic'] = 0;\n } else {\n $profile = Profile::getDefault();\n // Default right as dynamic. If dynamic rights are set it will disappear.\n $affectation['is_dynamic'] = 1;\n }", " if ($profile) {\n if (isset($this->input[\"_entities_id\"])) {\n // entities_id (user's pref) always set in prepareInputForAdd\n // use _entities_id for default right\n $affectation[\"entities_id\"] = $this->input[\"_entities_id\"];", " } else if (isset($_SESSION['glpiactive_entity'])) {\n $affectation[\"entities_id\"] = $_SESSION['glpiactive_entity'];", " } else {\n $affectation[\"entities_id\"] = 0;\n }\n if (isset($this->input[\"_is_recursive\"])) {\n $affectation[\"is_recursive\"] = $this->input[\"_is_recursive\"];\n } else {\n $affectation[\"is_recursive\"] = 0;\n }", " $affectation[\"profiles_id\"] = $profile;\n $affectation[\"users_id\"] = $this->fields[\"id\"];\n $right = new Profile_User();\n $right->add($affectation);\n }\n }\n }", "\n function prepareInputForUpdate($input) {\n global $CFG_GLPI;", " //picture manually uploaded by user\n if (isset($input[\"_blank_picture\"]) && $input[\"_blank_picture\"]) {\n self::dropPictureFiles($this->fields['picture']);\n $input['picture'] = 'NULL';\n } else {\n $newPicture = false;\n if (!isAPI()) {\n if (isset($input[\"_picture\"][0]) && !empty($input[\"_picture\"][0])) {\n $input[\"_picture\"] = $input[\"_picture\"][0];\n }\n }\n if (isset($input[\"_picture\"]) && !empty($input[\"_picture\"])) {\n $newPicture = true;\n }\n if ($newPicture) {\n $fullpath = GLPI_TMP_DIR.\"/\".$input[\"_picture\"];\n if (toolbox::getMime($fullpath, 'image')) {\n // Unlink old picture (clean on changing format)\n self::dropPictureFiles($this->fields['picture']);\n // Move uploaded file\n $filename = uniqid($this->fields['id'].'_');\n $sub = substr($filename, -2); /* 2 hex digit */\n $tmp = explode(\".\", $input[\"_picture\"]);\n $extension = Toolbox::strtolower(array_pop($tmp));\n @mkdir(GLPI_PICTURE_DIR . \"/$sub\");\n $picture_path = GLPI_PICTURE_DIR . \"/$sub/${filename}.$extension\";\n self::dropPictureFiles($filename.\".\".$extension);", " if (Document::isImage($input[\"_picture\"])\n && Document::renameForce($fullpath, $picture_path)) {\n Session::addMessageAfterRedirect(__('The file is valid. Upload is successful.'));\n // For display\n $input['picture'] = \"$sub/${filename}.$extension\";", " //prepare a thumbnail\n $thumb_path = GLPI_PICTURE_DIR . \"/$sub/${filename}_min.$extension\";\n Toolbox::resizePicture($picture_path, $thumb_path);\n } else {\n Session::addMessageAfterRedirect(__('Potential upload attack or file too large. Moving temporary file failed.'),\n false, ERROR);\n }\n } else {\n Session::addMessageAfterRedirect(__('The file is not an image file.'),\n false, ERROR);\n }\n } else {\n //ldap jpegphoto synchronisation.\n $picture = $this->syncLdapPhoto();\n if (!empty($picture)) {\n $input['picture'] = $picture;\n }\n }\n }", " if (isset($input[\"password2\"])) {\n // Empty : do not update\n if (empty($input[\"password\"])) {\n unset($input[\"password\"]);", " } else {\n if ($input[\"password\"] == $input[\"password2\"]) {\n // Check right : my password of user with lesser rights\n if (isset($input['id']) && Config::validatePassword($input[\"password\"])\n && (($input['id'] == Session::getLoginUserID())\n || $this->currentUserHaveMoreRightThan($input['id'])\n || (($input['password_forget_token'] == $this->fields['password_forget_token']) // Permit to change password with token and email\n && (abs(strtotime($_SESSION[\"glpi_currenttime\"])\n -strtotime($this->fields['password_forget_token_date'])) < DAY_TIMESTAMP)\n && $this->isEmail($input['email'])))) {\n $input[\"password\"]\n = Auth::getPasswordHash(Toolbox::unclean_cross_side_scripting_deep(stripslashes($input[\"password\"])));", " } else {\n unset($input[\"password\"]);\n }\n unset($input[\"password2\"]);", " } else {\n Session::addMessageAfterRedirect(__('Error: the two passwords do not match'),\n false, ERROR);\n return false;\n }\n }", " } else if (isset($input[\"password\"])) { // From login\n unset($input[\"password\"]);\n }", " // blank password when authtype changes\n if (isset($input[\"authtype\"])\n && $input[\"authtype\"] != Auth::DB_GLPI\n && $input[\"authtype\"] != $this->getField('authtype')) {\n $input[\"password\"] = \"\";\n }", " // Update User in the database\n if (!isset($input[\"id\"])\n && isset($input[\"name\"])) {\n if ($this->getFromDBbyName($input[\"name\"])) {\n $input[\"id\"] = $this->fields[\"id\"];\n }\n }", " if (isset($input[\"entities_id\"])\n && (Session::getLoginUserID() === $input['id'])) {\n $_SESSION[\"glpidefault_entity\"] = $input[\"entities_id\"];\n }", " // Security on default profile update\n if (isset($input['profiles_id'])) {\n if (!in_array($input['profiles_id'], Profile_User::getUserProfiles($input['id']))) {\n unset($input['profiles_id']);\n }\n }", " // Security on default entity update\n if (isset($input['entities_id'])) {\n if (!in_array($input['entities_id'], Profile_User::getUserEntities($input['id']))) {\n unset($input['entities_id']);\n }\n }", " // Security on default group update\n if (isset($input['groups_id'])\n && !Group_User::isUserInGroup($input['id'], $input['groups_id'])) {\n unset($input['groups_id']);\n }", " if (isset($input['_reset_personal_token'])\n && $input['_reset_personal_token']) {\n $input['personal_token'] = self::getUniqueToken('personal_token');\n $input['personal_token_date'] = $_SESSION['glpi_currenttime'];\n }", " if (isset($input['_reset_api_token'])\n && $input['_reset_api_token']) {\n $input['api_token'] = self::getUniqueToken('api_token');\n $input['api_token_date'] = $_SESSION['glpi_currenttime'];\n }", " // Manage preferences fields\n if (Session::getLoginUserID() === $input['id']) {\n if (isset($input['use_mode'])\n && ($_SESSION['glpi_use_mode'] != $input['use_mode'])) {\n $_SESSION['glpi_use_mode'] = $input['use_mode'];\n //Session::loadLanguage();\n }\n }", " foreach ($CFG_GLPI['user_pref_field'] as $f) {\n if (isset($input[$f])) {\n if (Session::getLoginUserID() === $input['id']) {\n if ($_SESSION[\"glpi$f\"] != $input[$f]) {\n $_SESSION[\"glpi$f\"] = $input[$f];\n // reinit translations\n if ($f == 'language') {\n $_SESSION['glpi_dropdowntranslations'] = DropdownTranslation::getAvailableTranslations($_SESSION[\"glpilanguage\"]);\n unset($_SESSION['glpimenu']);\n }\n }\n }\n if ($input[$f] == $CFG_GLPI[$f]) {\n $input[$f] = \"NULL\";\n }\n }\n }", " if (isset($input['language']) && GLPI_DEMO_MODE) {\n unset($input['language']);\n }\n return $input;\n }", "\n function post_updateItem($history = 1) {", " $this->updateUserEmails();\n $this->syncLdapGroups();\n $this->syncDynamicEmails();\n $this->applyRightRules();\n }", "", " /**\n * Apply rules to determine dynamic rights of the user.\n *\n * @return boolean true if rules are applied, false otherwise\n */\n function applyRightRules() {", " $return = false;", " if ((isset($this->fields['_ruleright_process'])\n || isset($this->input['_ruleright_process'])) // Add after a getFromLDAP\n && isset($this->fields[\"authtype\"])\n && (($this->fields[\"authtype\"] == Auth::LDAP)\n || ($this->fields[\"authtype\"] == Auth::MAIL)\n || Auth::isAlternateAuth($this->fields[\"authtype\"]))) {", " $dynamic_profiles = Profile_User::getForUser($this->fields[\"id\"], true);", " if (isset($this->fields[\"id\"])\n && ($this->fields[\"id\"] > 0)\n && isset($this->input[\"_ldap_rules\"])\n && count($this->input[\"_ldap_rules\"])) {", " //and add/update/delete only if it's necessary !\n if (isset($this->input[\"_ldap_rules\"][\"rules_entities_rights\"])) {\n $entities_rules = $this->input[\"_ldap_rules\"][\"rules_entities_rights\"];\n } else {\n $entities_rules = [];\n }", " if (isset($this->input[\"_ldap_rules\"][\"rules_entities\"])) {\n $entities = $this->input[\"_ldap_rules\"][\"rules_entities\"];\n } else {\n $entities = [];\n }", " if (isset($this->input[\"_ldap_rules\"][\"rules_rights\"])) {\n $rights = $this->input[\"_ldap_rules\"][\"rules_rights\"];\n } else {\n $rights = [];\n }", " $retrieved_dynamic_profiles = [];", " //For each affectation -> write it in DB\n foreach ($entities_rules as $entity) {\n //Multiple entities assignation\n if (is_array($entity[0])) {\n foreach ($entity[0] as $ent) {\n $retrieved_dynamic_profiles[] = [\n 'entities_id' => $ent,\n 'profiles_id' => $entity[1],\n 'is_recursive' => $entity[2],\n 'users_id' => $this->fields['id'],\n 'is_dynamic' => 1,\n ];\n }\n } else {\n $retrieved_dynamic_profiles[] = [\n 'entities_id' => $entity[0],\n 'profiles_id' => $entity[1],\n 'is_recursive' => $entity[2],\n 'users_id' => $this->fields['id'],\n 'is_dynamic' => 1,\n ];\n }\n }", " if ((count($entities) > 0)\n && (count($rights) == 0)) {\n if ($def_prof = Profile::getDefault()) {\n $rights[] = $def_prof;\n }\n }", " if ((count($rights) > 0)\n && (count($entities) > 0)) {\n foreach ($rights as $right) {\n foreach ($entities as $entity) {\n $retrieved_dynamic_profiles[] = [\n 'entities_id' => $entity[0],\n 'profiles_id' => $right,\n 'is_recursive' => $entity[1],\n 'users_id' => $this->fields['id'],\n 'is_dynamic' => 1,\n ];\n }\n }\n }", " // Compare retrived profiles to existing ones : clean arrays to do purge and add\n if (count($retrieved_dynamic_profiles)) {\n foreach ($retrieved_dynamic_profiles as $keyretr => $retr_profile) {\n $found = false;", " foreach ($dynamic_profiles as $keydb => $db_profile) {\n // Found existing profile : unset values in array\n if (!$found\n && ($db_profile['entities_id'] == $retr_profile['entities_id'])\n && ($db_profile['profiles_id'] == $retr_profile['profiles_id'])\n && ($db_profile['is_recursive'] == $retr_profile['is_recursive'])) {", " unset($retrieved_dynamic_profiles[$keyretr]);\n unset($dynamic_profiles[$keydb]);\n }\n }\n }\n }", " // Add new dynamic profiles\n if (count($retrieved_dynamic_profiles)) {\n $right = new Profile_User();\n foreach ($retrieved_dynamic_profiles as $keyretr => $retr_profile) {\n $right->add($retr_profile);\n }\n }", " //Unset all the temporary tables\n unset($this->input[\"_ldap_rules\"]);", " $return = true;\n }", " // Delete old dynamic profiles\n if (count($dynamic_profiles)) {\n $right = new Profile_User();\n foreach ($dynamic_profiles as $keydb => $db_profile) {\n $right->delete($db_profile);\n }\n }", " }\n return $return;\n }", "\n /**\n * Synchronise LDAP group of the user.\n *\n * @return void\n */\n function syncLdapGroups() {\n global $DB;", " // input[\"_groups\"] not set when update from user.form or preference\n if (isset($this->fields[\"authtype\"])\n && isset($this->input[\"_groups\"])\n && (($this->fields[\"authtype\"] == Auth::LDAP)\n || Auth::isAlternateAuth($this->fields['authtype']))) {", " if (isset($this->fields[\"id\"]) && ($this->fields[\"id\"] > 0)) {\n $authtype = Auth::getMethodsByID($this->fields[\"authtype\"], $this->fields[\"auths_id\"]);", " if (count($authtype)) {\n // Clean groups\n $this->input[\"_groups\"] = array_unique ($this->input[\"_groups\"]);", " // Delete not available groups like to LDAP\n $iterator = $DB->request([\n 'SELECT' => [\n 'glpi_groups_users.id',\n 'glpi_groups_users.groups_id',\n 'glpi_groups_users.is_dynamic'\n ],\n 'FROM' => 'glpi_groups_users',\n 'LEFT JOIN' => [\n 'glpi_groups' => [\n 'FKEY' => [\n 'glpi_groups_users' => 'groups_id',\n 'glpi_groups' => 'id'\n ]\n ]\n ],\n 'WHERE' => [\n 'glpi_groups_users.users_id' => $this->fields['id']\n ]\n ]);", " $groupuser = new Group_User();\n while ($data = $iterator->next()) {", " if (in_array($data[\"groups_id\"], $this->input[\"_groups\"])) {\n // Delete found item in order not to add it again\n unset($this->input[\"_groups\"][array_search($data[\"groups_id\"],\n $this->input[\"_groups\"])]);", " } else if ($data['is_dynamic']) {\n $groupuser->delete(['id' => $data[\"id\"]]);\n }\n }", " //If the user needs to be added to one group or more\n if (count($this->input[\"_groups\"]) > 0) {\n foreach ($this->input[\"_groups\"] as $group) {\n $groupuser->add(['users_id' => $this->fields[\"id\"],\n 'groups_id' => $group,\n 'is_dynamic' => 1]);\n }\n unset ($this->input[\"_groups\"]);\n }\n }\n }\n }\n }", "\n /**\n * Synchronize picture (photo) of the user.\n *\n * @since 0.85\n *\n * @return string|boolean Filename to be stored in user picture field, false if no picture found\n */\n function syncLdapPhoto() {", " if (isset($this->fields[\"authtype\"])\n && (($this->fields[\"authtype\"] == Auth::LDAP)\n || ($this->fields[\"authtype\"] == Auth::NOT_YET_AUTHENTIFIED\n && !empty($this->fields[\"auths_id\"]))\n || Auth::isAlternateAuth($this->fields['authtype']))) {", " if (isset($this->fields[\"id\"]) && ($this->fields[\"id\"] > 0)) {\n $config_ldap = new AuthLDAP();\n $ds = false;", " //connect ldap server\n if ($config_ldap->getFromDB($this->fields['auths_id'])) {\n $ds = $config_ldap->connect();\n }", " if ($ds) {\n //get picture fields\n $picture_field = $config_ldap->fields['picture_field'];\n if (empty($picture_field)) {\n return false;\n }", " //get picture content in ldap\n $info = AuthLdap::getUserByDn($ds, $this->fields['user_dn'],\n [$picture_field], false);", " //getUserByDn returns an array. If the picture is empty,\n //$info[$picture_field][0] is null\n if (!isset($info[$picture_field][0]) || empty($info[$picture_field][0])) {\n return \"\";\n }\n //prepare paths\n $img = array_pop($info[$picture_field]);\n $filename = uniqid($this->fields['id'].'_');\n $sub = substr($filename, -2); /* 2 hex digit */\n $file = GLPI_PICTURE_DIR . \"/$sub/${filename}.jpg\";", " if (array_key_exists('picture', $this->fields)) {\n $oldfile = GLPI_PICTURE_DIR . \"/\" . $this->fields[\"picture\"];\n } else {\n $oldfile = null;\n }", " // update picture if not exist or changed\n if (empty($this->fields[\"picture\"])\n || !file_exists($oldfile)\n || sha1_file($oldfile) !== sha1($img)) {\n if (!is_dir(GLPI_PICTURE_DIR . \"/$sub\")) {\n mkdir(GLPI_PICTURE_DIR . \"/$sub\");\n }", " //save picture\n $outjpeg = fopen($file, 'wb');\n fwrite($outjpeg, $img);\n fclose ($outjpeg);", " //save thumbnail\n $thumb = GLPI_PICTURE_DIR . \"/$sub/${filename}_min.jpg\";\n Toolbox::resizePicture($file, $thumb);", " return \"$sub/${filename}.jpg\";\n }\n return $this->fields[\"picture\"];\n }\n }\n }", " return false;\n }", "\n /**\n * Update emails of the user.\n * Uses _useremails set from UI, not _emails set from LDAP.\n *\n * @return void\n */\n function updateUserEmails() {\n // Update emails (use _useremails set from UI, not _emails set from LDAP)", " $userUpdated = false;", " if (isset($this->input['_useremails']) && count($this->input['_useremails'])) {\n $useremail = new UserEmail();\n foreach ($this->input['_useremails'] as $id => $email) {\n $email = trim($email);", " // existing email\n if ($id > 0) {\n $params = ['id' => $id];", " // empty email : delete\n if (strlen($email) == 0) {\n $deleted = $useremail->delete($params);\n $userUpdated = $userUpdated || $deleted;", " } else { // Update email\n $params['email'] = $email;\n $params['is_default'] = $this->input['_default_email'] == $id ? 1 : 0;", " $existingUserEmail = new UserEmail();\n $existingUserEmail->getFromDB($id);\n if ($params['email'] == $existingUserEmail->fields['email']\n && $params['is_default'] == $existingUserEmail->fields['is_default']) {\n // Do not update if email has not changed\n continue;\n }", " $updated = $useremail->update($params);\n $userUpdated = $userUpdated || $updated;\n }", " } else { // New email\n $email_input = ['email' => $email,\n 'users_id' => $this->fields['id']];\n if (isset($this->input['_default_email'])\n && ($this->input['_default_email'] == $id)) {\n $email_input['is_default'] = 1;\n } else {\n $email_input['is_default'] = 0;\n }\n $added = $useremail->add($email_input);\n $userUpdated = $userUpdated || $added;\n }\n }\n }", " if ($userUpdated) {\n // calling $this->update() here leads to loss in $this->input\n $user = new User();\n $user->update(['id' => $this->fields['id'], 'date_mod' => $_SESSION['glpi_currenttime']]);\n }\n }", "\n /**\n * Synchronise Dynamics emails of the user.\n * Uses _emails (set from getFromLDAP), not _usermails set from UI.\n *\n * @return void\n */\n function syncDynamicEmails() {\n global $DB;", " $userUpdated = false;", " // input[\"_emails\"] not set when update from user.form or preference\n if (isset($this->fields[\"authtype\"])\n && isset($this->input[\"_emails\"])\n && (($this->fields[\"authtype\"] == Auth::LDAP)\n || Auth::isAlternateAuth($this->fields['authtype'])\n || ($this->fields[\"authtype\"] == Auth::MAIL))) {", " if (isset($this->fields[\"id\"]) && ($this->fields[\"id\"] > 0)) {\n $authtype = Auth::getMethodsByID($this->fields[\"authtype\"], $this->fields[\"auths_id\"]);", " if (count($authtype)\n || $this->fields[\"authtype\"] == Auth::EXTERNAL) {\n // Clean emails\n $this->input[\"_emails\"] = array_unique ($this->input[\"_emails\"]);", " // Delete not available groups like to LDAP\n $iterator = $DB->request([\n 'SELECT' => [\n 'id',\n 'users_id',\n 'email',\n 'is_dynamic'\n ],\n 'FROM' => 'glpi_useremails',\n 'WHERE' => ['users_id' => $this->fields['id']]\n ]);", " $useremail = new UserEmail();\n while ($data = $iterator->next()) {\n $i = array_search($data[\"email\"], $this->input[\"_emails\"]);\n if ($i !== false) {\n // Delete found item in order not to add it again\n unset($this->input[\"_emails\"][$i]);\n } else if ($data['is_dynamic']) {\n // Delete not found email\n $deleted = $useremail->delete(['id' => $data[\"id\"]]);\n $userUpdated = $userUpdated || $deleted;\n }\n }", " //If the email need to be added\n if (count($this->input[\"_emails\"]) > 0) {\n foreach ($this->input[\"_emails\"] as $email) {\n $added = $useremail->add(['users_id' => $this->fields[\"id\"],\n 'email' => $email,\n 'is_dynamic' => 1]);\n $userUpdated = $userUpdated || $added;\n }\n unset ($this->input[\"_emails\"]);\n }\n }\n }\n }", " if ($userUpdated) {\n // calling $this->update() here leads to loss in $this->input\n $user = new User();\n $user->update(['id' => $this->fields['id'], 'date_mod' => $_SESSION['glpi_currenttime']]);\n }\n }", " function getRawName() {\n global $CFG_GLPI;", " if (isset($this->fields[\"id\"]) && ($this->fields[\"id\"] > 0)) {\n //getRawName should not add ID\n $bkp_conf = $CFG_GLPI['is_ids_visible'];\n $CFG_GLPI['is_ids_visible'] = 0;\n $bkp_sessconf = (isset($_SESSION['glpiis_ids_visible']) ? $_SESSION[\"glpiis_ids_visible\"] : 0);\n $_SESSION[\"glpiis_ids_visible\"] = 0;\n $name = formatUserName($this->fields[\"id\"],\n $this->fields[\"name\"],\n (isset($this->fields[\"realname\"]) ? $this->fields[\"realname\"] : ''),\n (isset($this->fields[\"firstname\"]) ? $this->fields[\"firstname\"] : ''));", " $CFG_GLPI['is_ids_visible'] = $bkp_conf;\n $_SESSION[\"glpiis_ids_visible\"] = $bkp_sessconf;\n return $name;\n }\n return '';\n }", "\n /**\n * Function that tries to load the user membership from LDAP\n * by searching in the attributes of the User.\n *\n * @param resource $ldap_connection LDAP connection\n * @param array $ldap_method LDAP method\n * @param string $userdn Basedn of the user\n * @param string $login User login\n *\n * @return string|boolean Basedn of the user / false if not found\n */\n private function getFromLDAPGroupVirtual($ldap_connection, array $ldap_method, $userdn, $login) {\n global $DB;", " // Search in DB the ldap_field we need to search for in LDAP\n $iterator = $DB->request([\n 'SELECT DISTINCT' => 'ldap_field',\n 'FROM' => 'glpi_groups',\n 'WHERE' => ['NOT' => ['ldap_field' => '']],\n 'ORDER' => 'ldap_field'\n ]);\n $group_fields = [];", " while ($data = $iterator->next()) {\n $group_fields[] = Toolbox::strtolower($data[\"ldap_field\"]);\n }\n if (count($group_fields)) {\n //Need to sort the array because edirectory don't like it!\n sort($group_fields);", " // If the groups must be retrieve from the ldap user object\n $sr = @ ldap_read($ldap_connection, $userdn, \"objectClass=*\", $group_fields);\n $v = AuthLDAP::get_entries_clean($ldap_connection, $sr);", " for ($i=0; $i < $v['count']; $i++) {\n //Try to find is DN in present and needed: if yes, then extract only the OU from it\n if ((($ldap_method[\"group_field\"] == 'dn') || in_array('ou', $group_fields))\n && isset($v[$i]['dn'])) {", " $v[$i]['ou'] = [];\n for ($tmp=$v[$i]['dn']; count($tmptab = explode(',', $tmp, 2))==2; $tmp=$tmptab[1]) {\n $v[$i]['ou'][] = $tmptab[1];\n }", " // Search in DB for group with ldap_group_dn\n if (($ldap_method[\"group_field\"] == 'dn')\n && (count($v[$i]['ou']) > 0)) {\n $group_iterator = $DB->request([\n 'SELECT' => 'id',\n 'FROM' => 'glpi_groups',\n 'WHERE' => ['ldap_group_dn' => Toolbox::addslashes_deep($v[$i]['ou'])]\n ]);", " while ($group = $group_iterator->next()) {\n $this->fields[\"_groups\"][] = $group['id'];\n }\n }", " // searching with ldap_field='OU' and ldap_value is also possible\n $v[$i]['ou']['count'] = count($v[$i]['ou']);\n }", " // For each attribute retrieve from LDAP, search in the DB\n foreach ($group_fields as $field) {\n if (isset($v[$i][$field])\n && isset($v[$i][$field]['count'])\n && ($v[$i][$field]['count'] > 0)) {", " unset($v[$i][$field]['count']);\n $lgroups = [];\n foreach (Toolbox::addslashes_deep($v[$i][$field]) as $lgroup) {\n $lgroups[] = [\n new \\QueryExpression($DB::quoteValue($lgroup).\n \" LIKE \".\n $DB::quoteName('ldap_value'))\n ];\n }\n $group_iterator = $DB->request([\n 'SELECT' => 'id',\n 'FROM' => 'glpi_groups',\n 'WHERE' => [\n 'ldap_field' => $field,\n 'OR' => $lgroups\n ]\n ]);", " while ($group = $group_iterator->next()) {\n $this->fields[\"_groups\"][] = $group['id'];\n }\n }\n }\n } // for each ldapresult\n } // count($group_fields)\n }", "\n /**\n * Function that tries to load the user membership from LDAP\n * by searching in the attributes of the Groups.\n *\n * @param resource $ldap_connection LDAP connection\n * @param array $ldap_method LDAP method\n * @param string $userdn Basedn of the user\n * @param string $login User login\n *\n * @return boolean true if search is applicable, false otherwise\n */\n private function getFromLDAPGroupDiscret($ldap_connection, array $ldap_method, $userdn, $login) {\n global $DB;", " // No group_member_field : unable to get group\n if (empty($ldap_method[\"group_member_field\"])) {\n return false;\n }", " if ($ldap_method[\"use_dn\"]) {\n $user_tmp = $userdn;\n } else {\n //Don't add $ldap_method[\"login_field\"].\"=\", because sometimes it may not work (for example with posixGroup)\n $user_tmp = $login;\n }", " $v = $this->ldap_get_user_groups($ldap_connection, $ldap_method[\"basedn\"],\n $user_tmp,\n $ldap_method[\"group_condition\"],\n $ldap_method[\"group_member_field\"],\n $ldap_method[\"use_dn\"],\n $ldap_method[\"login_field\"]);\n foreach ($v as $result) {\n if (isset($result[$ldap_method[\"group_member_field\"]])\n && is_array($result[$ldap_method[\"group_member_field\"]])\n && (count($result[$ldap_method[\"group_member_field\"]]) > 0)) {", " $iterator = $DB->request([\n 'SELECT' => 'id',\n 'FROM' => 'glpi_groups',\n 'WHERE' => ['ldap_group_dn' => Toolbox::addslashes_deep($result[$ldap_method[\"group_member_field\"]])]\n ]);", " while ($group = $iterator->next()) {\n $this->fields[\"_groups\"][] = $group['id'];\n }\n }\n }\n return true;\n }", "\n /**\n * Function that tries to load the user informations from LDAP.\n *\n * @param resource $ldap_connection LDAP connection\n * @param array $ldap_method LDAP method\n * @param string $userdn Basedn of the user\n * @param string $login User Login\n * @param boolean $import true for import, false for update\n *\n * @return boolean true if found / false if not\n */\n function getFromLDAP($ldap_connection, array $ldap_method, $userdn, $login, $import = true) {\n global $DB, $CFG_GLPI;", " // we prevent some delay...\n if (empty($ldap_method[\"host\"])) {\n return false;\n }", " if (is_resource($ldap_connection)) {\n //Set all the search fields\n $this->fields['password'] = \"\";", " $fields = AuthLDAP::getSyncFields($ldap_method);", " //Hook to allow plugin to request more attributes from ldap\n $fields = Plugin::doHookFunction(\"retrieve_more_field_from_ldap\", $fields);", " $fields = array_filter($fields);\n $f = self::getLdapFieldNames($fields);", " $sr = @ ldap_read($ldap_connection, $userdn, \"objectClass=*\", $f);\n $v = AuthLDAP::get_entries_clean($ldap_connection, $sr);", " if (!is_array($v)\n || ( count($v) == 0)\n || empty($v[0][$fields['name']][0])) {\n return false;\n }", " //Store user's dn\n $this->fields['user_dn'] = addslashes($userdn);\n //Store date_sync\n $this->fields['date_sync'] = $_SESSION['glpi_currenttime'];\n // Empty array to ensure than syncDynamicEmails will be done\n $this->fields[\"_emails\"] = [];\n // force authtype as we retrieve this user by ldap (we could have login with SSO)\n $this->fields[\"authtype\"] = Auth::LDAP;", " foreach ($fields as $k => $e) {\n $val = AuthLDAP::getFieldValue(\n [$e => self::getLdapFieldValue($e, $v)],\n $e\n );\n if (empty($val)) {\n switch ($k) {\n case \"language\" :\n // Not set value : managed but user class\n break;", " case \"usertitles_id\" :\n case \"usercategories_id\" :\n case 'locations_id' :\n case 'users_id_supervisor' :\n $this->fields[$k] = 0;\n break;", " default :\n $this->fields[$k] = \"\";\n }", " } else {\n $val = Toolbox::addslashes_deep($val);\n switch ($k) {\n case \"email1\" :\n case \"email2\" :\n case \"email3\" :\n case \"email4\" :\n // Manage multivaluable fields\n if (!empty($v[0][$e])) {\n foreach ($v[0][$e] as $km => $m) {\n if (!preg_match('/count/', $km)) {\n $this->fields[\"_emails\"][] = addslashes($m);\n }\n }\n // Only get them once if duplicated\n $this->fields[\"_emails\"] = array_unique($this->fields[\"_emails\"]);\n }\n break;", " case \"language\" :\n $language = Config::getLanguage($val);\n if ($language != '') {\n $this->fields[$k] = $language;\n }\n break;", " case \"usertitles_id\" :\n $this->fields[$k] = Dropdown::importExternal('UserTitle', $val);\n break;", " case 'locations_id' :\n // use import to build the location tree\n $this->fields[$k] = Dropdown::import('Location',\n ['completename' => $val,\n 'entities_id' => 0,\n 'is_recursive' => 1]);\n break;", " case \"usercategories_id\" :\n $this->fields[$k] = Dropdown::importExternal('UserCategory', $val);\n break;", " case 'users_id_supervisor':\n $this->fields[$k] = self::getIdByField('user_dn', $val);\n break;", " default :\n $this->fields[$k] = $val;\n }\n }\n }", " // Empty array to ensure than syncLdapGroups will be done\n $this->fields[\"_groups\"] = [];", " ///The groups are retrieved by looking into an ldap user object\n if (($ldap_method[\"group_search_type\"] == 0)\n || ($ldap_method[\"group_search_type\"] == 2)) {\n $this->getFromLDAPGroupVirtual($ldap_connection, $ldap_method, $userdn, $login);\n }", " ///The groups are retrived by looking into an ldap group object\n if (($ldap_method[\"group_search_type\"] == 1)\n || ($ldap_method[\"group_search_type\"] == 2)) {\n $this->getFromLDAPGroupDiscret($ldap_connection, $ldap_method, $userdn, $login);\n }", " ///Only process rules if working on the master database\n if (!$DB->isSlave()) {\n //Instanciate the affectation's rule\n $rule = new RuleRightCollection();", " //Process affectation rules :\n //we don't care about the function's return because all\n //the datas are stored in session temporary\n if (isset($this->fields[\"_groups\"])) {\n $groups = $this->fields[\"_groups\"];\n } else {\n $groups = [];\n }", " $this->fields = $rule->processAllRules($groups, Toolbox::stripslashes_deep($this->fields),\n ['type' => 'LDAP',\n 'ldap_server' => $ldap_method[\"id\"],\n 'connection' => $ldap_connection,\n 'userdn' => $userdn,\n 'login' => $this->fields['name'],\n 'mail_email' => $this->fields['_emails']]);", " $this->fields['_ruleright_process'] = true;", " //If rule action is ignore import\n if ($import\n && isset($this->fields[\"_stop_import\"])) {\n return false;\n }\n //or no rights found & do not import users with no rights\n if ($import\n && !$CFG_GLPI[\"use_noright_users_add\"]) {\n $ok = false;\n if (isset($this->fields[\"_ldap_rules\"])\n && count($this->fields[\"_ldap_rules\"])) {\n if (isset($this->fields[\"_ldap_rules\"][\"rules_entities_rights\"])\n && count($this->fields[\"_ldap_rules\"][\"rules_entities_rights\"])) {\n $ok = true;\n }\n if (!$ok) {\n $entity_count = 0;\n $right_count = 0;\n if (Profile::getDefault()) {\n $right_count++;\n }\n if (isset($this->fields[\"_ldap_rules\"][\"rules_entities\"])) {\n $entity_count += count($this->fields[\"_ldap_rules\"][\"rules_entities\"]);\n }\n if (isset($this->input[\"_ldap_rules\"][\"rules_rights\"])) {\n $right_count += count($this->fields[\"_ldap_rules\"][\"rules_rights\"]);\n }\n if ($entity_count && $right_count) {\n $ok = true;\n }\n }\n }\n if (!$ok) {\n $this->fields[\"_stop_import\"] = true;\n return false;\n }\n }", " // Add ldap result to data send to the hook\n $this->fields['_ldap_result'] = $v;\n $this->fields['_ldap_conn'] = $ldap_connection;\n //Hook to retrieve more information for ldap\n $this->fields = Plugin::doHookFunction(\"retrieve_more_data_from_ldap\", $this->fields);\n unset($this->fields['_ldap_result']);\n }\n return true;\n }\n return false;", " } // getFromLDAP()", "\n /**\n * Get all groups a user belongs to.\n *\n * @param resource $ds ldap connection\n * @param string $ldap_base_dn Basedn used\n * @param string $user_dn Basedn of the user\n * @param string $group_condition group search condition\n * @param string $group_member_field group field member in a user object\n * @param boolean $use_dn search dn of user ($login_field=$user_dn) in group_member_field\n * @param string $login_field user login field\n *\n * @return array Groups of the user located in [0][$group_member_field] in returned array\n */\n function ldap_get_user_groups($ds, $ldap_base_dn, $user_dn, $group_condition,\n $group_member_field, $use_dn, $login_field) {", " $groups = [];\n $listgroups = [];", " //User dn may contain ( or ), need to espace it!\n $user_dn = str_replace([\"(\", \")\", \"\\,\", \"\\+\"], [\"\\(\", \"\\)\", \"\\\\\\,\", \"\\\\\\+\"],\n $user_dn);", " //Only retrive cn and member attributes from groups\n $attrs = ['dn'];", " if (!$use_dn) {\n $filter = \"(& $group_condition (|($group_member_field=$user_dn)\n ($group_member_field=$login_field=$user_dn)))\";\n } else {\n $filter = \"(& $group_condition ($group_member_field=$user_dn))\";\n }", " //Perform the search\n $filter = Toolbox::unclean_cross_side_scripting_deep($filter);\n $sr = ldap_search($ds, $ldap_base_dn, $filter, $attrs);", " //Get the result of the search as an array\n $info = AuthLDAP::get_entries_clean($ds, $sr);\n //Browse all the groups\n for ($i = 0; $i < count($info); $i++) {\n //Get the cn of the group and add it to the list of groups\n if (isset($info[$i][\"dn\"]) && ($info[$i][\"dn\"] != '')) {\n $listgroups[$i] = $info[$i][\"dn\"];\n }\n }", " //Create an array with the list of groups of the user\n $groups[0][$group_member_field] = $listgroups;\n //Return the groups of the user\n return $groups;\n }", "\n /**\n * Function that tries to load the user informations from IMAP.\n *\n * @param array $mail_method mail method description array\n * @param string $name login of the user\n *\n * @return boolean true if method is applicable, false otherwise\n */\n function getFromIMAP(array $mail_method, $name) {\n global $DB;", " // we prevent some delay..\n if (empty($mail_method[\"host\"])) {\n return false;\n }", " // some defaults...\n $this->fields['password'] = \"\";\n // Empty array to ensure than syncDynamicEmails will be done\n $this->fields[\"_emails\"] = [];\n $email = '';\n if (strpos($name, \"@\")) {\n $email = $name;\n } else {\n $email = $name . \"@\" . $mail_method[\"host\"];\n }\n $this->fields[\"_emails\"][] = $email;", " $this->fields['name'] = $name;\n //Store date_sync\n $this->fields['date_sync'] = $_SESSION['glpi_currenttime'];\n // force authtype as we retrieve this user by imap (we could have login with SSO)\n $this->fields[\"authtype\"] = Auth::MAIL;", " if (!$DB->isSlave()) {\n //Instanciate the affectation's rule\n $rule = new RuleRightCollection();", " //Process affectation rules :\n //we don't care about the function's return because all the datas are stored in session temporary\n if (isset($this->fields[\"_groups\"])) {\n $groups = $this->fields[\"_groups\"];\n } else {\n $groups = [];\n }\n $this->fields = $rule->processAllRules($groups, Toolbox::stripslashes_deep($this->fields),\n ['type' => 'MAIL',\n 'mail_server' => $mail_method[\"id\"],\n 'login' => $name,\n 'email' => $email]);\n $this->fields['_ruleright_process'] = true;\n }\n return true;\n }", "\n /**\n * Function that tries to load the user informations from the SSO server.\n *\n * @since 0.84\n *\n * @return boolean true if method is applicable, false otherwise\n */\n function getFromSSO() {\n global $DB, $CFG_GLPI;", " $a_field = [];\n foreach ($CFG_GLPI as $key=>$value) {\n if (!is_array($value) && !empty($value)\n && strstr($key, \"_ssofield\")) {\n $key = str_replace('_ssofield', '', $key);\n $a_field[$key] = $value;\n }\n }", " if (count($a_field) == 0) {\n return true;\n }\n $this->fields['_ruleright_process'] = true;\n foreach ($a_field as $field=>$value) {\n if (!isset($_SERVER[$value])\n || empty($_SERVER[$value])) {", " switch ($field) {\n case \"title\" :\n $this->fields['usertitles_id'] = 0;\n break;", " case \"category\" :\n $this->fields['usercategories_id'] = 0;\n break;", " default :\n $this->fields[$field] = \"\";\n }", " } else {\n switch ($field) {\n case \"email1\" :\n case \"email2\" :\n case \"email3\" :\n case \"email4\" :\n // Manage multivaluable fields\n if (!preg_match('/count/', $_SERVER[$value])) {\n $this->fields[\"_emails\"][] = addslashes($_SERVER[$value]);\n }\n // Only get them once if duplicated\n $this->fields[\"_emails\"] = array_unique($this->fields[\"_emails\"]);\n break;", " case \"language\" :\n $language = Config::getLanguage($_SERVER[$value]);\n if ($language != '') {\n $this->fields[$field] = $language;\n }\n break;", " case \"title\" :\n $this->fields['usertitles_id']\n = Dropdown::importExternal('UserTitle', addslashes($_SERVER[$value]));\n break;", " case \"category\" :\n $this->fields['usercategories_id']\n = Dropdown::importExternal('UserCategory', addslashes($_SERVER[$value]));\n break;", " default :\n $this->fields[$field] = $_SERVER[$value];\n break;", " }\n }\n }\n ///Only process rules if working on the master database\n if (!$DB->isSlave()) {\n //Instanciate the affectation's rule\n $rule = new RuleRightCollection();", " $this->fields = $rule->processAllRules([], Toolbox::stripslashes_deep($this->fields),\n ['type' => 'SSO',\n 'email' => $this->fields[\"_emails\"],\n 'login' => $this->fields[\"name\"]]);", " //If rule action is ignore import\n if (isset($this->fields[\"_stop_import\"])) {\n return false;\n }\n }\n return true;\n }", "\n /**\n * Blank passwords field of a user in the DB.\n * Needed for external auth users.\n *\n * @return void\n */\n function blankPassword() {\n global $DB;", " if (!empty($this->fields[\"name\"])) {\n $DB->update(\n $this->getTable(), [\n 'password' => ''\n ], [\n 'name' => $this->fields['name']\n ]\n );\n }\n }", "\n /**\n * Print a good title for user pages.\n *\n * @return void\n */\n function title() {\n global $CFG_GLPI;", " $buttons = [];\n $title = self::getTypeName(Session::getPluralNumber());", " if (static::canCreate()) {\n $buttons[\"user.form.php\"] = __('Add user...');\n $title = \"\";", " if (Auth::useAuthExt()\n && Session::haveRight(\"user\", self::IMPORTEXTAUTHUSERS)) {\n // This requires write access because don't use entity config.\n $buttons[\"user.form.php?new=1&amp;ext_auth=1\"] = __('... From an external source');\n }\n }\n if (Session::haveRight(\"user\", self::IMPORTEXTAUTHUSERS)\n && (static::canCreate() || static::canUpdate())) {\n if (AuthLdap::useAuthLdap()) {\n $buttons[\"ldap.php\"] = __('LDAP directory link');\n }\n }\n Html::displayTitle($CFG_GLPI[\"root_doc\"] . \"/pics/users.png\", self::getTypeName(Session::getPluralNumber()), $title,\n $buttons);\n }", "\n /**\n * Check if current user have more right than the specified one.\n *\n * @param integer $ID ID of the user\n *\n * @return boolean\n */\n function currentUserHaveMoreRightThan($ID) {", " $user_prof = Profile_User::getUserProfiles($ID);\n return Profile::currentUserHaveMoreRightThan($user_prof);\n }", "\n /**\n * Print the user form.\n *\n * @param integer $ID ID of the user\n * @param array $options Options\n * - string target Form target\n * - boolean withtemplate Template or basic item\n *\n * @return boolean true if user found, false otherwise\n */\n function showForm($ID, array $options = []) {\n global $CFG_GLPI;", " // Affiche un formulaire User\n if (($ID != Session::getLoginUserID()) && !self::canView()) {\n return false;\n }", " $this->initForm($ID, $options);", " $ismyself = $ID == Session::getLoginUserID();\n $higherrights = $this->currentUserHaveMoreRightThan($ID);\n if ($ID) {\n $caneditpassword = $higherrights || ($ismyself && Session::haveRight('password_update', 1));\n } else {\n // can edit on creation form\n $caneditpassword = true;\n }", " $extauth = !(($this->fields[\"authtype\"] == Auth::DB_GLPI)\n || (($this->fields[\"authtype\"] == Auth::NOT_YET_AUTHENTIFIED)\n && !empty($this->fields[\"password\"])));", " $formtitle = $this->getTypeName(1);", " if ($ID > 0) {\n $formtitle .= \"<a class='pointer far fa-address-card' target='_blank' href='\".$CFG_GLPI[\"root_doc\"].\n User::getFormURLWithID($ID).\"&amp;getvcard=1' title='\".__s('Download user VCard').\n \"'><span class='sr-only'>\". __('Vcard').\"</span></a>\";\n }", " $options['formtitle'] = $formtitle;\n $options['formoptions'] = \" enctype='multipart/form-data'\";\n $this->showFormHeader($options);\n $rand = mt_rand();", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='name'>\" . __('Login') . \"</label></td>\";\n if ($this->fields[\"name\"] == \"\" ||\n !empty($this->fields[\"password\"])\n || ($this->fields[\"authtype\"] == Auth::DB_GLPI) ) {\n //display login field for new records, or if this is not external auth\n echo \"<td><input name='name' id='name' value=\\\"\" . $this->fields[\"name\"] . \"\\\"></td>\";\n } else {\n echo \"<td class='b'>\" . $this->fields[\"name\"];\n echo \"<input type='hidden' name='name' value=\\\"\" . $this->fields[\"name\"] . \"\\\"></td>\";\n }", " if (!empty($this->fields[\"name\"])) {\n echo \"<td rowspan='4'>\" . __('Picture') . \"</td>\";\n echo \"<td rowspan='4'>\";\n echo \"<div class='user_picture_border_small' id='picture$rand'>\";\n echo \"<img class='user_picture_small' alt=\\\"\".__s('Picture').\"\\\" src='\".\n User::getThumbnailURLForPicture($this->fields['picture']).\"'>\";\n // echo \"<img src='\".self::getURLForPicture($this->fields[\"picture\"]).\"' class='user_picture'/>\";\n echo \"</div>\";\n $full_picture = \"<div class='user_picture_border'>\";\n $full_picture .= \"<img class='user_picture' alt=\\\"\".__s('Picture').\"\\\" src='\".\n User::getURLForPicture($this->fields['picture']).\"'>\";\n $full_picture .= \"</div>\";", " Html::showTooltip($full_picture, ['applyto' => \"picture$rand\"]);\n echo Html::file(['name' => 'picture', 'display' => false, 'onlyimages' => true]);\n echo \"<input type='checkbox' name='_blank_picture'>&nbsp;\".__('Clear');\n echo \"</td>\";\n } else {\n echo \"<td rowspan='4'></td>\";\n echo \"<td rowspan='4'></td>\";\n }\n echo \"</tr>\";", " //If it's an external auth, check if the sync_field must be displayed\n if ($extauth\n && $this->fields['auths_id']\n && AuthLDAP::isSyncFieldConfigured($this->fields['auths_id'])) {\n $syncrand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_sync_field$syncrand'>\" . __('Synchronization field') . \"</label></td><td>\";\n if (self::canUpdate()\n && (!$extauth || empty($ID))) {\n Html::autocompletionTextField($this, \"sync_field\", ['rand' => $syncrand]);\n } else {\n if (empty($this->fields['sync_field'])) {\n echo Dropdown::EMPTY_VALUE;\n } else {\n echo $this->fields['sync_field'];\n }\n }\n echo \"</td></tr>\";\n } else {\n echo \"<tr class='tab_bg_1'><td colspan='2'></td></tr>\";\n }", " $surnamerand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_realname$surnamerand'>\" . __('Surname') . \"</label></td><td>\";\n Html::autocompletionTextField($this, \"realname\", ['rand' => $surnamerand]);\n echo \"</td></tr>\";", " $firstnamerand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_firstname$firstnamerand'>\" . __('First name') . \"</label></td><td>\";\n Html::autocompletionTextField($this, \"firstname\", ['rand' => $firstnamerand]);\n echo \"</td></tr>\";", " //do some rights verification\n if (self::canUpdate()\n && (!$extauth || empty($ID))\n && $caneditpassword) {\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='password'>\" . __('Password').\"</label></td>\";\n echo \"<td><input id='password' type='password' name='password' value='' size='20'\n autocomplete='off' onkeyup=\\\"return passwordCheck();\\\"></td>\";\n echo \"<td rowspan='2'>\";\n if ($CFG_GLPI[\"use_password_security\"]) {\n echo __('Password security policy');\n }\n echo \"</td>\";\n echo \"<td rowspan='2'>\";\n Config::displayPasswordSecurityChecks();\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='password2'>\" . __('Password confirmation') . \"</label></td>\";\n echo \"<td><input type='password' id='password2' name='password2' value='' size='20' autocomplete='off'>\";\n echo \"</td></tr>\";\n }", " echo \"<tr class='tab_bg_1'>\";\n if (!GLPI_DEMO_MODE) {\n $activerand = mt_rand();\n echo \"<td><label for='dropdown_is_active$activerand'>\".__('Active').\"</label></td><td>\";\n Dropdown::showYesNo('is_active', $this->fields['is_active'], -1, ['rand' => $activerand]);\n echo \"</td>\";\n } else {\n echo \"<td colspan='2'></td>\";\n }\n echo \"<td>\" . _n('Email', 'Emails', Session::getPluralNumber());\n UserEmail::showAddEmailButton($this);\n echo \"</td><td>\";\n UserEmail::showForUser($this);\n echo \"</td>\";\n echo \"</tr>\";", " if (!GLPI_DEMO_MODE) {\n $sincerand = mt_rand();\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='showdate$sincerand'>\".__('Valid since').\"</label></td><td>\";\n Html::showDateTimeField(\"begin_date\", ['value' => $this->fields[\"begin_date\"],\n 'rand' => $sincerand,\n 'timestep' => 1,\n 'maybeempty' => true]);\n echo \"</td>\";", " $untilrand = mt_rand();\n echo \"<td><label for='showdate$untilrand'>\".__('Valid until').\"</label></td><td>\";\n Html::showDateTimeField(\"end_date\", ['value' => $this->fields[\"end_date\"],\n 'rand' => $untilrand,\n 'timestep' => 1,\n 'maybeempty' => true]);\n echo \"</td></tr>\";\n }", " $phonerand = mt_rand();\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='textfield_phone$phonerand'>\" . __('Phone') . \"</label></td><td>\";\n Html::autocompletionTextField($this, \"phone\", ['rand' => $phonerand]);\n echo \"</td>\";\n //Authentications information : auth method used and server used\n //don't display is creation of a new user'\n if (!empty($ID)) {\n if (Session::haveRight(self::$rightname, self::READAUTHENT)) {\n echo \"<td>\" . __('Authentication') . \"</td><td>\";\n echo Auth::getMethodName($this->fields[\"authtype\"], $this->fields[\"auths_id\"]);\n if (!empty($this->fields[\"date_sync\"])) {\n //TRANS: %s is the date of last sync\n echo '<br>'.sprintf(__('Last synchronization on %s'),\n HTML::convDateTime($this->fields[\"date_sync\"]));\n }\n if (!empty($this->fields[\"user_dn\"])) {\n //TRANS: %s is the user dn\n echo '<br>'.sprintf(__('%1$s: %2$s'), __('User DN'), $this->fields[\"user_dn\"]);\n }\n if ($this->fields['is_deleted_ldap']) {\n echo '<br>'.__('User missing in LDAP directory');\n }", " echo \"</td>\";\n } else {\n echo \"<td colspan='2'>&nbsp;</td>\";\n }\n } else {\n echo \"<td colspan='2'><input type='hidden' name='authtype' value='1'></td>\";\n }", " echo \"</tr>\";", " $mobilerand = mt_rand();\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='textfield_mobile$mobilerand'>\" . __('Mobile phone') . \"</label></td><td>\";\n Html::autocompletionTextField($this, \"mobile\", ['rand' => $mobilerand]);\n echo \"</td>\";\n $catrand = mt_rand();\n echo \"<td><label for='dropdown_usercategories_id$catrand'>\" . __('Category') . \"</label></td><td>\";\n UserCategory::dropdown(['value' => $this->fields[\"usercategories_id\"], 'rand' => $catrand]);\n echo \"</td></tr>\";", " $phone2rand = mt_rand();\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='textfield_phone2$phone2rand'>\" . __('Phone 2') . \"</label></td><td>\";\n Html::autocompletionTextField($this, \"phone2\", ['rand' => $phone2rand]);\n echo \"</td>\";\n echo \"<td rowspan='4' class='middle'><label for='comment'>\" . __('Comments') . \"</label></td>\";\n echo \"<td class='center middle' rowspan='4'>\";\n echo \"<textarea cols='45' rows='6' id='comment' name='comment' >\".$this->fields[\"comment\"].\"</textarea>\";\n echo \"</td></tr>\";", " $admnumrand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_registration_number$admnumrand'>\" . __('Administrative number') . \"</label></td><td>\";\n Html::autocompletionTextField($this, \"registration_number\", ['rand' => $admnumrand]);\n echo \"</td></tr>\";", " $titlerand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='dropdown_usertitles_id$titlerand'>\" . _x('person', 'Title') . \"</label></td><td>\";\n UserTitle::dropdown(['value' => $this->fields[\"usertitles_id\"], 'rand' => $titlerand]);\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'>\";\n if (!empty($ID)) {\n $locrand = mt_rand();\n echo \"<td><label for='dropdown_locations_id$locrand'>\" . __('Location') . \"</label></td><td>\";\n $entities = $this->getEntities();\n if (count($entities) <= 0) {\n $entities = -1;\n }\n Location::dropdown(['value' => $this->fields[\"locations_id\"],\n 'rand' => $locrand,\n 'entity' => $entities]);\n echo \"</td>\";\n }\n echo \"</tr>\";", " if (empty($ID)) {\n echo \"<tr class='tab_bg_1'>\";\n echo \"<th colspan='2'>\"._n('Authorization', 'Authorizations', 1).\"</th>\";\n $recurrand = mt_rand();\n echo \"<td><label for='dropdown__is_recursive$recurrand'>\" . __('Recursive') . \"</label></td><td>\";\n Dropdown::showYesNo(\"_is_recursive\", 0, -1, ['rand' => $recurrand]);\n echo \"</td></tr>\";\n $profilerand = mt_rand();\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='dropdown__profiles_id$profilerand'>\" . __('Profile') . \"</label></td><td>\";\n Profile::dropdownUnder(['name' => '_profiles_id',\n 'rand' => $profilerand,\n 'value' => Profile::getDefault()]);", " $entrand = mt_rand();\n echo \"</td><td><label for='dropdown__entities_id$entrand'>\" . __('Entity') . \"</label></td><td>\";\n Entity::dropdown(['name' => '_entities_id',\n 'display_emptychoice' => false,\n 'rand' => $entrand,\n 'entity' => $_SESSION['glpiactiveentities']]);\n echo \"</td></tr>\";\n } else {\n if ($higherrights || $ismyself) {\n $profilerand = mt_rand();\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='dropdown_profiles_id$profilerand'>\" . __('Default profile') . \"</label></td><td>\";", " $options = Dropdown::getDropdownArrayNames('glpi_profiles',\n Profile_User::getUserProfiles($this->fields['id']));", " Dropdown::showFromArray(\"profiles_id\", $options,\n ['value' => $this->fields[\"profiles_id\"],\n 'rand' => $profilerand,\n 'display_emptychoice' => true]);\n }\n if ($higherrights) {\n $entrand = mt_rand();\n echo \"</td><td><label for='dropdown_entities_id$entrand'>\" . __('Default entity') . \"</label></td><td>\";\n $entities = $this->getEntities();\n Entity::dropdown(['value' => $this->fields[\"entities_id\"],\n 'rand' => $entrand,\n 'entity' => $entities]);\n echo \"</td></tr>\";", " $grouprand = mt_rand();\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='dropdown_profiles_id$grouprand'>\" . __('Default group') . \"</label></td><td>\";", " $options = [];\n foreach (Group_User::getUserGroups($this->fields['id']) as $group) {\n $options[$group['id']] = $group['completename'];\n }", " Dropdown::showFromArray(\"groups_id\", $options,\n ['value' => $this->fields[\"groups_id\"],\n 'rand' => $grouprand,\n 'display_emptychoice' => true]);", " echo \"</td>\";\n $userrand = mt_rand();\n echo \"<td><label for='dropdown_users_id_supervisor_$userrand'>\" . __('Responsible') . \"</label></td><td>\";", " User::dropdown(['name' => 'users_id_supervisor',\n 'value' => $this->fields[\"users_id_supervisor\"],\n 'rand' => $userrand,\n 'entity' => $_SESSION[\"glpiactive_entity\"],\n 'right' => 'all']);\n echo \"</td></tr>\";\n }", " if ($this->can($ID, UPDATE)) {\n echo \"<tr class='tab_bg_1'><th colspan='4'>\". __('Remote access keys') .\"</th></tr>\";", " echo \"<tr class='tab_bg_1'><td>\";\n echo __(\"Personal token\");\n echo \"</td><td colspan='2'>\";", " if (!empty($this->fields[\"personal_token\"])) {\n echo \"<div class='copy_to_clipboard_wrapper'>\";\n echo Html::input('_personal_token', [\n 'value' => $this->fields[\"personal_token\"],\n 'style' => 'width:90%'\n ]);\n echo \"</div>\";\n echo \"(\".sprintf(__('generated on %s'),\n Html::convDateTime($this->fields[\"personal_token_date\"])).\")\";\n }\n echo \"</td><td>\";\n Html::showCheckbox(['name' => '_reset_personal_token',\n 'title' => __('Regenerate')]);\n echo \"&nbsp;&nbsp;\".__('Regenerate');\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'><td>\";\n echo __(\"API token\");\n echo \"</td><td colspan='2'>\";\n if (!empty($this->fields[\"api_token\"])) {\n echo \"<div class='copy_to_clipboard_wrapper'>\";\n echo Html::input('_api_token', [\n 'value' => $this->fields[\"api_token\"],\n 'style' => 'width:90%'\n ]);\n echo \"</div>\";\n echo \"(\".sprintf(__('generated on %s'),\n Html::convDateTime($this->fields[\"api_token_date\"])).\")\";\n }\n echo \"</td><td>\";\n Html::showCheckbox(['name' => '_reset_api_token',\n 'title' => __('Regenerate')]);\n echo \"&nbsp;&nbsp;\".__('Regenerate');\n echo \"</td></tr>\";\n }", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td colspan='2' class='center'>\";\n if ($this->fields[\"last_login\"]) {\n printf(__('Last login on %s'), HTML::convDateTime($this->fields[\"last_login\"]));\n }\n echo \"</td><td colspan='2'class='center'>\";", " echo \"</td></tr>\";\n }", " $this->showFormButtons($options);", " return true;\n }", "\n /** Print the user personnal information for check.\n *\n * @param integer $userid ID of the user\n *\n * @return void|boolean false if user is not the current user, otherwise print form\n *\n * @since 0.84\n */\n static function showPersonalInformation($userid) {\n global $CFG_GLPI;", " $user = new self();\n if (!$user->can($userid, READ)\n && ($userid != Session::getLoginUserID())) {\n return false;\n }\n echo \"<table class='tab_glpi left' width='100%'>\";\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td class='b' width='20%'>\";\n echo __('Name');\n echo \"</td><td width='30%'>\";\n echo getUserName($userid);\n echo \"</td>\";\n echo \"<td class='b' width='20%'>\";\n echo __('Phone');\n echo \"</td><td width='30%'>\";\n echo $user->getField('phone');\n echo \"</td>\";\n echo \"</tr>\";", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td class='b'>\";\n echo __('Phone 2');\n echo \"</td><td>\";\n echo $user->getField('phone2');\n echo \"</td>\";\n echo \"<td class='b'>\";\n echo __('Mobile phone');\n echo \"</td><td>\";\n echo $user->getField('mobile');\n echo \"</td>\";\n echo \"</tr>\";", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td class='b'>\";\n echo __('Email');\n echo \"</td><td>\";\n echo $user->getDefaultEmail();\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td class='b'>\";\n echo __('Location');\n echo \"</td><td>\";\n echo Dropdown::getDropdownName('glpi_locations', $user->getField('locations_id'));\n echo \"</td>\";\n echo \"<td colspan='2' class='center'>\";\n if ($userid == Session::getLoginUserID()) {\n echo \"<a href='\".$CFG_GLPI['root_doc'].\"/front/preference.php' class='vsubmit'>\".\n __('Edit').\"</a>\";\n } else {\n echo \"&nbsp;\";\n }\n echo \"</td>\";\n echo \"</tr>\";\n echo \"</table>\";\n }", "\n /**\n * Print the user preference form.\n *\n * @param string $target Form target\n * @param integer $ID ID of the user\n *\n * @return boolean true if user found, false otherwise\n */\n function showMyForm($target, $ID) {\n global $CFG_GLPI;", " // Affiche un formulaire User\n if (($ID != Session::getLoginUserID())\n && !$this->currentUserHaveMoreRightThan($ID)) {\n return false;\n }\n if ($this->getFromDB($ID)) {\n $rand = mt_rand();\n $authtype = $this->getAuthMethodsByID();", " $extauth = !(($this->fields[\"authtype\"] == Auth::DB_GLPI)\n || (($this->fields[\"authtype\"] == Auth::NOT_YET_AUTHENTIFIED)\n && !empty($this->fields[\"password\"])));", " // No autocopletion :\n $save_autocompletion = $CFG_GLPI[\"use_ajax_autocompletion\"];\n $CFG_GLPI[\"use_ajax_autocompletion\"] = false;", " echo \"<div class='center'>\";\n echo \"<form method='post' name='user_manager' enctype='multipart/form-data' action='\".$target.\"' autocomplete='off'>\";\n echo \"<table class='tab_cadre_fixe'>\";\n echo \"<tr><th colspan='4'>\".sprintf(__('%1$s: %2$s'), __('Login'), $this->fields[\"name\"]);\n echo \"<input type='hidden' name='name' value='\" . $this->fields[\"name\"] . \"'>\";\n echo \"<input type='hidden' name='id' value='\" . $this->fields[\"id\"] . \"'>\";\n echo \"</th></tr>\";", " $surnamerand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_realname$surnamerand'>\" . __('Surname') . \"</label></td><td>\";", " if ($extauth\n && isset($authtype['realname_field'])\n && !empty($authtype['realname_field'])) {", " echo $this->fields[\"realname\"];\n } else {\n Html::autocompletionTextField($this, \"realname\", ['rand' => $surnamerand]);\n }\n echo \"</td>\";", " if (!empty($this->fields[\"name\"])) {\n echo \"<td rowspan='4'>\" . __('Picture') . \"</td>\";\n echo \"<td rowspan='4'>\";\n echo \"<div class='user_picture_border_small' id='picture$rand'>\";\n echo \"<img class='user_picture_small' alt=\\\"\".__s('Picture').\"\\\" src='\".\n User::getThumbnailURLForPicture($this->fields['picture']).\"'>\";\n echo \"</div>\";\n $full_picture = \"<div class='user_picture_border'>\";\n $full_picture .= \"<img class='user_picture' alt=\\\"\".__s('Picture').\"\\\" src='\".\n User::getURLForPicture($this->fields['picture']).\"'>\";\n $full_picture .= \"</div>\";", " Html::showTooltip($full_picture, ['applyto' => \"picture$rand\"]);\n echo Html::file(['name' => 'picture', 'display' => false, 'onlyimages' => true]);", " echo \"&nbsp;\";\n Html::showCheckbox(['name' => '_blank_picture', 'title' => __('Clear')]);\n echo \"&nbsp;\".__('Clear');", " echo \"</td>\";\n echo \"</tr>\";\n }", " $firstnamerand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_firstname$firstnamerand'>\" . __('First name') . \"</label></td><td>\";\n if ($extauth\n && isset($authtype['firstname_field'])\n && !empty($authtype['firstname_field'])) {", " echo $this->fields[\"firstname\"];\n } else {\n Html::autocompletionTextField($this, \"firstname\", ['rand' => $firstnamerand]);\n }\n echo \"</td></tr>\";", " if ($extauth\n && $this->fields['auths_id']\n && AuthLDAP::isSyncFieldConfigured($this->fields['auths_id'])) {\n echo \"<tr class='tab_bg_1'><td>\" . __('Synchronization field') . \"</td><td>\";\n if (empty($this->fields['sync_field'])) {\n echo Dropdown::EMPTY_VALUE;\n } else {\n echo $this->fields['sync_field'];\n }\n echo \"</td></tr>\";\n } else {\n echo \"<tr class='tab_bg_1'><td colspan='2'></td></tr>\";\n }", " echo \"<tr class='tab_bg_1'>\";", " if (!GLPI_DEMO_MODE) {\n $langrand = mt_rand();\n echo \"<td><label for='dropdown_language$langrand'>\" . __('Language') . \"</label></td><td>\";\n // Language is stored as null in DB if value is same as the global config.\n $language = $this->fields[\"language\"];\n if (null === $this->fields[\"language\"]) {\n $language = $CFG_GLPI['language'];\n }\n Dropdown::showLanguages(\n \"language\",\n [\n 'rand' => $langrand,\n 'value' => $language,\n ]\n );\n echo \"</td>\";\n } else {\n echo \"<td colspan='2'>&nbsp;</td>\";\n }\n echo \"</tr>\";", " //do some rights verification\n if (!$extauth\n && Session::haveRight(\"password_update\", \"1\")) {\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='password'>\" . __('Password') . \"</label></td>\";\n echo \"<td><input id='password' type='password' name='password' value='' size='30' autocomplete='off' onkeyup=\\\"return passwordCheck();\\\">\";\n echo \"</td>\";\n echo \"<td rowspan='2'>\";\n if ($CFG_GLPI[\"use_password_security\"]) {\n echo __('Password security policy');\n }\n echo \"</td>\";\n echo \"<td rowspan='2'>\";\n Config::displayPasswordSecurityChecks();\n echo \"</td>\";\n echo \"</tr>\";", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='password2'>\" . __('Password confirmation') . \"</label></td>\";\n echo \"<td><input type='password' name='password2' id='password2' value='' size='30' autocomplete='off'>\";\n echo \"</td></tr>\";", " }", " $phonerand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_phone$phonerand'>\" . __('Phone') . \"</label></td><td>\";", " if ($extauth\n && isset($authtype['phone_field']) && !empty($authtype['phone_field'])) {\n echo $this->fields[\"phone\"];\n } else {\n Html::autocompletionTextField($this, \"phone\", ['rand' => $phonerand]);\n }\n echo \"</td>\";\n echo \"<td class='top'>\" . _n('Email', 'Emails', Session::getPluralNumber());\n UserEmail::showAddEmailButton($this);\n echo \"</td><td>\";\n UserEmail::showForUser($this);\n echo \"</td>\";\n echo \"</tr>\";", " $mobilerand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_mobile$mobilerand'>\" . __('Mobile phone') . \"</label></td><td>\";", " if ($extauth\n && isset($authtype['mobile_field']) && !empty($authtype['mobile_field'])) {\n echo $this->fields[\"mobile\"];\n } else {\n Html::autocompletionTextField($this, \"mobile\", ['rand' => $mobilerand]);\n }\n echo \"</td>\";", " if (count($_SESSION['glpiprofiles']) >1) {\n $profilerand = mt_rand();\n echo \"<td><label for='dropdown_profiles_id$profilerand'>\" . __('Default profile') . \"</label></td><td>\";", " $options = Dropdown::getDropdownArrayNames('glpi_profiles',\n Profile_User::getUserProfiles($this->fields['id']));\n Dropdown::showFromArray(\"profiles_id\", $options,\n ['value' => $this->fields[\"profiles_id\"],\n 'rand' => $profilerand,\n 'display_emptychoice' => true]);\n echo \"</td>\";", " } else {\n echo \"<td colspan='2'>&nbsp;</td>\";\n }\n echo \"</tr>\";", " $phone2rand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_phone2$phone2rand'>\" . __('Phone 2') . \"</label></td><td>\";", " if ($extauth\n && isset($authtype['phone2_field']) && !empty($authtype['phone2_field'])) {\n echo $this->fields[\"phone2\"];\n } else {\n Html::autocompletionTextField($this, \"phone2\", ['rand' => $phone2rand]);\n }\n echo \"</td>\";", " $entities = $this->getEntities();\n if (!GLPI_DEMO_MODE\n && (count($_SESSION['glpiactiveentities']) > 1)) {\n $entrand = mt_rand();\n echo \"<td><label for='dropdown_entities_id$entrand'>\" . __('Default entity') . \"</td><td>\";\n Entity::dropdown(['value' => $this->fields['entities_id'],\n 'rand' => $entrand,\n 'entity' => $entities]);\n } else {\n echo \"<td colspan='2'>&nbsp;\";\n }\n echo \"</td></tr>\";", " $admnumrand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_registration_number$admnumrand'>\" . __('Administrative number') . \"</label></td><td>\";\n if ($extauth\n && isset($authtype['registration_number_field']) && !empty($authtype['registration_number_field'])) {\n echo $this->fields[\"registration_number\"];\n } else {\n Html::autocompletionTextField($this, \"registration_number\", ['rand' => $admnumrand]);\n }\n echo \"</td><td colspan='2'></td></tr>\";", " $locrand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='dropdown_locations_id$locrand'>\" . __('Location') . \"</label></td><td>\";\n Location::dropdown(['value' => $this->fields['locations_id'],\n 'rand' => $locrand,\n 'entity' => $entities]);", " if (Config::canUpdate()) {\n $moderand = mt_rand();\n echo \"<td><label for='dropdown_use_mode$moderand'>\" . __('Use GLPI in mode') . \"</label></td><td>\";\n $modes = [\n Session::NORMAL_MODE => __('Normal'),\n Session::DEBUG_MODE => __('Debug'),\n ];\n Dropdown::showFromArray('use_mode', $modes, ['value' => $this->fields[\"use_mode\"], 'rand' => $moderand]);\n } else {\n echo \"<td colspan='2'>&nbsp;\";\n }\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'><th colspan='4'>\". __('Remote access keys') .\"</th></tr>\";", " echo \"<tr class='tab_bg_1'><td>\";\n echo __(\"Personal token\");\n echo \"</td><td colspan='2'>\";", " if (!empty($this->fields[\"personal_token\"])) {\n echo \"<div class='copy_to_clipboard_wrapper'>\";\n echo Html::input('_personal_token', [\n 'value' => $this->fields[\"personal_token\"],\n 'style' => 'width:90%'\n ]);\n echo \"</div>\";\n echo \"(\".sprintf(__('generated on %s'),\n Html::convDateTime($this->fields[\"personal_token_date\"])).\")\";\n }\n echo \"</td><td>\";\n Html::showCheckbox(['name' => '_reset_personal_token',\n 'title' => __('Regenerate')]);\n echo \"&nbsp;&nbsp;\".__('Regenerate');\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'><td>\";\n echo __(\"API token\");\n echo \"</td><td colspan='2'>\";\n if (!empty($this->fields[\"api_token\"])) {\n echo \"<div class='copy_to_clipboard_wrapper'>\";\n echo Html::input('_api_token', [\n 'value' => $this->fields[\"api_token\"],\n 'style' => 'width:90%'\n ]);\n echo \"</div>\";\n echo \"(\".sprintf(__('generated on %s'),\n Html::convDateTime($this->fields[\"api_token_date\"])).\")\";\n }\n echo \"</td><td>\";\n Html::showCheckbox(['name' => '_reset_api_token',\n 'title' => __('Regenerate')]);\n echo \"&nbsp;&nbsp;\".__('Regenerate');\n echo \"</td></tr>\";", " echo \"<tr><td class='tab_bg_2 center' colspan='4'>\";\n echo \"<input type='submit' name='update' value=\\\"\"._sx('button', 'Save').\"\\\" class='submit'>\";\n echo \"</td></tr>\";", " echo \"</table>\";\n Html::closeForm();\n echo \"</div>\";\n $CFG_GLPI[\"use_ajax_autocompletion\"] = $save_autocompletion;\n return true;\n }\n return false;\n }", "\n /**\n * Get all the authentication method parameters for the current user.\n *\n * @return array\n */\n function getAuthMethodsByID() {\n return Auth::getMethodsByID($this->fields[\"authtype\"], $this->fields[\"auths_id\"]);\n }", "\n function pre_updateInDB() {\n global $DB;", " if (($key = array_search('name', $this->updates)) !== false) {\n /// Check if user does not exists\n $iterator = $DB->request([\n 'FROM' => $this->getTable(),\n 'WHERE' => [\n 'name' => $this->input['name'],\n 'id' => ['<>', $this->input['id']]\n ]\n ]);", " if (count($iterator)) {\n //To display a message\n $this->fields['name'] = $this->oldvalues['name'];\n unset($this->updates[$key]);\n unset($this->oldvalues['name']);\n Session::addMessageAfterRedirect(__('Unable to update login. A user already exists.'),\n false, ERROR);\n }", " if (!Auth::isValidLogin($this->input['name'])) {\n $this->fields['name'] = $this->oldvalues['name'];\n unset($this->updates[$key]);\n unset($this->oldvalues['name']);\n Session::addMessageAfterRedirect(__('The login is not valid. Unable to update login.'),\n false, ERROR);\n }", " }", " /// Security system except for login update\n if (Session::getLoginUserID()\n && !Session::haveRight(\"user\", UPDATE)\n && !strpos($_SERVER['PHP_SELF'], \"/front/login.php\")) {", " if (Session::getLoginUserID() === $this->input['id']) {\n if (isset($this->fields[\"authtype\"])) {", " // extauth ldap case\n if ($_SESSION[\"glpiextauth\"]\n && (($this->fields[\"authtype\"] == Auth::LDAP)\n || Auth::isAlternateAuth($this->fields[\"authtype\"]))) {", " $authtype = Auth::getMethodsByID($this->fields[\"authtype\"],\n $this->fields[\"auths_id\"]);\n if (count($authtype)) {\n $fields = AuthLDAP::getSyncFields($authtype);\n foreach ($fields as $key => $val) {\n if (!empty($val)\n && (($key2 = array_search($key, $this->updates)) !== false)) {", " unset ($this->updates[$key2]);\n unset($this->oldvalues[$key]);", " }\n }\n }\n }", " if (($key = array_search(\"is_active\", $this->updates)) !== false) {\n unset ($this->updates[$key]);\n unset($this->oldvalues['is_active']);\n }", " if (($key = array_search(\"comment\", $this->updates)) !== false) {\n unset ($this->updates[$key]);\n unset($this->oldvalues['comment']);\n }\n }\n }\n }\n }", " function getSpecificMassiveActions($checkitem = null) {", " $isadmin = static::canUpdate();\n $actions = parent::getSpecificMassiveActions($checkitem);\n if ($isadmin) {\n $actions['Group_User'.MassiveAction::CLASS_ACTION_SEPARATOR.'add']\n = __('Associate to a group');\n $actions['Group_User'.MassiveAction::CLASS_ACTION_SEPARATOR.'remove']\n = __('Dissociate from a group');\n $actions['Profile_User'.MassiveAction::CLASS_ACTION_SEPARATOR.'add']\n = __('Associate to a profile');\n $actions['Profile_User'.MassiveAction::CLASS_ACTION_SEPARATOR.'remove']\n = __('Dissociate from a profile');\n $actions['Group_User'.MassiveAction::CLASS_ACTION_SEPARATOR.'change_group_user']\n = __(\"Move to group\");\n }", " if (Session::haveRight(self::$rightname, self::UPDATEAUTHENT)) {\n $prefix = __CLASS__.MassiveAction::CLASS_ACTION_SEPARATOR;\n $actions[$prefix.'change_authtype'] = _x('button', 'Change the authentication method');\n $actions[$prefix.'force_user_ldap_update'] = __('Force synchronization');\n }\n return $actions;\n }", " static function showMassiveActionsSubForm(MassiveAction $ma) {\n global $CFG_GLPI;", " switch ($ma->getAction()) {\n case 'change_authtype' :\n $rand = Auth::dropdown(['name' => 'authtype']);\n $paramsmassaction = ['authtype' => '__VALUE__'];\n Ajax::updateItemOnSelectEvent(\"dropdown_authtype$rand\", \"show_massiveaction_field\",\n $CFG_GLPI[\"root_doc\"].\n \"/ajax/dropdownMassiveActionAuthMethods.php\",\n $paramsmassaction);\n echo \"<span id='show_massiveaction_field'><br><br>\";\n echo Html::submit(_x('button', 'Post'), ['name' => 'massiveaction']).\"</span>\";\n return true;\n }\n return parent::showMassiveActionsSubForm($ma);\n }", " static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item,\n array $ids) {", " switch ($ma->getAction()) {\n case 'force_user_ldap_update' :\n foreach ($ids as $id) {\n if ($item->can($id, UPDATE)) {\n if (($item->fields[\"authtype\"] == Auth::LDAP)\n || ($item->fields[\"authtype\"] == Auth::EXTERNAL)) {\n if (AuthLdap::forceOneUserSynchronization($item, false)) {\n $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);\n } else {\n $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);\n $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));\n }\n } else {\n $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);\n $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));\n }\n } else {\n $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);\n $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));\n }\n }\n return;", " case 'change_authtype' :\n $input = $ma->getInput();\n if (!isset($input[\"authtype\"])\n || !isset($input[\"auths_id\"])) {\n $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);\n $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));\n return;\n }\n if (Session::haveRight(self::$rightname, self::UPDATEAUTHENT)) {\n if (User::changeAuthMethod($ids, $input[\"authtype\"], $input[\"auths_id\"])) {\n $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_OK);\n } else {\n $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);\n }\n } else {\n $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_NORIGHT);\n $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));\n }\n return;\n }\n parent::processMassiveActionsForOneItemtype($ma, $item, $ids);\n }", "\n function rawSearchOptions() {\n // forcegroup by on name set force group by for all items\n $tab = [];", " $tab[] = [\n 'id' => 'common',\n 'name' => __('Characteristics')\n ];", " $tab[] = [\n 'id' => '1',\n 'table' => $this->getTable(),\n 'field' => 'name',\n 'name' => __('Login'),\n 'datatype' => 'itemlink',\n 'forcegroupby' => true,\n 'massiveaction' => false\n ];", " $tab[] = [\n 'id' => '2',\n 'table' => $this->getTable(),\n 'field' => 'id',\n 'name' => __('ID'),\n 'massiveaction' => false,\n 'datatype' => 'number'\n ];", " $tab[] = [\n 'id' => '34',\n 'table' => $this->getTable(),\n 'field' => 'realname',\n 'name' => __('Last name'),\n 'datatype' => 'string'\n ];", " $tab[] = [\n 'id' => '9',\n 'table' => $this->getTable(),\n 'field' => 'firstname',\n 'name' => __('First name'),\n 'datatype' => 'string'\n ];", " $tab[] = [\n 'id' => '5',\n 'table' => 'glpi_useremails',\n 'field' => 'email',\n 'name' => _n('Email', 'Emails', Session::getPluralNumber()),\n 'datatype' => 'email',\n 'joinparams' => [\n 'jointype' => 'child'\n ],\n 'forcegroupby' => true,\n 'massiveaction' => false\n ];", " $tab[] = [\n 'id' => '150',\n 'table' => $this->getTable(),\n 'field' => 'picture',\n 'name' => __('Picture'),\n 'datatype' => 'specific',\n 'nosearch' => true,\n 'massiveaction' => false\n ];", " $tab[] = [\n 'id' => '28',\n 'table' => $this->getTable(),\n 'field' => 'sync_field',\n 'name' => __('Synchronization field'),\n 'massiveaction' => false,\n 'datatype' => 'string'\n ];", " $tab = array_merge($tab, Location::rawSearchOptionsToAdd());", " $tab[] = [\n 'id' => '8',\n 'table' => $this->getTable(),\n 'field' => 'is_active',\n 'name' => __('Active'),\n 'datatype' => 'bool'\n ];", " $tab[] = [\n 'id' => '6',\n 'table' => $this->getTable(),\n 'field' => 'phone',\n 'name' => __('Phone'),\n 'datatype' => 'string'\n ];", " $tab[] = [\n 'id' => '10',\n 'table' => $this->getTable(),\n 'field' => 'phone2',\n 'name' => __('Phone 2'),\n 'datatype' => 'string'\n ];", " $tab[] = [\n 'id' => '11',\n 'table' => $this->getTable(),\n 'field' => 'mobile',\n 'name' => __('Mobile phone'),\n 'datatype' => 'string'\n ];", " $tab[] = [\n 'id' => '13',\n 'table' => 'glpi_groups',\n 'field' => 'completename',\n 'name' => _n('Group', 'Groups', Session::getPluralNumber()),\n 'forcegroupby' => true,\n 'datatype' => 'itemlink',\n 'massiveaction' => false,\n 'joinparams' => [\n 'beforejoin' => [\n 'table' => 'glpi_groups_users',\n 'joinparams' => [\n 'jointype' => 'child'\n ]\n ]\n ]\n ];", " $tab[] = [\n 'id' => '14',\n 'table' => $this->getTable(),\n 'field' => 'last_login',\n 'name' => __('Last login'),\n 'datatype' => 'datetime',\n 'massiveaction' => false\n ];", " $tab[] = [\n 'id' => '15',\n 'table' => $this->getTable(),\n 'field' => 'authtype',\n 'name' => __('Authentication'),\n 'massiveaction' => false,\n 'datatype' => 'specific',\n 'searchtype' => 'equals',\n 'additionalfields' => [\n '0' => 'auths_id'\n ]\n ];", " $tab[] = [\n 'id' => '30',\n 'table' => 'glpi_authldaps',\n 'field' => 'name',\n 'linkfield' => 'auths_id',\n 'name' => __('LDAP directory for authentication'),\n 'massiveaction' => false,\n 'joinparams' => [\n 'condition' => 'AND REFTABLE.`authtype` = ' . Auth::LDAP\n ],\n 'datatype' => 'dropdown'\n ];", " $tab[] = [\n 'id' => '31',\n 'table' => 'glpi_authmails',\n 'field' => 'name',\n 'linkfield' => 'auths_id',\n 'name' => __('Email server for authentication'),\n 'massiveaction' => false,\n 'joinparams' => [\n 'condition' => 'AND REFTABLE.`authtype` = ' . Auth::MAIL\n ],\n 'datatype' => 'dropdown'\n ];", " $tab[] = [\n 'id' => '16',\n 'table' => $this->getTable(),\n 'field' => 'comment',\n 'name' => __('Comments'),\n 'datatype' => 'text'\n ];", " $tab[] = [\n 'id' => '17',\n 'table' => $this->getTable(),\n 'field' => 'language',\n 'name' => __('Language'),\n 'datatype' => 'language',\n 'display_emptychoice' => true,\n 'emptylabel' => 'Default value'\n ];", " $tab[] = [\n 'id' => '19',\n 'table' => $this->getTable(),\n 'field' => 'date_mod',\n 'name' => __('Last update'),\n 'datatype' => 'datetime',\n 'massiveaction' => false\n ];", " $tab[] = [\n 'id' => '121',\n 'table' => $this->getTable(),\n 'field' => 'date_creation',\n 'name' => __('Creation date'),\n 'datatype' => 'datetime',\n 'massiveaction' => false\n ];", " $tab[] = [\n 'id' => '20',\n 'table' => 'glpi_profiles',\n 'field' => 'name',\n 'name' => sprintf(__('%1$s (%2$s)'), _n('Profile', 'Profiles', Session::getPluralNumber()),\n _n('Entity', 'Entities', 1)),\n 'forcegroupby' => true,\n 'massiveaction' => false,\n 'datatype' => 'dropdown',\n 'joinparams' => [\n 'beforejoin' => [\n 'table' => 'glpi_profiles_users',\n 'joinparams' => [\n 'jointype' => 'child'\n ]\n ]\n ]\n ];", " $tab[] = [\n 'id' => '21',\n 'table' => $this->getTable(),\n 'field' => 'user_dn',\n 'name' => __('User DN'),\n 'massiveaction' => false,\n 'datatype' => 'text'\n ];", " $tab[] = [\n 'id' => '22',\n 'table' => $this->getTable(),\n 'field' => 'registration_number',\n 'name' => __('Administrative number'),\n 'datatype' => 'string'\n ];", " $tab[] = [\n 'id' => '23',\n 'table' => $this->getTable(),\n 'field' => 'date_sync',\n 'datatype' => 'datetime',\n 'name' => __('Last synchronization'),\n 'massiveaction' => false\n ];", " $tab[] = [\n 'id' => '24',\n 'table' => $this->getTable(),\n 'field' => 'is_deleted_ldap',\n 'name' => __('Deleted user in LDAP directory'),\n 'datatype' => 'bool',\n 'massiveaction' => false\n ];", " $tab[] = [\n 'id' => '80',\n 'table' => 'glpi_entities',\n 'linkfield' => 'entities_id',\n 'field' => 'completename',\n 'name' => sprintf(__('%1$s (%2$s)'), _n('Entity', 'Entities', Session::getPluralNumber()),\n _n('Profile', 'Profiles', 1)),\n 'forcegroupby' => true,\n 'datatype' => 'dropdown',\n 'massiveaction' => false,\n 'joinparams' => [\n 'beforejoin' => [\n 'table' => 'glpi_profiles_users',\n 'joinparams' => [\n 'jointype' => 'child'\n ]\n ]\n ]\n ];", " $tab[] = [\n 'id' => '81',\n 'table' => 'glpi_usertitles',\n 'field' => 'name',\n 'name' => __('Title'),\n 'datatype' => 'dropdown'\n ];", " $tab[] = [\n 'id' => '82',\n 'table' => 'glpi_usercategories',\n 'field' => 'name',\n 'name' => __('Category'),\n 'datatype' => 'dropdown'\n ];", " $tab[] = [\n 'id' => '79',\n 'table' => 'glpi_profiles',\n 'field' => 'name',\n 'name' => __('Default profile'),\n 'datatype' => 'dropdown'\n ];", " $tab[] = [\n 'id' => '77',\n 'table' => 'glpi_entities',\n 'field' => 'name',\n 'massiveaction' => true,\n 'name' => __('Default entity'),\n 'datatype' => 'dropdown'\n ];", " $tab[] = [\n 'id' => '62',\n 'table' => $this->getTable(),\n 'field' => 'begin_date',\n 'name' => __('Begin date'),\n 'datatype' => 'datetime'\n ];", " $tab[] = [\n 'id' => '63',\n 'table' => $this->getTable(),\n 'field' => 'end_date',\n 'name' => __('End date'),\n 'datatype' => 'datetime'\n ];", " $tab[] = [\n 'id' => '60',\n 'table' => 'glpi_tickets',\n 'field' => 'id',\n 'name' => __('Number of tickets as requester'),\n 'forcegroupby' => true,\n 'usehaving' => true,\n 'datatype' => 'count',\n 'massiveaction' => false,\n 'joinparams' => [\n 'beforejoin' => [\n 'table' => 'glpi_tickets_users',\n 'joinparams' => [\n 'jointype' => 'child',\n 'condition' => 'AND NEWTABLE.`type` = ' . CommonITILActor::REQUESTER\n ]\n ]\n ]\n ];", " $tab[] = [\n 'id' => '61',\n 'table' => 'glpi_tickets',\n 'field' => 'id',\n 'name' => __('Number of written tickets'),\n 'forcegroupby' => true,\n 'usehaving' => true,\n 'datatype' => 'count',\n 'massiveaction' => false,\n 'joinparams' => [\n 'jointype' => 'child',\n 'linkfield' => 'users_id_recipient'\n ]\n ];", " $tab[] = [\n 'id' => '64',\n 'table' => 'glpi_tickets',\n 'field' => 'id',\n 'name' => __('Number of assigned tickets'),\n 'forcegroupby' => true,\n 'usehaving' => true,\n 'datatype' => 'count',\n 'massiveaction' => false,\n 'joinparams' => [\n 'beforejoin' => [\n 'table' => 'glpi_tickets_users',\n 'joinparams' => [\n 'jointype' => 'child',\n 'condition' => 'AND NEWTABLE.`type` = '.CommonITILActor::ASSIGN\n ]\n ]\n ]\n ];", " // add objectlock search options\n $tab = array_merge($tab, ObjectLock::rawSearchOptionsToAdd(get_class($this)));", " return $tab;\n }", " static function getSpecificValueToDisplay($field, $values, array $options = []) {", " if (!is_array($values)) {\n $values = [$field => $values];\n }\n switch ($field) {\n case 'authtype':\n $auths_id = 0;\n if (isset($values['auths_id']) && !empty($values['auths_id'])) {\n $auths_id = $values['auths_id'];\n }\n return Auth::getMethodName($values[$field], $auths_id);\n case 'picture':\n if (isset($options['html']) && $options['html']) {\n return Html::image(self::getThumbnailURLForPicture($values['picture']),\n ['class' => 'user_picture_small', 'alt' => __('Picture')]);\n }\n }\n return parent::getSpecificValueToDisplay($field, $values, $options);\n }", " static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = []) {", " if (!is_array($values)) {\n $values = [$field => $values];\n }\n $options['display'] = false;\n switch ($field) {\n case 'authtype' :\n $options['name'] = $name;\n $options['value'] = $values[$field];\n return Auth::dropdown($options);\n }\n return parent::getSpecificValueToSelect($field, $name, $values, $options);\n }", "\n /**\n * Get all groups where the current user have delegating.\n *\n * @since 0.83\n *\n * @param integer|string $entities_id ID of the entity to restrict\n *\n * @return integer[]\n */\n static function getDelegateGroupsForUser($entities_id = '') {\n global $DB;", " $iterator = $DB->request([\n 'SELECT DISTINCT' => 'glpi_groups_users.groups_id',\n 'FROM' => 'glpi_groups_users',\n 'INNER JOIN' => [\n 'glpi_groups' => [\n 'FKEY' => [\n 'glpi_groups_users' => 'groups_id',\n 'glpi_groups' => 'id'\n ]\n ]\n ],\n 'WHERE' => [\n 'glpi_groups_users.users_id' => Session::getLoginUserID(),\n 'glpi_groups_users.is_userdelegate' => 1\n ] + getEntitiesRestrictCriteria('glpi_groups', '', $entities_id, 1)\n ]);", " $groups = [];\n while ($data = $iterator->next()) {\n $groups[$data['groups_id']] = $data['groups_id'];\n }\n return $groups;\n }", "\n /**\n * Execute the query to select box with all glpi users where select key = name\n *\n * Internaly used by showGroup_Users, dropdownUsers and ajax/getDropdownUsers.php\n *\n * @param boolean $count true if execute an count(*) (true by default)\n * @param string|string[] $right limit user who have specific right (default 'all')\n * @param integer $entity_restrict Restrict to a defined entity (default -1)\n * @param integer $value default value (default 0)\n * @param integer[] $used Already used items ID: not to display in dropdown\n * @param string $search pattern (default '')\n * @param integer $start start LIMIT value (default 0)\n * @param integer $limit limit LIMIT value (default -1 no limit)\n * @param boolean $inactive_deleted true to retreive also inactive or deleted users\n *\n * @return mysqli_result|boolean\n */\n static function getSqlSearchResult ($count = true, $right = \"all\", $entity_restrict = -1, $value = 0,\n array $used = [], $search = '', $start = 0, $limit = -1,\n $inactive_deleted = 0) {\n global $DB;", " // No entity define : use active ones\n if ($entity_restrict < 0) {\n $entity_restrict = $_SESSION[\"glpiactiveentities\"];\n }", " $joinprofile = false;\n $joinprofileright = false;\n $WHERE = [];", " switch ($right) {\n case \"interface\" :\n $joinprofile = true;\n $WHERE = [\n 'glpi_profiles.interface' => 'central'\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1);\n break;", " case \"id\" :\n $WHERE = ['glpi_users.id' => Session::getLoginUserID()];\n break;", " case \"delegate\" :\n $groups = self::getDelegateGroupsForUser($entity_restrict);\n $users = [];\n if (count($groups)) {\n $iterator = $DB->request([\n 'SELECT' => 'glpi_users.id',\n 'FROM' => 'glpi_groups_users',\n 'LEFT JOIN' => [\n 'glpi_users' => [\n 'FKEY' => [\n 'glpi_groups_users' => 'users_id',\n 'glpi_users' => 'id'\n ]\n ]\n ],\n 'WHERE' => [\n 'glpi_groups_users.groups_id' => $groups,\n 'glpi_groups_users.users_id' => ['<>', Session::getLoginUserID()]\n ]\n ]);\n while ($data = $iterator->next()) {\n $users[$data[\"id\"]] = $data[\"id\"];\n }\n }\n // Add me to users list for central\n if (Session::getCurrentInterface() == 'central') {\n $users[Session::getLoginUserID()] = Session::getLoginUserID();\n }", " if (count($users)) {\n $WHERE = ['glpi_users.id' => $users];\n }\n break;", " case \"groups\" :\n $groups = [];\n if (isset($_SESSION['glpigroups'])) {\n $groups = $_SESSION['glpigroups'];\n }\n $users = [];\n if (count($groups)) {\n $iterator = $DB->request([\n 'SELECT' => 'glpi_users.id',\n 'FROM' => 'glpi_groups_users',\n 'LEFT JOIN' => [\n 'glpi_users' => [\n 'FKEY' => [\n 'glpi_groups_users' => 'users_id',\n 'glpi_users' => 'id'\n ]\n ]\n ],\n 'WHERE' => [\n 'glpi_groups_users.groups_id' => $groups,\n 'glpi_groups_users.users_id' => ['<>', Session::getLoginUserID()]\n ]\n ]);\n while ($data = $iterator->next()) {\n $users[$data[\"id\"]] = $data[\"id\"];\n }\n }\n // Add me to users list for central\n if (Session::getCurrentInterface() == 'central') {\n $users[Session::getLoginUserID()] = Session::getLoginUserID();\n }", " if (count($users)) {\n $WHERE = ['glpi_users.id' => $users];\n }", " break;", " case \"all\" :\n $WHERE = [\n 'glpi_users.id' => ['>', 0]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1);\n break;", " default :\n $joinprofile = true;\n $joinprofileright = true;\n if (!is_array($right)) {\n $right = [$right];\n }\n $forcecentral = true;", " $ORWHERE = [];\n foreach ($right as $r) {\n switch ($r) {\n case 'own_ticket' :\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => 'ticket',\n 'glpi_profilerights.rights' => ['&', Ticket::OWN]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];\n break;", " case 'create_ticket_validate' :\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => 'ticketvalidation',\n 'OR' => [\n 'glpi_profilerights.rights' => ['&', TicketValidation::CREATEREQUEST],\n 'glpi_profilerights.rights' => ['&', TicketValidation::CREATEINCIDENT]\n ]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];\n $forcecentral = false;\n break;", " case 'validate_request' :\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => 'ticketvalidation',\n 'glpi_profilerights.rights' => ['&', TicketValidation::VALIDATEREQUEST]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];\n $forcecentral = false;\n break;", " case 'validate_incident' :\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => 'ticketvalidation',\n 'glpi_profilerights.rights' => ['&', TicketValidation::VALIDATEINCIDENT]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];\n $forcecentral = false;\n break;", " case 'validate' :\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => 'changevalidation',\n 'glpi_profilerights.rights' => ['&', ChangeValidation::VALIDATE]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];\n break;", " case 'create_validate' :\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => 'changevalidation',\n 'glpi_profilerights.rights' => ['&', ChangeValidation::CREATE]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];\n break;", " case 'see_project' :\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => 'project',\n 'glpi_profilerights.rights' => ['&', Project::READMY]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];\n break;", " case 'faq' :\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => 'knowbase',\n 'glpi_profilerights.rights' => ['&', KnowbaseItem::READFAQ]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];", " default :\n // Check read or active for rights\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => $r,\n 'glpi_profilerights.rights' => [\n '&',\n READ | CREATE | UPDATE | DELETE | PURGE\n ]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];\n }\n if (in_array($r, Profile::$helpdesk_rights)) {\n $forcecentral = false;\n }\n }", " if (count($ORWHERE)) {\n $WHERE[] = ['OR' => $ORWHERE];\n }", " if ($forcecentral) {\n $WHERE['glpi_profiles.interface'] = 'central';\n }\n }", " if (!$inactive_deleted) {\n $WHERE = array_merge(\n $WHERE, [\n 'glpi_users.is_deleted' => 0,\n 'glpi_users.is_active' => 1,\n [\n 'OR' => [\n ['glpi_users.begin_date' => null],\n ['glpi_users.begin_date' => ['<', new QueryExpression('NOW()')]]\n ]\n ],\n [\n 'OR' => [\n ['glpi_users.end_date' => null],\n ['glpi_users.end_date' => ['>', new QueryExpression('NOW()')]]\n ]\n ]", " ]\n );\n }", " if ((is_numeric($value) && $value)\n || count($used)) {", " $WHERE[] = [\n 'NOT' => [\n 'glpi_users.id' => $used\n ]\n ];\n }", " $criteria = [\n 'FROM' => 'glpi_users',\n 'LEFT JOIN' => [\n 'glpi_useremails' => [\n 'ON' => [\n 'glpi_useremails' => 'users_id',\n 'glpi_users' => 'id'\n ]\n ],\n 'glpi_profiles_users' => [\n 'ON' => [\n 'glpi_profiles_users' => 'users_id',\n 'glpi_users' => 'id'\n ]\n ]\n ]\n ];\n if ($count) {\n $criteria['COUNT DISTINCT'] = 'glpi_users.*';\n } else {\n $criteria['SELECT DISTINCT'] = 'glpi_users.*';\n }", " if ($joinprofile) {\n $criteria['LEFT JOIN']['glpi_profiles'] = [\n 'ON' => [\n 'glpi_profiles_users' => 'profiles_id',\n 'glpi_profiles' => 'id'\n ]\n ];\n if ($joinprofileright) {\n $criteria['LEFT JOIN']['glpi_profilerights'] = [\n 'ON' => [\n 'glpi_profilerights' => 'profiles_id',\n 'glpi_profiles' => 'id'\n ]\n ];\n }\n }", " if (!$count) {\n if ((strlen($search) > 0)) {\n $txt_search = Search::makeTextSearchValue($search);\n $concat = new \\QueryExpression(\n \"CONCAT(\n glpi_users.realname,\n glpi_users.firstname,\n glpi_users.firstname\n ) LIKE '$txt_search'\"\n );\n $WHERE[] = [\n 'OR' => [\n 'glpi_users.name' => ['LIKE', $txt_search],\n 'glpi_users.realname' => ['LIKE', $txt_search],\n 'glpi_users.firstname' => ['LIKE', $txt_search],\n 'glpi_users.phone' => ['LIKE', $txt_search],\n 'glpi_useremails.email' => ['LIKE', $txt_search],\n $concat\n ]\n ];\n }", " if ($_SESSION[\"glpinames_format\"] == self::FIRSTNAME_BEFORE) {\n $criteria['ORDERBY'] = [\n 'glpi_users.firstname',\n 'glpi_users.realname',\n 'glpi_users.name'\n ];\n } else {\n $criteria['ORDERBY'] = [\n 'glpi_users.realname',\n 'glpi_users.firstname',\n 'glpi_users.name'\n ];\n }", " if ($limit > 0) {\n $criteria['LIMIT'] = $limit;\n $criteria['START'] = $start;\n }\n }\n $criteria['WHERE'] = $WHERE;\n return $DB->request($criteria);\n }", "\n /**\n * Make a select box with all glpi users where select key = name\n *\n * @param $options array of possible options:\n * - name : string / name of the select (default is users_id)\n * - value\n * - right : string / limit user who have specific right :\n * id -> only current user (default case);\n * interface -> central;\n * all -> all users;\n * specific right like Ticket::READALL, CREATE.... (is array passed one of all passed right is needed)\n * - comments : boolean / is the comments displayed near the dropdown (default true)\n * - entity : integer or array / restrict to a defined entity or array of entities\n * (default -1 : no restriction)\n * - entity_sons : boolean / if entity restrict specified auto select its sons\n * only available if entity is a single value not an array(default false)\n * - all : Nobody or All display for none selected\n * all=0 (default) -> Nobody\n * all=1 -> All\n * all=-1-> nothing\n * - rand : integer / already computed rand value\n * - toupdate : array / Update a specific item on select change on dropdown\n * (need value_fieldname, to_update, url\n * (see Ajax::updateItemOnSelectEvent for information)\n * and may have moreparams)\n * - used : array / Already used items ID: not to display in dropdown (default empty)\n * - ldap_import\n * - on_change : string / value to transmit to \"onChange\"\n * - display : boolean / display or get string (default true)\n * - width : specific width needed (default 80%)\n * - specific_tags : array of HTML5 tags to add to the field\n * - url : url of the ajax php code which should return the json data to show in\n * the dropdown (default /ajax/getDropdownUsers.php)\n * - inactive_deleted : retreive also inactive or deleted users\n *\n * @return integer|string Random value if displayed, string otherwise\n */\n static function dropdown($options = []) {\n global $CFG_GLPI;", " // Default values\n $p = [\n 'name' => 'users_id',\n 'value' => '',\n 'right' => 'id',\n 'all' => 0,\n 'on_change' => '',\n 'comments' => 1,\n 'width' => '80%',\n 'entity' => -1,\n 'entity_sons' => false,\n 'used' => [],\n 'ldap_import' => false,\n 'toupdate' => '',\n 'rand' => mt_rand(),\n 'display' => true,\n '_user_index' => 0,\n 'specific_tags' => [],\n 'url' => $CFG_GLPI['root_doc'].\"/ajax/getDropdownUsers.php\",\n 'inactive_deleted' => 0,\n ];", " if (is_array($options) && count($options)) {\n foreach ($options as $key => $val) {\n $p[$key] = $val;\n }\n }", " // check default value (in case of multiple observers)\n if (is_array($p['value'])) {\n $p['value'] = $p['value'][$p['_user_index']];\n }", " // Check default value for dropdown : need to be a numeric\n if ((strlen($p['value']) == 0) || !is_numeric($p['value'])) {\n $p['value'] = 0;\n }", " $output = '';\n if (!($p['entity'] < 0) && $p['entity_sons']) {\n if (is_array($p['entity'])) {\n $output .= \"entity_sons options is not available with array of entity\";\n } else {\n $p['entity'] = getSonsOf('glpi_entities', $p['entity']);\n }\n }", " // Make a select box with all glpi users\n $user = getUserName($p['value'], 2);", " $view_users = self::canView();", " if (!empty($p['value']) && ($p['value'] > 0)) {\n $default = $user[\"name\"];\n } else {\n if ($p['all']) {\n $default = __('All');\n } else {\n $default = Dropdown::EMPTY_VALUE;\n }\n }\n $field_id = Html::cleanId(\"dropdown_\".$p['name'].$p['rand']);\n $param = ['value' => $p['value'],\n 'valuename' => $default,\n 'width' => $p['width'],\n 'all' => $p['all'],\n 'right' => $p['right'],\n 'on_change' => $p['on_change'],\n 'used' => $p['used'],\n 'inactive_deleted' => $p['inactive_deleted'],\n 'entity_restrict' => (is_array($p['entity']) ? json_encode(array_values($p['entity'])) : $p['entity']),\n 'specific_tags' => $p['specific_tags']];", " $output = Html::jsAjaxDropdown($p['name'], $field_id,\n $p['url'],\n $param);", " // Display comment\n if ($p['comments']) {\n $comment_id = Html::cleanId(\"comment_\".$p['name'].$p['rand']);\n $link_id = Html::cleanId(\"comment_link_\".$p[\"name\"].$p['rand']);\n if (!$view_users) {\n $user[\"link\"] = '';\n } else if (empty($user[\"link\"])) {\n $user[\"link\"] = $CFG_GLPI['root_doc'].\"/front/user.php\";\n }", " if (empty($user['comment'])) {\n $user['comment'] = Toolbox::ucfirst(\n sprintf(\n __('Show %1$s'),\n self::getTypeName(Session::getPluralNumber())\n )\n );\n }\n $output .= \"&nbsp;\".Html::showToolTip($user[\"comment\"],\n ['contentid' => $comment_id,\n 'display' => false,\n 'link' => $user[\"link\"],\n 'linkid' => $link_id]);", " $paramscomment = ['value' => '__VALUE__',\n 'table' => \"glpi_users\"];", " if ($view_users) {\n $paramscomment['withlink'] = $link_id;\n }\n $output .= Ajax::updateItemOnSelectEvent($field_id, $comment_id,\n $CFG_GLPI[\"root_doc\"].\"/ajax/comments.php\",\n $paramscomment, false);\n }\n $output .= Ajax::commonDropdownUpdateItem($p, false);", " if (Session::haveRight('user', self::IMPORTEXTAUTHUSERS)\n && $p['ldap_import']\n && Entity::isEntityDirectoryConfigured($_SESSION['glpiactive_entity'])) {", " $output .= \"<span title=\\\"\".__s('Import a user').\"\\\" class='fa fa-plus pointer'\".\n \" onClick=\\\"\".Html::jsGetElementbyID('userimport'.$p['rand']).\".dialog('open');\\\">\n <span class='sr-only'>\" . __s('Import a user') . \"</span></span>\";\n $output .= Ajax::createIframeModalWindow('userimport'.$p['rand'],\n $CFG_GLPI[\"root_doc\"].\n \"/front/ldap.import.php?entity=\".\n $_SESSION['glpiactive_entity'],\n ['title' => __('Import a user'),\n 'display' => false]);\n }", " if ($p['display']) {\n echo $output;\n return $p['rand'];\n }\n return $output;\n }", "\n /**\n * Show simple add user form for external auth.\n *\n * @return void|boolean false if user does not have rights to import users from external sources,\n * print form otherwise\n */\n static function showAddExtAuthForm() {", " if (!Session::haveRight(\"user\", self::IMPORTEXTAUTHUSERS)) {\n return false;\n }", " echo \"<div class='center'>\\n\";\n echo \"<form method='post' action='\".Toolbox::getItemTypeFormURL('User').\"'>\\n\";", " echo \"<table class='tab_cadre'>\\n\";\n echo \"<tr><th colspan='4'>\".__('Automatically add a user of an external source').\"</th></tr>\\n\";", " echo \"<tr class='tab_bg_1'><td>\".__('Login').\"</td>\\n\";\n echo \"<td><input type='text' name='login'></td></tr>\";", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td class='tab_bg_2 center' colspan='2'>\\n\";\n echo \"<input type='submit' name='add_ext_auth_ldap' value=\\\"\".__s('Import from directories').\"\\\"\n class='submit'>\\n\";\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td class='tab_bg_2 center' colspan='2'>\\n\";\n echo \"<input type='submit' name='add_ext_auth_simple' value=\\\"\".__s('Import from other sources').\"\\\"\n class='submit'>\\n\";\n echo \"</td></tr>\\n\";", " echo \"</table>\";\n Html::closeForm();\n echo \"</div>\\n\";\n }", "\n /**\n * Change auth method for given users.\n *\n * @param integer[] $IDs IDs of users\n * @param integer $authtype Auth type (see Auth constants)\n * @param integer $server ID of auth server\n *\n * @return boolean\n */\n static function changeAuthMethod(array $IDs = [], $authtype = 1, $server = -1) {\n global $DB;", " if (!Session::haveRight(self::$rightname, self::UPDATEAUTHENT)) {\n return false;\n }", " if (!empty($IDs)\n && in_array($authtype, [Auth::DB_GLPI, Auth::LDAP, Auth::MAIL, Auth::EXTERNAL])) {", " $result = $DB->update(\n self::getTable(), [\n 'authtype' => $authtype,\n 'auths_id' => $server,\n 'password' => '',\n 'is_deleted_ldap' => 0\n ], [\n 'id' => $IDs\n ]\n );\n if ($result) {\n foreach ($IDs as $ID) {\n $changes = [\n 0,\n '',\n addslashes(\n sprintf(\n __('%1$s: %2$s'),\n __('Update authentification method to'),\n Auth::getMethodName($authtype, $server)\n )\n )\n ];\n Log::history($ID, __CLASS__, $changes, '', Log::HISTORY_LOG_SIMPLE_MESSAGE);\n }", " return true;\n }\n }\n return false;\n }", "\n /**\n * Generate vcard for the current user.\n *\n * @return void\n */\n function generateVcard() {", " // prepare properties for the Vcard\n if (!empty($this->fields[\"realname\"])\n || !empty($this->fields[\"firstname\"])) {\n $name = [$this->fields[\"realname\"], $this->fields[\"firstname\"], \"\", \"\", \"\"];\n } else {\n $name = [$this->fields[\"name\"], \"\", \"\", \"\", \"\"];\n }", " // create vcard\n $vcard = new VObject\\Component\\VCard([\n 'N' => $name,\n 'EMAIL' => $this->getDefaultEmail(),\n 'NOTE' => $this->fields[\"comment\"],\n ]);\n $vcard->add('TEL', $this->fields[\"phone\"], ['type' => 'PREF;WORK;VOICE']);\n $vcard->add('TEL', $this->fields[\"phone2\"], ['type' => 'HOME;VOICE']);\n $vcard->add('TEL', $this->fields[\"mobile\"], ['type' => 'WORK;CELL']);", " // send the VCard\n $output = $vcard->serialize();\n $filename = implode(\"_\", array_filter($name)).\".vcf\";", " @Header(\"Content-Disposition: attachment; filename=\\\"$filename\\\"\");\n @Header(\"Content-Length: \".Toolbox::strlen($output));\n @Header(\"Connection: close\");\n @Header(\"content-type: text/x-vcard; charset=UTF-8\");", " echo $output;\n }", "\n /**\n * Show items of the current user.\n *\n * @param boolean $tech false to display items owned by user, true to display items managed by user\n *\n * @return void\n */\n function showItems($tech) {\n global $DB, $CFG_GLPI;", " $ID = $this->getField('id');", " if ($tech) {\n $type_user = $CFG_GLPI['linkuser_tech_types'];\n $type_group = $CFG_GLPI['linkgroup_tech_types'];\n $field_user = 'users_id_tech';\n $field_group = 'groups_id_tech';\n } else {\n $type_user = $CFG_GLPI['linkuser_types'];\n $type_group = $CFG_GLPI['linkgroup_types'];\n $field_user = 'users_id';\n $field_group = 'groups_id';\n }", " $group_where = \"\";\n $groups = [];", " $iterator = $DB->request([\n 'SELECT' => [\n 'glpi_groups_users.groups_id',\n 'glpi_groups.name'\n ],\n 'FROM' => 'glpi_groups_users',\n 'LEFT JOIN' => [\n 'glpi_groups' => [\n 'FKEY' => [\n 'glpi_groups_users' => 'groups_id',\n 'glpi_groups' => 'id'\n ]\n ]\n ],\n 'WHERE' => ['glpi_groups_users.users_id' => $ID]\n ]);\n $number = count($iterator);", " $group_where = [];\n while ($data = $iterator->next()) {\n $group_where[$field_group][] = $data['groups_id'];\n $groups[$data[\"groups_id\"]] = $data[\"name\"];\n }", " echo \"<div class='spaced'><table class='tab_cadre_fixehov'>\";\n $header = \"<tr><th>\".__('Type').\"</th>\";\n $header .= \"<th>\".__('Entity').\"</th>\";\n $header .= \"<th>\".__('Name').\"</th>\";\n $header .= \"<th>\".__('Serial number').\"</th>\";\n $header .= \"<th>\".__('Inventory number').\"</th>\";\n $header .= \"<th>\".__('Status').\"</th>\";\n $header .= \"<th>&nbsp;</th></tr>\";\n echo $header;", " foreach ($type_user as $itemtype) {\n if (!($item = getItemForItemtype($itemtype))) {\n continue;\n }\n if ($item->canView()) {\n $itemtable = getTableForItemType($itemtype);\n $iterator_params = [\n 'FROM' => $itemtable,\n 'WHERE' => [$field_user => $ID]\n ];", " if ($item->maybeTemplate()) {\n $iterator_params['WHERE']['is_template'] = 0;\n }\n if ($item->maybeDeleted()) {\n $iterator_params['WHERE']['is_deleted'] = 0;\n }", " $item_iterator = $DB->request($iterator_params);", " $type_name = $item->getTypeName();", " while ($data = $item_iterator->next()) {\n $cansee = $item->can($data[\"id\"], READ);\n $link = $data[\"name\"];\n if ($cansee) {\n $link_item = $item::getFormURLWithID($data['id']);\n if ($_SESSION[\"glpiis_ids_visible\"] || empty($link)) {\n $link = sprintf(__('%1$s (%2$s)'), $link, $data[\"id\"]);\n }\n $link = \"<a href='\".$link_item.\"'>\".$link.\"</a>\";\n }\n $linktype = \"\";\n if ($data[$field_user] == $ID) {\n $linktype = self::getTypeName(1);\n }\n echo \"<tr class='tab_bg_1'><td class='center'>$type_name</td>\";\n echo \"<td class='center'>\".Dropdown::getDropdownName(\"glpi_entities\",\n $data[\"entities_id\"]).\"</td>\";\n echo \"<td class='center'>$link</td>\";\n echo \"<td class='center'>\";\n if (isset($data[\"serial\"]) && !empty($data[\"serial\"])) {\n echo $data[\"serial\"];\n } else {\n echo '&nbsp;';\n }\n echo \"</td><td class='center'>\";\n if (isset($data[\"otherserial\"]) && !empty($data[\"otherserial\"])) {\n echo $data[\"otherserial\"];\n } else {\n echo '&nbsp;';\n }\n echo \"</td><td class='center'>\";\n if (isset($data[\"states_id\"])) {\n echo Dropdown::getDropdownName(\"glpi_states\", $data['states_id']);\n } else {\n echo '&nbsp;';\n }", " echo \"</td><td class='center'>$linktype</td></tr>\";\n }\n }\n }\n if ($number) {\n echo $header;\n }\n echo \"</table></div>\";", " if (count($group_where)) {\n echo \"<div class='spaced'><table class='tab_cadre_fixehov'>\";\n $header = \"<tr>\".\n \"<th>\".__('Type').\"</th>\".\n \"<th>\".__('Entity').\"</th>\".\n \"<th>\".__('Name').\"</th>\".\n \"<th>\".__('Serial number').\"</th>\".\n \"<th>\".__('Inventory number').\"</th>\".\n \"<th>\".__('Status').\"</th>\".\n \"<th>&nbsp;</th></tr>\";\n echo $header;\n $nb = 0;\n foreach ($type_group as $itemtype) {\n if (!($item = getItemForItemtype($itemtype))) {\n continue;\n }\n if ($item->canView() && $item->isField($field_group)) {\n $itemtable = getTableForItemType($itemtype);\n $iterator_params = [\n 'FROM' => $itemtable,\n 'WHERE' => ['OR' => $group_where]\n ];", " if ($item->maybeTemplate()) {\n $iterator_params['WHERE']['is_template'] = 0;\n }\n if ($item->maybeDeleted()) {\n $iterator_params['WHERE']['is_deleted'] = 0;\n }", " $group_iterator = $DB->request($iterator_params);", " $type_name = $item->getTypeName();", " while ($data = $group_iterator->next()) {\n $nb++;\n $cansee = $item->can($data[\"id\"], READ);\n $link = $data[\"name\"];\n if ($cansee) {\n $link_item = $item::getFormURLWithID($data['id']);\n if ($_SESSION[\"glpiis_ids_visible\"] || empty($link)) {\n $link = sprintf(__('%1$s (%2$s)'), $link, $data[\"id\"]);\n }\n $link = \"<a href='\".$link_item.\"'>\".$link.\"</a>\";\n }\n $linktype = \"\";\n if (isset($groups[$data[$field_group]])) {\n $linktype = sprintf(__('%1$s = %2$s'), _n('Group', 'Groups', 1),\n $groups[$data[$field_group]]);\n }\n echo \"<tr class='tab_bg_1'><td class='center'>$type_name</td>\";\n echo \"<td class='center'>\".Dropdown::getDropdownName(\"glpi_entities\",\n $data[\"entities_id\"]);\n echo \"</td><td class='center'>$link</td>\";\n echo \"<td class='center'>\";\n if (isset($data[\"serial\"]) && !empty($data[\"serial\"])) {\n echo $data[\"serial\"];\n } else {\n echo '&nbsp;';\n }\n echo \"</td><td class='center'>\";\n if (isset($data[\"otherserial\"]) && !empty($data[\"otherserial\"])) {\n echo $data[\"otherserial\"];\n } else {\n echo '&nbsp;';\n }\n echo \"</td><td class='center'>\";\n if (isset($data[\"states_id\"])) {\n echo Dropdown::getDropdownName(\"glpi_states\", $data['states_id']);\n } else {\n echo '&nbsp;';\n }", " echo \"</td><td class='center'>$linktype</td></tr>\";\n }\n }\n }\n if ($nb) {\n echo $header;\n }\n echo \"</table></div>\";\n }\n }", "\n /**\n * Get user by email, importing it from LDAP if not existing.\n *\n * @param string $email\n *\n * @return integer ID of user, 0 if not found nor imported\n */\n static function getOrImportByEmail($email = '') {\n global $DB, $CFG_GLPI;", " $iterator = $DB->request([\n 'SELECT' => 'users_id AS id',\n 'FROM' => 'glpi_useremails',\n 'LEFT JOIN' => [\n 'glpi_users' => [\n 'FKEY' => [\n 'glpi_useremails' => 'users_id',\n 'glpi_users' => 'id'\n ]\n ]\n ],\n 'WHERE' => [\n 'glpi_useremails.email' => $DB->escape(stripslashes($email))\n ],\n 'ORDER' => ['glpi_users.is_active DESC', 'is_deleted ASC']\n ]);", " //User still exists in DB\n if (count($iterator)) {\n $result = $iterator->next();\n return $result['id'];\n } else {\n if ($CFG_GLPI[\"is_users_auto_add\"]) {\n //Get all ldap servers with email field configured\n $ldaps = AuthLdap::getServersWithImportByEmailActive();\n //Try to find the user by his email on each ldap server", " foreach ($ldaps as $ldap) {\n $params = [\n 'method' => AuthLdap::IDENTIFIER_EMAIL,\n 'value' => $email,\n ];\n $res = AuthLdap::ldapImportUserByServerId($params,\n AuthLdap::ACTION_IMPORT,\n $ldap);", " if (isset($res['id'])) {\n return $res['id'];\n }\n }\n }\n }\n return 0;\n }", "\n /**\n * Handle user deleted in LDAP using configured policy.\n *\n * @param integer $users_id\n *\n * @return void\n */\n static function manageDeletedUserInLdap($users_id) {\n global $CFG_GLPI;", " //The only case where users_id can be null if when a user has been imported into GLPI\n //it's dn still exists, but doesn't match the connection filter anymore\n //In this case, do not try to process the user\n if (!$users_id) {\n return;\n }", " //User is present in DB but not in the directory : it's been deleted in LDAP\n $tmp = [\n 'id' => $users_id,\n 'is_deleted_ldap' => 1,\n ];\n $myuser = new self();\n $myuser->getFromDB($users_id);", " //User is already considered as delete from ldap\n if ($myuser->fields['is_deleted_ldap'] == 1) {\n return;\n }", " switch ($CFG_GLPI['user_deleted_ldap']) {\n //DO nothing\n default :\n case AuthLDAP::DELETED_USER_PRESERVE:\n $myuser->update($tmp);\n break;", " //Put user in trashbin\n case AuthLDAP::DELETED_USER_DELETE:\n $myuser->delete($tmp);\n break;", " //Delete all user dynamic habilitations and groups\n case AuthLDAP::DELETED_USER_WITHDRAWDYNINFO:\n Profile_User::deleteRights($users_id, true);\n Group_User::deleteGroups($users_id, true);\n $myuser->update($tmp);\n break;", " //Deactivate the user\n case AuthLDAP::DELETED_USER_DISABLE:\n $tmp['is_active'] = 0;\n $myuser->update($tmp);\n break;", " //Deactivate the user+ Delete all user dynamic habilitations and groups\n case AuthLDAP::DELETED_USER_DISABLEANDWITHDRAWDYNINFO:\n $tmp['is_active'] = 0;\n $myuser->update($tmp);\n Profile_User::deleteRights($users_id, true);\n Group_User::deleteGroups($users_id, true);\n break;", " }\n /*\n $changes[0] = '0';\n $changes[1] = '';\n $changes[2] = __('Deleted user in LDAP directory');\n Log::history($users_id, 'User', $changes, 0, Log::HISTORY_LOG_SIMPLE_MESSAGE);*/\n }", " /**\n * Get user ID from its name.\n *\n * @param string $name User name\n *\n * @return integer\n */\n static function getIdByName($name) {\n return self::getIdByField('name', $name);\n }", "\n /**\n * Get user ID from a field\n *\n * @since 0.84\n *\n * @param string $field Field name\n * @param string $value Field value\n *\n * @return integer\n */\n static function getIdByField($field, $value) {\n global $DB;", " $iterator = $DB->request([\n 'SELECT' => 'id',\n 'FROM' => self::getTable(),\n 'WHERE' => [$field => addslashes($value)]\n ]);", " if (count($iterator) == 1) {\n $row = $iterator->next();\n return (int)$row['id'];\n }\n return false;\n }", "\n /**\n * Show new password form of password recovery process.\n *\n * @param $token\n *\n * @return void\n */\n static function showPasswordForgetChangeForm($token) {\n global $CFG_GLPI, $DB;", " // Verif token.\n $token_ok = false;\n $iterator = $DB->request([\n 'FROM' => self::getTable(),\n 'WHERE' => [\n 'password_forget_token' => $token,", " new \\QueryExpression('NOW() < ADDDATE(password_forget_token_date, INTERVAL 1 DAY))')", " ]\n ]);", " if (count($iterator) == 1) {\n $token_ok = true;\n }\n echo \"<div class='center'>\";", " if ($token_ok) {\n echo \"<form method='post' name='forgetpassword' action='\".$CFG_GLPI['root_doc'].\n \"/front/lostpassword.php'>\";\n echo \"<table class='tab_cadre'>\";\n echo \"<tr><th colspan='2'>\" . __('Forgotten password?').\"</th></tr>\";", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td colspan='2'>\". __('Please confirm your email address and enter your new password.').\n \"</td></tr>\";", " echo \"<tr class='tab_bg_1'><td>\" . _n('Email', 'Emails', 1).\"</td>\";\n echo \"<td><input type='text' name='email' value='' size='60'></td></tr>\";", " echo \"<tr class='tab_bg_1'><td>\" . __('Password').\"</td>\";\n echo \"<td><input id='password' type='password' name='password' value='' size='20'\n autocomplete='off' onkeyup=\\\"return passwordCheck();\\\">\";\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'><td>\" . __('Password confirmation').\"</td>\";\n echo \"<td><input type='password' name='password2' value='' size='20' autocomplete='off'>\";\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'><td>\".__('Password security policy').\"</td>\";\n echo \"<td>\";\n Config::displayPasswordSecurityChecks();\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_2 center'><td colspan='2'>\";\n echo \"<input type='hidden' name='password_forget_token' value='$token'>\";\n echo \"<input type='submit' name='update' value=\\\"\".__s('Save').\"\\\" class='submit'>\";\n echo \"</td></tr>\";", " echo \"</table>\";\n Html::closeForm();", " } else {\n echo __('Your password reset request has expired or is invalid. Please renew it.');\n }\n echo \"</div>\";\n }", "\n /**\n * Show request form of password recovery process.\n *\n * @return void\n */\n static function showPasswordForgetRequestForm() {\n global $CFG_GLPI;", " echo \"<div class='center'>\";\n echo \"<form method='post' name='forgetpassword' action='\".$CFG_GLPI['root_doc'].\n \"/front/lostpassword.php'>\";\n echo \"<table class='tab_cadre'>\";\n echo \"<tr><th colspan='2'>\" . __('Forgotten password?').\"</th></tr>\";", " echo \"<tr class='tab_bg_1'><td colspan='2'>\" .\n __('Please enter your email address. An email will be sent to you and you will be able to choose a new password.').\n \"</td></tr>\";", " echo \"<tr class='tab_bg_2 center'>\";\n echo \"<td><input type='text' size='60' name='email' value=''></td>\";\n echo \"<td><input type='submit' name='update' value=\\\"\".__s('Save').\"\\\" class='submit'>\";\n echo \"</td></tr>\";", " echo \"</table>\";\n Html::closeForm();\n echo \"</div>\";\n }", "\n /**\n * Handle password recovery form submission.\n *\n * @param array $input\n *\n * @throws ForgetPasswordException when requirements are not met\n *\n * @return boolean true if password successfully changed, false otherwise\n */\n public function updateForgottenPassword(array $input) {\n $condition = [\n 'glpi_users.is_active' => 1,\n 'glpi_users.is_deleted' => 0, [\n 'OR' => [\n ['glpi_users.begin_date' => null],\n ['glpi_users.begin_date' => ['<', new QueryExpression('NOW()')]]\n ],\n ], [\n 'OR' => [\n ['glpi_users.end_date' => null],\n ['glpi_users.end_date' => ['>', new QueryExpression('NOW()')]]\n ]\n ]\n ];\n if ($this->getFromDBbyEmail($input['email'], $condition)) {\n if (($this->fields[\"authtype\"] == Auth::DB_GLPI)\n || !Auth::useAuthExt()) {", " if (($input['password_forget_token'] == $this->fields['password_forget_token'])\n && (abs(strtotime($_SESSION[\"glpi_currenttime\"])\n -strtotime($this->fields['password_forget_token_date'])) < DAY_TIMESTAMP)) {", " $input['id'] = $this->fields['id'];\n Config::validatePassword($input[\"password\"], false); // Throws exception if password is invalid\n if (!$this->update($input)) {\n return false;\n }\n $input2 = [\n 'password_forget_token' => '',\n 'password_forget_token_date' => null,\n 'id' => $this->fields['id']\n ];\n $this->update($input2);\n return true;", " } else {\n throw new ForgetPasswordException(__('Your password reset request has expired or is invalid. Please renew it.'));\n }", " } else {\n throw new ForgetPasswordException(__(\"The authentication method configuration doesn't allow you to change your password.\"));\n }", " } else {\n throw new ForgetPasswordException(__('Email address not found.'));\n }", " return false;\n }", "\n /**\n * Displays password recovery result.\n *\n * @param array $input\n *\n * @return void\n */\n public function showUpdateForgottenPassword(array $input) {\n global $CFG_GLPI;", " echo \"<div class='center'>\";\n try {\n if (!$this->updateForgottenPassword($input)) {\n Html::displayMessageAfterRedirect();\n } else {\n echo __('Reset password successful.');\n }\n } catch (ForgetPasswordException $e) {\n echo $e->getMessage();\n } catch (PasswordTooWeakException $e) {\n // Force display on error\n foreach ($e->getMessages() as $message) {\n Session::addMessageAfterRedirect($message);\n }\n Html::displayMessageAfterRedirect();\n }", " echo \"<br>\";\n echo \"<a href=\\\"\".$CFG_GLPI['root_doc'].\"/index.php\\\">\".__s('Back').\"</a>\";\n echo \"</div>\";\n }", "\n /**\n * Send password recovery for a user and display result message.\n *\n * @param string $email email of the user\n *\n * @return void\n */\n public function showForgetPassword($email) {", " echo \"<div class='center'>\";\n try {\n $this->forgetPassword($email);\n } catch (ForgetPasswordException $e) {\n echo $e->getMessage();\n return;\n }\n echo __('An email has been sent to your email address. The email contains information for reset your password.');\n }", " /**\n * Send password recovery email for a user.\n *\n * @param string $email\n *\n * @throws ForgetPasswordException when requirements are not met\n *\n * @return boolean true if notification successfully created, false if user not found\n */\n public function forgetPassword($email) {\n $condition = [\n 'glpi_users.is_active' => 1,\n 'glpi_users.is_deleted' => 0, [\n 'OR' => [\n ['glpi_users.begin_date' => null],\n ['glpi_users.begin_date' => ['<', new QueryExpression('NOW()')]]\n ],\n ], [\n 'OR' => [\n ['glpi_users.end_date' => null],\n ['glpi_users.end_date' => ['>', new QueryExpression('NOW()')]]\n ]\n ]\n ];", " if ($this->getFromDBbyEmail($email, $condition)) {", " // Send token if auth DB or not external auth defined\n if (($this->fields[\"authtype\"] == Auth::DB_GLPI)\n || !Auth::useAuthExt()) {", " if (NotificationMailing::isUserAddressValid($email)) {\n $input = [\n 'password_forget_token' => sha1(Toolbox::getRandomString(30)),\n 'password_forget_token_date' => $_SESSION[\"glpi_currenttime\"],\n 'id' => $this->fields['id'],\n ];\n $this->update($input);\n // Notication on root entity (glpi_users.entities_id is only a pref)\n NotificationEvent::raiseEvent('passwordforget', $this, ['entities_id' => 0]);\n QueuedNotification::forceSendFor($this->getType(), $this->fields['id']);\n return true;\n } else {\n throw new ForgetPasswordException(__('Invalid email address'));\n }", " } else {\n throw new ForgetPasswordException(__(\"The authentication method configuration doesn't allow you to change your password.\"));\n }", " }", " throw new ForgetPasswordException(__('Email address not found.'));\n }", "\n /**\n * Display information from LDAP server for user.\n *\n * @return void\n */\n private function showLdapDebug() {", " if ($this->fields['authtype'] != Auth::LDAP) {\n return false;\n }\n echo \"<div class='spaced'>\";\n echo \"<table class='tab_cadre_fixe'>\";\n echo \"<tr><th colspan='4'>\".__('LDAP directory').\"</th></tr>\";", " echo \"<tr class='tab_bg_2'><td>\".__('User DN').\"</td>\";\n echo \"<td>\".$this->fields['user_dn'].\"</td></tr>\\n\";", " if ($this->fields['user_dn']) {\n echo \"<tr class='tab_bg_2'><td>\".__('User information').\"</td><td>\";\n $config_ldap = new AuthLDAP();\n $ds = false;", " if ($config_ldap->getFromDB($this->fields['auths_id'])) {\n $ds = $config_ldap->connect();\n }", " if ($ds) {\n $info = AuthLdap::getUserByDn($ds, $this->fields['user_dn'],\n ['*', 'createTimeStamp', 'modifyTimestamp']);\n if (is_array($info)) {\n Html::printCleanArray($info);\n } else {\n echo __('No item to display');\n }", " } else {\n echo __('Connection failed');\n }", " echo \"</td></tr>\\n\";\n }", " echo \"</table></div>\";\n }", "\n /**\n * Display debug information for current object.\n *\n * @return void\n */\n function showDebug() {", " NotificationEvent::debugEvent($this);\n $this->showLdapDebug();\n }", " function getUnicityFieldsToDisplayInErrorMessage() {", " return ['id' => __('ID'),\n 'entities_id' => __('Entity')];\n }", "\n function getUnallowedFieldsForUnicity() {", " return array_merge(parent::getUnallowedFieldsForUnicity(),\n ['auths_id', 'date_sync', 'entities_id', 'last_login', 'profiles_id']);\n }", "\n /**\n * Get a unique generated token.\n *\n * @param string $field Field storing the token\n *\n * @return string\n */\n static function getUniqueToken($field = 'personal_token') {\n global $DB;", " $ok = false;\n do {\n $key = Toolbox::getRandomString(40);\n $row = $DB->request([\n 'COUNT' => 'cpt',\n 'FROM' => self::getTable(),\n 'WHERE' => [$field => $key]\n ])->next();", " if ($row['cpt'] == 0) {\n return $key;\n }\n } while (!$ok);", " }", "\n /**\n * Get token of a user. If not exists generate it.\n *\n * @param integer $ID User ID\n * @param string $field Field storing the token\n *\n * @return string|boolean User token, false if user does not exist\n */\n static function getToken($ID, $field = 'personal_token') {", " $user = new self();\n if ($user->getFromDB($ID)) {\n return $user->getAuthToken($field);\n }", " return false;\n }", " /**\n * Get token of a user. If it does not exists then generate it.\n *\n * @since 9.4\n *\n * @param string $field the field storing the token\n *\n * @return string|false token or false in case of error\n */\n public function getAuthToken($field = 'personal_token') {\n global $DB;", " if ($this->isNewItem()) {\n return false;\n }", " if (!empty($this->fields[$field])) {\n return $this->fields[$field];\n }\n $token = self::getUniqueToken($field);\n $this->update(['id' => $this->getID(),\n $field => $token,\n $field . \"_date\" => $_SESSION['glpi_currenttime']]);\n return $this->fields[$field];\n }", "\n /**\n * Get name of users using default passwords\n *\n * @return string[]\n */\n static function checkDefaultPasswords() {\n global $DB;", " $passwords = ['glpi' => 'glpi',\n 'tech' => 'tech',\n 'normal' => 'normal',\n 'post-only' => 'postonly'];\n $default_password_set = [];", " $crit = ['FIELDS' => ['name', 'password'],\n 'is_active' => 1,\n 'is_deleted' => 0,\n 'name' => array_keys($passwords)];", " foreach ($DB->request('glpi_users', $crit) as $data) {\n if (Auth::checkPassword($passwords[$data['name']], $data['password'])) {\n $default_password_set[] = $data['name'];\n }\n }", " return $default_password_set;\n }", "\n /**\n * Get picture URL from picture field.\n *\n * @since 0.85\n *\n * @param string $picture Picture field value\n *\n * @return string\n */\n static function getURLForPicture($picture) {\n global $CFG_GLPI;", " if (!empty($picture)) {\n return $CFG_GLPI[\"root_doc\"].\"/front/document.send.php?file=_pictures/$picture\";\n }\n return $CFG_GLPI[\"root_doc\"].\"/pics/picture.png\";\n }", "\n /**\n * Get thumbnail URL from picture field.\n *\n * @since 0.85\n *\n * @param string $picture Picture field value\n *\n * @return string\n */\n static function getThumbnailURLForPicture($picture) {\n global $CFG_GLPI;", " if (!empty($picture)) {\n $tmp = explode(\".\", $picture);\n if (count($tmp) ==2) {\n return $CFG_GLPI[\"root_doc\"].\"/front/document.send.php?file=_pictures/\".$tmp[0].\n \"_min.\".$tmp[1];\n }\n return $CFG_GLPI[\"root_doc\"].\"/pics/picture_min.png\";\n }\n return $CFG_GLPI[\"root_doc\"].\"/pics/picture_min.png\";", " }", "\n /**\n * Drop existing files for user picture.\n *\n * @since 0.85\n *\n * @param string $picture Picture field value\n *\n * @return void\n */\n static function dropPictureFiles($picture) {", " if (!empty($picture)) {\n // unlink main file\n if (file_exists(GLPI_PICTURE_DIR.\"/$picture\")) {\n @unlink(GLPI_DOC_DIR.\"/_pictures/$picture\");\n }\n // unlink Thunmnail\n $tmp = explode(\".\", $picture);\n if (count($tmp) == 2) {\n if (file_exists(GLPI_PICTURE_DIR.\"/\".$tmp[0].\"_min.\".$tmp[1])) {\n @unlink(GLPI_PICTURE_DIR.\"/\".$tmp[0].\"_min.\".$tmp[1]);\n }\n }\n }\n }", " function getRights($interface = 'central') {", " $values = parent::getRights();\n //TRANS: short for : Add users from an external source\n $values[self::IMPORTEXTAUTHUSERS] = ['short' => __('Add external'),\n 'long' => __('Add users from an external source')];\n //TRANS: short for : Read method for user authentication and synchronization\n $values[self::READAUTHENT] = ['short' => __('Read auth'),\n 'long' => __('Read user authentication and synchronization method')];\n //TRANS: short for : Update method for user authentication and synchronization\n $values[self::UPDATEAUTHENT] = ['short' => __('Update auth and sync'),\n 'long' => __('Update method for user authentication and synchronization')];", " return $values;\n }", "\n /**\n * Retrieve the list of LDAP field names from a list of fields\n * allow pattern substitution, e.g. %{name}.\n *\n * @since 9.1\n *\n * @param string[] $map array of fields\n *\n * @return string[]\n */\n private static function getLdapFieldNames(array $map) {", " $ret = [];\n foreach ($map as $v) {\n /** @var array $reg */\n if (preg_match_all('/%{(.*)}/U', $v, $reg)) {\n // e.g. \"%{country} > %{city} > %{site}\"\n foreach ($reg [1] as $f) {\n $ret [] = $f;\n }\n } else {\n // single field name\n $ret [] = $v;\n }\n }\n return $ret;\n }", "\n /**\n * Retrieve the value of a fields from a LDAP result applying needed substitution of %{value}.\n *\n * @since 9.1\n *\n * @param string $map String with field format\n * @param array $res LDAP result\n *\n * @return string\n */\n private static function getLdapFieldValue($map, array $res) {", " $map = Toolbox::unclean_cross_side_scripting_deep($map);\n $ret = preg_replace_callback('/%{(.*)}/U',\n function ($matches) use ($res) {\n return (isset($res[0][$matches[1]][0]) ? $res[0][$matches[1]][0] : '');\n }, $map );", " return $ret == $map ? (isset($res[0][$map][0]) ? $res[0][$map][0] : '') : $ret;\n }", " /**\n * Get/Print the switch language form.\n *\n * @param boolean $display Whether to display or return output\n * @param array $options Options\n * - string value Selected language value\n * - boolean showbutton Whether to display or not submit button\n *\n * @return void|string Nothing if displayed, string to display otherwise\n */\n function showSwitchLangForm($display = true, array $options = []) {", " $params = [\n 'value' => $_SESSION[\"glpilanguage\"],\n 'display' => false,\n 'showbutton' => true\n ];", " foreach ($options as $key => $value) {\n $params[$key] = $value;\n }", " $out = '';\n $out .= \"<form method='post' name='switchlang' action='\".User::getFormURL().\"' autocomplete='off'>\";\n $out .= \"<p class='center'>\";\n $out .= Dropdown::showLanguages(\"language\", $params);\n if ($params['showbutton'] === true) {\n $out .= \"&nbsp;<input type='submit' name='update' value=\\\"\"._sx('button', 'Save').\"\\\" class='submit'>\";\n }\n $out .= \"</p>\";\n $out .= Html::closeForm(false);", " if ($display === true) {\n echo $out;\n } else {\n return $out;\n }\n }", " /**\n * Get list of entities ids for current user.\n *\n * @return integer[]\n */\n private function getEntities() {\n //get user entities\n if ($this->entities == null) {\n $this->entities = Profile_User::getUserEntities($this->fields['id'], true);\n }\n return $this->entities;\n }\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [4396], "buggy_code_start_loc": [4395], "filenames": ["inc/user.class.php"], "fixing_code_end_loc": [4396], "fixing_code_start_loc": [4395], "message": "An issue was discovered in GLPI before 9.4.1. After a successful password reset by a user, it is possible to change that user's password again during the next 24 hours without any information except the associated email address.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:glpi-project:glpi:*:*:*:*:*:*:*:*", "matchCriteriaId": "49F5CE77-0669-4846-93DE-D2454579E6A4", "versionEndExcluding": "9.4.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in GLPI before 9.4.1. After a successful password reset by a user, it is possible to change that user's password again during the next 24 hours without any information except the associated email address."}, {"lang": "es", "value": "Se detect\u00f3 un problema en GLPI versiones anteriores a 9.4.1. Despu\u00e9s de que un usuario haya restablecido con \u00e9xito la contrase\u00f1a, es posible cambiarla de nuevo durante las pr\u00f3ximas 24 horas sin ninguna informaci\u00f3n, excepto la direcci\u00f3n de correo electr\u00f3nico asociada."}], "evaluatorComment": null, "id": "CVE-2019-13240", "lastModified": "2019-07-17T14:12:39.453", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:N/C:P/I:N/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.9, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-07-10T14:15:11.793", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/glpi-project/glpi/commit/5da9f99b2d81713b1e36016b47ce656a33648bc7"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/glpi-project/glpi/commit/86a43ae47b3dd844947f40a2ffcf1a36e53dbba6"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/glpi-project/glpi/compare/1783b78...8e621f6"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://github.com/glpi-project/glpi/releases/tag/9.4.1"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Third Party Advisory"], "url": "https://www.synacktiv.com/ressources/advisories/GLPI_9.4.0_unsafe_reset.pdf"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-640"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/glpi-project/glpi/commit/5da9f99b2d81713b1e36016b47ce656a33648bc7"}, "type": "CWE-640"}
354
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n/**\n * ---------------------------------------------------------------------\n * GLPI - Gestionnaire Libre de Parc Informatique\n * Copyright (C) 2015-2018 Teclib' and contributors.\n *\n * http://glpi-project.org\n *\n * based on GLPI - Gestionnaire Libre de Parc Informatique\n * Copyright (C) 2003-2014 by the INDEPNET Development Team.\n *\n * ---------------------------------------------------------------------\n *\n * LICENSE\n *\n * This file is part of GLPI.\n *\n * GLPI is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * GLPI is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with GLPI. If not, see <http://www.gnu.org/licenses/>.\n * ---------------------------------------------------------------------\n */", "if (!defined('GLPI_ROOT')) {\n die(\"Sorry. You can't access this file directly\");\n}", "use Sabre\\VObject;\nuse Glpi\\Exception\\ForgetPasswordException;\nuse Glpi\\Exception\\PasswordTooWeakException;", "class User extends CommonDBTM {", " // From CommonDBTM\n public $dohistory = true;\n public $history_blacklist = ['date_mod', 'date_sync', 'last_login',\n 'publicbookmarkorder', 'privatebookmarkorder'];", " // NAME FIRSTNAME ORDER TYPE\n const REALNAME_BEFORE = 0;\n const FIRSTNAME_BEFORE = 1;", " const IMPORTEXTAUTHUSERS = 1024;\n const READAUTHENT = 2048;\n const UPDATEAUTHENT = 4096;", " static $rightname = 'user';", " private $entities = null;", "\n static function getTypeName($nb = 0) {\n return _n('User', 'Users', $nb);\n }", " static function getMenuShorcut() {\n return 'u';\n }", " static function getAdditionalMenuOptions() {", " if (Session::haveRight('user', self::IMPORTEXTAUTHUSERS)) {\n return [\n 'ldap' => [\n 'title' => AuthLDAP::getTypeName(Session::getPluralNumber()),\n 'page' => '/front/ldap.php',\n ],\n ];\n }\n return false;\n }", "\n function canViewItem() {\n if (Session::canViewAllEntities()\n || Session::haveAccessToOneOfEntities($this->getEntities())) {\n return true;\n }\n return false;\n }", "\n function canCreateItem() {", " // Will be created from form, with selected entity/profile\n if (isset($this->input['_profiles_id']) && ($this->input['_profiles_id'] > 0)\n && Profile::currentUserHaveMoreRightThan([$this->input['_profiles_id']])\n && isset($this->input['_entities_id'])\n && Session::haveAccessToEntity($this->input['_entities_id'])) {\n return true;\n }\n // Will be created with default value\n if (Session::haveAccessToEntity(0) // Access to root entity (required when no default profile)\n || (Profile::getDefault() > 0)) {\n return true;\n }", " if (($_SESSION['glpiactive_entity'] > 0)\n && (Profile::getDefault() == 0)) {\n echo \"<div class='tab_cadre_fixe warning'>\".\n __('You must define a default profile to create a new user').\"</div>\";\n }", " return false;\n }", "\n function canUpdateItem() {", " $entities = Profile_User::getUserEntities($this->fields['id'], false);\n if (Session::canViewAllEntities()\n || Session::haveAccessToOneOfEntities($entities)) {\n return true;\n }\n return false;\n }", "\n function canDeleteItem() {\n if (Session::canViewAllEntities()\n || Session::haveAccessToAllOfEntities($this->getEntities())) {\n return true;\n }\n return false;\n }", "\n function canPurgeItem() {\n return $this->canDeleteItem();\n }", "\n function isEntityAssign() {\n // glpi_users.entities_id is only a pref.\n return false;\n }", "\n /**\n * Compute preferences for the current user mixing config and user data.\n *\n * @return void\n */\n function computePreferences() {\n global $CFG_GLPI;", " if (isset($this->fields['id'])) {\n foreach ($CFG_GLPI['user_pref_field'] as $f) {\n if (is_null($this->fields[$f]) || !Session::haveRight('personalization', UPDATE)) {\n $this->fields[$f] = $CFG_GLPI[$f];\n }\n }\n }\n /// Specific case for show_count_on_tabs : global config can forbid\n if ($CFG_GLPI['show_count_on_tabs'] == -1) {\n $this->fields['show_count_on_tabs'] = 0;\n }\n }", "\n /**\n * Load minimal session for user.\n *\n * @param integer $entities_id Entity to use\n * @param boolean $is_recursive Whether to load entities recursivly or not\n *\n * @return void\n *\n * @since 0.83.7\n */\n function loadMinimalSession($entities_id, $is_recursive) {\n global $CFG_GLPI;", " if (isset($this->fields['id']) && !isset($_SESSION[\"glpiID\"])) {\n Session::destroy();\n Session::start();\n $_SESSION[\"glpiID\"] = $this->fields['id'];\n $_SESSION[\"glpi_use_mode\"] = Session::NORMAL_MODE;\n $_SESSION[\"glpiactive_entity\"] = $entities_id;\n $_SESSION[\"glpiactive_entity_recursive\"] = $is_recursive;\n if ($is_recursive) {\n $entities = getSonsOf(\"glpi_entities\", $entities_id);\n } else {\n $entities = [$entities_id];\n }\n $_SESSION['glpiactiveentities'] = $entities;\n $_SESSION['glpiactiveentities_string'] = \"'\".implode(\"', '\", $entities).\"'\";\n $this->computePreferences();\n foreach ($CFG_GLPI['user_pref_field'] as $field) {\n if (isset($this->fields[$field])) {\n $_SESSION[\"glpi$field\"] = $this->fields[$field];\n }\n }\n Session::loadGroups();\n Session::loadLanguage();\n }\n }", "\n function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {", " switch ($item->getType()) {\n case __CLASS__ :\n $ong = [];\n $ong[1] = __('Used items');\n $ong[2] = __('Managed items');\n return $ong;", " case 'Preference' :\n return __('Main');\n }\n return '';\n }", "\n static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {\n global $CFG_GLPI;", " switch ($item->getType()) {\n case __CLASS__ :\n $item->showItems($tabnum==2);\n return true;", " case 'Preference' :\n $user = new self();\n $user->showMyForm($CFG_GLPI['root_doc'].\"/front/preference.php\",\n Session::getLoginUserID());\n return true;\n }\n return false;\n }", "\n function defineTabs($options = []) {", " $ong = [];\n $this->addDefaultFormTab($ong);\n $this->addStandardTab('Profile_User', $ong, $options);\n $this->addStandardTab('Group_User', $ong, $options);\n $this->addStandardTab('Config', $ong, $options);\n $this->addStandardTab(__CLASS__, $ong, $options);\n $this->addStandardTab('Ticket', $ong, $options);\n $this->addStandardTab('Item_Problem', $ong, $options);\n $this->addStandardTab('Change_Item', $ong, $options);\n $this->addStandardTab('Document_Item', $ong, $options);\n $this->addStandardTab('Reservation', $ong, $options);\n $this->addStandardTab('Auth', $ong, $options);\n $this->addStandardTab('Link', $ong, $options);\n $this->addStandardTab('Certificate_Item', $ong, $options);\n $this->addStandardTab('Log', $ong, $options);", " return $ong;\n }", "\n function post_getEmpty() {\n global $CFG_GLPI;", " $this->fields[\"is_active\"] = 1;\n if (isset($CFG_GLPI[\"language\"])) {\n $this->fields['language'] = $CFG_GLPI[\"language\"];\n } else {\n $this->fields['language'] = \"en_GB\";\n }\n }", " static public function unsetUndisclosedFields(&$fields) {\n unset($fields['password']);\n }", " function pre_deleteItem() {\n global $DB;", " $entities = $this->getEntities();\n $view_all = Session::canViewAllEntities();\n // Have right on all entities ?\n $all = true;\n if (!$view_all) {\n foreach ($entities as $ent) {\n if (!Session::haveAccessToEntity($ent)) {\n $all = false;\n }\n }\n }\n if ($all) { // Mark as deleted\n return true;\n }\n // only delete profile\n foreach ($entities as $ent) {\n if (Session::haveAccessToEntity($ent)) {\n $all = false;\n $DB->delete(\n 'glpi_profiles_users', [\n 'users_id' => $this->fields['id'],\n 'entities_id' => $ent\n ]\n );\n }\n return false;\n }\n }", "\n function cleanDBonPurge() {", " global $DB;", " // ObjectLock does not extends CommonDBConnexity\n $ol = new ObjectLock();\n $ol->deleteByCriteria(['users_id' => $this->fields['id']]);", " // Reminder does not extends CommonDBConnexity\n $r = new Reminder();\n $r->deleteByCriteria(['users_id' => $this->fields['id']]);", " // Delete private bookmark\n $ss = new SavedSearch();\n $ss->deleteByCriteria(\n [\n 'users_id' => $this->fields['id'],\n 'is_private' => 1,\n ]\n );", " // Set no user to public bookmark\n $DB->update(\n SavedSearch::getTable(), [\n 'users_id' => 0\n ], [\n 'users_id' => $this->fields['id']\n ]\n );", " // Set no user to consumables\n $DB->update(\n 'glpi_consumables', [\n 'items_id' => 0,\n 'itemtype' => 'NULL',\n 'date_out' => 'NULL'\n ], [\n 'items_id' => $this->fields['id'],\n 'itemtype' => 'User'\n ]\n );", " $this->deleteChildrenAndRelationsFromDb(\n [\n Certificate_Item::class,\n Change_User::class,\n Group_User::class,\n KnowbaseItem_User::class,\n Problem_User::class,\n Profile_User::class,\n ProjectTaskTeam::class,\n ProjectTeam::class,\n Reminder_User::class,\n RSSFeed_User::class,\n SavedSearch_User::class,\n Ticket_User::class,\n UserEmail::class,\n ]\n );", " if ($this->fields['id'] > 0) { // Security\n // DisplayPreference does not extends CommonDBConnexity\n $dp = new DisplayPreference();\n $dp->deleteByCriteria(['users_id' => $this->fields['id']]);\n }", " $this->dropPictureFiles($this->fields['picture']);", " // Ticket rules use various _users_id_*\n Rule::cleanForItemAction($this, '_users_id%');\n Rule::cleanForItemCriteria($this, '_users_id%');\n }", "\n /**\n * Retrieve a user from the database using its login.\n *\n * @param string $name Login of the user\n *\n * @return boolean\n */\n function getFromDBbyName($name) {\n return $this->getFromDBByCrit(['name' => $name]);\n }", " /**\n * Retrieve a user from the database using its login.\n *\n * @param string $name Login of the user\n * @param integer $authtype Auth type (see Auth constants)\n * @param integer $auths_id ID of auth server\n *\n * @return boolean\n */\n function getFromDBbyNameAndAuth($name, $authtype, $auths_id) {\n return $this->getFromDBByCrit([\n 'name' => $name,\n 'authtype' => $authtype,\n 'auths_id' => $auths_id\n ]);\n }", " /**\n * Retrieve a user from the database using value of the sync field.\n *\n * @param string $value Value of the sync field\n *\n * @return boolean\n */\n function getFromDBbySyncField($value) {\n return $this->getFromDBByCrit(['sync_field' => $value]);\n }", " /**\n * Retrieve a user from the database using it's dn.\n *\n * @since 0.84\n *\n * @param string $user_dn dn of the user\n *\n * @return boolean\n */\n function getFromDBbyDn($user_dn) {\n return $this->getFromDBByCrit(['user_dn' => $user_dn]);\n }", "\n /**\n * Retrieve a user from the database using its email.\n *\n * @since 9.3 Can pass condition as a parameter\n *\n * @param string $email user email\n * @param array $condition add condition\n *\n * @return boolean\n */\n function getFromDBbyEmail($email, $condition = []) {\n global $DB;", " $crit = [\n 'SELECT' => $this->getTable() . '.id',\n 'FROM' => $this->getTable(),\n 'LEFT JOIN' => [\n 'glpi_useremails' => [\n 'FKEY' => [\n $this->getTable() => 'id',\n 'glpi_useremails' => 'users_id'\n ]\n ]\n ],\n 'WHERE' => ['glpi_useremails.email' => $email] + $condition\n ];", " $iter = $DB->request($crit);\n if ($iter->numrows()==1) {\n $row = $iter->next();\n return $this->getFromDB($row['id']);\n }\n return false;\n }", "\n /**\n * Get the default email of the user.\n *\n * @return string\n */\n function getDefaultEmail() {", " if (!isset($this->fields['id'])) {\n return '';\n }", " return UserEmail::getDefaultForUser($this->fields['id']);\n }", "\n /**\n * Get all emails of the user.\n *\n * @return string[]\n */\n function getAllEmails() {", " if (!isset($this->fields['id'])) {\n return [];\n }\n return UserEmail::getAllForUser($this->fields['id']);\n }", "\n /**\n * Check if the email is attached to the current user.\n *\n * @param string $email\n *\n * @return boolean\n */\n function isEmail($email) {", " if (!isset($this->fields['id'])) {\n return false;\n }\n return UserEmail::isEmailForUser($this->fields['id'], $email);\n }", "\n /**\n * Retrieve a user from the database using its personal token.\n *\n * @param string $token user token\n * @param string $field the field storing the token\n *\n * @return boolean\n */\n function getFromDBbyToken($token, $field = 'personal_token') {\n $fields = ['personal_token', 'api_token'];\n if (!in_array($field, $fields)) {\n Toolbox::logWarning('User::getFromDBbyToken() can only be called with $field parameter with theses values: \\'' . implode('\\', \\'', $fields) . '\\'');\n return false;\n }", " return $this->getFromDBByCrit([$this->getTable() . \".$field\" => $token]);\n }", "\n function prepareInputForAdd($input) {\n global $DB;", " if (isset($input['_stop_import'])) {\n return false;\n }", " if (!Auth::isValidLogin($input['name'])) {\n Session::addMessageAfterRedirect(__('The login is not valid. Unable to add the user.'),\n false, ERROR);\n return false;\n }", " if (!isset($input[\"authtype\"])) {\n $input[\"authtype\"] = Auth::DB_GLPI;\n }", " if (!isset($input[\"auths_id\"])) {\n $input[\"auths_id\"] = 0;\n }", " // Check if user does not exists\n $iterator = $DB->request([\n 'FROM' => $this->getTable(),\n 'WHERE' => [\n 'name' => $input['name'],\n 'authtype' => $input['authtype'],\n 'auths_id' => $input['auths_id']\n ],\n 'LIMIT' => 1\n ]);", " if (count($iterator)) {\n Session::addMessageAfterRedirect(__('Unable to add. The user already exists.'),\n false, ERROR);\n return false;\n }", " if (isset($input[\"password2\"])) {\n if (empty($input[\"password\"])) {\n unset ($input[\"password\"]);", " } else {\n if ($input[\"password\"] == $input[\"password2\"]) {\n if (Config::validatePassword($input[\"password\"])) {\n $input[\"password\"]\n = Auth::getPasswordHash(Toolbox::unclean_cross_side_scripting_deep(stripslashes($input[\"password\"])));\n } else {\n unset($input[\"password\"]);\n }\n unset($input[\"password2\"]);\n } else {\n Session::addMessageAfterRedirect(__('Error: the two passwords do not match'),\n false, ERROR);\n return false;\n }\n }\n }", " if (isset($input[\"_extauth\"])) {\n $input[\"password\"] = \"\";\n }", " // Force DB default values : not really needed\n if (!isset($input[\"is_active\"])) {\n $input[\"is_active\"] = 1;\n }", " if (!isset($input[\"is_deleted\"])) {\n $input[\"is_deleted\"] = 0;\n }", " if (!isset($input[\"entities_id\"])) {\n $input[\"entities_id\"] = 0;\n }", " if (!isset($input[\"profiles_id\"])) {\n $input[\"profiles_id\"] = 0;\n }", " return $input;\n }", "\n function post_addItem() {", " $this->updateUserEmails();\n $this->syncLdapGroups();\n $this->syncDynamicEmails();", " $rulesplayed = $this->applyRightRules();\n $picture = $this->syncLdapPhoto();", " //add picture in user fields\n if (!empty($picture)) {\n $this->update(['id' => $this->fields['id'],\n 'picture' => $picture]);\n }", " // Add default profile\n if (!$rulesplayed) {\n $affectation = [];\n if (isset($this->input['_profiles_id']) && $this->input['_profiles_id']\n && Profile::currentUserHaveMoreRightThan([$this->input['_profiles_id']])\n ) {\n $profile = $this->input['_profiles_id'];\n // Choosen in form, so not dynamic\n $affectation['is_dynamic'] = 0;\n } else {\n $profile = Profile::getDefault();\n // Default right as dynamic. If dynamic rights are set it will disappear.\n $affectation['is_dynamic'] = 1;\n }", " if ($profile) {\n if (isset($this->input[\"_entities_id\"])) {\n // entities_id (user's pref) always set in prepareInputForAdd\n // use _entities_id for default right\n $affectation[\"entities_id\"] = $this->input[\"_entities_id\"];", " } else if (isset($_SESSION['glpiactive_entity'])) {\n $affectation[\"entities_id\"] = $_SESSION['glpiactive_entity'];", " } else {\n $affectation[\"entities_id\"] = 0;\n }\n if (isset($this->input[\"_is_recursive\"])) {\n $affectation[\"is_recursive\"] = $this->input[\"_is_recursive\"];\n } else {\n $affectation[\"is_recursive\"] = 0;\n }", " $affectation[\"profiles_id\"] = $profile;\n $affectation[\"users_id\"] = $this->fields[\"id\"];\n $right = new Profile_User();\n $right->add($affectation);\n }\n }\n }", "\n function prepareInputForUpdate($input) {\n global $CFG_GLPI;", " //picture manually uploaded by user\n if (isset($input[\"_blank_picture\"]) && $input[\"_blank_picture\"]) {\n self::dropPictureFiles($this->fields['picture']);\n $input['picture'] = 'NULL';\n } else {\n $newPicture = false;\n if (!isAPI()) {\n if (isset($input[\"_picture\"][0]) && !empty($input[\"_picture\"][0])) {\n $input[\"_picture\"] = $input[\"_picture\"][0];\n }\n }\n if (isset($input[\"_picture\"]) && !empty($input[\"_picture\"])) {\n $newPicture = true;\n }\n if ($newPicture) {\n $fullpath = GLPI_TMP_DIR.\"/\".$input[\"_picture\"];\n if (toolbox::getMime($fullpath, 'image')) {\n // Unlink old picture (clean on changing format)\n self::dropPictureFiles($this->fields['picture']);\n // Move uploaded file\n $filename = uniqid($this->fields['id'].'_');\n $sub = substr($filename, -2); /* 2 hex digit */\n $tmp = explode(\".\", $input[\"_picture\"]);\n $extension = Toolbox::strtolower(array_pop($tmp));\n @mkdir(GLPI_PICTURE_DIR . \"/$sub\");\n $picture_path = GLPI_PICTURE_DIR . \"/$sub/${filename}.$extension\";\n self::dropPictureFiles($filename.\".\".$extension);", " if (Document::isImage($input[\"_picture\"])\n && Document::renameForce($fullpath, $picture_path)) {\n Session::addMessageAfterRedirect(__('The file is valid. Upload is successful.'));\n // For display\n $input['picture'] = \"$sub/${filename}.$extension\";", " //prepare a thumbnail\n $thumb_path = GLPI_PICTURE_DIR . \"/$sub/${filename}_min.$extension\";\n Toolbox::resizePicture($picture_path, $thumb_path);\n } else {\n Session::addMessageAfterRedirect(__('Potential upload attack or file too large. Moving temporary file failed.'),\n false, ERROR);\n }\n } else {\n Session::addMessageAfterRedirect(__('The file is not an image file.'),\n false, ERROR);\n }\n } else {\n //ldap jpegphoto synchronisation.\n $picture = $this->syncLdapPhoto();\n if (!empty($picture)) {\n $input['picture'] = $picture;\n }\n }\n }", " if (isset($input[\"password2\"])) {\n // Empty : do not update\n if (empty($input[\"password\"])) {\n unset($input[\"password\"]);", " } else {\n if ($input[\"password\"] == $input[\"password2\"]) {\n // Check right : my password of user with lesser rights\n if (isset($input['id']) && Config::validatePassword($input[\"password\"])\n && (($input['id'] == Session::getLoginUserID())\n || $this->currentUserHaveMoreRightThan($input['id'])\n || (($input['password_forget_token'] == $this->fields['password_forget_token']) // Permit to change password with token and email\n && (abs(strtotime($_SESSION[\"glpi_currenttime\"])\n -strtotime($this->fields['password_forget_token_date'])) < DAY_TIMESTAMP)\n && $this->isEmail($input['email'])))) {\n $input[\"password\"]\n = Auth::getPasswordHash(Toolbox::unclean_cross_side_scripting_deep(stripslashes($input[\"password\"])));", " } else {\n unset($input[\"password\"]);\n }\n unset($input[\"password2\"]);", " } else {\n Session::addMessageAfterRedirect(__('Error: the two passwords do not match'),\n false, ERROR);\n return false;\n }\n }", " } else if (isset($input[\"password\"])) { // From login\n unset($input[\"password\"]);\n }", " // blank password when authtype changes\n if (isset($input[\"authtype\"])\n && $input[\"authtype\"] != Auth::DB_GLPI\n && $input[\"authtype\"] != $this->getField('authtype')) {\n $input[\"password\"] = \"\";\n }", " // Update User in the database\n if (!isset($input[\"id\"])\n && isset($input[\"name\"])) {\n if ($this->getFromDBbyName($input[\"name\"])) {\n $input[\"id\"] = $this->fields[\"id\"];\n }\n }", " if (isset($input[\"entities_id\"])\n && (Session::getLoginUserID() === $input['id'])) {\n $_SESSION[\"glpidefault_entity\"] = $input[\"entities_id\"];\n }", " // Security on default profile update\n if (isset($input['profiles_id'])) {\n if (!in_array($input['profiles_id'], Profile_User::getUserProfiles($input['id']))) {\n unset($input['profiles_id']);\n }\n }", " // Security on default entity update\n if (isset($input['entities_id'])) {\n if (!in_array($input['entities_id'], Profile_User::getUserEntities($input['id']))) {\n unset($input['entities_id']);\n }\n }", " // Security on default group update\n if (isset($input['groups_id'])\n && !Group_User::isUserInGroup($input['id'], $input['groups_id'])) {\n unset($input['groups_id']);\n }", " if (isset($input['_reset_personal_token'])\n && $input['_reset_personal_token']) {\n $input['personal_token'] = self::getUniqueToken('personal_token');\n $input['personal_token_date'] = $_SESSION['glpi_currenttime'];\n }", " if (isset($input['_reset_api_token'])\n && $input['_reset_api_token']) {\n $input['api_token'] = self::getUniqueToken('api_token');\n $input['api_token_date'] = $_SESSION['glpi_currenttime'];\n }", " // Manage preferences fields\n if (Session::getLoginUserID() === $input['id']) {\n if (isset($input['use_mode'])\n && ($_SESSION['glpi_use_mode'] != $input['use_mode'])) {\n $_SESSION['glpi_use_mode'] = $input['use_mode'];\n //Session::loadLanguage();\n }\n }", " foreach ($CFG_GLPI['user_pref_field'] as $f) {\n if (isset($input[$f])) {\n if (Session::getLoginUserID() === $input['id']) {\n if ($_SESSION[\"glpi$f\"] != $input[$f]) {\n $_SESSION[\"glpi$f\"] = $input[$f];\n // reinit translations\n if ($f == 'language') {\n $_SESSION['glpi_dropdowntranslations'] = DropdownTranslation::getAvailableTranslations($_SESSION[\"glpilanguage\"]);\n unset($_SESSION['glpimenu']);\n }\n }\n }\n if ($input[$f] == $CFG_GLPI[$f]) {\n $input[$f] = \"NULL\";\n }\n }\n }", " if (isset($input['language']) && GLPI_DEMO_MODE) {\n unset($input['language']);\n }\n return $input;\n }", "\n function post_updateItem($history = 1) {", " $this->updateUserEmails();\n $this->syncLdapGroups();\n $this->syncDynamicEmails();\n $this->applyRightRules();\n }", "", " /**\n * Apply rules to determine dynamic rights of the user.\n *\n * @return boolean true if rules are applied, false otherwise\n */\n function applyRightRules() {", " $return = false;", " if ((isset($this->fields['_ruleright_process'])\n || isset($this->input['_ruleright_process'])) // Add after a getFromLDAP\n && isset($this->fields[\"authtype\"])\n && (($this->fields[\"authtype\"] == Auth::LDAP)\n || ($this->fields[\"authtype\"] == Auth::MAIL)\n || Auth::isAlternateAuth($this->fields[\"authtype\"]))) {", " $dynamic_profiles = Profile_User::getForUser($this->fields[\"id\"], true);", " if (isset($this->fields[\"id\"])\n && ($this->fields[\"id\"] > 0)\n && isset($this->input[\"_ldap_rules\"])\n && count($this->input[\"_ldap_rules\"])) {", " //and add/update/delete only if it's necessary !\n if (isset($this->input[\"_ldap_rules\"][\"rules_entities_rights\"])) {\n $entities_rules = $this->input[\"_ldap_rules\"][\"rules_entities_rights\"];\n } else {\n $entities_rules = [];\n }", " if (isset($this->input[\"_ldap_rules\"][\"rules_entities\"])) {\n $entities = $this->input[\"_ldap_rules\"][\"rules_entities\"];\n } else {\n $entities = [];\n }", " if (isset($this->input[\"_ldap_rules\"][\"rules_rights\"])) {\n $rights = $this->input[\"_ldap_rules\"][\"rules_rights\"];\n } else {\n $rights = [];\n }", " $retrieved_dynamic_profiles = [];", " //For each affectation -> write it in DB\n foreach ($entities_rules as $entity) {\n //Multiple entities assignation\n if (is_array($entity[0])) {\n foreach ($entity[0] as $ent) {\n $retrieved_dynamic_profiles[] = [\n 'entities_id' => $ent,\n 'profiles_id' => $entity[1],\n 'is_recursive' => $entity[2],\n 'users_id' => $this->fields['id'],\n 'is_dynamic' => 1,\n ];\n }\n } else {\n $retrieved_dynamic_profiles[] = [\n 'entities_id' => $entity[0],\n 'profiles_id' => $entity[1],\n 'is_recursive' => $entity[2],\n 'users_id' => $this->fields['id'],\n 'is_dynamic' => 1,\n ];\n }\n }", " if ((count($entities) > 0)\n && (count($rights) == 0)) {\n if ($def_prof = Profile::getDefault()) {\n $rights[] = $def_prof;\n }\n }", " if ((count($rights) > 0)\n && (count($entities) > 0)) {\n foreach ($rights as $right) {\n foreach ($entities as $entity) {\n $retrieved_dynamic_profiles[] = [\n 'entities_id' => $entity[0],\n 'profiles_id' => $right,\n 'is_recursive' => $entity[1],\n 'users_id' => $this->fields['id'],\n 'is_dynamic' => 1,\n ];\n }\n }\n }", " // Compare retrived profiles to existing ones : clean arrays to do purge and add\n if (count($retrieved_dynamic_profiles)) {\n foreach ($retrieved_dynamic_profiles as $keyretr => $retr_profile) {\n $found = false;", " foreach ($dynamic_profiles as $keydb => $db_profile) {\n // Found existing profile : unset values in array\n if (!$found\n && ($db_profile['entities_id'] == $retr_profile['entities_id'])\n && ($db_profile['profiles_id'] == $retr_profile['profiles_id'])\n && ($db_profile['is_recursive'] == $retr_profile['is_recursive'])) {", " unset($retrieved_dynamic_profiles[$keyretr]);\n unset($dynamic_profiles[$keydb]);\n }\n }\n }\n }", " // Add new dynamic profiles\n if (count($retrieved_dynamic_profiles)) {\n $right = new Profile_User();\n foreach ($retrieved_dynamic_profiles as $keyretr => $retr_profile) {\n $right->add($retr_profile);\n }\n }", " //Unset all the temporary tables\n unset($this->input[\"_ldap_rules\"]);", " $return = true;\n }", " // Delete old dynamic profiles\n if (count($dynamic_profiles)) {\n $right = new Profile_User();\n foreach ($dynamic_profiles as $keydb => $db_profile) {\n $right->delete($db_profile);\n }\n }", " }\n return $return;\n }", "\n /**\n * Synchronise LDAP group of the user.\n *\n * @return void\n */\n function syncLdapGroups() {\n global $DB;", " // input[\"_groups\"] not set when update from user.form or preference\n if (isset($this->fields[\"authtype\"])\n && isset($this->input[\"_groups\"])\n && (($this->fields[\"authtype\"] == Auth::LDAP)\n || Auth::isAlternateAuth($this->fields['authtype']))) {", " if (isset($this->fields[\"id\"]) && ($this->fields[\"id\"] > 0)) {\n $authtype = Auth::getMethodsByID($this->fields[\"authtype\"], $this->fields[\"auths_id\"]);", " if (count($authtype)) {\n // Clean groups\n $this->input[\"_groups\"] = array_unique ($this->input[\"_groups\"]);", " // Delete not available groups like to LDAP\n $iterator = $DB->request([\n 'SELECT' => [\n 'glpi_groups_users.id',\n 'glpi_groups_users.groups_id',\n 'glpi_groups_users.is_dynamic'\n ],\n 'FROM' => 'glpi_groups_users',\n 'LEFT JOIN' => [\n 'glpi_groups' => [\n 'FKEY' => [\n 'glpi_groups_users' => 'groups_id',\n 'glpi_groups' => 'id'\n ]\n ]\n ],\n 'WHERE' => [\n 'glpi_groups_users.users_id' => $this->fields['id']\n ]\n ]);", " $groupuser = new Group_User();\n while ($data = $iterator->next()) {", " if (in_array($data[\"groups_id\"], $this->input[\"_groups\"])) {\n // Delete found item in order not to add it again\n unset($this->input[\"_groups\"][array_search($data[\"groups_id\"],\n $this->input[\"_groups\"])]);", " } else if ($data['is_dynamic']) {\n $groupuser->delete(['id' => $data[\"id\"]]);\n }\n }", " //If the user needs to be added to one group or more\n if (count($this->input[\"_groups\"]) > 0) {\n foreach ($this->input[\"_groups\"] as $group) {\n $groupuser->add(['users_id' => $this->fields[\"id\"],\n 'groups_id' => $group,\n 'is_dynamic' => 1]);\n }\n unset ($this->input[\"_groups\"]);\n }\n }\n }\n }\n }", "\n /**\n * Synchronize picture (photo) of the user.\n *\n * @since 0.85\n *\n * @return string|boolean Filename to be stored in user picture field, false if no picture found\n */\n function syncLdapPhoto() {", " if (isset($this->fields[\"authtype\"])\n && (($this->fields[\"authtype\"] == Auth::LDAP)\n || ($this->fields[\"authtype\"] == Auth::NOT_YET_AUTHENTIFIED\n && !empty($this->fields[\"auths_id\"]))\n || Auth::isAlternateAuth($this->fields['authtype']))) {", " if (isset($this->fields[\"id\"]) && ($this->fields[\"id\"] > 0)) {\n $config_ldap = new AuthLDAP();\n $ds = false;", " //connect ldap server\n if ($config_ldap->getFromDB($this->fields['auths_id'])) {\n $ds = $config_ldap->connect();\n }", " if ($ds) {\n //get picture fields\n $picture_field = $config_ldap->fields['picture_field'];\n if (empty($picture_field)) {\n return false;\n }", " //get picture content in ldap\n $info = AuthLdap::getUserByDn($ds, $this->fields['user_dn'],\n [$picture_field], false);", " //getUserByDn returns an array. If the picture is empty,\n //$info[$picture_field][0] is null\n if (!isset($info[$picture_field][0]) || empty($info[$picture_field][0])) {\n return \"\";\n }\n //prepare paths\n $img = array_pop($info[$picture_field]);\n $filename = uniqid($this->fields['id'].'_');\n $sub = substr($filename, -2); /* 2 hex digit */\n $file = GLPI_PICTURE_DIR . \"/$sub/${filename}.jpg\";", " if (array_key_exists('picture', $this->fields)) {\n $oldfile = GLPI_PICTURE_DIR . \"/\" . $this->fields[\"picture\"];\n } else {\n $oldfile = null;\n }", " // update picture if not exist or changed\n if (empty($this->fields[\"picture\"])\n || !file_exists($oldfile)\n || sha1_file($oldfile) !== sha1($img)) {\n if (!is_dir(GLPI_PICTURE_DIR . \"/$sub\")) {\n mkdir(GLPI_PICTURE_DIR . \"/$sub\");\n }", " //save picture\n $outjpeg = fopen($file, 'wb');\n fwrite($outjpeg, $img);\n fclose ($outjpeg);", " //save thumbnail\n $thumb = GLPI_PICTURE_DIR . \"/$sub/${filename}_min.jpg\";\n Toolbox::resizePicture($file, $thumb);", " return \"$sub/${filename}.jpg\";\n }\n return $this->fields[\"picture\"];\n }\n }\n }", " return false;\n }", "\n /**\n * Update emails of the user.\n * Uses _useremails set from UI, not _emails set from LDAP.\n *\n * @return void\n */\n function updateUserEmails() {\n // Update emails (use _useremails set from UI, not _emails set from LDAP)", " $userUpdated = false;", " if (isset($this->input['_useremails']) && count($this->input['_useremails'])) {\n $useremail = new UserEmail();\n foreach ($this->input['_useremails'] as $id => $email) {\n $email = trim($email);", " // existing email\n if ($id > 0) {\n $params = ['id' => $id];", " // empty email : delete\n if (strlen($email) == 0) {\n $deleted = $useremail->delete($params);\n $userUpdated = $userUpdated || $deleted;", " } else { // Update email\n $params['email'] = $email;\n $params['is_default'] = $this->input['_default_email'] == $id ? 1 : 0;", " $existingUserEmail = new UserEmail();\n $existingUserEmail->getFromDB($id);\n if ($params['email'] == $existingUserEmail->fields['email']\n && $params['is_default'] == $existingUserEmail->fields['is_default']) {\n // Do not update if email has not changed\n continue;\n }", " $updated = $useremail->update($params);\n $userUpdated = $userUpdated || $updated;\n }", " } else { // New email\n $email_input = ['email' => $email,\n 'users_id' => $this->fields['id']];\n if (isset($this->input['_default_email'])\n && ($this->input['_default_email'] == $id)) {\n $email_input['is_default'] = 1;\n } else {\n $email_input['is_default'] = 0;\n }\n $added = $useremail->add($email_input);\n $userUpdated = $userUpdated || $added;\n }\n }\n }", " if ($userUpdated) {\n // calling $this->update() here leads to loss in $this->input\n $user = new User();\n $user->update(['id' => $this->fields['id'], 'date_mod' => $_SESSION['glpi_currenttime']]);\n }\n }", "\n /**\n * Synchronise Dynamics emails of the user.\n * Uses _emails (set from getFromLDAP), not _usermails set from UI.\n *\n * @return void\n */\n function syncDynamicEmails() {\n global $DB;", " $userUpdated = false;", " // input[\"_emails\"] not set when update from user.form or preference\n if (isset($this->fields[\"authtype\"])\n && isset($this->input[\"_emails\"])\n && (($this->fields[\"authtype\"] == Auth::LDAP)\n || Auth::isAlternateAuth($this->fields['authtype'])\n || ($this->fields[\"authtype\"] == Auth::MAIL))) {", " if (isset($this->fields[\"id\"]) && ($this->fields[\"id\"] > 0)) {\n $authtype = Auth::getMethodsByID($this->fields[\"authtype\"], $this->fields[\"auths_id\"]);", " if (count($authtype)\n || $this->fields[\"authtype\"] == Auth::EXTERNAL) {\n // Clean emails\n $this->input[\"_emails\"] = array_unique ($this->input[\"_emails\"]);", " // Delete not available groups like to LDAP\n $iterator = $DB->request([\n 'SELECT' => [\n 'id',\n 'users_id',\n 'email',\n 'is_dynamic'\n ],\n 'FROM' => 'glpi_useremails',\n 'WHERE' => ['users_id' => $this->fields['id']]\n ]);", " $useremail = new UserEmail();\n while ($data = $iterator->next()) {\n $i = array_search($data[\"email\"], $this->input[\"_emails\"]);\n if ($i !== false) {\n // Delete found item in order not to add it again\n unset($this->input[\"_emails\"][$i]);\n } else if ($data['is_dynamic']) {\n // Delete not found email\n $deleted = $useremail->delete(['id' => $data[\"id\"]]);\n $userUpdated = $userUpdated || $deleted;\n }\n }", " //If the email need to be added\n if (count($this->input[\"_emails\"]) > 0) {\n foreach ($this->input[\"_emails\"] as $email) {\n $added = $useremail->add(['users_id' => $this->fields[\"id\"],\n 'email' => $email,\n 'is_dynamic' => 1]);\n $userUpdated = $userUpdated || $added;\n }\n unset ($this->input[\"_emails\"]);\n }\n }\n }\n }", " if ($userUpdated) {\n // calling $this->update() here leads to loss in $this->input\n $user = new User();\n $user->update(['id' => $this->fields['id'], 'date_mod' => $_SESSION['glpi_currenttime']]);\n }\n }", " function getRawName() {\n global $CFG_GLPI;", " if (isset($this->fields[\"id\"]) && ($this->fields[\"id\"] > 0)) {\n //getRawName should not add ID\n $bkp_conf = $CFG_GLPI['is_ids_visible'];\n $CFG_GLPI['is_ids_visible'] = 0;\n $bkp_sessconf = (isset($_SESSION['glpiis_ids_visible']) ? $_SESSION[\"glpiis_ids_visible\"] : 0);\n $_SESSION[\"glpiis_ids_visible\"] = 0;\n $name = formatUserName($this->fields[\"id\"],\n $this->fields[\"name\"],\n (isset($this->fields[\"realname\"]) ? $this->fields[\"realname\"] : ''),\n (isset($this->fields[\"firstname\"]) ? $this->fields[\"firstname\"] : ''));", " $CFG_GLPI['is_ids_visible'] = $bkp_conf;\n $_SESSION[\"glpiis_ids_visible\"] = $bkp_sessconf;\n return $name;\n }\n return '';\n }", "\n /**\n * Function that tries to load the user membership from LDAP\n * by searching in the attributes of the User.\n *\n * @param resource $ldap_connection LDAP connection\n * @param array $ldap_method LDAP method\n * @param string $userdn Basedn of the user\n * @param string $login User login\n *\n * @return string|boolean Basedn of the user / false if not found\n */\n private function getFromLDAPGroupVirtual($ldap_connection, array $ldap_method, $userdn, $login) {\n global $DB;", " // Search in DB the ldap_field we need to search for in LDAP\n $iterator = $DB->request([\n 'SELECT DISTINCT' => 'ldap_field',\n 'FROM' => 'glpi_groups',\n 'WHERE' => ['NOT' => ['ldap_field' => '']],\n 'ORDER' => 'ldap_field'\n ]);\n $group_fields = [];", " while ($data = $iterator->next()) {\n $group_fields[] = Toolbox::strtolower($data[\"ldap_field\"]);\n }\n if (count($group_fields)) {\n //Need to sort the array because edirectory don't like it!\n sort($group_fields);", " // If the groups must be retrieve from the ldap user object\n $sr = @ ldap_read($ldap_connection, $userdn, \"objectClass=*\", $group_fields);\n $v = AuthLDAP::get_entries_clean($ldap_connection, $sr);", " for ($i=0; $i < $v['count']; $i++) {\n //Try to find is DN in present and needed: if yes, then extract only the OU from it\n if ((($ldap_method[\"group_field\"] == 'dn') || in_array('ou', $group_fields))\n && isset($v[$i]['dn'])) {", " $v[$i]['ou'] = [];\n for ($tmp=$v[$i]['dn']; count($tmptab = explode(',', $tmp, 2))==2; $tmp=$tmptab[1]) {\n $v[$i]['ou'][] = $tmptab[1];\n }", " // Search in DB for group with ldap_group_dn\n if (($ldap_method[\"group_field\"] == 'dn')\n && (count($v[$i]['ou']) > 0)) {\n $group_iterator = $DB->request([\n 'SELECT' => 'id',\n 'FROM' => 'glpi_groups',\n 'WHERE' => ['ldap_group_dn' => Toolbox::addslashes_deep($v[$i]['ou'])]\n ]);", " while ($group = $group_iterator->next()) {\n $this->fields[\"_groups\"][] = $group['id'];\n }\n }", " // searching with ldap_field='OU' and ldap_value is also possible\n $v[$i]['ou']['count'] = count($v[$i]['ou']);\n }", " // For each attribute retrieve from LDAP, search in the DB\n foreach ($group_fields as $field) {\n if (isset($v[$i][$field])\n && isset($v[$i][$field]['count'])\n && ($v[$i][$field]['count'] > 0)) {", " unset($v[$i][$field]['count']);\n $lgroups = [];\n foreach (Toolbox::addslashes_deep($v[$i][$field]) as $lgroup) {\n $lgroups[] = [\n new \\QueryExpression($DB::quoteValue($lgroup).\n \" LIKE \".\n $DB::quoteName('ldap_value'))\n ];\n }\n $group_iterator = $DB->request([\n 'SELECT' => 'id',\n 'FROM' => 'glpi_groups',\n 'WHERE' => [\n 'ldap_field' => $field,\n 'OR' => $lgroups\n ]\n ]);", " while ($group = $group_iterator->next()) {\n $this->fields[\"_groups\"][] = $group['id'];\n }\n }\n }\n } // for each ldapresult\n } // count($group_fields)\n }", "\n /**\n * Function that tries to load the user membership from LDAP\n * by searching in the attributes of the Groups.\n *\n * @param resource $ldap_connection LDAP connection\n * @param array $ldap_method LDAP method\n * @param string $userdn Basedn of the user\n * @param string $login User login\n *\n * @return boolean true if search is applicable, false otherwise\n */\n private function getFromLDAPGroupDiscret($ldap_connection, array $ldap_method, $userdn, $login) {\n global $DB;", " // No group_member_field : unable to get group\n if (empty($ldap_method[\"group_member_field\"])) {\n return false;\n }", " if ($ldap_method[\"use_dn\"]) {\n $user_tmp = $userdn;\n } else {\n //Don't add $ldap_method[\"login_field\"].\"=\", because sometimes it may not work (for example with posixGroup)\n $user_tmp = $login;\n }", " $v = $this->ldap_get_user_groups($ldap_connection, $ldap_method[\"basedn\"],\n $user_tmp,\n $ldap_method[\"group_condition\"],\n $ldap_method[\"group_member_field\"],\n $ldap_method[\"use_dn\"],\n $ldap_method[\"login_field\"]);\n foreach ($v as $result) {\n if (isset($result[$ldap_method[\"group_member_field\"]])\n && is_array($result[$ldap_method[\"group_member_field\"]])\n && (count($result[$ldap_method[\"group_member_field\"]]) > 0)) {", " $iterator = $DB->request([\n 'SELECT' => 'id',\n 'FROM' => 'glpi_groups',\n 'WHERE' => ['ldap_group_dn' => Toolbox::addslashes_deep($result[$ldap_method[\"group_member_field\"]])]\n ]);", " while ($group = $iterator->next()) {\n $this->fields[\"_groups\"][] = $group['id'];\n }\n }\n }\n return true;\n }", "\n /**\n * Function that tries to load the user informations from LDAP.\n *\n * @param resource $ldap_connection LDAP connection\n * @param array $ldap_method LDAP method\n * @param string $userdn Basedn of the user\n * @param string $login User Login\n * @param boolean $import true for import, false for update\n *\n * @return boolean true if found / false if not\n */\n function getFromLDAP($ldap_connection, array $ldap_method, $userdn, $login, $import = true) {\n global $DB, $CFG_GLPI;", " // we prevent some delay...\n if (empty($ldap_method[\"host\"])) {\n return false;\n }", " if (is_resource($ldap_connection)) {\n //Set all the search fields\n $this->fields['password'] = \"\";", " $fields = AuthLDAP::getSyncFields($ldap_method);", " //Hook to allow plugin to request more attributes from ldap\n $fields = Plugin::doHookFunction(\"retrieve_more_field_from_ldap\", $fields);", " $fields = array_filter($fields);\n $f = self::getLdapFieldNames($fields);", " $sr = @ ldap_read($ldap_connection, $userdn, \"objectClass=*\", $f);\n $v = AuthLDAP::get_entries_clean($ldap_connection, $sr);", " if (!is_array($v)\n || ( count($v) == 0)\n || empty($v[0][$fields['name']][0])) {\n return false;\n }", " //Store user's dn\n $this->fields['user_dn'] = addslashes($userdn);\n //Store date_sync\n $this->fields['date_sync'] = $_SESSION['glpi_currenttime'];\n // Empty array to ensure than syncDynamicEmails will be done\n $this->fields[\"_emails\"] = [];\n // force authtype as we retrieve this user by ldap (we could have login with SSO)\n $this->fields[\"authtype\"] = Auth::LDAP;", " foreach ($fields as $k => $e) {\n $val = AuthLDAP::getFieldValue(\n [$e => self::getLdapFieldValue($e, $v)],\n $e\n );\n if (empty($val)) {\n switch ($k) {\n case \"language\" :\n // Not set value : managed but user class\n break;", " case \"usertitles_id\" :\n case \"usercategories_id\" :\n case 'locations_id' :\n case 'users_id_supervisor' :\n $this->fields[$k] = 0;\n break;", " default :\n $this->fields[$k] = \"\";\n }", " } else {\n $val = Toolbox::addslashes_deep($val);\n switch ($k) {\n case \"email1\" :\n case \"email2\" :\n case \"email3\" :\n case \"email4\" :\n // Manage multivaluable fields\n if (!empty($v[0][$e])) {\n foreach ($v[0][$e] as $km => $m) {\n if (!preg_match('/count/', $km)) {\n $this->fields[\"_emails\"][] = addslashes($m);\n }\n }\n // Only get them once if duplicated\n $this->fields[\"_emails\"] = array_unique($this->fields[\"_emails\"]);\n }\n break;", " case \"language\" :\n $language = Config::getLanguage($val);\n if ($language != '') {\n $this->fields[$k] = $language;\n }\n break;", " case \"usertitles_id\" :\n $this->fields[$k] = Dropdown::importExternal('UserTitle', $val);\n break;", " case 'locations_id' :\n // use import to build the location tree\n $this->fields[$k] = Dropdown::import('Location',\n ['completename' => $val,\n 'entities_id' => 0,\n 'is_recursive' => 1]);\n break;", " case \"usercategories_id\" :\n $this->fields[$k] = Dropdown::importExternal('UserCategory', $val);\n break;", " case 'users_id_supervisor':\n $this->fields[$k] = self::getIdByField('user_dn', $val);\n break;", " default :\n $this->fields[$k] = $val;\n }\n }\n }", " // Empty array to ensure than syncLdapGroups will be done\n $this->fields[\"_groups\"] = [];", " ///The groups are retrieved by looking into an ldap user object\n if (($ldap_method[\"group_search_type\"] == 0)\n || ($ldap_method[\"group_search_type\"] == 2)) {\n $this->getFromLDAPGroupVirtual($ldap_connection, $ldap_method, $userdn, $login);\n }", " ///The groups are retrived by looking into an ldap group object\n if (($ldap_method[\"group_search_type\"] == 1)\n || ($ldap_method[\"group_search_type\"] == 2)) {\n $this->getFromLDAPGroupDiscret($ldap_connection, $ldap_method, $userdn, $login);\n }", " ///Only process rules if working on the master database\n if (!$DB->isSlave()) {\n //Instanciate the affectation's rule\n $rule = new RuleRightCollection();", " //Process affectation rules :\n //we don't care about the function's return because all\n //the datas are stored in session temporary\n if (isset($this->fields[\"_groups\"])) {\n $groups = $this->fields[\"_groups\"];\n } else {\n $groups = [];\n }", " $this->fields = $rule->processAllRules($groups, Toolbox::stripslashes_deep($this->fields),\n ['type' => 'LDAP',\n 'ldap_server' => $ldap_method[\"id\"],\n 'connection' => $ldap_connection,\n 'userdn' => $userdn,\n 'login' => $this->fields['name'],\n 'mail_email' => $this->fields['_emails']]);", " $this->fields['_ruleright_process'] = true;", " //If rule action is ignore import\n if ($import\n && isset($this->fields[\"_stop_import\"])) {\n return false;\n }\n //or no rights found & do not import users with no rights\n if ($import\n && !$CFG_GLPI[\"use_noright_users_add\"]) {\n $ok = false;\n if (isset($this->fields[\"_ldap_rules\"])\n && count($this->fields[\"_ldap_rules\"])) {\n if (isset($this->fields[\"_ldap_rules\"][\"rules_entities_rights\"])\n && count($this->fields[\"_ldap_rules\"][\"rules_entities_rights\"])) {\n $ok = true;\n }\n if (!$ok) {\n $entity_count = 0;\n $right_count = 0;\n if (Profile::getDefault()) {\n $right_count++;\n }\n if (isset($this->fields[\"_ldap_rules\"][\"rules_entities\"])) {\n $entity_count += count($this->fields[\"_ldap_rules\"][\"rules_entities\"]);\n }\n if (isset($this->input[\"_ldap_rules\"][\"rules_rights\"])) {\n $right_count += count($this->fields[\"_ldap_rules\"][\"rules_rights\"]);\n }\n if ($entity_count && $right_count) {\n $ok = true;\n }\n }\n }\n if (!$ok) {\n $this->fields[\"_stop_import\"] = true;\n return false;\n }\n }", " // Add ldap result to data send to the hook\n $this->fields['_ldap_result'] = $v;\n $this->fields['_ldap_conn'] = $ldap_connection;\n //Hook to retrieve more information for ldap\n $this->fields = Plugin::doHookFunction(\"retrieve_more_data_from_ldap\", $this->fields);\n unset($this->fields['_ldap_result']);\n }\n return true;\n }\n return false;", " } // getFromLDAP()", "\n /**\n * Get all groups a user belongs to.\n *\n * @param resource $ds ldap connection\n * @param string $ldap_base_dn Basedn used\n * @param string $user_dn Basedn of the user\n * @param string $group_condition group search condition\n * @param string $group_member_field group field member in a user object\n * @param boolean $use_dn search dn of user ($login_field=$user_dn) in group_member_field\n * @param string $login_field user login field\n *\n * @return array Groups of the user located in [0][$group_member_field] in returned array\n */\n function ldap_get_user_groups($ds, $ldap_base_dn, $user_dn, $group_condition,\n $group_member_field, $use_dn, $login_field) {", " $groups = [];\n $listgroups = [];", " //User dn may contain ( or ), need to espace it!\n $user_dn = str_replace([\"(\", \")\", \"\\,\", \"\\+\"], [\"\\(\", \"\\)\", \"\\\\\\,\", \"\\\\\\+\"],\n $user_dn);", " //Only retrive cn and member attributes from groups\n $attrs = ['dn'];", " if (!$use_dn) {\n $filter = \"(& $group_condition (|($group_member_field=$user_dn)\n ($group_member_field=$login_field=$user_dn)))\";\n } else {\n $filter = \"(& $group_condition ($group_member_field=$user_dn))\";\n }", " //Perform the search\n $filter = Toolbox::unclean_cross_side_scripting_deep($filter);\n $sr = ldap_search($ds, $ldap_base_dn, $filter, $attrs);", " //Get the result of the search as an array\n $info = AuthLDAP::get_entries_clean($ds, $sr);\n //Browse all the groups\n for ($i = 0; $i < count($info); $i++) {\n //Get the cn of the group and add it to the list of groups\n if (isset($info[$i][\"dn\"]) && ($info[$i][\"dn\"] != '')) {\n $listgroups[$i] = $info[$i][\"dn\"];\n }\n }", " //Create an array with the list of groups of the user\n $groups[0][$group_member_field] = $listgroups;\n //Return the groups of the user\n return $groups;\n }", "\n /**\n * Function that tries to load the user informations from IMAP.\n *\n * @param array $mail_method mail method description array\n * @param string $name login of the user\n *\n * @return boolean true if method is applicable, false otherwise\n */\n function getFromIMAP(array $mail_method, $name) {\n global $DB;", " // we prevent some delay..\n if (empty($mail_method[\"host\"])) {\n return false;\n }", " // some defaults...\n $this->fields['password'] = \"\";\n // Empty array to ensure than syncDynamicEmails will be done\n $this->fields[\"_emails\"] = [];\n $email = '';\n if (strpos($name, \"@\")) {\n $email = $name;\n } else {\n $email = $name . \"@\" . $mail_method[\"host\"];\n }\n $this->fields[\"_emails\"][] = $email;", " $this->fields['name'] = $name;\n //Store date_sync\n $this->fields['date_sync'] = $_SESSION['glpi_currenttime'];\n // force authtype as we retrieve this user by imap (we could have login with SSO)\n $this->fields[\"authtype\"] = Auth::MAIL;", " if (!$DB->isSlave()) {\n //Instanciate the affectation's rule\n $rule = new RuleRightCollection();", " //Process affectation rules :\n //we don't care about the function's return because all the datas are stored in session temporary\n if (isset($this->fields[\"_groups\"])) {\n $groups = $this->fields[\"_groups\"];\n } else {\n $groups = [];\n }\n $this->fields = $rule->processAllRules($groups, Toolbox::stripslashes_deep($this->fields),\n ['type' => 'MAIL',\n 'mail_server' => $mail_method[\"id\"],\n 'login' => $name,\n 'email' => $email]);\n $this->fields['_ruleright_process'] = true;\n }\n return true;\n }", "\n /**\n * Function that tries to load the user informations from the SSO server.\n *\n * @since 0.84\n *\n * @return boolean true if method is applicable, false otherwise\n */\n function getFromSSO() {\n global $DB, $CFG_GLPI;", " $a_field = [];\n foreach ($CFG_GLPI as $key=>$value) {\n if (!is_array($value) && !empty($value)\n && strstr($key, \"_ssofield\")) {\n $key = str_replace('_ssofield', '', $key);\n $a_field[$key] = $value;\n }\n }", " if (count($a_field) == 0) {\n return true;\n }\n $this->fields['_ruleright_process'] = true;\n foreach ($a_field as $field=>$value) {\n if (!isset($_SERVER[$value])\n || empty($_SERVER[$value])) {", " switch ($field) {\n case \"title\" :\n $this->fields['usertitles_id'] = 0;\n break;", " case \"category\" :\n $this->fields['usercategories_id'] = 0;\n break;", " default :\n $this->fields[$field] = \"\";\n }", " } else {\n switch ($field) {\n case \"email1\" :\n case \"email2\" :\n case \"email3\" :\n case \"email4\" :\n // Manage multivaluable fields\n if (!preg_match('/count/', $_SERVER[$value])) {\n $this->fields[\"_emails\"][] = addslashes($_SERVER[$value]);\n }\n // Only get them once if duplicated\n $this->fields[\"_emails\"] = array_unique($this->fields[\"_emails\"]);\n break;", " case \"language\" :\n $language = Config::getLanguage($_SERVER[$value]);\n if ($language != '') {\n $this->fields[$field] = $language;\n }\n break;", " case \"title\" :\n $this->fields['usertitles_id']\n = Dropdown::importExternal('UserTitle', addslashes($_SERVER[$value]));\n break;", " case \"category\" :\n $this->fields['usercategories_id']\n = Dropdown::importExternal('UserCategory', addslashes($_SERVER[$value]));\n break;", " default :\n $this->fields[$field] = $_SERVER[$value];\n break;", " }\n }\n }\n ///Only process rules if working on the master database\n if (!$DB->isSlave()) {\n //Instanciate the affectation's rule\n $rule = new RuleRightCollection();", " $this->fields = $rule->processAllRules([], Toolbox::stripslashes_deep($this->fields),\n ['type' => 'SSO',\n 'email' => $this->fields[\"_emails\"],\n 'login' => $this->fields[\"name\"]]);", " //If rule action is ignore import\n if (isset($this->fields[\"_stop_import\"])) {\n return false;\n }\n }\n return true;\n }", "\n /**\n * Blank passwords field of a user in the DB.\n * Needed for external auth users.\n *\n * @return void\n */\n function blankPassword() {\n global $DB;", " if (!empty($this->fields[\"name\"])) {\n $DB->update(\n $this->getTable(), [\n 'password' => ''\n ], [\n 'name' => $this->fields['name']\n ]\n );\n }\n }", "\n /**\n * Print a good title for user pages.\n *\n * @return void\n */\n function title() {\n global $CFG_GLPI;", " $buttons = [];\n $title = self::getTypeName(Session::getPluralNumber());", " if (static::canCreate()) {\n $buttons[\"user.form.php\"] = __('Add user...');\n $title = \"\";", " if (Auth::useAuthExt()\n && Session::haveRight(\"user\", self::IMPORTEXTAUTHUSERS)) {\n // This requires write access because don't use entity config.\n $buttons[\"user.form.php?new=1&amp;ext_auth=1\"] = __('... From an external source');\n }\n }\n if (Session::haveRight(\"user\", self::IMPORTEXTAUTHUSERS)\n && (static::canCreate() || static::canUpdate())) {\n if (AuthLdap::useAuthLdap()) {\n $buttons[\"ldap.php\"] = __('LDAP directory link');\n }\n }\n Html::displayTitle($CFG_GLPI[\"root_doc\"] . \"/pics/users.png\", self::getTypeName(Session::getPluralNumber()), $title,\n $buttons);\n }", "\n /**\n * Check if current user have more right than the specified one.\n *\n * @param integer $ID ID of the user\n *\n * @return boolean\n */\n function currentUserHaveMoreRightThan($ID) {", " $user_prof = Profile_User::getUserProfiles($ID);\n return Profile::currentUserHaveMoreRightThan($user_prof);\n }", "\n /**\n * Print the user form.\n *\n * @param integer $ID ID of the user\n * @param array $options Options\n * - string target Form target\n * - boolean withtemplate Template or basic item\n *\n * @return boolean true if user found, false otherwise\n */\n function showForm($ID, array $options = []) {\n global $CFG_GLPI;", " // Affiche un formulaire User\n if (($ID != Session::getLoginUserID()) && !self::canView()) {\n return false;\n }", " $this->initForm($ID, $options);", " $ismyself = $ID == Session::getLoginUserID();\n $higherrights = $this->currentUserHaveMoreRightThan($ID);\n if ($ID) {\n $caneditpassword = $higherrights || ($ismyself && Session::haveRight('password_update', 1));\n } else {\n // can edit on creation form\n $caneditpassword = true;\n }", " $extauth = !(($this->fields[\"authtype\"] == Auth::DB_GLPI)\n || (($this->fields[\"authtype\"] == Auth::NOT_YET_AUTHENTIFIED)\n && !empty($this->fields[\"password\"])));", " $formtitle = $this->getTypeName(1);", " if ($ID > 0) {\n $formtitle .= \"<a class='pointer far fa-address-card' target='_blank' href='\".$CFG_GLPI[\"root_doc\"].\n User::getFormURLWithID($ID).\"&amp;getvcard=1' title='\".__s('Download user VCard').\n \"'><span class='sr-only'>\". __('Vcard').\"</span></a>\";\n }", " $options['formtitle'] = $formtitle;\n $options['formoptions'] = \" enctype='multipart/form-data'\";\n $this->showFormHeader($options);\n $rand = mt_rand();", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='name'>\" . __('Login') . \"</label></td>\";\n if ($this->fields[\"name\"] == \"\" ||\n !empty($this->fields[\"password\"])\n || ($this->fields[\"authtype\"] == Auth::DB_GLPI) ) {\n //display login field for new records, or if this is not external auth\n echo \"<td><input name='name' id='name' value=\\\"\" . $this->fields[\"name\"] . \"\\\"></td>\";\n } else {\n echo \"<td class='b'>\" . $this->fields[\"name\"];\n echo \"<input type='hidden' name='name' value=\\\"\" . $this->fields[\"name\"] . \"\\\"></td>\";\n }", " if (!empty($this->fields[\"name\"])) {\n echo \"<td rowspan='4'>\" . __('Picture') . \"</td>\";\n echo \"<td rowspan='4'>\";\n echo \"<div class='user_picture_border_small' id='picture$rand'>\";\n echo \"<img class='user_picture_small' alt=\\\"\".__s('Picture').\"\\\" src='\".\n User::getThumbnailURLForPicture($this->fields['picture']).\"'>\";\n // echo \"<img src='\".self::getURLForPicture($this->fields[\"picture\"]).\"' class='user_picture'/>\";\n echo \"</div>\";\n $full_picture = \"<div class='user_picture_border'>\";\n $full_picture .= \"<img class='user_picture' alt=\\\"\".__s('Picture').\"\\\" src='\".\n User::getURLForPicture($this->fields['picture']).\"'>\";\n $full_picture .= \"</div>\";", " Html::showTooltip($full_picture, ['applyto' => \"picture$rand\"]);\n echo Html::file(['name' => 'picture', 'display' => false, 'onlyimages' => true]);\n echo \"<input type='checkbox' name='_blank_picture'>&nbsp;\".__('Clear');\n echo \"</td>\";\n } else {\n echo \"<td rowspan='4'></td>\";\n echo \"<td rowspan='4'></td>\";\n }\n echo \"</tr>\";", " //If it's an external auth, check if the sync_field must be displayed\n if ($extauth\n && $this->fields['auths_id']\n && AuthLDAP::isSyncFieldConfigured($this->fields['auths_id'])) {\n $syncrand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_sync_field$syncrand'>\" . __('Synchronization field') . \"</label></td><td>\";\n if (self::canUpdate()\n && (!$extauth || empty($ID))) {\n Html::autocompletionTextField($this, \"sync_field\", ['rand' => $syncrand]);\n } else {\n if (empty($this->fields['sync_field'])) {\n echo Dropdown::EMPTY_VALUE;\n } else {\n echo $this->fields['sync_field'];\n }\n }\n echo \"</td></tr>\";\n } else {\n echo \"<tr class='tab_bg_1'><td colspan='2'></td></tr>\";\n }", " $surnamerand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_realname$surnamerand'>\" . __('Surname') . \"</label></td><td>\";\n Html::autocompletionTextField($this, \"realname\", ['rand' => $surnamerand]);\n echo \"</td></tr>\";", " $firstnamerand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_firstname$firstnamerand'>\" . __('First name') . \"</label></td><td>\";\n Html::autocompletionTextField($this, \"firstname\", ['rand' => $firstnamerand]);\n echo \"</td></tr>\";", " //do some rights verification\n if (self::canUpdate()\n && (!$extauth || empty($ID))\n && $caneditpassword) {\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='password'>\" . __('Password').\"</label></td>\";\n echo \"<td><input id='password' type='password' name='password' value='' size='20'\n autocomplete='off' onkeyup=\\\"return passwordCheck();\\\"></td>\";\n echo \"<td rowspan='2'>\";\n if ($CFG_GLPI[\"use_password_security\"]) {\n echo __('Password security policy');\n }\n echo \"</td>\";\n echo \"<td rowspan='2'>\";\n Config::displayPasswordSecurityChecks();\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='password2'>\" . __('Password confirmation') . \"</label></td>\";\n echo \"<td><input type='password' id='password2' name='password2' value='' size='20' autocomplete='off'>\";\n echo \"</td></tr>\";\n }", " echo \"<tr class='tab_bg_1'>\";\n if (!GLPI_DEMO_MODE) {\n $activerand = mt_rand();\n echo \"<td><label for='dropdown_is_active$activerand'>\".__('Active').\"</label></td><td>\";\n Dropdown::showYesNo('is_active', $this->fields['is_active'], -1, ['rand' => $activerand]);\n echo \"</td>\";\n } else {\n echo \"<td colspan='2'></td>\";\n }\n echo \"<td>\" . _n('Email', 'Emails', Session::getPluralNumber());\n UserEmail::showAddEmailButton($this);\n echo \"</td><td>\";\n UserEmail::showForUser($this);\n echo \"</td>\";\n echo \"</tr>\";", " if (!GLPI_DEMO_MODE) {\n $sincerand = mt_rand();\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='showdate$sincerand'>\".__('Valid since').\"</label></td><td>\";\n Html::showDateTimeField(\"begin_date\", ['value' => $this->fields[\"begin_date\"],\n 'rand' => $sincerand,\n 'timestep' => 1,\n 'maybeempty' => true]);\n echo \"</td>\";", " $untilrand = mt_rand();\n echo \"<td><label for='showdate$untilrand'>\".__('Valid until').\"</label></td><td>\";\n Html::showDateTimeField(\"end_date\", ['value' => $this->fields[\"end_date\"],\n 'rand' => $untilrand,\n 'timestep' => 1,\n 'maybeempty' => true]);\n echo \"</td></tr>\";\n }", " $phonerand = mt_rand();\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='textfield_phone$phonerand'>\" . __('Phone') . \"</label></td><td>\";\n Html::autocompletionTextField($this, \"phone\", ['rand' => $phonerand]);\n echo \"</td>\";\n //Authentications information : auth method used and server used\n //don't display is creation of a new user'\n if (!empty($ID)) {\n if (Session::haveRight(self::$rightname, self::READAUTHENT)) {\n echo \"<td>\" . __('Authentication') . \"</td><td>\";\n echo Auth::getMethodName($this->fields[\"authtype\"], $this->fields[\"auths_id\"]);\n if (!empty($this->fields[\"date_sync\"])) {\n //TRANS: %s is the date of last sync\n echo '<br>'.sprintf(__('Last synchronization on %s'),\n HTML::convDateTime($this->fields[\"date_sync\"]));\n }\n if (!empty($this->fields[\"user_dn\"])) {\n //TRANS: %s is the user dn\n echo '<br>'.sprintf(__('%1$s: %2$s'), __('User DN'), $this->fields[\"user_dn\"]);\n }\n if ($this->fields['is_deleted_ldap']) {\n echo '<br>'.__('User missing in LDAP directory');\n }", " echo \"</td>\";\n } else {\n echo \"<td colspan='2'>&nbsp;</td>\";\n }\n } else {\n echo \"<td colspan='2'><input type='hidden' name='authtype' value='1'></td>\";\n }", " echo \"</tr>\";", " $mobilerand = mt_rand();\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='textfield_mobile$mobilerand'>\" . __('Mobile phone') . \"</label></td><td>\";\n Html::autocompletionTextField($this, \"mobile\", ['rand' => $mobilerand]);\n echo \"</td>\";\n $catrand = mt_rand();\n echo \"<td><label for='dropdown_usercategories_id$catrand'>\" . __('Category') . \"</label></td><td>\";\n UserCategory::dropdown(['value' => $this->fields[\"usercategories_id\"], 'rand' => $catrand]);\n echo \"</td></tr>\";", " $phone2rand = mt_rand();\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='textfield_phone2$phone2rand'>\" . __('Phone 2') . \"</label></td><td>\";\n Html::autocompletionTextField($this, \"phone2\", ['rand' => $phone2rand]);\n echo \"</td>\";\n echo \"<td rowspan='4' class='middle'><label for='comment'>\" . __('Comments') . \"</label></td>\";\n echo \"<td class='center middle' rowspan='4'>\";\n echo \"<textarea cols='45' rows='6' id='comment' name='comment' >\".$this->fields[\"comment\"].\"</textarea>\";\n echo \"</td></tr>\";", " $admnumrand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_registration_number$admnumrand'>\" . __('Administrative number') . \"</label></td><td>\";\n Html::autocompletionTextField($this, \"registration_number\", ['rand' => $admnumrand]);\n echo \"</td></tr>\";", " $titlerand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='dropdown_usertitles_id$titlerand'>\" . _x('person', 'Title') . \"</label></td><td>\";\n UserTitle::dropdown(['value' => $this->fields[\"usertitles_id\"], 'rand' => $titlerand]);\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'>\";\n if (!empty($ID)) {\n $locrand = mt_rand();\n echo \"<td><label for='dropdown_locations_id$locrand'>\" . __('Location') . \"</label></td><td>\";\n $entities = $this->getEntities();\n if (count($entities) <= 0) {\n $entities = -1;\n }\n Location::dropdown(['value' => $this->fields[\"locations_id\"],\n 'rand' => $locrand,\n 'entity' => $entities]);\n echo \"</td>\";\n }\n echo \"</tr>\";", " if (empty($ID)) {\n echo \"<tr class='tab_bg_1'>\";\n echo \"<th colspan='2'>\"._n('Authorization', 'Authorizations', 1).\"</th>\";\n $recurrand = mt_rand();\n echo \"<td><label for='dropdown__is_recursive$recurrand'>\" . __('Recursive') . \"</label></td><td>\";\n Dropdown::showYesNo(\"_is_recursive\", 0, -1, ['rand' => $recurrand]);\n echo \"</td></tr>\";\n $profilerand = mt_rand();\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='dropdown__profiles_id$profilerand'>\" . __('Profile') . \"</label></td><td>\";\n Profile::dropdownUnder(['name' => '_profiles_id',\n 'rand' => $profilerand,\n 'value' => Profile::getDefault()]);", " $entrand = mt_rand();\n echo \"</td><td><label for='dropdown__entities_id$entrand'>\" . __('Entity') . \"</label></td><td>\";\n Entity::dropdown(['name' => '_entities_id',\n 'display_emptychoice' => false,\n 'rand' => $entrand,\n 'entity' => $_SESSION['glpiactiveentities']]);\n echo \"</td></tr>\";\n } else {\n if ($higherrights || $ismyself) {\n $profilerand = mt_rand();\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='dropdown_profiles_id$profilerand'>\" . __('Default profile') . \"</label></td><td>\";", " $options = Dropdown::getDropdownArrayNames('glpi_profiles',\n Profile_User::getUserProfiles($this->fields['id']));", " Dropdown::showFromArray(\"profiles_id\", $options,\n ['value' => $this->fields[\"profiles_id\"],\n 'rand' => $profilerand,\n 'display_emptychoice' => true]);\n }\n if ($higherrights) {\n $entrand = mt_rand();\n echo \"</td><td><label for='dropdown_entities_id$entrand'>\" . __('Default entity') . \"</label></td><td>\";\n $entities = $this->getEntities();\n Entity::dropdown(['value' => $this->fields[\"entities_id\"],\n 'rand' => $entrand,\n 'entity' => $entities]);\n echo \"</td></tr>\";", " $grouprand = mt_rand();\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='dropdown_profiles_id$grouprand'>\" . __('Default group') . \"</label></td><td>\";", " $options = [];\n foreach (Group_User::getUserGroups($this->fields['id']) as $group) {\n $options[$group['id']] = $group['completename'];\n }", " Dropdown::showFromArray(\"groups_id\", $options,\n ['value' => $this->fields[\"groups_id\"],\n 'rand' => $grouprand,\n 'display_emptychoice' => true]);", " echo \"</td>\";\n $userrand = mt_rand();\n echo \"<td><label for='dropdown_users_id_supervisor_$userrand'>\" . __('Responsible') . \"</label></td><td>\";", " User::dropdown(['name' => 'users_id_supervisor',\n 'value' => $this->fields[\"users_id_supervisor\"],\n 'rand' => $userrand,\n 'entity' => $_SESSION[\"glpiactive_entity\"],\n 'right' => 'all']);\n echo \"</td></tr>\";\n }", " if ($this->can($ID, UPDATE)) {\n echo \"<tr class='tab_bg_1'><th colspan='4'>\". __('Remote access keys') .\"</th></tr>\";", " echo \"<tr class='tab_bg_1'><td>\";\n echo __(\"Personal token\");\n echo \"</td><td colspan='2'>\";", " if (!empty($this->fields[\"personal_token\"])) {\n echo \"<div class='copy_to_clipboard_wrapper'>\";\n echo Html::input('_personal_token', [\n 'value' => $this->fields[\"personal_token\"],\n 'style' => 'width:90%'\n ]);\n echo \"</div>\";\n echo \"(\".sprintf(__('generated on %s'),\n Html::convDateTime($this->fields[\"personal_token_date\"])).\")\";\n }\n echo \"</td><td>\";\n Html::showCheckbox(['name' => '_reset_personal_token',\n 'title' => __('Regenerate')]);\n echo \"&nbsp;&nbsp;\".__('Regenerate');\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'><td>\";\n echo __(\"API token\");\n echo \"</td><td colspan='2'>\";\n if (!empty($this->fields[\"api_token\"])) {\n echo \"<div class='copy_to_clipboard_wrapper'>\";\n echo Html::input('_api_token', [\n 'value' => $this->fields[\"api_token\"],\n 'style' => 'width:90%'\n ]);\n echo \"</div>\";\n echo \"(\".sprintf(__('generated on %s'),\n Html::convDateTime($this->fields[\"api_token_date\"])).\")\";\n }\n echo \"</td><td>\";\n Html::showCheckbox(['name' => '_reset_api_token',\n 'title' => __('Regenerate')]);\n echo \"&nbsp;&nbsp;\".__('Regenerate');\n echo \"</td></tr>\";\n }", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td colspan='2' class='center'>\";\n if ($this->fields[\"last_login\"]) {\n printf(__('Last login on %s'), HTML::convDateTime($this->fields[\"last_login\"]));\n }\n echo \"</td><td colspan='2'class='center'>\";", " echo \"</td></tr>\";\n }", " $this->showFormButtons($options);", " return true;\n }", "\n /** Print the user personnal information for check.\n *\n * @param integer $userid ID of the user\n *\n * @return void|boolean false if user is not the current user, otherwise print form\n *\n * @since 0.84\n */\n static function showPersonalInformation($userid) {\n global $CFG_GLPI;", " $user = new self();\n if (!$user->can($userid, READ)\n && ($userid != Session::getLoginUserID())) {\n return false;\n }\n echo \"<table class='tab_glpi left' width='100%'>\";\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td class='b' width='20%'>\";\n echo __('Name');\n echo \"</td><td width='30%'>\";\n echo getUserName($userid);\n echo \"</td>\";\n echo \"<td class='b' width='20%'>\";\n echo __('Phone');\n echo \"</td><td width='30%'>\";\n echo $user->getField('phone');\n echo \"</td>\";\n echo \"</tr>\";", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td class='b'>\";\n echo __('Phone 2');\n echo \"</td><td>\";\n echo $user->getField('phone2');\n echo \"</td>\";\n echo \"<td class='b'>\";\n echo __('Mobile phone');\n echo \"</td><td>\";\n echo $user->getField('mobile');\n echo \"</td>\";\n echo \"</tr>\";", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td class='b'>\";\n echo __('Email');\n echo \"</td><td>\";\n echo $user->getDefaultEmail();\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td class='b'>\";\n echo __('Location');\n echo \"</td><td>\";\n echo Dropdown::getDropdownName('glpi_locations', $user->getField('locations_id'));\n echo \"</td>\";\n echo \"<td colspan='2' class='center'>\";\n if ($userid == Session::getLoginUserID()) {\n echo \"<a href='\".$CFG_GLPI['root_doc'].\"/front/preference.php' class='vsubmit'>\".\n __('Edit').\"</a>\";\n } else {\n echo \"&nbsp;\";\n }\n echo \"</td>\";\n echo \"</tr>\";\n echo \"</table>\";\n }", "\n /**\n * Print the user preference form.\n *\n * @param string $target Form target\n * @param integer $ID ID of the user\n *\n * @return boolean true if user found, false otherwise\n */\n function showMyForm($target, $ID) {\n global $CFG_GLPI;", " // Affiche un formulaire User\n if (($ID != Session::getLoginUserID())\n && !$this->currentUserHaveMoreRightThan($ID)) {\n return false;\n }\n if ($this->getFromDB($ID)) {\n $rand = mt_rand();\n $authtype = $this->getAuthMethodsByID();", " $extauth = !(($this->fields[\"authtype\"] == Auth::DB_GLPI)\n || (($this->fields[\"authtype\"] == Auth::NOT_YET_AUTHENTIFIED)\n && !empty($this->fields[\"password\"])));", " // No autocopletion :\n $save_autocompletion = $CFG_GLPI[\"use_ajax_autocompletion\"];\n $CFG_GLPI[\"use_ajax_autocompletion\"] = false;", " echo \"<div class='center'>\";\n echo \"<form method='post' name='user_manager' enctype='multipart/form-data' action='\".$target.\"' autocomplete='off'>\";\n echo \"<table class='tab_cadre_fixe'>\";\n echo \"<tr><th colspan='4'>\".sprintf(__('%1$s: %2$s'), __('Login'), $this->fields[\"name\"]);\n echo \"<input type='hidden' name='name' value='\" . $this->fields[\"name\"] . \"'>\";\n echo \"<input type='hidden' name='id' value='\" . $this->fields[\"id\"] . \"'>\";\n echo \"</th></tr>\";", " $surnamerand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_realname$surnamerand'>\" . __('Surname') . \"</label></td><td>\";", " if ($extauth\n && isset($authtype['realname_field'])\n && !empty($authtype['realname_field'])) {", " echo $this->fields[\"realname\"];\n } else {\n Html::autocompletionTextField($this, \"realname\", ['rand' => $surnamerand]);\n }\n echo \"</td>\";", " if (!empty($this->fields[\"name\"])) {\n echo \"<td rowspan='4'>\" . __('Picture') . \"</td>\";\n echo \"<td rowspan='4'>\";\n echo \"<div class='user_picture_border_small' id='picture$rand'>\";\n echo \"<img class='user_picture_small' alt=\\\"\".__s('Picture').\"\\\" src='\".\n User::getThumbnailURLForPicture($this->fields['picture']).\"'>\";\n echo \"</div>\";\n $full_picture = \"<div class='user_picture_border'>\";\n $full_picture .= \"<img class='user_picture' alt=\\\"\".__s('Picture').\"\\\" src='\".\n User::getURLForPicture($this->fields['picture']).\"'>\";\n $full_picture .= \"</div>\";", " Html::showTooltip($full_picture, ['applyto' => \"picture$rand\"]);\n echo Html::file(['name' => 'picture', 'display' => false, 'onlyimages' => true]);", " echo \"&nbsp;\";\n Html::showCheckbox(['name' => '_blank_picture', 'title' => __('Clear')]);\n echo \"&nbsp;\".__('Clear');", " echo \"</td>\";\n echo \"</tr>\";\n }", " $firstnamerand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_firstname$firstnamerand'>\" . __('First name') . \"</label></td><td>\";\n if ($extauth\n && isset($authtype['firstname_field'])\n && !empty($authtype['firstname_field'])) {", " echo $this->fields[\"firstname\"];\n } else {\n Html::autocompletionTextField($this, \"firstname\", ['rand' => $firstnamerand]);\n }\n echo \"</td></tr>\";", " if ($extauth\n && $this->fields['auths_id']\n && AuthLDAP::isSyncFieldConfigured($this->fields['auths_id'])) {\n echo \"<tr class='tab_bg_1'><td>\" . __('Synchronization field') . \"</td><td>\";\n if (empty($this->fields['sync_field'])) {\n echo Dropdown::EMPTY_VALUE;\n } else {\n echo $this->fields['sync_field'];\n }\n echo \"</td></tr>\";\n } else {\n echo \"<tr class='tab_bg_1'><td colspan='2'></td></tr>\";\n }", " echo \"<tr class='tab_bg_1'>\";", " if (!GLPI_DEMO_MODE) {\n $langrand = mt_rand();\n echo \"<td><label for='dropdown_language$langrand'>\" . __('Language') . \"</label></td><td>\";\n // Language is stored as null in DB if value is same as the global config.\n $language = $this->fields[\"language\"];\n if (null === $this->fields[\"language\"]) {\n $language = $CFG_GLPI['language'];\n }\n Dropdown::showLanguages(\n \"language\",\n [\n 'rand' => $langrand,\n 'value' => $language,\n ]\n );\n echo \"</td>\";\n } else {\n echo \"<td colspan='2'>&nbsp;</td>\";\n }\n echo \"</tr>\";", " //do some rights verification\n if (!$extauth\n && Session::haveRight(\"password_update\", \"1\")) {\n echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='password'>\" . __('Password') . \"</label></td>\";\n echo \"<td><input id='password' type='password' name='password' value='' size='30' autocomplete='off' onkeyup=\\\"return passwordCheck();\\\">\";\n echo \"</td>\";\n echo \"<td rowspan='2'>\";\n if ($CFG_GLPI[\"use_password_security\"]) {\n echo __('Password security policy');\n }\n echo \"</td>\";\n echo \"<td rowspan='2'>\";\n Config::displayPasswordSecurityChecks();\n echo \"</td>\";\n echo \"</tr>\";", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td><label for='password2'>\" . __('Password confirmation') . \"</label></td>\";\n echo \"<td><input type='password' name='password2' id='password2' value='' size='30' autocomplete='off'>\";\n echo \"</td></tr>\";", " }", " $phonerand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_phone$phonerand'>\" . __('Phone') . \"</label></td><td>\";", " if ($extauth\n && isset($authtype['phone_field']) && !empty($authtype['phone_field'])) {\n echo $this->fields[\"phone\"];\n } else {\n Html::autocompletionTextField($this, \"phone\", ['rand' => $phonerand]);\n }\n echo \"</td>\";\n echo \"<td class='top'>\" . _n('Email', 'Emails', Session::getPluralNumber());\n UserEmail::showAddEmailButton($this);\n echo \"</td><td>\";\n UserEmail::showForUser($this);\n echo \"</td>\";\n echo \"</tr>\";", " $mobilerand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_mobile$mobilerand'>\" . __('Mobile phone') . \"</label></td><td>\";", " if ($extauth\n && isset($authtype['mobile_field']) && !empty($authtype['mobile_field'])) {\n echo $this->fields[\"mobile\"];\n } else {\n Html::autocompletionTextField($this, \"mobile\", ['rand' => $mobilerand]);\n }\n echo \"</td>\";", " if (count($_SESSION['glpiprofiles']) >1) {\n $profilerand = mt_rand();\n echo \"<td><label for='dropdown_profiles_id$profilerand'>\" . __('Default profile') . \"</label></td><td>\";", " $options = Dropdown::getDropdownArrayNames('glpi_profiles',\n Profile_User::getUserProfiles($this->fields['id']));\n Dropdown::showFromArray(\"profiles_id\", $options,\n ['value' => $this->fields[\"profiles_id\"],\n 'rand' => $profilerand,\n 'display_emptychoice' => true]);\n echo \"</td>\";", " } else {\n echo \"<td colspan='2'>&nbsp;</td>\";\n }\n echo \"</tr>\";", " $phone2rand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_phone2$phone2rand'>\" . __('Phone 2') . \"</label></td><td>\";", " if ($extauth\n && isset($authtype['phone2_field']) && !empty($authtype['phone2_field'])) {\n echo $this->fields[\"phone2\"];\n } else {\n Html::autocompletionTextField($this, \"phone2\", ['rand' => $phone2rand]);\n }\n echo \"</td>\";", " $entities = $this->getEntities();\n if (!GLPI_DEMO_MODE\n && (count($_SESSION['glpiactiveentities']) > 1)) {\n $entrand = mt_rand();\n echo \"<td><label for='dropdown_entities_id$entrand'>\" . __('Default entity') . \"</td><td>\";\n Entity::dropdown(['value' => $this->fields['entities_id'],\n 'rand' => $entrand,\n 'entity' => $entities]);\n } else {\n echo \"<td colspan='2'>&nbsp;\";\n }\n echo \"</td></tr>\";", " $admnumrand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='textfield_registration_number$admnumrand'>\" . __('Administrative number') . \"</label></td><td>\";\n if ($extauth\n && isset($authtype['registration_number_field']) && !empty($authtype['registration_number_field'])) {\n echo $this->fields[\"registration_number\"];\n } else {\n Html::autocompletionTextField($this, \"registration_number\", ['rand' => $admnumrand]);\n }\n echo \"</td><td colspan='2'></td></tr>\";", " $locrand = mt_rand();\n echo \"<tr class='tab_bg_1'><td><label for='dropdown_locations_id$locrand'>\" . __('Location') . \"</label></td><td>\";\n Location::dropdown(['value' => $this->fields['locations_id'],\n 'rand' => $locrand,\n 'entity' => $entities]);", " if (Config::canUpdate()) {\n $moderand = mt_rand();\n echo \"<td><label for='dropdown_use_mode$moderand'>\" . __('Use GLPI in mode') . \"</label></td><td>\";\n $modes = [\n Session::NORMAL_MODE => __('Normal'),\n Session::DEBUG_MODE => __('Debug'),\n ];\n Dropdown::showFromArray('use_mode', $modes, ['value' => $this->fields[\"use_mode\"], 'rand' => $moderand]);\n } else {\n echo \"<td colspan='2'>&nbsp;\";\n }\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'><th colspan='4'>\". __('Remote access keys') .\"</th></tr>\";", " echo \"<tr class='tab_bg_1'><td>\";\n echo __(\"Personal token\");\n echo \"</td><td colspan='2'>\";", " if (!empty($this->fields[\"personal_token\"])) {\n echo \"<div class='copy_to_clipboard_wrapper'>\";\n echo Html::input('_personal_token', [\n 'value' => $this->fields[\"personal_token\"],\n 'style' => 'width:90%'\n ]);\n echo \"</div>\";\n echo \"(\".sprintf(__('generated on %s'),\n Html::convDateTime($this->fields[\"personal_token_date\"])).\")\";\n }\n echo \"</td><td>\";\n Html::showCheckbox(['name' => '_reset_personal_token',\n 'title' => __('Regenerate')]);\n echo \"&nbsp;&nbsp;\".__('Regenerate');\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'><td>\";\n echo __(\"API token\");\n echo \"</td><td colspan='2'>\";\n if (!empty($this->fields[\"api_token\"])) {\n echo \"<div class='copy_to_clipboard_wrapper'>\";\n echo Html::input('_api_token', [\n 'value' => $this->fields[\"api_token\"],\n 'style' => 'width:90%'\n ]);\n echo \"</div>\";\n echo \"(\".sprintf(__('generated on %s'),\n Html::convDateTime($this->fields[\"api_token_date\"])).\")\";\n }\n echo \"</td><td>\";\n Html::showCheckbox(['name' => '_reset_api_token',\n 'title' => __('Regenerate')]);\n echo \"&nbsp;&nbsp;\".__('Regenerate');\n echo \"</td></tr>\";", " echo \"<tr><td class='tab_bg_2 center' colspan='4'>\";\n echo \"<input type='submit' name='update' value=\\\"\"._sx('button', 'Save').\"\\\" class='submit'>\";\n echo \"</td></tr>\";", " echo \"</table>\";\n Html::closeForm();\n echo \"</div>\";\n $CFG_GLPI[\"use_ajax_autocompletion\"] = $save_autocompletion;\n return true;\n }\n return false;\n }", "\n /**\n * Get all the authentication method parameters for the current user.\n *\n * @return array\n */\n function getAuthMethodsByID() {\n return Auth::getMethodsByID($this->fields[\"authtype\"], $this->fields[\"auths_id\"]);\n }", "\n function pre_updateInDB() {\n global $DB;", " if (($key = array_search('name', $this->updates)) !== false) {\n /// Check if user does not exists\n $iterator = $DB->request([\n 'FROM' => $this->getTable(),\n 'WHERE' => [\n 'name' => $this->input['name'],\n 'id' => ['<>', $this->input['id']]\n ]\n ]);", " if (count($iterator)) {\n //To display a message\n $this->fields['name'] = $this->oldvalues['name'];\n unset($this->updates[$key]);\n unset($this->oldvalues['name']);\n Session::addMessageAfterRedirect(__('Unable to update login. A user already exists.'),\n false, ERROR);\n }", " if (!Auth::isValidLogin($this->input['name'])) {\n $this->fields['name'] = $this->oldvalues['name'];\n unset($this->updates[$key]);\n unset($this->oldvalues['name']);\n Session::addMessageAfterRedirect(__('The login is not valid. Unable to update login.'),\n false, ERROR);\n }", " }", " /// Security system except for login update\n if (Session::getLoginUserID()\n && !Session::haveRight(\"user\", UPDATE)\n && !strpos($_SERVER['PHP_SELF'], \"/front/login.php\")) {", " if (Session::getLoginUserID() === $this->input['id']) {\n if (isset($this->fields[\"authtype\"])) {", " // extauth ldap case\n if ($_SESSION[\"glpiextauth\"]\n && (($this->fields[\"authtype\"] == Auth::LDAP)\n || Auth::isAlternateAuth($this->fields[\"authtype\"]))) {", " $authtype = Auth::getMethodsByID($this->fields[\"authtype\"],\n $this->fields[\"auths_id\"]);\n if (count($authtype)) {\n $fields = AuthLDAP::getSyncFields($authtype);\n foreach ($fields as $key => $val) {\n if (!empty($val)\n && (($key2 = array_search($key, $this->updates)) !== false)) {", " unset ($this->updates[$key2]);\n unset($this->oldvalues[$key]);", " }\n }\n }\n }", " if (($key = array_search(\"is_active\", $this->updates)) !== false) {\n unset ($this->updates[$key]);\n unset($this->oldvalues['is_active']);\n }", " if (($key = array_search(\"comment\", $this->updates)) !== false) {\n unset ($this->updates[$key]);\n unset($this->oldvalues['comment']);\n }\n }\n }\n }\n }", " function getSpecificMassiveActions($checkitem = null) {", " $isadmin = static::canUpdate();\n $actions = parent::getSpecificMassiveActions($checkitem);\n if ($isadmin) {\n $actions['Group_User'.MassiveAction::CLASS_ACTION_SEPARATOR.'add']\n = __('Associate to a group');\n $actions['Group_User'.MassiveAction::CLASS_ACTION_SEPARATOR.'remove']\n = __('Dissociate from a group');\n $actions['Profile_User'.MassiveAction::CLASS_ACTION_SEPARATOR.'add']\n = __('Associate to a profile');\n $actions['Profile_User'.MassiveAction::CLASS_ACTION_SEPARATOR.'remove']\n = __('Dissociate from a profile');\n $actions['Group_User'.MassiveAction::CLASS_ACTION_SEPARATOR.'change_group_user']\n = __(\"Move to group\");\n }", " if (Session::haveRight(self::$rightname, self::UPDATEAUTHENT)) {\n $prefix = __CLASS__.MassiveAction::CLASS_ACTION_SEPARATOR;\n $actions[$prefix.'change_authtype'] = _x('button', 'Change the authentication method');\n $actions[$prefix.'force_user_ldap_update'] = __('Force synchronization');\n }\n return $actions;\n }", " static function showMassiveActionsSubForm(MassiveAction $ma) {\n global $CFG_GLPI;", " switch ($ma->getAction()) {\n case 'change_authtype' :\n $rand = Auth::dropdown(['name' => 'authtype']);\n $paramsmassaction = ['authtype' => '__VALUE__'];\n Ajax::updateItemOnSelectEvent(\"dropdown_authtype$rand\", \"show_massiveaction_field\",\n $CFG_GLPI[\"root_doc\"].\n \"/ajax/dropdownMassiveActionAuthMethods.php\",\n $paramsmassaction);\n echo \"<span id='show_massiveaction_field'><br><br>\";\n echo Html::submit(_x('button', 'Post'), ['name' => 'massiveaction']).\"</span>\";\n return true;\n }\n return parent::showMassiveActionsSubForm($ma);\n }", " static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item,\n array $ids) {", " switch ($ma->getAction()) {\n case 'force_user_ldap_update' :\n foreach ($ids as $id) {\n if ($item->can($id, UPDATE)) {\n if (($item->fields[\"authtype\"] == Auth::LDAP)\n || ($item->fields[\"authtype\"] == Auth::EXTERNAL)) {\n if (AuthLdap::forceOneUserSynchronization($item, false)) {\n $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);\n } else {\n $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);\n $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));\n }\n } else {\n $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);\n $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));\n }\n } else {\n $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);\n $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));\n }\n }\n return;", " case 'change_authtype' :\n $input = $ma->getInput();\n if (!isset($input[\"authtype\"])\n || !isset($input[\"auths_id\"])) {\n $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);\n $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));\n return;\n }\n if (Session::haveRight(self::$rightname, self::UPDATEAUTHENT)) {\n if (User::changeAuthMethod($ids, $input[\"authtype\"], $input[\"auths_id\"])) {\n $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_OK);\n } else {\n $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);\n }\n } else {\n $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_NORIGHT);\n $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));\n }\n return;\n }\n parent::processMassiveActionsForOneItemtype($ma, $item, $ids);\n }", "\n function rawSearchOptions() {\n // forcegroup by on name set force group by for all items\n $tab = [];", " $tab[] = [\n 'id' => 'common',\n 'name' => __('Characteristics')\n ];", " $tab[] = [\n 'id' => '1',\n 'table' => $this->getTable(),\n 'field' => 'name',\n 'name' => __('Login'),\n 'datatype' => 'itemlink',\n 'forcegroupby' => true,\n 'massiveaction' => false\n ];", " $tab[] = [\n 'id' => '2',\n 'table' => $this->getTable(),\n 'field' => 'id',\n 'name' => __('ID'),\n 'massiveaction' => false,\n 'datatype' => 'number'\n ];", " $tab[] = [\n 'id' => '34',\n 'table' => $this->getTable(),\n 'field' => 'realname',\n 'name' => __('Last name'),\n 'datatype' => 'string'\n ];", " $tab[] = [\n 'id' => '9',\n 'table' => $this->getTable(),\n 'field' => 'firstname',\n 'name' => __('First name'),\n 'datatype' => 'string'\n ];", " $tab[] = [\n 'id' => '5',\n 'table' => 'glpi_useremails',\n 'field' => 'email',\n 'name' => _n('Email', 'Emails', Session::getPluralNumber()),\n 'datatype' => 'email',\n 'joinparams' => [\n 'jointype' => 'child'\n ],\n 'forcegroupby' => true,\n 'massiveaction' => false\n ];", " $tab[] = [\n 'id' => '150',\n 'table' => $this->getTable(),\n 'field' => 'picture',\n 'name' => __('Picture'),\n 'datatype' => 'specific',\n 'nosearch' => true,\n 'massiveaction' => false\n ];", " $tab[] = [\n 'id' => '28',\n 'table' => $this->getTable(),\n 'field' => 'sync_field',\n 'name' => __('Synchronization field'),\n 'massiveaction' => false,\n 'datatype' => 'string'\n ];", " $tab = array_merge($tab, Location::rawSearchOptionsToAdd());", " $tab[] = [\n 'id' => '8',\n 'table' => $this->getTable(),\n 'field' => 'is_active',\n 'name' => __('Active'),\n 'datatype' => 'bool'\n ];", " $tab[] = [\n 'id' => '6',\n 'table' => $this->getTable(),\n 'field' => 'phone',\n 'name' => __('Phone'),\n 'datatype' => 'string'\n ];", " $tab[] = [\n 'id' => '10',\n 'table' => $this->getTable(),\n 'field' => 'phone2',\n 'name' => __('Phone 2'),\n 'datatype' => 'string'\n ];", " $tab[] = [\n 'id' => '11',\n 'table' => $this->getTable(),\n 'field' => 'mobile',\n 'name' => __('Mobile phone'),\n 'datatype' => 'string'\n ];", " $tab[] = [\n 'id' => '13',\n 'table' => 'glpi_groups',\n 'field' => 'completename',\n 'name' => _n('Group', 'Groups', Session::getPluralNumber()),\n 'forcegroupby' => true,\n 'datatype' => 'itemlink',\n 'massiveaction' => false,\n 'joinparams' => [\n 'beforejoin' => [\n 'table' => 'glpi_groups_users',\n 'joinparams' => [\n 'jointype' => 'child'\n ]\n ]\n ]\n ];", " $tab[] = [\n 'id' => '14',\n 'table' => $this->getTable(),\n 'field' => 'last_login',\n 'name' => __('Last login'),\n 'datatype' => 'datetime',\n 'massiveaction' => false\n ];", " $tab[] = [\n 'id' => '15',\n 'table' => $this->getTable(),\n 'field' => 'authtype',\n 'name' => __('Authentication'),\n 'massiveaction' => false,\n 'datatype' => 'specific',\n 'searchtype' => 'equals',\n 'additionalfields' => [\n '0' => 'auths_id'\n ]\n ];", " $tab[] = [\n 'id' => '30',\n 'table' => 'glpi_authldaps',\n 'field' => 'name',\n 'linkfield' => 'auths_id',\n 'name' => __('LDAP directory for authentication'),\n 'massiveaction' => false,\n 'joinparams' => [\n 'condition' => 'AND REFTABLE.`authtype` = ' . Auth::LDAP\n ],\n 'datatype' => 'dropdown'\n ];", " $tab[] = [\n 'id' => '31',\n 'table' => 'glpi_authmails',\n 'field' => 'name',\n 'linkfield' => 'auths_id',\n 'name' => __('Email server for authentication'),\n 'massiveaction' => false,\n 'joinparams' => [\n 'condition' => 'AND REFTABLE.`authtype` = ' . Auth::MAIL\n ],\n 'datatype' => 'dropdown'\n ];", " $tab[] = [\n 'id' => '16',\n 'table' => $this->getTable(),\n 'field' => 'comment',\n 'name' => __('Comments'),\n 'datatype' => 'text'\n ];", " $tab[] = [\n 'id' => '17',\n 'table' => $this->getTable(),\n 'field' => 'language',\n 'name' => __('Language'),\n 'datatype' => 'language',\n 'display_emptychoice' => true,\n 'emptylabel' => 'Default value'\n ];", " $tab[] = [\n 'id' => '19',\n 'table' => $this->getTable(),\n 'field' => 'date_mod',\n 'name' => __('Last update'),\n 'datatype' => 'datetime',\n 'massiveaction' => false\n ];", " $tab[] = [\n 'id' => '121',\n 'table' => $this->getTable(),\n 'field' => 'date_creation',\n 'name' => __('Creation date'),\n 'datatype' => 'datetime',\n 'massiveaction' => false\n ];", " $tab[] = [\n 'id' => '20',\n 'table' => 'glpi_profiles',\n 'field' => 'name',\n 'name' => sprintf(__('%1$s (%2$s)'), _n('Profile', 'Profiles', Session::getPluralNumber()),\n _n('Entity', 'Entities', 1)),\n 'forcegroupby' => true,\n 'massiveaction' => false,\n 'datatype' => 'dropdown',\n 'joinparams' => [\n 'beforejoin' => [\n 'table' => 'glpi_profiles_users',\n 'joinparams' => [\n 'jointype' => 'child'\n ]\n ]\n ]\n ];", " $tab[] = [\n 'id' => '21',\n 'table' => $this->getTable(),\n 'field' => 'user_dn',\n 'name' => __('User DN'),\n 'massiveaction' => false,\n 'datatype' => 'text'\n ];", " $tab[] = [\n 'id' => '22',\n 'table' => $this->getTable(),\n 'field' => 'registration_number',\n 'name' => __('Administrative number'),\n 'datatype' => 'string'\n ];", " $tab[] = [\n 'id' => '23',\n 'table' => $this->getTable(),\n 'field' => 'date_sync',\n 'datatype' => 'datetime',\n 'name' => __('Last synchronization'),\n 'massiveaction' => false\n ];", " $tab[] = [\n 'id' => '24',\n 'table' => $this->getTable(),\n 'field' => 'is_deleted_ldap',\n 'name' => __('Deleted user in LDAP directory'),\n 'datatype' => 'bool',\n 'massiveaction' => false\n ];", " $tab[] = [\n 'id' => '80',\n 'table' => 'glpi_entities',\n 'linkfield' => 'entities_id',\n 'field' => 'completename',\n 'name' => sprintf(__('%1$s (%2$s)'), _n('Entity', 'Entities', Session::getPluralNumber()),\n _n('Profile', 'Profiles', 1)),\n 'forcegroupby' => true,\n 'datatype' => 'dropdown',\n 'massiveaction' => false,\n 'joinparams' => [\n 'beforejoin' => [\n 'table' => 'glpi_profiles_users',\n 'joinparams' => [\n 'jointype' => 'child'\n ]\n ]\n ]\n ];", " $tab[] = [\n 'id' => '81',\n 'table' => 'glpi_usertitles',\n 'field' => 'name',\n 'name' => __('Title'),\n 'datatype' => 'dropdown'\n ];", " $tab[] = [\n 'id' => '82',\n 'table' => 'glpi_usercategories',\n 'field' => 'name',\n 'name' => __('Category'),\n 'datatype' => 'dropdown'\n ];", " $tab[] = [\n 'id' => '79',\n 'table' => 'glpi_profiles',\n 'field' => 'name',\n 'name' => __('Default profile'),\n 'datatype' => 'dropdown'\n ];", " $tab[] = [\n 'id' => '77',\n 'table' => 'glpi_entities',\n 'field' => 'name',\n 'massiveaction' => true,\n 'name' => __('Default entity'),\n 'datatype' => 'dropdown'\n ];", " $tab[] = [\n 'id' => '62',\n 'table' => $this->getTable(),\n 'field' => 'begin_date',\n 'name' => __('Begin date'),\n 'datatype' => 'datetime'\n ];", " $tab[] = [\n 'id' => '63',\n 'table' => $this->getTable(),\n 'field' => 'end_date',\n 'name' => __('End date'),\n 'datatype' => 'datetime'\n ];", " $tab[] = [\n 'id' => '60',\n 'table' => 'glpi_tickets',\n 'field' => 'id',\n 'name' => __('Number of tickets as requester'),\n 'forcegroupby' => true,\n 'usehaving' => true,\n 'datatype' => 'count',\n 'massiveaction' => false,\n 'joinparams' => [\n 'beforejoin' => [\n 'table' => 'glpi_tickets_users',\n 'joinparams' => [\n 'jointype' => 'child',\n 'condition' => 'AND NEWTABLE.`type` = ' . CommonITILActor::REQUESTER\n ]\n ]\n ]\n ];", " $tab[] = [\n 'id' => '61',\n 'table' => 'glpi_tickets',\n 'field' => 'id',\n 'name' => __('Number of written tickets'),\n 'forcegroupby' => true,\n 'usehaving' => true,\n 'datatype' => 'count',\n 'massiveaction' => false,\n 'joinparams' => [\n 'jointype' => 'child',\n 'linkfield' => 'users_id_recipient'\n ]\n ];", " $tab[] = [\n 'id' => '64',\n 'table' => 'glpi_tickets',\n 'field' => 'id',\n 'name' => __('Number of assigned tickets'),\n 'forcegroupby' => true,\n 'usehaving' => true,\n 'datatype' => 'count',\n 'massiveaction' => false,\n 'joinparams' => [\n 'beforejoin' => [\n 'table' => 'glpi_tickets_users',\n 'joinparams' => [\n 'jointype' => 'child',\n 'condition' => 'AND NEWTABLE.`type` = '.CommonITILActor::ASSIGN\n ]\n ]\n ]\n ];", " // add objectlock search options\n $tab = array_merge($tab, ObjectLock::rawSearchOptionsToAdd(get_class($this)));", " return $tab;\n }", " static function getSpecificValueToDisplay($field, $values, array $options = []) {", " if (!is_array($values)) {\n $values = [$field => $values];\n }\n switch ($field) {\n case 'authtype':\n $auths_id = 0;\n if (isset($values['auths_id']) && !empty($values['auths_id'])) {\n $auths_id = $values['auths_id'];\n }\n return Auth::getMethodName($values[$field], $auths_id);\n case 'picture':\n if (isset($options['html']) && $options['html']) {\n return Html::image(self::getThumbnailURLForPicture($values['picture']),\n ['class' => 'user_picture_small', 'alt' => __('Picture')]);\n }\n }\n return parent::getSpecificValueToDisplay($field, $values, $options);\n }", " static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = []) {", " if (!is_array($values)) {\n $values = [$field => $values];\n }\n $options['display'] = false;\n switch ($field) {\n case 'authtype' :\n $options['name'] = $name;\n $options['value'] = $values[$field];\n return Auth::dropdown($options);\n }\n return parent::getSpecificValueToSelect($field, $name, $values, $options);\n }", "\n /**\n * Get all groups where the current user have delegating.\n *\n * @since 0.83\n *\n * @param integer|string $entities_id ID of the entity to restrict\n *\n * @return integer[]\n */\n static function getDelegateGroupsForUser($entities_id = '') {\n global $DB;", " $iterator = $DB->request([\n 'SELECT DISTINCT' => 'glpi_groups_users.groups_id',\n 'FROM' => 'glpi_groups_users',\n 'INNER JOIN' => [\n 'glpi_groups' => [\n 'FKEY' => [\n 'glpi_groups_users' => 'groups_id',\n 'glpi_groups' => 'id'\n ]\n ]\n ],\n 'WHERE' => [\n 'glpi_groups_users.users_id' => Session::getLoginUserID(),\n 'glpi_groups_users.is_userdelegate' => 1\n ] + getEntitiesRestrictCriteria('glpi_groups', '', $entities_id, 1)\n ]);", " $groups = [];\n while ($data = $iterator->next()) {\n $groups[$data['groups_id']] = $data['groups_id'];\n }\n return $groups;\n }", "\n /**\n * Execute the query to select box with all glpi users where select key = name\n *\n * Internaly used by showGroup_Users, dropdownUsers and ajax/getDropdownUsers.php\n *\n * @param boolean $count true if execute an count(*) (true by default)\n * @param string|string[] $right limit user who have specific right (default 'all')\n * @param integer $entity_restrict Restrict to a defined entity (default -1)\n * @param integer $value default value (default 0)\n * @param integer[] $used Already used items ID: not to display in dropdown\n * @param string $search pattern (default '')\n * @param integer $start start LIMIT value (default 0)\n * @param integer $limit limit LIMIT value (default -1 no limit)\n * @param boolean $inactive_deleted true to retreive also inactive or deleted users\n *\n * @return mysqli_result|boolean\n */\n static function getSqlSearchResult ($count = true, $right = \"all\", $entity_restrict = -1, $value = 0,\n array $used = [], $search = '', $start = 0, $limit = -1,\n $inactive_deleted = 0) {\n global $DB;", " // No entity define : use active ones\n if ($entity_restrict < 0) {\n $entity_restrict = $_SESSION[\"glpiactiveentities\"];\n }", " $joinprofile = false;\n $joinprofileright = false;\n $WHERE = [];", " switch ($right) {\n case \"interface\" :\n $joinprofile = true;\n $WHERE = [\n 'glpi_profiles.interface' => 'central'\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1);\n break;", " case \"id\" :\n $WHERE = ['glpi_users.id' => Session::getLoginUserID()];\n break;", " case \"delegate\" :\n $groups = self::getDelegateGroupsForUser($entity_restrict);\n $users = [];\n if (count($groups)) {\n $iterator = $DB->request([\n 'SELECT' => 'glpi_users.id',\n 'FROM' => 'glpi_groups_users',\n 'LEFT JOIN' => [\n 'glpi_users' => [\n 'FKEY' => [\n 'glpi_groups_users' => 'users_id',\n 'glpi_users' => 'id'\n ]\n ]\n ],\n 'WHERE' => [\n 'glpi_groups_users.groups_id' => $groups,\n 'glpi_groups_users.users_id' => ['<>', Session::getLoginUserID()]\n ]\n ]);\n while ($data = $iterator->next()) {\n $users[$data[\"id\"]] = $data[\"id\"];\n }\n }\n // Add me to users list for central\n if (Session::getCurrentInterface() == 'central') {\n $users[Session::getLoginUserID()] = Session::getLoginUserID();\n }", " if (count($users)) {\n $WHERE = ['glpi_users.id' => $users];\n }\n break;", " case \"groups\" :\n $groups = [];\n if (isset($_SESSION['glpigroups'])) {\n $groups = $_SESSION['glpigroups'];\n }\n $users = [];\n if (count($groups)) {\n $iterator = $DB->request([\n 'SELECT' => 'glpi_users.id',\n 'FROM' => 'glpi_groups_users',\n 'LEFT JOIN' => [\n 'glpi_users' => [\n 'FKEY' => [\n 'glpi_groups_users' => 'users_id',\n 'glpi_users' => 'id'\n ]\n ]\n ],\n 'WHERE' => [\n 'glpi_groups_users.groups_id' => $groups,\n 'glpi_groups_users.users_id' => ['<>', Session::getLoginUserID()]\n ]\n ]);\n while ($data = $iterator->next()) {\n $users[$data[\"id\"]] = $data[\"id\"];\n }\n }\n // Add me to users list for central\n if (Session::getCurrentInterface() == 'central') {\n $users[Session::getLoginUserID()] = Session::getLoginUserID();\n }", " if (count($users)) {\n $WHERE = ['glpi_users.id' => $users];\n }", " break;", " case \"all\" :\n $WHERE = [\n 'glpi_users.id' => ['>', 0]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1);\n break;", " default :\n $joinprofile = true;\n $joinprofileright = true;\n if (!is_array($right)) {\n $right = [$right];\n }\n $forcecentral = true;", " $ORWHERE = [];\n foreach ($right as $r) {\n switch ($r) {\n case 'own_ticket' :\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => 'ticket',\n 'glpi_profilerights.rights' => ['&', Ticket::OWN]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];\n break;", " case 'create_ticket_validate' :\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => 'ticketvalidation',\n 'OR' => [\n 'glpi_profilerights.rights' => ['&', TicketValidation::CREATEREQUEST],\n 'glpi_profilerights.rights' => ['&', TicketValidation::CREATEINCIDENT]\n ]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];\n $forcecentral = false;\n break;", " case 'validate_request' :\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => 'ticketvalidation',\n 'glpi_profilerights.rights' => ['&', TicketValidation::VALIDATEREQUEST]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];\n $forcecentral = false;\n break;", " case 'validate_incident' :\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => 'ticketvalidation',\n 'glpi_profilerights.rights' => ['&', TicketValidation::VALIDATEINCIDENT]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];\n $forcecentral = false;\n break;", " case 'validate' :\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => 'changevalidation',\n 'glpi_profilerights.rights' => ['&', ChangeValidation::VALIDATE]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];\n break;", " case 'create_validate' :\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => 'changevalidation',\n 'glpi_profilerights.rights' => ['&', ChangeValidation::CREATE]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];\n break;", " case 'see_project' :\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => 'project',\n 'glpi_profilerights.rights' => ['&', Project::READMY]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];\n break;", " case 'faq' :\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => 'knowbase',\n 'glpi_profilerights.rights' => ['&', KnowbaseItem::READFAQ]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];", " default :\n // Check read or active for rights\n $ORWHERE[] = [\n 'AND' => [\n 'glpi_profilerights.name' => $r,\n 'glpi_profilerights.rights' => [\n '&',\n READ | CREATE | UPDATE | DELETE | PURGE\n ]\n ] + getEntitiesRestrictCriteria('glpi_profiles_users', '', $entity_restrict, 1)\n ];\n }\n if (in_array($r, Profile::$helpdesk_rights)) {\n $forcecentral = false;\n }\n }", " if (count($ORWHERE)) {\n $WHERE[] = ['OR' => $ORWHERE];\n }", " if ($forcecentral) {\n $WHERE['glpi_profiles.interface'] = 'central';\n }\n }", " if (!$inactive_deleted) {\n $WHERE = array_merge(\n $WHERE, [\n 'glpi_users.is_deleted' => 0,\n 'glpi_users.is_active' => 1,\n [\n 'OR' => [\n ['glpi_users.begin_date' => null],\n ['glpi_users.begin_date' => ['<', new QueryExpression('NOW()')]]\n ]\n ],\n [\n 'OR' => [\n ['glpi_users.end_date' => null],\n ['glpi_users.end_date' => ['>', new QueryExpression('NOW()')]]\n ]\n ]", " ]\n );\n }", " if ((is_numeric($value) && $value)\n || count($used)) {", " $WHERE[] = [\n 'NOT' => [\n 'glpi_users.id' => $used\n ]\n ];\n }", " $criteria = [\n 'FROM' => 'glpi_users',\n 'LEFT JOIN' => [\n 'glpi_useremails' => [\n 'ON' => [\n 'glpi_useremails' => 'users_id',\n 'glpi_users' => 'id'\n ]\n ],\n 'glpi_profiles_users' => [\n 'ON' => [\n 'glpi_profiles_users' => 'users_id',\n 'glpi_users' => 'id'\n ]\n ]\n ]\n ];\n if ($count) {\n $criteria['COUNT DISTINCT'] = 'glpi_users.*';\n } else {\n $criteria['SELECT DISTINCT'] = 'glpi_users.*';\n }", " if ($joinprofile) {\n $criteria['LEFT JOIN']['glpi_profiles'] = [\n 'ON' => [\n 'glpi_profiles_users' => 'profiles_id',\n 'glpi_profiles' => 'id'\n ]\n ];\n if ($joinprofileright) {\n $criteria['LEFT JOIN']['glpi_profilerights'] = [\n 'ON' => [\n 'glpi_profilerights' => 'profiles_id',\n 'glpi_profiles' => 'id'\n ]\n ];\n }\n }", " if (!$count) {\n if ((strlen($search) > 0)) {\n $txt_search = Search::makeTextSearchValue($search);\n $concat = new \\QueryExpression(\n \"CONCAT(\n glpi_users.realname,\n glpi_users.firstname,\n glpi_users.firstname\n ) LIKE '$txt_search'\"\n );\n $WHERE[] = [\n 'OR' => [\n 'glpi_users.name' => ['LIKE', $txt_search],\n 'glpi_users.realname' => ['LIKE', $txt_search],\n 'glpi_users.firstname' => ['LIKE', $txt_search],\n 'glpi_users.phone' => ['LIKE', $txt_search],\n 'glpi_useremails.email' => ['LIKE', $txt_search],\n $concat\n ]\n ];\n }", " if ($_SESSION[\"glpinames_format\"] == self::FIRSTNAME_BEFORE) {\n $criteria['ORDERBY'] = [\n 'glpi_users.firstname',\n 'glpi_users.realname',\n 'glpi_users.name'\n ];\n } else {\n $criteria['ORDERBY'] = [\n 'glpi_users.realname',\n 'glpi_users.firstname',\n 'glpi_users.name'\n ];\n }", " if ($limit > 0) {\n $criteria['LIMIT'] = $limit;\n $criteria['START'] = $start;\n }\n }\n $criteria['WHERE'] = $WHERE;\n return $DB->request($criteria);\n }", "\n /**\n * Make a select box with all glpi users where select key = name\n *\n * @param $options array of possible options:\n * - name : string / name of the select (default is users_id)\n * - value\n * - right : string / limit user who have specific right :\n * id -> only current user (default case);\n * interface -> central;\n * all -> all users;\n * specific right like Ticket::READALL, CREATE.... (is array passed one of all passed right is needed)\n * - comments : boolean / is the comments displayed near the dropdown (default true)\n * - entity : integer or array / restrict to a defined entity or array of entities\n * (default -1 : no restriction)\n * - entity_sons : boolean / if entity restrict specified auto select its sons\n * only available if entity is a single value not an array(default false)\n * - all : Nobody or All display for none selected\n * all=0 (default) -> Nobody\n * all=1 -> All\n * all=-1-> nothing\n * - rand : integer / already computed rand value\n * - toupdate : array / Update a specific item on select change on dropdown\n * (need value_fieldname, to_update, url\n * (see Ajax::updateItemOnSelectEvent for information)\n * and may have moreparams)\n * - used : array / Already used items ID: not to display in dropdown (default empty)\n * - ldap_import\n * - on_change : string / value to transmit to \"onChange\"\n * - display : boolean / display or get string (default true)\n * - width : specific width needed (default 80%)\n * - specific_tags : array of HTML5 tags to add to the field\n * - url : url of the ajax php code which should return the json data to show in\n * the dropdown (default /ajax/getDropdownUsers.php)\n * - inactive_deleted : retreive also inactive or deleted users\n *\n * @return integer|string Random value if displayed, string otherwise\n */\n static function dropdown($options = []) {\n global $CFG_GLPI;", " // Default values\n $p = [\n 'name' => 'users_id',\n 'value' => '',\n 'right' => 'id',\n 'all' => 0,\n 'on_change' => '',\n 'comments' => 1,\n 'width' => '80%',\n 'entity' => -1,\n 'entity_sons' => false,\n 'used' => [],\n 'ldap_import' => false,\n 'toupdate' => '',\n 'rand' => mt_rand(),\n 'display' => true,\n '_user_index' => 0,\n 'specific_tags' => [],\n 'url' => $CFG_GLPI['root_doc'].\"/ajax/getDropdownUsers.php\",\n 'inactive_deleted' => 0,\n ];", " if (is_array($options) && count($options)) {\n foreach ($options as $key => $val) {\n $p[$key] = $val;\n }\n }", " // check default value (in case of multiple observers)\n if (is_array($p['value'])) {\n $p['value'] = $p['value'][$p['_user_index']];\n }", " // Check default value for dropdown : need to be a numeric\n if ((strlen($p['value']) == 0) || !is_numeric($p['value'])) {\n $p['value'] = 0;\n }", " $output = '';\n if (!($p['entity'] < 0) && $p['entity_sons']) {\n if (is_array($p['entity'])) {\n $output .= \"entity_sons options is not available with array of entity\";\n } else {\n $p['entity'] = getSonsOf('glpi_entities', $p['entity']);\n }\n }", " // Make a select box with all glpi users\n $user = getUserName($p['value'], 2);", " $view_users = self::canView();", " if (!empty($p['value']) && ($p['value'] > 0)) {\n $default = $user[\"name\"];\n } else {\n if ($p['all']) {\n $default = __('All');\n } else {\n $default = Dropdown::EMPTY_VALUE;\n }\n }\n $field_id = Html::cleanId(\"dropdown_\".$p['name'].$p['rand']);\n $param = ['value' => $p['value'],\n 'valuename' => $default,\n 'width' => $p['width'],\n 'all' => $p['all'],\n 'right' => $p['right'],\n 'on_change' => $p['on_change'],\n 'used' => $p['used'],\n 'inactive_deleted' => $p['inactive_deleted'],\n 'entity_restrict' => (is_array($p['entity']) ? json_encode(array_values($p['entity'])) : $p['entity']),\n 'specific_tags' => $p['specific_tags']];", " $output = Html::jsAjaxDropdown($p['name'], $field_id,\n $p['url'],\n $param);", " // Display comment\n if ($p['comments']) {\n $comment_id = Html::cleanId(\"comment_\".$p['name'].$p['rand']);\n $link_id = Html::cleanId(\"comment_link_\".$p[\"name\"].$p['rand']);\n if (!$view_users) {\n $user[\"link\"] = '';\n } else if (empty($user[\"link\"])) {\n $user[\"link\"] = $CFG_GLPI['root_doc'].\"/front/user.php\";\n }", " if (empty($user['comment'])) {\n $user['comment'] = Toolbox::ucfirst(\n sprintf(\n __('Show %1$s'),\n self::getTypeName(Session::getPluralNumber())\n )\n );\n }\n $output .= \"&nbsp;\".Html::showToolTip($user[\"comment\"],\n ['contentid' => $comment_id,\n 'display' => false,\n 'link' => $user[\"link\"],\n 'linkid' => $link_id]);", " $paramscomment = ['value' => '__VALUE__',\n 'table' => \"glpi_users\"];", " if ($view_users) {\n $paramscomment['withlink'] = $link_id;\n }\n $output .= Ajax::updateItemOnSelectEvent($field_id, $comment_id,\n $CFG_GLPI[\"root_doc\"].\"/ajax/comments.php\",\n $paramscomment, false);\n }\n $output .= Ajax::commonDropdownUpdateItem($p, false);", " if (Session::haveRight('user', self::IMPORTEXTAUTHUSERS)\n && $p['ldap_import']\n && Entity::isEntityDirectoryConfigured($_SESSION['glpiactive_entity'])) {", " $output .= \"<span title=\\\"\".__s('Import a user').\"\\\" class='fa fa-plus pointer'\".\n \" onClick=\\\"\".Html::jsGetElementbyID('userimport'.$p['rand']).\".dialog('open');\\\">\n <span class='sr-only'>\" . __s('Import a user') . \"</span></span>\";\n $output .= Ajax::createIframeModalWindow('userimport'.$p['rand'],\n $CFG_GLPI[\"root_doc\"].\n \"/front/ldap.import.php?entity=\".\n $_SESSION['glpiactive_entity'],\n ['title' => __('Import a user'),\n 'display' => false]);\n }", " if ($p['display']) {\n echo $output;\n return $p['rand'];\n }\n return $output;\n }", "\n /**\n * Show simple add user form for external auth.\n *\n * @return void|boolean false if user does not have rights to import users from external sources,\n * print form otherwise\n */\n static function showAddExtAuthForm() {", " if (!Session::haveRight(\"user\", self::IMPORTEXTAUTHUSERS)) {\n return false;\n }", " echo \"<div class='center'>\\n\";\n echo \"<form method='post' action='\".Toolbox::getItemTypeFormURL('User').\"'>\\n\";", " echo \"<table class='tab_cadre'>\\n\";\n echo \"<tr><th colspan='4'>\".__('Automatically add a user of an external source').\"</th></tr>\\n\";", " echo \"<tr class='tab_bg_1'><td>\".__('Login').\"</td>\\n\";\n echo \"<td><input type='text' name='login'></td></tr>\";", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td class='tab_bg_2 center' colspan='2'>\\n\";\n echo \"<input type='submit' name='add_ext_auth_ldap' value=\\\"\".__s('Import from directories').\"\\\"\n class='submit'>\\n\";\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td class='tab_bg_2 center' colspan='2'>\\n\";\n echo \"<input type='submit' name='add_ext_auth_simple' value=\\\"\".__s('Import from other sources').\"\\\"\n class='submit'>\\n\";\n echo \"</td></tr>\\n\";", " echo \"</table>\";\n Html::closeForm();\n echo \"</div>\\n\";\n }", "\n /**\n * Change auth method for given users.\n *\n * @param integer[] $IDs IDs of users\n * @param integer $authtype Auth type (see Auth constants)\n * @param integer $server ID of auth server\n *\n * @return boolean\n */\n static function changeAuthMethod(array $IDs = [], $authtype = 1, $server = -1) {\n global $DB;", " if (!Session::haveRight(self::$rightname, self::UPDATEAUTHENT)) {\n return false;\n }", " if (!empty($IDs)\n && in_array($authtype, [Auth::DB_GLPI, Auth::LDAP, Auth::MAIL, Auth::EXTERNAL])) {", " $result = $DB->update(\n self::getTable(), [\n 'authtype' => $authtype,\n 'auths_id' => $server,\n 'password' => '',\n 'is_deleted_ldap' => 0\n ], [\n 'id' => $IDs\n ]\n );\n if ($result) {\n foreach ($IDs as $ID) {\n $changes = [\n 0,\n '',\n addslashes(\n sprintf(\n __('%1$s: %2$s'),\n __('Update authentification method to'),\n Auth::getMethodName($authtype, $server)\n )\n )\n ];\n Log::history($ID, __CLASS__, $changes, '', Log::HISTORY_LOG_SIMPLE_MESSAGE);\n }", " return true;\n }\n }\n return false;\n }", "\n /**\n * Generate vcard for the current user.\n *\n * @return void\n */\n function generateVcard() {", " // prepare properties for the Vcard\n if (!empty($this->fields[\"realname\"])\n || !empty($this->fields[\"firstname\"])) {\n $name = [$this->fields[\"realname\"], $this->fields[\"firstname\"], \"\", \"\", \"\"];\n } else {\n $name = [$this->fields[\"name\"], \"\", \"\", \"\", \"\"];\n }", " // create vcard\n $vcard = new VObject\\Component\\VCard([\n 'N' => $name,\n 'EMAIL' => $this->getDefaultEmail(),\n 'NOTE' => $this->fields[\"comment\"],\n ]);\n $vcard->add('TEL', $this->fields[\"phone\"], ['type' => 'PREF;WORK;VOICE']);\n $vcard->add('TEL', $this->fields[\"phone2\"], ['type' => 'HOME;VOICE']);\n $vcard->add('TEL', $this->fields[\"mobile\"], ['type' => 'WORK;CELL']);", " // send the VCard\n $output = $vcard->serialize();\n $filename = implode(\"_\", array_filter($name)).\".vcf\";", " @Header(\"Content-Disposition: attachment; filename=\\\"$filename\\\"\");\n @Header(\"Content-Length: \".Toolbox::strlen($output));\n @Header(\"Connection: close\");\n @Header(\"content-type: text/x-vcard; charset=UTF-8\");", " echo $output;\n }", "\n /**\n * Show items of the current user.\n *\n * @param boolean $tech false to display items owned by user, true to display items managed by user\n *\n * @return void\n */\n function showItems($tech) {\n global $DB, $CFG_GLPI;", " $ID = $this->getField('id');", " if ($tech) {\n $type_user = $CFG_GLPI['linkuser_tech_types'];\n $type_group = $CFG_GLPI['linkgroup_tech_types'];\n $field_user = 'users_id_tech';\n $field_group = 'groups_id_tech';\n } else {\n $type_user = $CFG_GLPI['linkuser_types'];\n $type_group = $CFG_GLPI['linkgroup_types'];\n $field_user = 'users_id';\n $field_group = 'groups_id';\n }", " $group_where = \"\";\n $groups = [];", " $iterator = $DB->request([\n 'SELECT' => [\n 'glpi_groups_users.groups_id',\n 'glpi_groups.name'\n ],\n 'FROM' => 'glpi_groups_users',\n 'LEFT JOIN' => [\n 'glpi_groups' => [\n 'FKEY' => [\n 'glpi_groups_users' => 'groups_id',\n 'glpi_groups' => 'id'\n ]\n ]\n ],\n 'WHERE' => ['glpi_groups_users.users_id' => $ID]\n ]);\n $number = count($iterator);", " $group_where = [];\n while ($data = $iterator->next()) {\n $group_where[$field_group][] = $data['groups_id'];\n $groups[$data[\"groups_id\"]] = $data[\"name\"];\n }", " echo \"<div class='spaced'><table class='tab_cadre_fixehov'>\";\n $header = \"<tr><th>\".__('Type').\"</th>\";\n $header .= \"<th>\".__('Entity').\"</th>\";\n $header .= \"<th>\".__('Name').\"</th>\";\n $header .= \"<th>\".__('Serial number').\"</th>\";\n $header .= \"<th>\".__('Inventory number').\"</th>\";\n $header .= \"<th>\".__('Status').\"</th>\";\n $header .= \"<th>&nbsp;</th></tr>\";\n echo $header;", " foreach ($type_user as $itemtype) {\n if (!($item = getItemForItemtype($itemtype))) {\n continue;\n }\n if ($item->canView()) {\n $itemtable = getTableForItemType($itemtype);\n $iterator_params = [\n 'FROM' => $itemtable,\n 'WHERE' => [$field_user => $ID]\n ];", " if ($item->maybeTemplate()) {\n $iterator_params['WHERE']['is_template'] = 0;\n }\n if ($item->maybeDeleted()) {\n $iterator_params['WHERE']['is_deleted'] = 0;\n }", " $item_iterator = $DB->request($iterator_params);", " $type_name = $item->getTypeName();", " while ($data = $item_iterator->next()) {\n $cansee = $item->can($data[\"id\"], READ);\n $link = $data[\"name\"];\n if ($cansee) {\n $link_item = $item::getFormURLWithID($data['id']);\n if ($_SESSION[\"glpiis_ids_visible\"] || empty($link)) {\n $link = sprintf(__('%1$s (%2$s)'), $link, $data[\"id\"]);\n }\n $link = \"<a href='\".$link_item.\"'>\".$link.\"</a>\";\n }\n $linktype = \"\";\n if ($data[$field_user] == $ID) {\n $linktype = self::getTypeName(1);\n }\n echo \"<tr class='tab_bg_1'><td class='center'>$type_name</td>\";\n echo \"<td class='center'>\".Dropdown::getDropdownName(\"glpi_entities\",\n $data[\"entities_id\"]).\"</td>\";\n echo \"<td class='center'>$link</td>\";\n echo \"<td class='center'>\";\n if (isset($data[\"serial\"]) && !empty($data[\"serial\"])) {\n echo $data[\"serial\"];\n } else {\n echo '&nbsp;';\n }\n echo \"</td><td class='center'>\";\n if (isset($data[\"otherserial\"]) && !empty($data[\"otherserial\"])) {\n echo $data[\"otherserial\"];\n } else {\n echo '&nbsp;';\n }\n echo \"</td><td class='center'>\";\n if (isset($data[\"states_id\"])) {\n echo Dropdown::getDropdownName(\"glpi_states\", $data['states_id']);\n } else {\n echo '&nbsp;';\n }", " echo \"</td><td class='center'>$linktype</td></tr>\";\n }\n }\n }\n if ($number) {\n echo $header;\n }\n echo \"</table></div>\";", " if (count($group_where)) {\n echo \"<div class='spaced'><table class='tab_cadre_fixehov'>\";\n $header = \"<tr>\".\n \"<th>\".__('Type').\"</th>\".\n \"<th>\".__('Entity').\"</th>\".\n \"<th>\".__('Name').\"</th>\".\n \"<th>\".__('Serial number').\"</th>\".\n \"<th>\".__('Inventory number').\"</th>\".\n \"<th>\".__('Status').\"</th>\".\n \"<th>&nbsp;</th></tr>\";\n echo $header;\n $nb = 0;\n foreach ($type_group as $itemtype) {\n if (!($item = getItemForItemtype($itemtype))) {\n continue;\n }\n if ($item->canView() && $item->isField($field_group)) {\n $itemtable = getTableForItemType($itemtype);\n $iterator_params = [\n 'FROM' => $itemtable,\n 'WHERE' => ['OR' => $group_where]\n ];", " if ($item->maybeTemplate()) {\n $iterator_params['WHERE']['is_template'] = 0;\n }\n if ($item->maybeDeleted()) {\n $iterator_params['WHERE']['is_deleted'] = 0;\n }", " $group_iterator = $DB->request($iterator_params);", " $type_name = $item->getTypeName();", " while ($data = $group_iterator->next()) {\n $nb++;\n $cansee = $item->can($data[\"id\"], READ);\n $link = $data[\"name\"];\n if ($cansee) {\n $link_item = $item::getFormURLWithID($data['id']);\n if ($_SESSION[\"glpiis_ids_visible\"] || empty($link)) {\n $link = sprintf(__('%1$s (%2$s)'), $link, $data[\"id\"]);\n }\n $link = \"<a href='\".$link_item.\"'>\".$link.\"</a>\";\n }\n $linktype = \"\";\n if (isset($groups[$data[$field_group]])) {\n $linktype = sprintf(__('%1$s = %2$s'), _n('Group', 'Groups', 1),\n $groups[$data[$field_group]]);\n }\n echo \"<tr class='tab_bg_1'><td class='center'>$type_name</td>\";\n echo \"<td class='center'>\".Dropdown::getDropdownName(\"glpi_entities\",\n $data[\"entities_id\"]);\n echo \"</td><td class='center'>$link</td>\";\n echo \"<td class='center'>\";\n if (isset($data[\"serial\"]) && !empty($data[\"serial\"])) {\n echo $data[\"serial\"];\n } else {\n echo '&nbsp;';\n }\n echo \"</td><td class='center'>\";\n if (isset($data[\"otherserial\"]) && !empty($data[\"otherserial\"])) {\n echo $data[\"otherserial\"];\n } else {\n echo '&nbsp;';\n }\n echo \"</td><td class='center'>\";\n if (isset($data[\"states_id\"])) {\n echo Dropdown::getDropdownName(\"glpi_states\", $data['states_id']);\n } else {\n echo '&nbsp;';\n }", " echo \"</td><td class='center'>$linktype</td></tr>\";\n }\n }\n }\n if ($nb) {\n echo $header;\n }\n echo \"</table></div>\";\n }\n }", "\n /**\n * Get user by email, importing it from LDAP if not existing.\n *\n * @param string $email\n *\n * @return integer ID of user, 0 if not found nor imported\n */\n static function getOrImportByEmail($email = '') {\n global $DB, $CFG_GLPI;", " $iterator = $DB->request([\n 'SELECT' => 'users_id AS id',\n 'FROM' => 'glpi_useremails',\n 'LEFT JOIN' => [\n 'glpi_users' => [\n 'FKEY' => [\n 'glpi_useremails' => 'users_id',\n 'glpi_users' => 'id'\n ]\n ]\n ],\n 'WHERE' => [\n 'glpi_useremails.email' => $DB->escape(stripslashes($email))\n ],\n 'ORDER' => ['glpi_users.is_active DESC', 'is_deleted ASC']\n ]);", " //User still exists in DB\n if (count($iterator)) {\n $result = $iterator->next();\n return $result['id'];\n } else {\n if ($CFG_GLPI[\"is_users_auto_add\"]) {\n //Get all ldap servers with email field configured\n $ldaps = AuthLdap::getServersWithImportByEmailActive();\n //Try to find the user by his email on each ldap server", " foreach ($ldaps as $ldap) {\n $params = [\n 'method' => AuthLdap::IDENTIFIER_EMAIL,\n 'value' => $email,\n ];\n $res = AuthLdap::ldapImportUserByServerId($params,\n AuthLdap::ACTION_IMPORT,\n $ldap);", " if (isset($res['id'])) {\n return $res['id'];\n }\n }\n }\n }\n return 0;\n }", "\n /**\n * Handle user deleted in LDAP using configured policy.\n *\n * @param integer $users_id\n *\n * @return void\n */\n static function manageDeletedUserInLdap($users_id) {\n global $CFG_GLPI;", " //The only case where users_id can be null if when a user has been imported into GLPI\n //it's dn still exists, but doesn't match the connection filter anymore\n //In this case, do not try to process the user\n if (!$users_id) {\n return;\n }", " //User is present in DB but not in the directory : it's been deleted in LDAP\n $tmp = [\n 'id' => $users_id,\n 'is_deleted_ldap' => 1,\n ];\n $myuser = new self();\n $myuser->getFromDB($users_id);", " //User is already considered as delete from ldap\n if ($myuser->fields['is_deleted_ldap'] == 1) {\n return;\n }", " switch ($CFG_GLPI['user_deleted_ldap']) {\n //DO nothing\n default :\n case AuthLDAP::DELETED_USER_PRESERVE:\n $myuser->update($tmp);\n break;", " //Put user in trashbin\n case AuthLDAP::DELETED_USER_DELETE:\n $myuser->delete($tmp);\n break;", " //Delete all user dynamic habilitations and groups\n case AuthLDAP::DELETED_USER_WITHDRAWDYNINFO:\n Profile_User::deleteRights($users_id, true);\n Group_User::deleteGroups($users_id, true);\n $myuser->update($tmp);\n break;", " //Deactivate the user\n case AuthLDAP::DELETED_USER_DISABLE:\n $tmp['is_active'] = 0;\n $myuser->update($tmp);\n break;", " //Deactivate the user+ Delete all user dynamic habilitations and groups\n case AuthLDAP::DELETED_USER_DISABLEANDWITHDRAWDYNINFO:\n $tmp['is_active'] = 0;\n $myuser->update($tmp);\n Profile_User::deleteRights($users_id, true);\n Group_User::deleteGroups($users_id, true);\n break;", " }\n /*\n $changes[0] = '0';\n $changes[1] = '';\n $changes[2] = __('Deleted user in LDAP directory');\n Log::history($users_id, 'User', $changes, 0, Log::HISTORY_LOG_SIMPLE_MESSAGE);*/\n }", " /**\n * Get user ID from its name.\n *\n * @param string $name User name\n *\n * @return integer\n */\n static function getIdByName($name) {\n return self::getIdByField('name', $name);\n }", "\n /**\n * Get user ID from a field\n *\n * @since 0.84\n *\n * @param string $field Field name\n * @param string $value Field value\n *\n * @return integer\n */\n static function getIdByField($field, $value) {\n global $DB;", " $iterator = $DB->request([\n 'SELECT' => 'id',\n 'FROM' => self::getTable(),\n 'WHERE' => [$field => addslashes($value)]\n ]);", " if (count($iterator) == 1) {\n $row = $iterator->next();\n return (int)$row['id'];\n }\n return false;\n }", "\n /**\n * Show new password form of password recovery process.\n *\n * @param $token\n *\n * @return void\n */\n static function showPasswordForgetChangeForm($token) {\n global $CFG_GLPI, $DB;", " // Verif token.\n $token_ok = false;\n $iterator = $DB->request([\n 'FROM' => self::getTable(),\n 'WHERE' => [\n 'password_forget_token' => $token,", " new \\QueryExpression('NOW() < ADDDATE(' . $DB->quoteName('password_forget_token_date') . ', INTERVAL 1 DAY)')", " ]\n ]);", " if (count($iterator) == 1) {\n $token_ok = true;\n }\n echo \"<div class='center'>\";", " if ($token_ok) {\n echo \"<form method='post' name='forgetpassword' action='\".$CFG_GLPI['root_doc'].\n \"/front/lostpassword.php'>\";\n echo \"<table class='tab_cadre'>\";\n echo \"<tr><th colspan='2'>\" . __('Forgotten password?').\"</th></tr>\";", " echo \"<tr class='tab_bg_1'>\";\n echo \"<td colspan='2'>\". __('Please confirm your email address and enter your new password.').\n \"</td></tr>\";", " echo \"<tr class='tab_bg_1'><td>\" . _n('Email', 'Emails', 1).\"</td>\";\n echo \"<td><input type='text' name='email' value='' size='60'></td></tr>\";", " echo \"<tr class='tab_bg_1'><td>\" . __('Password').\"</td>\";\n echo \"<td><input id='password' type='password' name='password' value='' size='20'\n autocomplete='off' onkeyup=\\\"return passwordCheck();\\\">\";\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'><td>\" . __('Password confirmation').\"</td>\";\n echo \"<td><input type='password' name='password2' value='' size='20' autocomplete='off'>\";\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_1'><td>\".__('Password security policy').\"</td>\";\n echo \"<td>\";\n Config::displayPasswordSecurityChecks();\n echo \"</td></tr>\";", " echo \"<tr class='tab_bg_2 center'><td colspan='2'>\";\n echo \"<input type='hidden' name='password_forget_token' value='$token'>\";\n echo \"<input type='submit' name='update' value=\\\"\".__s('Save').\"\\\" class='submit'>\";\n echo \"</td></tr>\";", " echo \"</table>\";\n Html::closeForm();", " } else {\n echo __('Your password reset request has expired or is invalid. Please renew it.');\n }\n echo \"</div>\";\n }", "\n /**\n * Show request form of password recovery process.\n *\n * @return void\n */\n static function showPasswordForgetRequestForm() {\n global $CFG_GLPI;", " echo \"<div class='center'>\";\n echo \"<form method='post' name='forgetpassword' action='\".$CFG_GLPI['root_doc'].\n \"/front/lostpassword.php'>\";\n echo \"<table class='tab_cadre'>\";\n echo \"<tr><th colspan='2'>\" . __('Forgotten password?').\"</th></tr>\";", " echo \"<tr class='tab_bg_1'><td colspan='2'>\" .\n __('Please enter your email address. An email will be sent to you and you will be able to choose a new password.').\n \"</td></tr>\";", " echo \"<tr class='tab_bg_2 center'>\";\n echo \"<td><input type='text' size='60' name='email' value=''></td>\";\n echo \"<td><input type='submit' name='update' value=\\\"\".__s('Save').\"\\\" class='submit'>\";\n echo \"</td></tr>\";", " echo \"</table>\";\n Html::closeForm();\n echo \"</div>\";\n }", "\n /**\n * Handle password recovery form submission.\n *\n * @param array $input\n *\n * @throws ForgetPasswordException when requirements are not met\n *\n * @return boolean true if password successfully changed, false otherwise\n */\n public function updateForgottenPassword(array $input) {\n $condition = [\n 'glpi_users.is_active' => 1,\n 'glpi_users.is_deleted' => 0, [\n 'OR' => [\n ['glpi_users.begin_date' => null],\n ['glpi_users.begin_date' => ['<', new QueryExpression('NOW()')]]\n ],\n ], [\n 'OR' => [\n ['glpi_users.end_date' => null],\n ['glpi_users.end_date' => ['>', new QueryExpression('NOW()')]]\n ]\n ]\n ];\n if ($this->getFromDBbyEmail($input['email'], $condition)) {\n if (($this->fields[\"authtype\"] == Auth::DB_GLPI)\n || !Auth::useAuthExt()) {", " if (($input['password_forget_token'] == $this->fields['password_forget_token'])\n && (abs(strtotime($_SESSION[\"glpi_currenttime\"])\n -strtotime($this->fields['password_forget_token_date'])) < DAY_TIMESTAMP)) {", " $input['id'] = $this->fields['id'];\n Config::validatePassword($input[\"password\"], false); // Throws exception if password is invalid\n if (!$this->update($input)) {\n return false;\n }\n $input2 = [\n 'password_forget_token' => '',\n 'password_forget_token_date' => null,\n 'id' => $this->fields['id']\n ];\n $this->update($input2);\n return true;", " } else {\n throw new ForgetPasswordException(__('Your password reset request has expired or is invalid. Please renew it.'));\n }", " } else {\n throw new ForgetPasswordException(__(\"The authentication method configuration doesn't allow you to change your password.\"));\n }", " } else {\n throw new ForgetPasswordException(__('Email address not found.'));\n }", " return false;\n }", "\n /**\n * Displays password recovery result.\n *\n * @param array $input\n *\n * @return void\n */\n public function showUpdateForgottenPassword(array $input) {\n global $CFG_GLPI;", " echo \"<div class='center'>\";\n try {\n if (!$this->updateForgottenPassword($input)) {\n Html::displayMessageAfterRedirect();\n } else {\n echo __('Reset password successful.');\n }\n } catch (ForgetPasswordException $e) {\n echo $e->getMessage();\n } catch (PasswordTooWeakException $e) {\n // Force display on error\n foreach ($e->getMessages() as $message) {\n Session::addMessageAfterRedirect($message);\n }\n Html::displayMessageAfterRedirect();\n }", " echo \"<br>\";\n echo \"<a href=\\\"\".$CFG_GLPI['root_doc'].\"/index.php\\\">\".__s('Back').\"</a>\";\n echo \"</div>\";\n }", "\n /**\n * Send password recovery for a user and display result message.\n *\n * @param string $email email of the user\n *\n * @return void\n */\n public function showForgetPassword($email) {", " echo \"<div class='center'>\";\n try {\n $this->forgetPassword($email);\n } catch (ForgetPasswordException $e) {\n echo $e->getMessage();\n return;\n }\n echo __('An email has been sent to your email address. The email contains information for reset your password.');\n }", " /**\n * Send password recovery email for a user.\n *\n * @param string $email\n *\n * @throws ForgetPasswordException when requirements are not met\n *\n * @return boolean true if notification successfully created, false if user not found\n */\n public function forgetPassword($email) {\n $condition = [\n 'glpi_users.is_active' => 1,\n 'glpi_users.is_deleted' => 0, [\n 'OR' => [\n ['glpi_users.begin_date' => null],\n ['glpi_users.begin_date' => ['<', new QueryExpression('NOW()')]]\n ],\n ], [\n 'OR' => [\n ['glpi_users.end_date' => null],\n ['glpi_users.end_date' => ['>', new QueryExpression('NOW()')]]\n ]\n ]\n ];", " if ($this->getFromDBbyEmail($email, $condition)) {", " // Send token if auth DB or not external auth defined\n if (($this->fields[\"authtype\"] == Auth::DB_GLPI)\n || !Auth::useAuthExt()) {", " if (NotificationMailing::isUserAddressValid($email)) {\n $input = [\n 'password_forget_token' => sha1(Toolbox::getRandomString(30)),\n 'password_forget_token_date' => $_SESSION[\"glpi_currenttime\"],\n 'id' => $this->fields['id'],\n ];\n $this->update($input);\n // Notication on root entity (glpi_users.entities_id is only a pref)\n NotificationEvent::raiseEvent('passwordforget', $this, ['entities_id' => 0]);\n QueuedNotification::forceSendFor($this->getType(), $this->fields['id']);\n return true;\n } else {\n throw new ForgetPasswordException(__('Invalid email address'));\n }", " } else {\n throw new ForgetPasswordException(__(\"The authentication method configuration doesn't allow you to change your password.\"));\n }", " }", " throw new ForgetPasswordException(__('Email address not found.'));\n }", "\n /**\n * Display information from LDAP server for user.\n *\n * @return void\n */\n private function showLdapDebug() {", " if ($this->fields['authtype'] != Auth::LDAP) {\n return false;\n }\n echo \"<div class='spaced'>\";\n echo \"<table class='tab_cadre_fixe'>\";\n echo \"<tr><th colspan='4'>\".__('LDAP directory').\"</th></tr>\";", " echo \"<tr class='tab_bg_2'><td>\".__('User DN').\"</td>\";\n echo \"<td>\".$this->fields['user_dn'].\"</td></tr>\\n\";", " if ($this->fields['user_dn']) {\n echo \"<tr class='tab_bg_2'><td>\".__('User information').\"</td><td>\";\n $config_ldap = new AuthLDAP();\n $ds = false;", " if ($config_ldap->getFromDB($this->fields['auths_id'])) {\n $ds = $config_ldap->connect();\n }", " if ($ds) {\n $info = AuthLdap::getUserByDn($ds, $this->fields['user_dn'],\n ['*', 'createTimeStamp', 'modifyTimestamp']);\n if (is_array($info)) {\n Html::printCleanArray($info);\n } else {\n echo __('No item to display');\n }", " } else {\n echo __('Connection failed');\n }", " echo \"</td></tr>\\n\";\n }", " echo \"</table></div>\";\n }", "\n /**\n * Display debug information for current object.\n *\n * @return void\n */\n function showDebug() {", " NotificationEvent::debugEvent($this);\n $this->showLdapDebug();\n }", " function getUnicityFieldsToDisplayInErrorMessage() {", " return ['id' => __('ID'),\n 'entities_id' => __('Entity')];\n }", "\n function getUnallowedFieldsForUnicity() {", " return array_merge(parent::getUnallowedFieldsForUnicity(),\n ['auths_id', 'date_sync', 'entities_id', 'last_login', 'profiles_id']);\n }", "\n /**\n * Get a unique generated token.\n *\n * @param string $field Field storing the token\n *\n * @return string\n */\n static function getUniqueToken($field = 'personal_token') {\n global $DB;", " $ok = false;\n do {\n $key = Toolbox::getRandomString(40);\n $row = $DB->request([\n 'COUNT' => 'cpt',\n 'FROM' => self::getTable(),\n 'WHERE' => [$field => $key]\n ])->next();", " if ($row['cpt'] == 0) {\n return $key;\n }\n } while (!$ok);", " }", "\n /**\n * Get token of a user. If not exists generate it.\n *\n * @param integer $ID User ID\n * @param string $field Field storing the token\n *\n * @return string|boolean User token, false if user does not exist\n */\n static function getToken($ID, $field = 'personal_token') {", " $user = new self();\n if ($user->getFromDB($ID)) {\n return $user->getAuthToken($field);\n }", " return false;\n }", " /**\n * Get token of a user. If it does not exists then generate it.\n *\n * @since 9.4\n *\n * @param string $field the field storing the token\n *\n * @return string|false token or false in case of error\n */\n public function getAuthToken($field = 'personal_token') {\n global $DB;", " if ($this->isNewItem()) {\n return false;\n }", " if (!empty($this->fields[$field])) {\n return $this->fields[$field];\n }\n $token = self::getUniqueToken($field);\n $this->update(['id' => $this->getID(),\n $field => $token,\n $field . \"_date\" => $_SESSION['glpi_currenttime']]);\n return $this->fields[$field];\n }", "\n /**\n * Get name of users using default passwords\n *\n * @return string[]\n */\n static function checkDefaultPasswords() {\n global $DB;", " $passwords = ['glpi' => 'glpi',\n 'tech' => 'tech',\n 'normal' => 'normal',\n 'post-only' => 'postonly'];\n $default_password_set = [];", " $crit = ['FIELDS' => ['name', 'password'],\n 'is_active' => 1,\n 'is_deleted' => 0,\n 'name' => array_keys($passwords)];", " foreach ($DB->request('glpi_users', $crit) as $data) {\n if (Auth::checkPassword($passwords[$data['name']], $data['password'])) {\n $default_password_set[] = $data['name'];\n }\n }", " return $default_password_set;\n }", "\n /**\n * Get picture URL from picture field.\n *\n * @since 0.85\n *\n * @param string $picture Picture field value\n *\n * @return string\n */\n static function getURLForPicture($picture) {\n global $CFG_GLPI;", " if (!empty($picture)) {\n return $CFG_GLPI[\"root_doc\"].\"/front/document.send.php?file=_pictures/$picture\";\n }\n return $CFG_GLPI[\"root_doc\"].\"/pics/picture.png\";\n }", "\n /**\n * Get thumbnail URL from picture field.\n *\n * @since 0.85\n *\n * @param string $picture Picture field value\n *\n * @return string\n */\n static function getThumbnailURLForPicture($picture) {\n global $CFG_GLPI;", " if (!empty($picture)) {\n $tmp = explode(\".\", $picture);\n if (count($tmp) ==2) {\n return $CFG_GLPI[\"root_doc\"].\"/front/document.send.php?file=_pictures/\".$tmp[0].\n \"_min.\".$tmp[1];\n }\n return $CFG_GLPI[\"root_doc\"].\"/pics/picture_min.png\";\n }\n return $CFG_GLPI[\"root_doc\"].\"/pics/picture_min.png\";", " }", "\n /**\n * Drop existing files for user picture.\n *\n * @since 0.85\n *\n * @param string $picture Picture field value\n *\n * @return void\n */\n static function dropPictureFiles($picture) {", " if (!empty($picture)) {\n // unlink main file\n if (file_exists(GLPI_PICTURE_DIR.\"/$picture\")) {\n @unlink(GLPI_DOC_DIR.\"/_pictures/$picture\");\n }\n // unlink Thunmnail\n $tmp = explode(\".\", $picture);\n if (count($tmp) == 2) {\n if (file_exists(GLPI_PICTURE_DIR.\"/\".$tmp[0].\"_min.\".$tmp[1])) {\n @unlink(GLPI_PICTURE_DIR.\"/\".$tmp[0].\"_min.\".$tmp[1]);\n }\n }\n }\n }", " function getRights($interface = 'central') {", " $values = parent::getRights();\n //TRANS: short for : Add users from an external source\n $values[self::IMPORTEXTAUTHUSERS] = ['short' => __('Add external'),\n 'long' => __('Add users from an external source')];\n //TRANS: short for : Read method for user authentication and synchronization\n $values[self::READAUTHENT] = ['short' => __('Read auth'),\n 'long' => __('Read user authentication and synchronization method')];\n //TRANS: short for : Update method for user authentication and synchronization\n $values[self::UPDATEAUTHENT] = ['short' => __('Update auth and sync'),\n 'long' => __('Update method for user authentication and synchronization')];", " return $values;\n }", "\n /**\n * Retrieve the list of LDAP field names from a list of fields\n * allow pattern substitution, e.g. %{name}.\n *\n * @since 9.1\n *\n * @param string[] $map array of fields\n *\n * @return string[]\n */\n private static function getLdapFieldNames(array $map) {", " $ret = [];\n foreach ($map as $v) {\n /** @var array $reg */\n if (preg_match_all('/%{(.*)}/U', $v, $reg)) {\n // e.g. \"%{country} > %{city} > %{site}\"\n foreach ($reg [1] as $f) {\n $ret [] = $f;\n }\n } else {\n // single field name\n $ret [] = $v;\n }\n }\n return $ret;\n }", "\n /**\n * Retrieve the value of a fields from a LDAP result applying needed substitution of %{value}.\n *\n * @since 9.1\n *\n * @param string $map String with field format\n * @param array $res LDAP result\n *\n * @return string\n */\n private static function getLdapFieldValue($map, array $res) {", " $map = Toolbox::unclean_cross_side_scripting_deep($map);\n $ret = preg_replace_callback('/%{(.*)}/U',\n function ($matches) use ($res) {\n return (isset($res[0][$matches[1]][0]) ? $res[0][$matches[1]][0] : '');\n }, $map );", " return $ret == $map ? (isset($res[0][$map][0]) ? $res[0][$map][0] : '') : $ret;\n }", " /**\n * Get/Print the switch language form.\n *\n * @param boolean $display Whether to display or return output\n * @param array $options Options\n * - string value Selected language value\n * - boolean showbutton Whether to display or not submit button\n *\n * @return void|string Nothing if displayed, string to display otherwise\n */\n function showSwitchLangForm($display = true, array $options = []) {", " $params = [\n 'value' => $_SESSION[\"glpilanguage\"],\n 'display' => false,\n 'showbutton' => true\n ];", " foreach ($options as $key => $value) {\n $params[$key] = $value;\n }", " $out = '';\n $out .= \"<form method='post' name='switchlang' action='\".User::getFormURL().\"' autocomplete='off'>\";\n $out .= \"<p class='center'>\";\n $out .= Dropdown::showLanguages(\"language\", $params);\n if ($params['showbutton'] === true) {\n $out .= \"&nbsp;<input type='submit' name='update' value=\\\"\"._sx('button', 'Save').\"\\\" class='submit'>\";\n }\n $out .= \"</p>\";\n $out .= Html::closeForm(false);", " if ($display === true) {\n echo $out;\n } else {\n return $out;\n }\n }", " /**\n * Get list of entities ids for current user.\n *\n * @return integer[]\n */\n private function getEntities() {\n //get user entities\n if ($this->entities == null) {\n $this->entities = Profile_User::getUserEntities($this->fields['id'], true);\n }\n return $this->entities;\n }\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [4396], "buggy_code_start_loc": [4395], "filenames": ["inc/user.class.php"], "fixing_code_end_loc": [4396], "fixing_code_start_loc": [4395], "message": "An issue was discovered in GLPI before 9.4.1. After a successful password reset by a user, it is possible to change that user's password again during the next 24 hours without any information except the associated email address.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:glpi-project:glpi:*:*:*:*:*:*:*:*", "matchCriteriaId": "49F5CE77-0669-4846-93DE-D2454579E6A4", "versionEndExcluding": "9.4.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in GLPI before 9.4.1. After a successful password reset by a user, it is possible to change that user's password again during the next 24 hours without any information except the associated email address."}, {"lang": "es", "value": "Se detect\u00f3 un problema en GLPI versiones anteriores a 9.4.1. Despu\u00e9s de que un usuario haya restablecido con \u00e9xito la contrase\u00f1a, es posible cambiarla de nuevo durante las pr\u00f3ximas 24 horas sin ninguna informaci\u00f3n, excepto la direcci\u00f3n de correo electr\u00f3nico asociada."}], "evaluatorComment": null, "id": "CVE-2019-13240", "lastModified": "2019-07-17T14:12:39.453", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:N/C:P/I:N/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.9, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2019-07-10T14:15:11.793", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/glpi-project/glpi/commit/5da9f99b2d81713b1e36016b47ce656a33648bc7"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/glpi-project/glpi/commit/86a43ae47b3dd844947f40a2ffcf1a36e53dbba6"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/glpi-project/glpi/compare/1783b78...8e621f6"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://github.com/glpi-project/glpi/releases/tag/9.4.1"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Third Party Advisory"], "url": "https://www.synacktiv.com/ressources/advisories/GLPI_9.4.0_unsafe_reset.pdf"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-640"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/glpi-project/glpi/commit/5da9f99b2d81713b1e36016b47ce656a33648bc7"}, "type": "CWE-640"}
354
Determine whether the {function_name} code is vulnerable or not.
[ "module Recurly\n # The API class handles all requests to the Recurly API. While most of its\n # functionality is leveraged by the Resource class, it can be used directly,\n # as well.\n #\n # Requests are made with methods named after the four main HTTP verbs\n # recognized by the Recurly API.\n #\n # @example\n # Recurly::API.get 'accounts' # => #<Net::HTTPOK ...>\n # Recurly::API.post 'accounts', xml_body # => #<Net::HTTPCreated ...>\n # Recurly::API.put 'accounts/1', xml_body # => #<Net::HTTPOK ...>\n # Recurly::API.delete 'accounts/1' # => #<Net::HTTPNoContent ...>\n class API\n require 'recurly/api/errors'", " @@base_uri = \"https://api.recurly.com/v2/\"", "", "\n RECURLY_API_VERSION = '2.8'", " FORMATS = Helper.hash_with_indifferent_read_access(\n 'pdf' => 'application/pdf',\n 'xml' => 'application/xml'\n )", " class << self\n # Additional HTTP headers sent with each API call\n # @return [Hash{String => String}]\n def headers\n @headers ||= { 'Accept' => accept, 'User-Agent' => user_agent, 'X-Api-Version' => RECURLY_API_VERSION }\n end", " # @return [String, nil] Accept-Language header value\n def accept_language\n headers['Accept-Language']\n end", " # @param [String] language Accept-Language header value\n def accept_language=(language)\n headers['Accept-Language'] = language\n end", " # @return [Net::HTTPOK, Net::HTTPResponse]\n # @raise [ResponseError] With a non-2xx status code.\n def head uri, params = {}, options = {}\n request :head, uri, { :params => params || {} }.merge(options)\n end", " # @return [Net::HTTPOK, Net::HTTPResponse]\n # @raise [ResponseError] With a non-2xx status code.\n def get uri, params = {}, options = {}\n request :get, uri, { :params => params || {} }.merge(options)\n end", " # @return [Net::HTTPCreated, Net::HTTPResponse]\n # @raise [ResponseError] With a non-2xx status code.\n def post uri, body = nil, options = {}\n request :post, uri, { :body => body.to_s }.merge(options)\n end", " # @return [Net::HTTPOK, Net::HTTPResponse]\n # @raise [ResponseError] With a non-2xx status code.\n def put uri, body = nil, options = {}\n request :put, uri, { :body => body.to_s }.merge(options)\n end", " # @return [Net::HTTPNoContent, Net::HTTPResponse]\n # @raise [ResponseError] With a non-2xx status code.\n def delete uri, body = nil, options = {}\n request :delete, uri, options\n end", " # @return [URI::Generic]\n def base_uri\n URI.parse @@base_uri.sub('api', Recurly.subdomain)\n end\n", "", " # @return [String]\n def user_agent\n \"Recurly/#{Version}; #{RUBY_DESCRIPTION}\"\n end", " private", " def accept\n FORMATS['xml']\n end\n alias content_type accept\n end\n end\nend", "require 'recurly/api/net_http_adapter'" ]
[ 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [77, 45, 341], "buggy_code_start_loc": [17, 45, 338], "filenames": ["lib/recurly/api.rb", "lib/recurly/api/net_http_adapter.rb", "lib/recurly/resource.rb"], "fixing_code_end_loc": [86, 47, 340], "fixing_code_start_loc": [18, 46, 337], "message": "The Recurly Client Ruby Library before 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4, 2.11.3 is vulnerable to a Server-Side Request Forgery vulnerability in the \"Resource#find\" method that could result in compromise of API keys or other critical resources.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "D2111C93-1F01-4B79-B731-14E639037521", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "BE0E6539-B427-4F49-8F7D-9D7778E2174B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.2:*:*:*:*:*:*:*", "matchCriteriaId": "D1DCAD09-8071-4965-88B6-64D83F9FEDB2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.3:*:*:*:*:*:*:*", "matchCriteriaId": "BE1A049E-4B43-4FF8-9AFC-803A85ABF7AA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.4:*:*:*:*:*:*:*", "matchCriteriaId": "6C1515F4-4B33-4A04-8448-A2E4397B1581", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.5:*:*:*:*:*:*:*", "matchCriteriaId": "5215C59F-D763-41F4-9673-77B64481DF16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "667CAF6A-2F8D-498A-9797-CEB2C457F967", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "78812028-9678-48FF-83B4-C6BA0DA5ED95", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "3BC2ABD2-E685-45E4-A423-909DF3C8FABE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.9:*:*:*:*:*:*:*", "matchCriteriaId": "1169885A-59C3-40B8-AC53-625A20A40295", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.10:*:*:*:*:*:*:*", "matchCriteriaId": "B660902B-353C-4917-A607-3DEBB076B130", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.11:*:*:*:*:*:*:*", "matchCriteriaId": "8CE4D650-30B2-461C-BB58-E56112B21E16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.12:*:*:*:*:*:*:*", "matchCriteriaId": "429B0B74-B230-428A-BF7D-FDE45FACBA7E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "62D6ED01-8289-4F93-ADC6-0E5C5E8BD348", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.0:c:*:*:*:*:*:*", "matchCriteriaId": "13ABB028-6997-40DC-B61E-27238BEF99A2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "3746FE6C-CE9F-4267-871D-D585CD404305", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "F725D5E4-E81F-4DB7-AE22-F9A36872CC75", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "29351445-7C64-4409-9B5E-5AEBB96FC4C9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "8516A98B-AE81-48A9-BBBA-9F050FE0AD60", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "7B6F5715-A3D5-4CCC-9645-AFB56E26FD5E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "3FD7D5EB-4C42-4966-ACAA-185DA5ECB72A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "4C65414F-75FC-4C15-8265-F73E9BFAB067", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "16944240-53F2-4F7D-9C29-DF2B0CA5C763", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "ED1A64D2-F06A-490B-8D59-B6F9B83E9152", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.10:*:*:*:*:*:*:*", "matchCriteriaId": "58881236-C96F-461C-BFE0-5880039C1203", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "DC547D0F-E1FB-4C19-A3D0-D3FC48E4EDB1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "99AFBA9B-BFA3-494C-90B9-55F3D18604DF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.2:*:*:*:*:*:*:*", "matchCriteriaId": "066D3983-6BF1-4416-B87E-725122DF82EC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.3:*:*:*:*:*:*:*", "matchCriteriaId": "A9FBEB10-5B34-47F6-85BC-8995CE77AC05", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.4:*:*:*:*:*:*:*", "matchCriteriaId": "869018B3-4286-4D34-B69F-4749A61DC1A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "95919D64-1B0F-4005-BDF8-C390DBA181E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.0:beta1:*:*:*:*:*:*", "matchCriteriaId": "0F8A6E88-C153-440B-AEC6-EBA2BFD3E2E5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.1:*:*:*:*:*:*:*", "matchCriteriaId": "2F8F03AC-BD84-4D2A-B6DC-94BF509C3C67", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.2:*:*:*:*:*:*:*", "matchCriteriaId": "E288DC42-7D2E-404D-85FF-CA02CFD16164", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.3:*:*:*:*:*:*:*", "matchCriteriaId": "9E53C11E-E506-4113-95D8-C526E70A2AAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.4:*:*:*:*:*:*:*", "matchCriteriaId": "D5BC2A4D-D523-4B82-872C-EF2D1F70992D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.5:*:*:*:*:*:*:*", "matchCriteriaId": "33692513-74D9-472C-B3D3-54F06C835832", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.6:*:*:*:*:*:*:*", "matchCriteriaId": "09210851-79D4-49B5-994E-07E40C489D16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.7:*:*:*:*:*:*:*", "matchCriteriaId": "8021F44A-CD23-4D15-9411-20F0E28C7D25", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.8:*:*:*:*:*:*:*", "matchCriteriaId": "A9C5ADAE-E620-4440-8C3D-D071A279FB2E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "A810DF15-CCDF-4D5E-A3A2-4DF852D9CBF4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "8D427209-016F-4115-9447-7F96875A7D86", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.1:*:*:*:*:*:*:*", "matchCriteriaId": "36D5AD56-959D-4990-9B43-170D9083CDF3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "78789F09-77A2-4A86-882D-DEA4E52ED6C9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.3:*:*:*:*:*:*:*", "matchCriteriaId": "0737A57D-411D-4BB5-83FC-15900B0D9150", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.4:*:*:*:*:*:*:*", "matchCriteriaId": "633161B1-1E51-40E9-8EE2-9EDCDDA653D2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.5:*:*:*:*:*:*:*", "matchCriteriaId": "9E2CC4EA-8D08-42D8-A822-78042CD7946D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.6:*:*:*:*:*:*:*", "matchCriteriaId": "91083CF3-8A5C-4178-A91A-BB6DE3C2BAF0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.7:*:*:*:*:*:*:*", "matchCriteriaId": "D9BC8E96-C437-4016-8A22-F402BF6B8E19", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.8:*:*:*:*:*:*:*", "matchCriteriaId": "A9E8AD18-59DF-45BD-AB25-F62CAEC223FE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.9:*:*:*:*:*:*:*", "matchCriteriaId": "D2BDD100-4A8E-4700-9377-22AB1483E76C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.10:*:*:*:*:*:*:*", "matchCriteriaId": "1E580467-9DC2-43CC-8C00-92BCFC4DA49A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.0:*:*:*:*:*:*:*", "matchCriteriaId": "01596D40-6039-4626-AF32-FE4C217EE120", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "ED738A23-EB6C-4BAF-9CDF-209C6EF8E70D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.2:*:*:*:*:*:*:*", "matchCriteriaId": "26315E34-0869-4A18-B9E7-4E3306FAB4B3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.3:*:*:*:*:*:*:*", "matchCriteriaId": "881A7D1C-769C-4B10-9034-E017CD300280", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.0:*:*:*:*:*:*:*", "matchCriteriaId": "B4775539-0309-4FEA-BE79-2D45FE4E0B7C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.1:*:*:*:*:*:*:*", "matchCriteriaId": "7E684118-BCA4-4A8F-A49C-87B06294523F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "D24E0F3B-EA8D-4D67-B16E-244E8954155F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEF8F56B-BEF3-4276-9B38-C8C1A0867B00", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.1:*:*:*:*:*:*:*", "matchCriteriaId": "6A41F7A0-B271-4060-80F2-8E6B2B6051E1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE24079A-61D1-411E-BAA7-6B75251CAAC5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.3:*:*:*:*:*:*:*", "matchCriteriaId": "81EFB16F-267E-417A-AF3E-E20E674FC59D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.4:*:*:*:*:*:*:*", "matchCriteriaId": "7E3C6786-1E84-4906-BE56-938FEC02E7FE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.5:*:*:*:*:*:*:*", "matchCriteriaId": "928F451E-6416-455C-8F3E-56FC918A3AC3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.6:*:*:*:*:*:*:*", "matchCriteriaId": "E3C38ACD-05EB-4EDE-8BDC-CDEA4EDF4C78", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.7:*:*:*:*:*:*:*", "matchCriteriaId": "0148307A-7F03-4B83-BAC5-A090B534DD9B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:*:*:*:*:*:*:*", "matchCriteriaId": "665A2524-FA33-4BF1-B496-160964DB71D1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:rc1:*:*:*:*:*:*", "matchCriteriaId": "5F4373D8-DBC3-4B3C-A911-2EEC94668694", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:rc3:*:*:*:*:*:*", "matchCriteriaId": "50F53821-6B2E-47B5-898A-72BA03DE9889", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.1:*:*:*:*:*:*:*", "matchCriteriaId": "429C418A-A716-4A8D-A8FD-5A895F4BBA11", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "5EE4E79E-5DD5-48D7-8254-14CF61EEAA8E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.9.1:*:*:*:*:*:*:*", "matchCriteriaId": "CF88DD8B-3243-484E-9ED5-BF5C99D69D25", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.0:*:*:*:*:*:*:*", "matchCriteriaId": "9FD6D773-CF96-4E8C-82FC-187116AEE584", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.1:*:*:*:*:*:*:*", "matchCriteriaId": "2FA30686-C9AA-4031-B2F9-C5779B34D8DB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.2:*:*:*:*:*:*:*", "matchCriteriaId": "B8FFF737-4974-43C8-8C2F-475BFB05CA9B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.3:*:*:*:*:*:*:*", "matchCriteriaId": "5BACB549-4C65-4B09-8C0F-ABC662B52016", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.0:*:*:*:*:*:*:*", "matchCriteriaId": "1607963B-FBC3-4A32-A2D8-9ACBAFD97962", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.1:*:*:*:*:*:*:*", "matchCriteriaId": "002E6140-C28B-4CDE-8EFF-90CB4768F4CF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.2:*:*:*:*:*:*:*", "matchCriteriaId": "9C509480-F8E5-4A7D-ADA7-235D5F2C8A94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The Recurly Client Ruby Library before 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4, 2.11.3 is vulnerable to a Server-Side Request Forgery vulnerability in the \"Resource#find\" method that could result in compromise of API keys or other critical resources."}, {"lang": "es", "value": "La biblioteca de Ruby Recurly Client en versiones anteriores a la 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4 y 2.11.3 es vulnerable a Server-Side Request Forgery en el m\u00e9todo \"Resource#find\" que podr\u00eda conllevar el compromiso de las claves API o de otros recursos cr\u00edticos."}], "evaluatorComment": null, "id": "CVE-2017-0905", "lastModified": "2019-10-09T23:21:11.040", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-11-13T17:29:00.427", "references": [{"source": "support@hackerone.com", "tags": ["Vendor Advisory"], "url": "https://dev.recurly.com/page/ruby-updates"}, {"source": "support@hackerone.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/recurly/recurly-client-ruby/commit/1bb0284d6e668b8b3d31167790ed6db1f6ccc4be"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/288635"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-918"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/recurly/recurly-client-ruby/commit/1bb0284d6e668b8b3d31167790ed6db1f6ccc4be"}, "type": "CWE-918"}
355
Determine whether the {function_name} code is vulnerable or not.
[ "module Recurly\n # The API class handles all requests to the Recurly API. While most of its\n # functionality is leveraged by the Resource class, it can be used directly,\n # as well.\n #\n # Requests are made with methods named after the four main HTTP verbs\n # recognized by the Recurly API.\n #\n # @example\n # Recurly::API.get 'accounts' # => #<Net::HTTPOK ...>\n # Recurly::API.post 'accounts', xml_body # => #<Net::HTTPCreated ...>\n # Recurly::API.put 'accounts/1', xml_body # => #<Net::HTTPOK ...>\n # Recurly::API.delete 'accounts/1' # => #<Net::HTTPNoContent ...>\n class API\n require 'recurly/api/errors'", " @@base_uri = \"https://api.recurly.com/v2/\"", " @@valid_domains = [\".recurly.com\"]", "\n RECURLY_API_VERSION = '2.8'", " FORMATS = Helper.hash_with_indifferent_read_access(\n 'pdf' => 'application/pdf',\n 'xml' => 'application/xml'\n )", " class << self\n # Additional HTTP headers sent with each API call\n # @return [Hash{String => String}]\n def headers\n @headers ||= { 'Accept' => accept, 'User-Agent' => user_agent, 'X-Api-Version' => RECURLY_API_VERSION }\n end", " # @return [String, nil] Accept-Language header value\n def accept_language\n headers['Accept-Language']\n end", " # @param [String] language Accept-Language header value\n def accept_language=(language)\n headers['Accept-Language'] = language\n end", " # @return [Net::HTTPOK, Net::HTTPResponse]\n # @raise [ResponseError] With a non-2xx status code.\n def head uri, params = {}, options = {}\n request :head, uri, { :params => params || {} }.merge(options)\n end", " # @return [Net::HTTPOK, Net::HTTPResponse]\n # @raise [ResponseError] With a non-2xx status code.\n def get uri, params = {}, options = {}\n request :get, uri, { :params => params || {} }.merge(options)\n end", " # @return [Net::HTTPCreated, Net::HTTPResponse]\n # @raise [ResponseError] With a non-2xx status code.\n def post uri, body = nil, options = {}\n request :post, uri, { :body => body.to_s }.merge(options)\n end", " # @return [Net::HTTPOK, Net::HTTPResponse]\n # @raise [ResponseError] With a non-2xx status code.\n def put uri, body = nil, options = {}\n request :put, uri, { :body => body.to_s }.merge(options)\n end", " # @return [Net::HTTPNoContent, Net::HTTPResponse]\n # @raise [ResponseError] With a non-2xx status code.\n def delete uri, body = nil, options = {}\n request :delete, uri, options\n end", " # @return [URI::Generic]\n def base_uri\n URI.parse @@base_uri.sub('api', Recurly.subdomain)\n end\n", " def validate_uri!(uri)\n domain = @@valid_domains.detect { |d| uri.host.end_with?(d) }\n unless domain\n raise ArgumentError, \"URI #{uri} is invalid. You may only make requests to a Recurly domain.\"\n end\n end\n", " # @return [String]\n def user_agent\n \"Recurly/#{Version}; #{RUBY_DESCRIPTION}\"\n end", " private", " def accept\n FORMATS['xml']\n end\n alias content_type accept\n end\n end\nend", "require 'recurly/api/net_http_adapter'" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [77, 45, 341], "buggy_code_start_loc": [17, 45, 338], "filenames": ["lib/recurly/api.rb", "lib/recurly/api/net_http_adapter.rb", "lib/recurly/resource.rb"], "fixing_code_end_loc": [86, 47, 340], "fixing_code_start_loc": [18, 46, 337], "message": "The Recurly Client Ruby Library before 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4, 2.11.3 is vulnerable to a Server-Side Request Forgery vulnerability in the \"Resource#find\" method that could result in compromise of API keys or other critical resources.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "D2111C93-1F01-4B79-B731-14E639037521", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "BE0E6539-B427-4F49-8F7D-9D7778E2174B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.2:*:*:*:*:*:*:*", "matchCriteriaId": "D1DCAD09-8071-4965-88B6-64D83F9FEDB2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.3:*:*:*:*:*:*:*", "matchCriteriaId": "BE1A049E-4B43-4FF8-9AFC-803A85ABF7AA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.4:*:*:*:*:*:*:*", "matchCriteriaId": "6C1515F4-4B33-4A04-8448-A2E4397B1581", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.5:*:*:*:*:*:*:*", "matchCriteriaId": "5215C59F-D763-41F4-9673-77B64481DF16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "667CAF6A-2F8D-498A-9797-CEB2C457F967", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "78812028-9678-48FF-83B4-C6BA0DA5ED95", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "3BC2ABD2-E685-45E4-A423-909DF3C8FABE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.9:*:*:*:*:*:*:*", "matchCriteriaId": "1169885A-59C3-40B8-AC53-625A20A40295", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.10:*:*:*:*:*:*:*", "matchCriteriaId": "B660902B-353C-4917-A607-3DEBB076B130", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.11:*:*:*:*:*:*:*", "matchCriteriaId": "8CE4D650-30B2-461C-BB58-E56112B21E16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.12:*:*:*:*:*:*:*", "matchCriteriaId": "429B0B74-B230-428A-BF7D-FDE45FACBA7E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "62D6ED01-8289-4F93-ADC6-0E5C5E8BD348", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.0:c:*:*:*:*:*:*", "matchCriteriaId": "13ABB028-6997-40DC-B61E-27238BEF99A2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "3746FE6C-CE9F-4267-871D-D585CD404305", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "F725D5E4-E81F-4DB7-AE22-F9A36872CC75", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "29351445-7C64-4409-9B5E-5AEBB96FC4C9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "8516A98B-AE81-48A9-BBBA-9F050FE0AD60", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "7B6F5715-A3D5-4CCC-9645-AFB56E26FD5E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "3FD7D5EB-4C42-4966-ACAA-185DA5ECB72A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "4C65414F-75FC-4C15-8265-F73E9BFAB067", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "16944240-53F2-4F7D-9C29-DF2B0CA5C763", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "ED1A64D2-F06A-490B-8D59-B6F9B83E9152", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.10:*:*:*:*:*:*:*", "matchCriteriaId": "58881236-C96F-461C-BFE0-5880039C1203", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "DC547D0F-E1FB-4C19-A3D0-D3FC48E4EDB1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "99AFBA9B-BFA3-494C-90B9-55F3D18604DF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.2:*:*:*:*:*:*:*", "matchCriteriaId": "066D3983-6BF1-4416-B87E-725122DF82EC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.3:*:*:*:*:*:*:*", "matchCriteriaId": "A9FBEB10-5B34-47F6-85BC-8995CE77AC05", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.4:*:*:*:*:*:*:*", "matchCriteriaId": "869018B3-4286-4D34-B69F-4749A61DC1A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "95919D64-1B0F-4005-BDF8-C390DBA181E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.0:beta1:*:*:*:*:*:*", "matchCriteriaId": "0F8A6E88-C153-440B-AEC6-EBA2BFD3E2E5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.1:*:*:*:*:*:*:*", "matchCriteriaId": "2F8F03AC-BD84-4D2A-B6DC-94BF509C3C67", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.2:*:*:*:*:*:*:*", "matchCriteriaId": "E288DC42-7D2E-404D-85FF-CA02CFD16164", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.3:*:*:*:*:*:*:*", "matchCriteriaId": "9E53C11E-E506-4113-95D8-C526E70A2AAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.4:*:*:*:*:*:*:*", "matchCriteriaId": "D5BC2A4D-D523-4B82-872C-EF2D1F70992D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.5:*:*:*:*:*:*:*", "matchCriteriaId": "33692513-74D9-472C-B3D3-54F06C835832", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.6:*:*:*:*:*:*:*", "matchCriteriaId": "09210851-79D4-49B5-994E-07E40C489D16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.7:*:*:*:*:*:*:*", "matchCriteriaId": "8021F44A-CD23-4D15-9411-20F0E28C7D25", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.8:*:*:*:*:*:*:*", "matchCriteriaId": "A9C5ADAE-E620-4440-8C3D-D071A279FB2E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "A810DF15-CCDF-4D5E-A3A2-4DF852D9CBF4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "8D427209-016F-4115-9447-7F96875A7D86", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.1:*:*:*:*:*:*:*", "matchCriteriaId": "36D5AD56-959D-4990-9B43-170D9083CDF3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "78789F09-77A2-4A86-882D-DEA4E52ED6C9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.3:*:*:*:*:*:*:*", "matchCriteriaId": "0737A57D-411D-4BB5-83FC-15900B0D9150", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.4:*:*:*:*:*:*:*", "matchCriteriaId": "633161B1-1E51-40E9-8EE2-9EDCDDA653D2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.5:*:*:*:*:*:*:*", "matchCriteriaId": "9E2CC4EA-8D08-42D8-A822-78042CD7946D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.6:*:*:*:*:*:*:*", "matchCriteriaId": "91083CF3-8A5C-4178-A91A-BB6DE3C2BAF0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.7:*:*:*:*:*:*:*", "matchCriteriaId": "D9BC8E96-C437-4016-8A22-F402BF6B8E19", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.8:*:*:*:*:*:*:*", "matchCriteriaId": "A9E8AD18-59DF-45BD-AB25-F62CAEC223FE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.9:*:*:*:*:*:*:*", "matchCriteriaId": "D2BDD100-4A8E-4700-9377-22AB1483E76C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.10:*:*:*:*:*:*:*", "matchCriteriaId": "1E580467-9DC2-43CC-8C00-92BCFC4DA49A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.0:*:*:*:*:*:*:*", "matchCriteriaId": "01596D40-6039-4626-AF32-FE4C217EE120", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "ED738A23-EB6C-4BAF-9CDF-209C6EF8E70D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.2:*:*:*:*:*:*:*", "matchCriteriaId": "26315E34-0869-4A18-B9E7-4E3306FAB4B3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.3:*:*:*:*:*:*:*", "matchCriteriaId": "881A7D1C-769C-4B10-9034-E017CD300280", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.0:*:*:*:*:*:*:*", "matchCriteriaId": "B4775539-0309-4FEA-BE79-2D45FE4E0B7C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.1:*:*:*:*:*:*:*", "matchCriteriaId": "7E684118-BCA4-4A8F-A49C-87B06294523F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "D24E0F3B-EA8D-4D67-B16E-244E8954155F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEF8F56B-BEF3-4276-9B38-C8C1A0867B00", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.1:*:*:*:*:*:*:*", "matchCriteriaId": "6A41F7A0-B271-4060-80F2-8E6B2B6051E1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE24079A-61D1-411E-BAA7-6B75251CAAC5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.3:*:*:*:*:*:*:*", "matchCriteriaId": "81EFB16F-267E-417A-AF3E-E20E674FC59D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.4:*:*:*:*:*:*:*", "matchCriteriaId": "7E3C6786-1E84-4906-BE56-938FEC02E7FE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.5:*:*:*:*:*:*:*", "matchCriteriaId": "928F451E-6416-455C-8F3E-56FC918A3AC3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.6:*:*:*:*:*:*:*", "matchCriteriaId": "E3C38ACD-05EB-4EDE-8BDC-CDEA4EDF4C78", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.7:*:*:*:*:*:*:*", "matchCriteriaId": "0148307A-7F03-4B83-BAC5-A090B534DD9B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:*:*:*:*:*:*:*", "matchCriteriaId": "665A2524-FA33-4BF1-B496-160964DB71D1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:rc1:*:*:*:*:*:*", "matchCriteriaId": "5F4373D8-DBC3-4B3C-A911-2EEC94668694", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:rc3:*:*:*:*:*:*", "matchCriteriaId": "50F53821-6B2E-47B5-898A-72BA03DE9889", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.1:*:*:*:*:*:*:*", "matchCriteriaId": "429C418A-A716-4A8D-A8FD-5A895F4BBA11", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "5EE4E79E-5DD5-48D7-8254-14CF61EEAA8E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.9.1:*:*:*:*:*:*:*", "matchCriteriaId": "CF88DD8B-3243-484E-9ED5-BF5C99D69D25", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.0:*:*:*:*:*:*:*", "matchCriteriaId": "9FD6D773-CF96-4E8C-82FC-187116AEE584", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.1:*:*:*:*:*:*:*", "matchCriteriaId": "2FA30686-C9AA-4031-B2F9-C5779B34D8DB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.2:*:*:*:*:*:*:*", "matchCriteriaId": "B8FFF737-4974-43C8-8C2F-475BFB05CA9B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.3:*:*:*:*:*:*:*", "matchCriteriaId": "5BACB549-4C65-4B09-8C0F-ABC662B52016", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.0:*:*:*:*:*:*:*", "matchCriteriaId": "1607963B-FBC3-4A32-A2D8-9ACBAFD97962", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.1:*:*:*:*:*:*:*", "matchCriteriaId": "002E6140-C28B-4CDE-8EFF-90CB4768F4CF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.2:*:*:*:*:*:*:*", "matchCriteriaId": "9C509480-F8E5-4A7D-ADA7-235D5F2C8A94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The Recurly Client Ruby Library before 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4, 2.11.3 is vulnerable to a Server-Side Request Forgery vulnerability in the \"Resource#find\" method that could result in compromise of API keys or other critical resources."}, {"lang": "es", "value": "La biblioteca de Ruby Recurly Client en versiones anteriores a la 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4 y 2.11.3 es vulnerable a Server-Side Request Forgery en el m\u00e9todo \"Resource#find\" que podr\u00eda conllevar el compromiso de las claves API o de otros recursos cr\u00edticos."}], "evaluatorComment": null, "id": "CVE-2017-0905", "lastModified": "2019-10-09T23:21:11.040", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-11-13T17:29:00.427", "references": [{"source": "support@hackerone.com", "tags": ["Vendor Advisory"], "url": "https://dev.recurly.com/page/ruby-updates"}, {"source": "support@hackerone.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/recurly/recurly-client-ruby/commit/1bb0284d6e668b8b3d31167790ed6db1f6ccc4be"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/288635"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-918"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/recurly/recurly-client-ruby/commit/1bb0284d6e668b8b3d31167790ed6db1f6ccc4be"}, "type": "CWE-918"}
355
Determine whether the {function_name} code is vulnerable or not.
[ "require 'cgi'\nrequire 'net/https'", "module Recurly\n class API\n module Net\n module HTTPAdapter\n # A hash of Net::HTTP settings configured before the request.\n #\n # @return [Hash]\n def net_http\n @net_http ||= {}\n end", " # Used to store any Net::HTTP settings.\n #\n # @example\n # Recurly::API.net_http = {\n # :verify_mode => OpenSSL::SSL::VERIFY_PEER,\n # :ca_path => \"/etc/ssl/certs\",\n # :ca_file => \"/opt/local/share/curl/curl-ca-bundle.crt\"\n # }\n attr_writer :net_http", " private", " METHODS = {\n :head => ::Net::HTTP::Head,\n :get => ::Net::HTTP::Get,\n :post => ::Net::HTTP::Post,\n :put => ::Net::HTTP::Put,\n :delete => ::Net::HTTP::Delete\n }", " def request method, uri, options = {}\n head = headers.dup\n head.update options[:head] if options[:head]\n head.delete_if { |_, value| value.nil? }\n uri = base_uri + uri\n if options[:params] && !options[:params].empty?\n pairs = options[:params].map { |key, value|\n \"#{CGI.escape key.to_s}=#{CGI.escape value.to_s}\"\n }\n uri += \"?#{pairs.join '&'}\"\n end", "", " request = METHODS[method].new uri.request_uri, head\n request.basic_auth(*[Recurly.api_key, nil].flatten[0, 2])\n if options[:body]\n request['Content-Type'] = content_type\n request.body = options[:body]\n end\n if options[:etag]\n request['If-None-Match'] = options[:etag]\n end\n if options[:format]\n request['Accept'] = FORMATS[options[:format]]\n end\n if options[:locale]\n request['Accept-Language'] = options[:locale]\n end\n http = ::Net::HTTP.new uri.host, uri.port\n http.use_ssl = uri.scheme == 'https'\n net_http.each_pair { |key, value| http.send \"#{key}=\", value }", " if Recurly.logger\n Recurly.log :info, \"===> %s %s\" % [request.method, uri]\n headers = request.to_hash\n headers['authorization'] &&= ['Basic [FILTERED]']\n Recurly.log :debug, headers.inspect\n if request.body && !request.body.empty?\n Recurly.log :debug, XML.filter(request.body)\n end\n start_time = Time.now\n end", " response = http.start { http.request request }\n code = response.code.to_i", " if Recurly.logger\n latency = (Time.now - start_time) * 1_000\n level = case code\n when 200...300 then :info\n when 300...400 then :warn\n when 400...500 then :error\n else :fatal\n end\n Recurly.log level, \"<=== %d %s (%.1fms)\" % [\n code,\n response.class.name[9, response.class.name.length].gsub(\n /([a-z])([A-Z])/, '\\1 \\2'\n ),\n latency\n ]\n Recurly.log :debug, response.to_hash.inspect\n Recurly.log :debug, response.body if response.body\n end", " case code\n when 200...300 then response\n else raise ERRORS[code].new request, response\n end\n rescue Errno::ECONNREFUSED => e\n raise Error, e.message\n end\n end\n end", " extend Net::HTTPAdapter\n end\nend" ]
[ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [77, 45, 341], "buggy_code_start_loc": [17, 45, 338], "filenames": ["lib/recurly/api.rb", "lib/recurly/api/net_http_adapter.rb", "lib/recurly/resource.rb"], "fixing_code_end_loc": [86, 47, 340], "fixing_code_start_loc": [18, 46, 337], "message": "The Recurly Client Ruby Library before 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4, 2.11.3 is vulnerable to a Server-Side Request Forgery vulnerability in the \"Resource#find\" method that could result in compromise of API keys or other critical resources.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "D2111C93-1F01-4B79-B731-14E639037521", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "BE0E6539-B427-4F49-8F7D-9D7778E2174B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.2:*:*:*:*:*:*:*", "matchCriteriaId": "D1DCAD09-8071-4965-88B6-64D83F9FEDB2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.3:*:*:*:*:*:*:*", "matchCriteriaId": "BE1A049E-4B43-4FF8-9AFC-803A85ABF7AA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.4:*:*:*:*:*:*:*", "matchCriteriaId": "6C1515F4-4B33-4A04-8448-A2E4397B1581", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.5:*:*:*:*:*:*:*", "matchCriteriaId": "5215C59F-D763-41F4-9673-77B64481DF16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "667CAF6A-2F8D-498A-9797-CEB2C457F967", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "78812028-9678-48FF-83B4-C6BA0DA5ED95", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "3BC2ABD2-E685-45E4-A423-909DF3C8FABE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.9:*:*:*:*:*:*:*", "matchCriteriaId": "1169885A-59C3-40B8-AC53-625A20A40295", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.10:*:*:*:*:*:*:*", "matchCriteriaId": "B660902B-353C-4917-A607-3DEBB076B130", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.11:*:*:*:*:*:*:*", "matchCriteriaId": "8CE4D650-30B2-461C-BB58-E56112B21E16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.12:*:*:*:*:*:*:*", "matchCriteriaId": "429B0B74-B230-428A-BF7D-FDE45FACBA7E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "62D6ED01-8289-4F93-ADC6-0E5C5E8BD348", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.0:c:*:*:*:*:*:*", "matchCriteriaId": "13ABB028-6997-40DC-B61E-27238BEF99A2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "3746FE6C-CE9F-4267-871D-D585CD404305", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "F725D5E4-E81F-4DB7-AE22-F9A36872CC75", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "29351445-7C64-4409-9B5E-5AEBB96FC4C9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "8516A98B-AE81-48A9-BBBA-9F050FE0AD60", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "7B6F5715-A3D5-4CCC-9645-AFB56E26FD5E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "3FD7D5EB-4C42-4966-ACAA-185DA5ECB72A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "4C65414F-75FC-4C15-8265-F73E9BFAB067", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "16944240-53F2-4F7D-9C29-DF2B0CA5C763", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "ED1A64D2-F06A-490B-8D59-B6F9B83E9152", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.10:*:*:*:*:*:*:*", "matchCriteriaId": "58881236-C96F-461C-BFE0-5880039C1203", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "DC547D0F-E1FB-4C19-A3D0-D3FC48E4EDB1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "99AFBA9B-BFA3-494C-90B9-55F3D18604DF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.2:*:*:*:*:*:*:*", "matchCriteriaId": "066D3983-6BF1-4416-B87E-725122DF82EC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.3:*:*:*:*:*:*:*", "matchCriteriaId": "A9FBEB10-5B34-47F6-85BC-8995CE77AC05", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.4:*:*:*:*:*:*:*", "matchCriteriaId": "869018B3-4286-4D34-B69F-4749A61DC1A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "95919D64-1B0F-4005-BDF8-C390DBA181E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.0:beta1:*:*:*:*:*:*", "matchCriteriaId": "0F8A6E88-C153-440B-AEC6-EBA2BFD3E2E5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.1:*:*:*:*:*:*:*", "matchCriteriaId": "2F8F03AC-BD84-4D2A-B6DC-94BF509C3C67", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.2:*:*:*:*:*:*:*", "matchCriteriaId": "E288DC42-7D2E-404D-85FF-CA02CFD16164", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.3:*:*:*:*:*:*:*", "matchCriteriaId": "9E53C11E-E506-4113-95D8-C526E70A2AAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.4:*:*:*:*:*:*:*", "matchCriteriaId": "D5BC2A4D-D523-4B82-872C-EF2D1F70992D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.5:*:*:*:*:*:*:*", "matchCriteriaId": "33692513-74D9-472C-B3D3-54F06C835832", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.6:*:*:*:*:*:*:*", "matchCriteriaId": "09210851-79D4-49B5-994E-07E40C489D16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.7:*:*:*:*:*:*:*", "matchCriteriaId": "8021F44A-CD23-4D15-9411-20F0E28C7D25", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.8:*:*:*:*:*:*:*", "matchCriteriaId": "A9C5ADAE-E620-4440-8C3D-D071A279FB2E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "A810DF15-CCDF-4D5E-A3A2-4DF852D9CBF4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "8D427209-016F-4115-9447-7F96875A7D86", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.1:*:*:*:*:*:*:*", "matchCriteriaId": "36D5AD56-959D-4990-9B43-170D9083CDF3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "78789F09-77A2-4A86-882D-DEA4E52ED6C9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.3:*:*:*:*:*:*:*", "matchCriteriaId": "0737A57D-411D-4BB5-83FC-15900B0D9150", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.4:*:*:*:*:*:*:*", "matchCriteriaId": "633161B1-1E51-40E9-8EE2-9EDCDDA653D2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.5:*:*:*:*:*:*:*", "matchCriteriaId": "9E2CC4EA-8D08-42D8-A822-78042CD7946D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.6:*:*:*:*:*:*:*", "matchCriteriaId": "91083CF3-8A5C-4178-A91A-BB6DE3C2BAF0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.7:*:*:*:*:*:*:*", "matchCriteriaId": "D9BC8E96-C437-4016-8A22-F402BF6B8E19", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.8:*:*:*:*:*:*:*", "matchCriteriaId": "A9E8AD18-59DF-45BD-AB25-F62CAEC223FE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.9:*:*:*:*:*:*:*", "matchCriteriaId": "D2BDD100-4A8E-4700-9377-22AB1483E76C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.10:*:*:*:*:*:*:*", "matchCriteriaId": "1E580467-9DC2-43CC-8C00-92BCFC4DA49A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.0:*:*:*:*:*:*:*", "matchCriteriaId": "01596D40-6039-4626-AF32-FE4C217EE120", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "ED738A23-EB6C-4BAF-9CDF-209C6EF8E70D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.2:*:*:*:*:*:*:*", "matchCriteriaId": "26315E34-0869-4A18-B9E7-4E3306FAB4B3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.3:*:*:*:*:*:*:*", "matchCriteriaId": "881A7D1C-769C-4B10-9034-E017CD300280", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.0:*:*:*:*:*:*:*", "matchCriteriaId": "B4775539-0309-4FEA-BE79-2D45FE4E0B7C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.1:*:*:*:*:*:*:*", "matchCriteriaId": "7E684118-BCA4-4A8F-A49C-87B06294523F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "D24E0F3B-EA8D-4D67-B16E-244E8954155F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEF8F56B-BEF3-4276-9B38-C8C1A0867B00", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.1:*:*:*:*:*:*:*", "matchCriteriaId": "6A41F7A0-B271-4060-80F2-8E6B2B6051E1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE24079A-61D1-411E-BAA7-6B75251CAAC5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.3:*:*:*:*:*:*:*", "matchCriteriaId": "81EFB16F-267E-417A-AF3E-E20E674FC59D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.4:*:*:*:*:*:*:*", "matchCriteriaId": "7E3C6786-1E84-4906-BE56-938FEC02E7FE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.5:*:*:*:*:*:*:*", "matchCriteriaId": "928F451E-6416-455C-8F3E-56FC918A3AC3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.6:*:*:*:*:*:*:*", "matchCriteriaId": "E3C38ACD-05EB-4EDE-8BDC-CDEA4EDF4C78", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.7:*:*:*:*:*:*:*", "matchCriteriaId": "0148307A-7F03-4B83-BAC5-A090B534DD9B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:*:*:*:*:*:*:*", "matchCriteriaId": "665A2524-FA33-4BF1-B496-160964DB71D1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:rc1:*:*:*:*:*:*", "matchCriteriaId": "5F4373D8-DBC3-4B3C-A911-2EEC94668694", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:rc3:*:*:*:*:*:*", "matchCriteriaId": "50F53821-6B2E-47B5-898A-72BA03DE9889", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.1:*:*:*:*:*:*:*", "matchCriteriaId": "429C418A-A716-4A8D-A8FD-5A895F4BBA11", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "5EE4E79E-5DD5-48D7-8254-14CF61EEAA8E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.9.1:*:*:*:*:*:*:*", "matchCriteriaId": "CF88DD8B-3243-484E-9ED5-BF5C99D69D25", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.0:*:*:*:*:*:*:*", "matchCriteriaId": "9FD6D773-CF96-4E8C-82FC-187116AEE584", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.1:*:*:*:*:*:*:*", "matchCriteriaId": "2FA30686-C9AA-4031-B2F9-C5779B34D8DB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.2:*:*:*:*:*:*:*", "matchCriteriaId": "B8FFF737-4974-43C8-8C2F-475BFB05CA9B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.3:*:*:*:*:*:*:*", "matchCriteriaId": "5BACB549-4C65-4B09-8C0F-ABC662B52016", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.0:*:*:*:*:*:*:*", "matchCriteriaId": "1607963B-FBC3-4A32-A2D8-9ACBAFD97962", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.1:*:*:*:*:*:*:*", "matchCriteriaId": "002E6140-C28B-4CDE-8EFF-90CB4768F4CF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.2:*:*:*:*:*:*:*", "matchCriteriaId": "9C509480-F8E5-4A7D-ADA7-235D5F2C8A94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The Recurly Client Ruby Library before 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4, 2.11.3 is vulnerable to a Server-Side Request Forgery vulnerability in the \"Resource#find\" method that could result in compromise of API keys or other critical resources."}, {"lang": "es", "value": "La biblioteca de Ruby Recurly Client en versiones anteriores a la 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4 y 2.11.3 es vulnerable a Server-Side Request Forgery en el m\u00e9todo \"Resource#find\" que podr\u00eda conllevar el compromiso de las claves API o de otros recursos cr\u00edticos."}], "evaluatorComment": null, "id": "CVE-2017-0905", "lastModified": "2019-10-09T23:21:11.040", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-11-13T17:29:00.427", "references": [{"source": "support@hackerone.com", "tags": ["Vendor Advisory"], "url": "https://dev.recurly.com/page/ruby-updates"}, {"source": "support@hackerone.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/recurly/recurly-client-ruby/commit/1bb0284d6e668b8b3d31167790ed6db1f6ccc4be"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/288635"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-918"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/recurly/recurly-client-ruby/commit/1bb0284d6e668b8b3d31167790ed6db1f6ccc4be"}, "type": "CWE-918"}
355
Determine whether the {function_name} code is vulnerable or not.
[ "require 'cgi'\nrequire 'net/https'", "module Recurly\n class API\n module Net\n module HTTPAdapter\n # A hash of Net::HTTP settings configured before the request.\n #\n # @return [Hash]\n def net_http\n @net_http ||= {}\n end", " # Used to store any Net::HTTP settings.\n #\n # @example\n # Recurly::API.net_http = {\n # :verify_mode => OpenSSL::SSL::VERIFY_PEER,\n # :ca_path => \"/etc/ssl/certs\",\n # :ca_file => \"/opt/local/share/curl/curl-ca-bundle.crt\"\n # }\n attr_writer :net_http", " private", " METHODS = {\n :head => ::Net::HTTP::Head,\n :get => ::Net::HTTP::Get,\n :post => ::Net::HTTP::Post,\n :put => ::Net::HTTP::Put,\n :delete => ::Net::HTTP::Delete\n }", " def request method, uri, options = {}\n head = headers.dup\n head.update options[:head] if options[:head]\n head.delete_if { |_, value| value.nil? }\n uri = base_uri + uri\n if options[:params] && !options[:params].empty?\n pairs = options[:params].map { |key, value|\n \"#{CGI.escape key.to_s}=#{CGI.escape value.to_s}\"\n }\n uri += \"?#{pairs.join '&'}\"\n end", " self.validate_uri!(uri)", " request = METHODS[method].new uri.request_uri, head\n request.basic_auth(*[Recurly.api_key, nil].flatten[0, 2])\n if options[:body]\n request['Content-Type'] = content_type\n request.body = options[:body]\n end\n if options[:etag]\n request['If-None-Match'] = options[:etag]\n end\n if options[:format]\n request['Accept'] = FORMATS[options[:format]]\n end\n if options[:locale]\n request['Accept-Language'] = options[:locale]\n end\n http = ::Net::HTTP.new uri.host, uri.port\n http.use_ssl = uri.scheme == 'https'\n net_http.each_pair { |key, value| http.send \"#{key}=\", value }", " if Recurly.logger\n Recurly.log :info, \"===> %s %s\" % [request.method, uri]\n headers = request.to_hash\n headers['authorization'] &&= ['Basic [FILTERED]']\n Recurly.log :debug, headers.inspect\n if request.body && !request.body.empty?\n Recurly.log :debug, XML.filter(request.body)\n end\n start_time = Time.now\n end", " response = http.start { http.request request }\n code = response.code.to_i", " if Recurly.logger\n latency = (Time.now - start_time) * 1_000\n level = case code\n when 200...300 then :info\n when 300...400 then :warn\n when 400...500 then :error\n else :fatal\n end\n Recurly.log level, \"<=== %d %s (%.1fms)\" % [\n code,\n response.class.name[9, response.class.name.length].gsub(\n /([a-z])([A-Z])/, '\\1 \\2'\n ),\n latency\n ]\n Recurly.log :debug, response.to_hash.inspect\n Recurly.log :debug, response.body if response.body\n end", " case code\n when 200...300 then response\n else raise ERRORS[code].new request, response\n end\n rescue Errno::ECONNREFUSED => e\n raise Error, e.message\n end\n end\n end", " extend Net::HTTPAdapter\n end\nend" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [77, 45, 341], "buggy_code_start_loc": [17, 45, 338], "filenames": ["lib/recurly/api.rb", "lib/recurly/api/net_http_adapter.rb", "lib/recurly/resource.rb"], "fixing_code_end_loc": [86, 47, 340], "fixing_code_start_loc": [18, 46, 337], "message": "The Recurly Client Ruby Library before 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4, 2.11.3 is vulnerable to a Server-Side Request Forgery vulnerability in the \"Resource#find\" method that could result in compromise of API keys or other critical resources.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "D2111C93-1F01-4B79-B731-14E639037521", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "BE0E6539-B427-4F49-8F7D-9D7778E2174B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.2:*:*:*:*:*:*:*", "matchCriteriaId": "D1DCAD09-8071-4965-88B6-64D83F9FEDB2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.3:*:*:*:*:*:*:*", "matchCriteriaId": "BE1A049E-4B43-4FF8-9AFC-803A85ABF7AA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.4:*:*:*:*:*:*:*", "matchCriteriaId": "6C1515F4-4B33-4A04-8448-A2E4397B1581", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.5:*:*:*:*:*:*:*", "matchCriteriaId": "5215C59F-D763-41F4-9673-77B64481DF16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "667CAF6A-2F8D-498A-9797-CEB2C457F967", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "78812028-9678-48FF-83B4-C6BA0DA5ED95", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "3BC2ABD2-E685-45E4-A423-909DF3C8FABE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.9:*:*:*:*:*:*:*", "matchCriteriaId": "1169885A-59C3-40B8-AC53-625A20A40295", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.10:*:*:*:*:*:*:*", "matchCriteriaId": "B660902B-353C-4917-A607-3DEBB076B130", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.11:*:*:*:*:*:*:*", "matchCriteriaId": "8CE4D650-30B2-461C-BB58-E56112B21E16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.12:*:*:*:*:*:*:*", "matchCriteriaId": "429B0B74-B230-428A-BF7D-FDE45FACBA7E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "62D6ED01-8289-4F93-ADC6-0E5C5E8BD348", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.0:c:*:*:*:*:*:*", "matchCriteriaId": "13ABB028-6997-40DC-B61E-27238BEF99A2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "3746FE6C-CE9F-4267-871D-D585CD404305", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "F725D5E4-E81F-4DB7-AE22-F9A36872CC75", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "29351445-7C64-4409-9B5E-5AEBB96FC4C9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "8516A98B-AE81-48A9-BBBA-9F050FE0AD60", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "7B6F5715-A3D5-4CCC-9645-AFB56E26FD5E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "3FD7D5EB-4C42-4966-ACAA-185DA5ECB72A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "4C65414F-75FC-4C15-8265-F73E9BFAB067", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "16944240-53F2-4F7D-9C29-DF2B0CA5C763", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "ED1A64D2-F06A-490B-8D59-B6F9B83E9152", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.10:*:*:*:*:*:*:*", "matchCriteriaId": "58881236-C96F-461C-BFE0-5880039C1203", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "DC547D0F-E1FB-4C19-A3D0-D3FC48E4EDB1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "99AFBA9B-BFA3-494C-90B9-55F3D18604DF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.2:*:*:*:*:*:*:*", "matchCriteriaId": "066D3983-6BF1-4416-B87E-725122DF82EC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.3:*:*:*:*:*:*:*", "matchCriteriaId": "A9FBEB10-5B34-47F6-85BC-8995CE77AC05", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.4:*:*:*:*:*:*:*", "matchCriteriaId": "869018B3-4286-4D34-B69F-4749A61DC1A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "95919D64-1B0F-4005-BDF8-C390DBA181E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.0:beta1:*:*:*:*:*:*", "matchCriteriaId": "0F8A6E88-C153-440B-AEC6-EBA2BFD3E2E5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.1:*:*:*:*:*:*:*", "matchCriteriaId": "2F8F03AC-BD84-4D2A-B6DC-94BF509C3C67", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.2:*:*:*:*:*:*:*", "matchCriteriaId": "E288DC42-7D2E-404D-85FF-CA02CFD16164", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.3:*:*:*:*:*:*:*", "matchCriteriaId": "9E53C11E-E506-4113-95D8-C526E70A2AAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.4:*:*:*:*:*:*:*", "matchCriteriaId": "D5BC2A4D-D523-4B82-872C-EF2D1F70992D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.5:*:*:*:*:*:*:*", "matchCriteriaId": "33692513-74D9-472C-B3D3-54F06C835832", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.6:*:*:*:*:*:*:*", "matchCriteriaId": "09210851-79D4-49B5-994E-07E40C489D16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.7:*:*:*:*:*:*:*", "matchCriteriaId": "8021F44A-CD23-4D15-9411-20F0E28C7D25", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.8:*:*:*:*:*:*:*", "matchCriteriaId": "A9C5ADAE-E620-4440-8C3D-D071A279FB2E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "A810DF15-CCDF-4D5E-A3A2-4DF852D9CBF4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "8D427209-016F-4115-9447-7F96875A7D86", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.1:*:*:*:*:*:*:*", "matchCriteriaId": "36D5AD56-959D-4990-9B43-170D9083CDF3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "78789F09-77A2-4A86-882D-DEA4E52ED6C9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.3:*:*:*:*:*:*:*", "matchCriteriaId": "0737A57D-411D-4BB5-83FC-15900B0D9150", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.4:*:*:*:*:*:*:*", "matchCriteriaId": "633161B1-1E51-40E9-8EE2-9EDCDDA653D2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.5:*:*:*:*:*:*:*", "matchCriteriaId": "9E2CC4EA-8D08-42D8-A822-78042CD7946D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.6:*:*:*:*:*:*:*", "matchCriteriaId": "91083CF3-8A5C-4178-A91A-BB6DE3C2BAF0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.7:*:*:*:*:*:*:*", "matchCriteriaId": "D9BC8E96-C437-4016-8A22-F402BF6B8E19", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.8:*:*:*:*:*:*:*", "matchCriteriaId": "A9E8AD18-59DF-45BD-AB25-F62CAEC223FE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.9:*:*:*:*:*:*:*", "matchCriteriaId": "D2BDD100-4A8E-4700-9377-22AB1483E76C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.10:*:*:*:*:*:*:*", "matchCriteriaId": "1E580467-9DC2-43CC-8C00-92BCFC4DA49A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.0:*:*:*:*:*:*:*", "matchCriteriaId": "01596D40-6039-4626-AF32-FE4C217EE120", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "ED738A23-EB6C-4BAF-9CDF-209C6EF8E70D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.2:*:*:*:*:*:*:*", "matchCriteriaId": "26315E34-0869-4A18-B9E7-4E3306FAB4B3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.3:*:*:*:*:*:*:*", "matchCriteriaId": "881A7D1C-769C-4B10-9034-E017CD300280", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.0:*:*:*:*:*:*:*", "matchCriteriaId": "B4775539-0309-4FEA-BE79-2D45FE4E0B7C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.1:*:*:*:*:*:*:*", "matchCriteriaId": "7E684118-BCA4-4A8F-A49C-87B06294523F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "D24E0F3B-EA8D-4D67-B16E-244E8954155F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEF8F56B-BEF3-4276-9B38-C8C1A0867B00", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.1:*:*:*:*:*:*:*", "matchCriteriaId": "6A41F7A0-B271-4060-80F2-8E6B2B6051E1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE24079A-61D1-411E-BAA7-6B75251CAAC5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.3:*:*:*:*:*:*:*", "matchCriteriaId": "81EFB16F-267E-417A-AF3E-E20E674FC59D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.4:*:*:*:*:*:*:*", "matchCriteriaId": "7E3C6786-1E84-4906-BE56-938FEC02E7FE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.5:*:*:*:*:*:*:*", "matchCriteriaId": "928F451E-6416-455C-8F3E-56FC918A3AC3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.6:*:*:*:*:*:*:*", "matchCriteriaId": "E3C38ACD-05EB-4EDE-8BDC-CDEA4EDF4C78", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.7:*:*:*:*:*:*:*", "matchCriteriaId": "0148307A-7F03-4B83-BAC5-A090B534DD9B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:*:*:*:*:*:*:*", "matchCriteriaId": "665A2524-FA33-4BF1-B496-160964DB71D1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:rc1:*:*:*:*:*:*", "matchCriteriaId": "5F4373D8-DBC3-4B3C-A911-2EEC94668694", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:rc3:*:*:*:*:*:*", "matchCriteriaId": "50F53821-6B2E-47B5-898A-72BA03DE9889", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.1:*:*:*:*:*:*:*", "matchCriteriaId": "429C418A-A716-4A8D-A8FD-5A895F4BBA11", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "5EE4E79E-5DD5-48D7-8254-14CF61EEAA8E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.9.1:*:*:*:*:*:*:*", "matchCriteriaId": "CF88DD8B-3243-484E-9ED5-BF5C99D69D25", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.0:*:*:*:*:*:*:*", "matchCriteriaId": "9FD6D773-CF96-4E8C-82FC-187116AEE584", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.1:*:*:*:*:*:*:*", "matchCriteriaId": "2FA30686-C9AA-4031-B2F9-C5779B34D8DB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.2:*:*:*:*:*:*:*", "matchCriteriaId": "B8FFF737-4974-43C8-8C2F-475BFB05CA9B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.3:*:*:*:*:*:*:*", "matchCriteriaId": "5BACB549-4C65-4B09-8C0F-ABC662B52016", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.0:*:*:*:*:*:*:*", "matchCriteriaId": "1607963B-FBC3-4A32-A2D8-9ACBAFD97962", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.1:*:*:*:*:*:*:*", "matchCriteriaId": "002E6140-C28B-4CDE-8EFF-90CB4768F4CF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.2:*:*:*:*:*:*:*", "matchCriteriaId": "9C509480-F8E5-4A7D-ADA7-235D5F2C8A94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The Recurly Client Ruby Library before 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4, 2.11.3 is vulnerable to a Server-Side Request Forgery vulnerability in the \"Resource#find\" method that could result in compromise of API keys or other critical resources."}, {"lang": "es", "value": "La biblioteca de Ruby Recurly Client en versiones anteriores a la 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4 y 2.11.3 es vulnerable a Server-Side Request Forgery en el m\u00e9todo \"Resource#find\" que podr\u00eda conllevar el compromiso de las claves API o de otros recursos cr\u00edticos."}], "evaluatorComment": null, "id": "CVE-2017-0905", "lastModified": "2019-10-09T23:21:11.040", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-11-13T17:29:00.427", "references": [{"source": "support@hackerone.com", "tags": ["Vendor Advisory"], "url": "https://dev.recurly.com/page/ruby-updates"}, {"source": "support@hackerone.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/recurly/recurly-client-ruby/commit/1bb0284d6e668b8b3d31167790ed6db1f6ccc4be"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/288635"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-918"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/recurly/recurly-client-ruby/commit/1bb0284d6e668b8b3d31167790ed6db1f6ccc4be"}, "type": "CWE-918"}
355
Determine whether the {function_name} code is vulnerable or not.
[ "require 'date'\nrequire 'erb'", "module Recurly\n # The base class for all Recurly resources (e.g. {Account}, {Subscription},\n # {Transaction}).\n #\n # Resources behave much like\n # {ActiveModel}[http://rubydoc.info/gems/activemodel] classes, especially\n # like {ActiveRecord}[http://rubydoc.info/gems/activerecord].\n #\n # == Life Cycle\n #\n # To take you through the typical life cycle of a resource, we'll use\n # {Recurly::Account} as an example.\n #\n # === Creating a Record\n #\n # You can instantiate a record before attempting to save it.\n #\n # account = Recurly::Account.new :first_name => 'Walter'\n #\n # Once instantiated, you can assign and reassign any attribute.\n #\n # account.first_name = 'Walt'\n # account.last_name = 'White'\n #\n # When you're ready to save, do so.\n #\n # account.save # => false\n #\n # If save returns +false+, validation likely failed. You can check the record\n # for errors.\n #\n # account.errors # => {\"account_code\"=>[\"can't be blank\"]}\n #\n # Once the errors are fixed, you can try again.\n #\n # account.account_code = 'heisenberg'\n # account.save # => true\n #\n # The object will be updated with any information provided by the server\n # (including any UUIDs set).\n #\n # account.created_at # => 2011-04-30 07:13:35 -0700\n #\n # You can also create accounts in one fell swoop.\n #\n # Recurly::Account.create(\n # :first_name => 'Jesse'\n # :last_name => 'Pinkman'\n # :account_code => 'capn_cook'\n # )\n # # => #<Recurly::Account account_code: \"capn_cook\" ...>\n #\n # You can use alternative \"bang\" methods for exception control. If the record\n # fails to save, a Recurly::Resource::Invalid exception will be raised.\n #\n # begin\n # account = Recurly::Account.new :first_name => 'Junior'\n # account.save!\n # rescue Recurly::Resource::Invalid\n # p account.errors\n # end\n #\n # You can access the invalid record from the exception itself (if, for\n # example, you use the <tt>create!</tt> method).\n #\n # begin\n # Recurly::Account.create! :first_name => 'Skylar', :last_name => 'White'\n # rescue Recurly::Resource::Invalid => e\n # p e.record.errors\n # end\n #\n # === Fetching a Record\n #\n # Records are fetched by their unique identifiers.\n #\n # account = Recurly::Account.find 'better_call_saul'\n # # => #<Recurly::Account account_code: \"better_call_saul\" ...>\n #\n # If the record doesn't exist, a Recurly::Resource::NotFound exception will\n # be raised.\n #\n # === Updating a Record\n #\n # Once fetched, a record can be updated with a hash of attributes.\n #\n # account.update_attributes :first_name => 'Saul', :last_name => 'Goodman'\n # # => true\n #\n # (A bang method, update_attributes!, will raise Recurly::Resource::Invalid.)\n #\n # You can also update a record by setting attributes and calling save.\n #\n # account.last_name = 'McGill'\n # account.save # Alternatively, call save!\n #\n # === Deleting a Record\n #\n # To delete (deactivate, close, etc.) a fetched record, merely call destroy\n # on it.\n #\n # account.destroy # => true\n #\n # === Fetching a List of Records\n #\n # If you want to iterate over a list of accounts, you can use a Pager.\n #\n # pager = Account.paginate :per_page => 50\n #\n # If you want to iterate over _every_ record, a convenience method will\n # automatically paginate:\n #\n # Account.find_each { |account| p account }\n class Resource\n require 'recurly/resource/errors'\n require 'recurly/resource/pager'\n require 'recurly/resource/association'", " # Raised when a record cannot be found.\n #\n # @example\n # begin\n # Recurly::Account.find 'tortuga'\n # rescue Recurly::Resource::NotFound => e\n # e.message # => \"Can't find Account with account_code = tortuga\"\n # end\n class NotFound < API::NotFound\n def initialize(message)\n set_message message\n end\n end", " # Raised when a record is invalid.\n #\n # @example\n # begin\n # Recurly::Account.create! :first_name => \"Flynn\"\n # rescue Recurly::Resource::Invalid => e\n # e.record.errors # => errors: {\"account_code\"=>[\"can't be blank\"]}>\n # end\n class Invalid < Error\n # @return [Resource, nil] The invalid record.\n attr_reader :record", " def initialize(message)\n if message.is_a? Resource\n @record = message\n set_message(record_to_message)\n else\n set_message(message)\n end\n end", " private", " def record_to_message\n @record.errors.map do |k, v|\n message = v.join(', ')\n k == 'base' ? message : \"#{k} #{message}\"\n end.join('; ')\n end\n end", " class << self\n # @return [String] The demodulized name of the resource class.\n # @example\n # Recurly::Account.name # => \"Account\"\n def resource_name\n Helper.demodulize name\n end", " # @return [String] The underscored, pluralized name of the resource\n # class.\n # @example\n # Recurly::Account.collection_name # => \"accounts\"\n def collection_name\n Helper.pluralize Helper.underscore(resource_name)\n end\n alias collection_path collection_name", " # @return [String] The underscored name of the resource class.\n # @example\n # Recurly::Account.member_name # => \"account\"\n def member_name\n Helper.underscore resource_name\n end", " # @return [String] The relative path to a resource's identifier from the\n # API's base URI.\n # @param uuid [String, nil]\n # @example\n # Recurly::Account.member_path \"code\" # => \"accounts/code\"\n # Recurly::Account.member_path nil # => \"accounts\"\n def member_path(uuid)\n uuid = ERB::Util.url_encode(uuid) if uuid\n [collection_path, uuid].compact.join '/'\n end", " # @return [Array] Per attribute, defines readers, writers, boolean and\n # change-tracking methods.\n # @param attribute_names [Array] An array of attribute names.\n # @example\n # class Account < Resource\n # define_attribute_methods [:name]\n # end\n #\n # a = Account.new\n # a.name? # => false\n # a.name # => nil\n # a.name = \"Stephen\"\n # a.name? # => true\n # a.name # => \"Stephen\"\n # a.name_changed? # => true\n # a.name_was # => nil\n # a.name_change # => [nil, \"Stephen\"]\n def define_attribute_methods(attribute_names)\n @attribute_names = attribute_names.map! { |m| m.to_s }.sort!.freeze\n remove_const :AttributeMethods if constants.include? :AttributeMethods\n include const_set :AttributeMethods, Module.new {\n attribute_names.each do |name|\n define_method(name) { self[name] } # Get.\n define_method(\"#{name}=\") { |value| self[name] = value } # Set.\n define_method(\"#{name}?\") { !!self[name] } # Present.\n define_method(\"#{name}_change\") { changes[name] } # Dirt...\n define_method(\"#{name}_changed?\") { changed_attributes.key? name }\n define_method(\"#{name}_was\") { changed_attributes[name] }\n define_method(\"#{name}_previously_changed?\") {\n previous_changes.key? name\n }\n define_method(\"#{name}_previously_was\") {\n previous_changes[name].first if previous_changes.key? name\n }\n end\n }\n end", " # @return [Array, nil] The list of attribute names defined for the\n # resource class.\n attr_reader :attribute_names", " # @return [Pager] A pager with an iterable collection of records\n # @param options [Hash] A hash of pagination options\n # @option options [Integer] :per_page The number of records returned per\n # page\n # @option options [DateTime, Time, Integer] :cursor A timestamp that the\n # pager will skim back to and return records created before it\n # @option options [String] :etag When set, will raise\n # {Recurly::API::NotModified} if the pager's loaded page content has\n # not changed\n # @example Fetch 50 records and iterate over them\n # Recurly::Account.paginate(:per_page => 50).each { |a| p a }\n # @example Fetch records before January 1, 2011\n # Recurly::Account.paginate(:cursor => Time.new(2011, 1, 1))\n def paginate(options = {})\n Pager.new self, options\n end\n alias scoped paginate\n alias where paginate", " def all(options = {})\n paginate(options).to_a\n end", " # @return [Hash] Defined scopes per resource.\n def scopes\n @scopes ||= Recurly::Helper.hash_with_indifferent_read_access\n end", " # @return [Module] Module of scopes methods.\n def scopes_helper\n @scopes_helper ||= Module.new.tap { |helper| extend helper }\n end", " # Defines a new resource scope.\n #\n # @return [Proc]\n # @param [Symbol] name the scope name\n # @param [Hash] params the scope params\n def scope(name, params = {})\n scopes[name = name.to_s] = params\n scopes_helper.send(:define_method, name) { paginate scopes[name] }\n end", " # Iterates through every record by automatically paging.\n #\n # @return [nil]\n # @param [Integer] per_page The number of records returned per request.\n # @yield [record]\n # @see Pager#find_each\n # @example\n # Recurly::Account.find_each { |a| p a }\n def find_each(per_page = 50, &block)\n paginate(:per_page => per_page).find_each(&block)\n end", " # @return [Integer] The total record count of the resource in question.\n # @see Pager#count\n # @example\n # Recurly::Account.count # => 42\n def count\n paginate.count\n end", " # @api internal\n # @return [Resource, nil]\n def first\n paginate(:per_page => 1).first\n end", " # @return [Resource] A record matching the designated unique identifier.\n # @param [String] uuid The unique identifier of the resource to be\n # retrieved.\n # @param [Hash] options A hash of options.\n # @option options [String] :etag When set, will raise {API::NotModified}\n # if the record content has not changed.\n # @raise [Error] If the resource has no identifier (and thus cannot be\n # retrieved).\n # @raise [NotFound] If no resource can be found for the supplied\n # identifier (or the supplied identifier is +nil+).\n # @raise [API::NotModified] If the <tt>:etag</tt> option is set and\n # matches the server's.\n # @example\n # Recurly::Account.find \"heisenberg\"\n # # => #<Recurly::Account account_code: \"heisenberg\", ...>\n # Use the following identifiers for these types of objects:\n # for accounts use account_code\n # for plans use plan_code\n # for invoices use invoice_number\n # for subscriptions use uuid\n # for transactions use uuid\n def find(uuid, options = {})\n if uuid.nil? || uuid.to_s.empty?\n raise NotFound, \"can't find a record with nil identifier\"\n end\n", " uri = uuid =~ /^http/ ? uuid : member_path(uuid)", " begin", " from_response API.get(uri, {}, options)", " rescue API::NotFound => e\n raise NotFound, e.description\n end\n end", " # Instantiates and attempts to save a record.\n #\n # @return [Resource] The record.\n # @raise [Transaction::Error] A monetary transaction failed.\n # @see create!\n def create(attributes = {})\n new(attributes) { |record| record.save }\n end", " # Instantiates and attempts to save a record.\n #\n # @return [Resource] The saved record.\n # @raise [Invalid] The record is invalid.\n # @raise [Transaction::Error] A monetary transaction failed.\n # @see create\n def create!(attributes = {})\n new(attributes) { |record| record.save! }\n end", " # Instantiates a record from an HTTP response, setting the record's\n # response attribute in the process.\n #\n # @return [Resource]\n # @param response [Net::HTTPResponse]\n def from_response(response)\n content_type = response['Content-Type']", " case content_type\n when %r{application/pdf}\n response.body\n when %r{application/xml}\n record = from_xml response.body\n record.instance_eval { @etag, @response = response['ETag'], response }\n record\n else\n raise Recurly::Error, \"Content-Type \\\"#{content_type}\\\" is not accepted\"\n end\n end", " # Instantiates a record from an XML blob: either a String or XML element.\n #\n # Assuming the record is from an API response, the record is flagged as\n # persisted.\n #\n # @return [Resource]\n # @param xml [String, REXML::Element, Nokogiri::XML::Node]\n # @see from_response\n def from_xml(xml)\n xml = XML.new xml", " if self != Resource || xml.name == member_name\n record = new\n elsif Recurly.const_defined?(class_name = Helper.classify(xml.name), false)\n klass = Recurly.const_get class_name, false\n record = klass.send :new\n elsif root = xml.root and root.elements.empty?\n return XML.cast root\n else\n record = {}\n end\n klass ||= self", " xml.root.attributes.each do |name, value|\n record.instance_variable_set \"@#{name}\", value.to_s\n end", " xml.each_element do |el|\n # skip this element if it's an xml comment\n next if defined?(Nokogiri::XML::Node::TEXT_NODE) && el.is_a?(Nokogiri::XML::Comment)", " if el.name == 'a'\n record.links[el.attribute('name').value] = {\n :method => el.attribute('method').to_s,\n :href => el.attribute('href').value\n }\n next\n end", " # Nokogiri on Jruby-1.7.19 likes to throw NullPointer exceptions\n # if you try to run certian operations like el.attribute(''). Since\n # we dont care about text nodes, let's just skip them\n next if defined?(Nokogiri::XML::Node::TEXT_NODE) && el.node_type == Nokogiri::XML::Node::TEXT_NODE", " if el.children.empty? && href = el.attribute('href')\n klass_name = Helper.classify(klass.association_class_name(el.name) ||\n el.attribute('type') ||\n el.name)", " next unless Recurly.const_defined?(klass_name)", " resource_class = Recurly.const_get(klass_name, false)", " case el.name\n when *klass.associations_for_relation(:has_many)\n record[el.name] = Pager.new(\n resource_class, :uri => href.value, :parent => record\n )\n when *(klass.associations_for_relation(:has_one) + klass.associations_for_relation(:belongs_to))\n record.links[el.name] = {\n :resource_class => resource_class,\n :method => :get,\n :href => href.value\n }\n end\n else\n # TODO name tax_type conflicts with the TaxType\n # class so if we get to this point was can assume\n # it's the string. Will need to refactor this\n if el.name == 'tax_type'\n record[el.name] = el.text\n else\n val = XML.cast(el)", " # TODO we have to clear changed attributes after\n # parsing here or else it always serializes. Need\n # a better way of handling changed attributes\n if el.name == 'address' && val.kind_of?(Hash)\n address = Address.new(val)\n address.instance_variable_set(:@changed_attributes, {})\n record[el.name] = address\n else\n record[el.name] = val\n end\n end\n end\n end", " record.persist! if record.respond_to? :persist!\n record\n end", " # @return [Array] A list of associations for the current class.\n def associations\n @associations ||= []\n end", " # @return [Array] A list of associated resource classes with\n # the relation [:has_many, :has_one, :belongs_to] for the current class.\n def associations_for_relation(relation)\n associations.select{ |a| a.relation == relation }.map(&:resource_class)\n end", " # @return [String, nil] The actual associated resource class name\n # for the current class if the resource class does not match the\n # actual class.\n def association_class_name(resource_class)\n association = find_association(resource_class)\n association.class_name if association\n end", " # @return [Association, nil] Find association for the current class\n # with resource class name.\n def find_association(resource_class)\n associations.find{ |a| a.resource_class.to_s == resource_class.to_s }\n end", " def associations_helper\n @associations_helper ||= Module.new.tap { |helper| include helper }\n end", " # Establishes a has_many association.\n #\n # @return [Proc, nil]\n # @param collection_name [Symbol] Association name.\n # @param options [Hash] A hash of association options.\n # @option options [true, false] :readonly Don't define a setter.\n # [String] :class_name Actual associated resource class name\n # if not same as collection_name.\n def has_many(collection_name, options = {})\n associations << Association.new(:has_many, collection_name.to_s, options)\n associations_helper.module_eval do\n define_method collection_name do\n if self[collection_name]\n self[collection_name]\n else\n attributes[collection_name] = []\n end\n end\n if options.key?(:readonly) && options[:readonly] == false\n define_method \"#{collection_name}=\" do |collection|\n self[collection_name] = collection\n end\n end\n end\n end", " # Establishes a has_one association.\n #\n # @return [Proc, nil]\n # @param member_name [Symbol] Association name.\n # @param options [Hash] A hash of association options.\n # @option options [true, false] :readonly Don't define a setter.\n # [String] :class_name Actual associated resource class name\n # if not same as member_name.\n def has_one(member_name, options = {})\n associations << Association.new(:has_one, member_name.to_s, options)\n associations_helper.module_eval do\n define_method(member_name) { self[member_name] }\n if options.key?(:readonly) && options[:readonly] == false\n associated = Recurly.const_get Helper.classify(member_name), false\n define_method \"#{member_name}=\" do |member|\n associated_uri = \"#{path}/#{member_name}\"\n self[member_name] = case member\n when Hash\n associated.send :new, member.merge(:uri => associated_uri)\n when associated\n member.uri = associated_uri and member\n else\n raise ArgumentError, \"expected #{associated}\"\n end\n end\n define_method \"build_#{member_name}\" do |*args|\n attributes = args.shift || {}\n self[member_name] = associated.send(\n :new, attributes.merge(:uri => \"#{path}/#{member_name}\")\n ).tap { |child| child.attributes[self.class.member_name] = self }\n end\n define_method \"create_#{member_name}\" do |*args|\n send(\"build_#{member_name}\", *args).tap { |child| child.save }\n end\n end\n end\n end", " # Establishes a belongs_to association.\n #\n # @return [Proc]\n # @param parent_name [Symbol] Association name.\n # @param options [Hash] A hash of association options.\n # @option options [true, false] :readonly Don't define a setter.\n # [String] :class_name Actual associated resource class name\n # if not same as parent_name.\n def belongs_to(parent_name, options = {})\n associations << Association.new(:belongs_to, parent_name.to_s, options)\n associations_helper.module_eval do\n define_method(parent_name) { self[parent_name] }\n if options.key?(:readonly) && options[:readonly] == false\n define_method \"#{parent_name}=\" do |parent|\n self[parent_name] = parent\n end\n end\n end\n end", " # @return [:has_many, :has_one, :belongs_to, nil] An association type.\n def reflect_on_association(name)\n a = find_association(name)\n a.relation if a\n end", " def embedded!(root_index = false)\n protected :initialize\n private_class_method(*%w(create create!))\n unless root_index\n private_class_method(*%w(all find_each first paginate scoped where))\n end\n end\n end", " # @return [Hash] The raw hash of record attributes.\n attr_reader :attributes", " # @return [Net::HTTPResponse, nil] The most recent response object for the\n # record (updated during {#save} and {#destroy}).\n attr_reader :response", " # @return [String, nil] An ETag for the current record.\n attr_reader :etag", " # @return [String, nil] A writer to override the URI the record saves to.\n attr_writer :uri", " # @return [Resource] A new resource instance.\n # @param attributes [Hash] A hash of attributes.\n def initialize(attributes = {})\n if instance_of? Resource\n raise Error,\n \"#{self.class} is an abstract class and cannot be instantiated\"\n end", " @attributes, @new_record, @destroyed, @uri, @href = {}, true, false\n self.attributes = attributes\n yield self if block_given?\n end", " # @return [self] Reloads the record from the server.\n def reload(response = nil)\n if response\n return if response.body.to_s.length.zero?\n fresh = self.class.from_response response\n else\n fresh = self.class.find(\n @href || to_param, :etag => (etag unless changed?)\n )\n end\n fresh and copy_from fresh\n persist! true\n self\n rescue API::NotModified\n self\n end", " # @return [Hash] Hash of changed attributes.\n # @see #changes\n def changed_attributes\n @changed_attributes ||= {}\n end", " # @return [Array] A list of changed attribute keys.\n def changed\n changed_attributes.keys\n end", " # Do any attributes have unsaved changes?\n # @return [true, false]\n def changed?\n !changed_attributes.empty?\n end", " # @return [Hash] Map of changed attributes to original value and new value.\n def changes\n changed_attributes.inject({}) { |changes, (key, original_value)|\n changes[key] = [original_value, self[key]] and changes\n }\n end", " # @return [Hash] Previously-changed attributes.\n # @see #changes\n def previous_changes\n @previous_changes ||= {}\n end", " # Is the record new (i.e., not saved on Recurly's servers)?\n #\n # @return [true, false]\n # @see #persisted?\n # @see #destroyed?\n def new_record?\n @new_record\n end", " # Has the record been destroyed? (Set +true+ after a successful destroy.)\n # @return [true, false]\n # @see #new_record?\n # @see #persisted?\n def destroyed?\n @destroyed\n end", " # Has the record persisted (i.e., saved on Recurly's servers)?\n #\n # @return [true, false]\n # @see #new_record?\n # @see #destroyed?\n def persisted?\n !(new_record? || destroyed?)\n end", " # The value of a specified attribute, lazily fetching any defined\n # association.\n #\n # @param key [Symbol, String] The name of the attribute to be fetched.\n # @example\n # account.read_attribute :first_name # => \"Ted\"\n # account[:last_name] # => \"Beneke\"\n # @see #write_attribute\n def read_attribute(key)\n key = key.to_s\n if attributes.key? key\n value = attributes[key]\n elsif links.key?(key) && self.class.reflect_on_association(key)\n value = attributes[key] = follow_link key\n end\n value\n end\n alias [] read_attribute", " # Sets the value of a specified attribute.\n #\n # @param key [Symbol, String] The name of the attribute to be set.\n # @param value [Object] The value the attribute will be set to.\n # @example\n # account.write_attribute :first_name, 'Gus'\n # account[:company_name] = 'Los Pollos Hermanos'\n # @see #read_attribute\n def write_attribute(key, value)\n if changed_attributes.key?(key = key.to_s)\n changed_attributes.delete key if changed_attributes[key] == value\n elsif self[key] != value\n changed_attributes[key] = self[key]\n end", " association = self.class.find_association(key)\n if association\n value = fetch_associated(key, value)\n # FIXME: More explicit; less magic.\n elsif value && key.end_with?('_in_cents') && !respond_to?(:currency)\n value = Money.new(value, self, key) unless value.is_a?(Money)\n end", " attributes[key] = value\n end\n alias []= write_attribute", " # Apply a given hash of attributes to a record.\n #\n # @return [Hash]\n # @param attributes [Hash] A hash of attributes.\n def attributes=(attributes = {})\n attributes.each_pair { |k, v|\n respond_to?(name = \"#{k}=\") and send(name, v) or self[k] = v\n }\n end", " def as_json(options = nil)\n attributes.reject { |k, v| v.is_a?(Recurly::Resource::Pager) }\n end", " # @return [Hash] The raw hash of record href links.\n def links\n @links ||= {}\n end", " # Whether a record has a link with the given name.\n #\n # @param key [Symbol, String] The name of the link to check for.\n # @example\n # account.link? :billing_info # => true\n def link?(key)\n links.key?(key.to_s)\n end", " # Fetch the value of a link by following the associated href.\n #\n # @param key [Symbol, String] The name of the link to be followed.\n # @param options [Hash] A hash of API options.\n # @example\n # account.read_link :billing_info # => <Recurly::BillingInfo>\n def follow_link(key, options = {})\n if link = links[key = key.to_s]\n response = API.send link[:method], link[:href], options[:body], options\n if resource_class = link[:resource_class]\n response = resource_class.from_response response\n response.attributes[self.class.member_name] = self\n end\n response\n end\n rescue Recurly::API::NotFound\n raise unless resource_class\n end", " # Serializes the record to XML.\n #\n # @return [String] An XML string.\n # @param options [Hash] A hash of XML options.\n # @example\n # Recurly::Account.new(:account_code => 'code').to_xml\n # # => \"<account><account_code>code</account_code></account>\"\n def to_xml(options = {})\n builder = options[:builder] || XML.new(\"<#{self.class.member_name}/>\")\n xml_keys.each { |key|\n value = respond_to?(key) ? send(key) : self[key]\n node = builder.add_element key", " # Duck-typing here is problematic because of ActiveSupport's #to_xml.\n case value\n when Resource, Subscription::AddOns\n value.to_xml options.merge(:builder => node)\n when Array\n value.each do |e|\n if e.is_a? Recurly::Resource\n # create a node to hold this resource\n e_node = node.add_element Helper.singularize(key)\n # serialize the resource into this node\n e.to_xml(options.merge(builder: e_node))\n else\n # it's just a primitive value\n node.add_element(Helper.singularize(key), e)\n end\n end\n when Hash, Recurly::Money\n value.each_pair { |k, v| node.add_element k.to_s, v }\n else\n node.text = value\n end\n }\n builder.to_s\n end", " # Attempts to save the record, returning the success of the request.\n #\n # @return [true, false]\n # @raise [Transaction::Error] A monetary transaction failed.\n # @example\n # account = Recurly::Account.new\n # account.save # => false\n # account.account_code = 'account_code'\n # account.save # => true\n # @see #save!\n def save\n if new_record? || changed?\n clear_errors\n @response = API.send(\n persisted? ? :put : :post, path, to_xml\n )\n reload response\n persist! true\n end\n true\n rescue API::UnprocessableEntity => e\n apply_errors e\n Transaction::Error.validate! e, (self if is_a?(Transaction))\n false\n end", " # Attempts to save the record, returning +true+ if the record was saved and\n # raising {Invalid} otherwise.\n #\n # @return [true]\n # @raise [Invalid] The record was invalid.\n # @raise [Transaction::Error] A monetary transaction failed.\n # @example\n # account = Recurly::Account.new\n # account.save! # raises Recurly::Resource::Invalid\n # account.account_code = 'account_code'\n # account.save! # => true\n # @see #save\n def save!\n save || raise(Invalid.new(self))\n end", " # @return [true, false, nil] The validity of the record: +true+ if the\n # record was successfully saved (or persisted and unchanged), +false+ if\n # the record was not successfully saved, or +nil+ for a record with an\n # unknown state (i.e. (i.e. new records that haven't been saved and\n # persisted records with changed attributes).\n # @example\n # account = Recurly::Account.new\n # account.valid? # => nil\n # account.save # => false\n # account.valid? # => false\n # account.account_code = 'account_code'\n # account.save # => true\n # account.valid? # => true\n def valid?\n return true if persisted? && !changed?\n errors_empty = errors.values.flatten.empty?\n return if errors_empty && changed?\n errors_empty\n end", " # Update a record with a given hash of attributes.\n #\n # @return [true, false] The success of the update.\n # @param attributes [Hash] A hash of attributes.\n # @raise [Transaction::Error] A monetary transaction failed.\n # @example\n # account = Account.find 'junior'\n # account.update_attributes :account_code => 'flynn' # => true\n # @see #update_attributes!\n def update_attributes(attributes = {})\n self.attributes = attributes and save\n end", " # Update a record with a given hash of attributes.\n #\n # @return [true] The update was successful.\n # @param attributes [Hash] A hash of attributes.\n # @raise [Invalid] The record was invalid.\n # @raise [Transaction::Error] A monetary transaction failed.\n # @example\n # account = Account.find 'gale_boetticher'\n # account.update_attributes! :account_code => nil # Raises an exception.\n # @see #update_attributes\n def update_attributes!(attributes = {})\n self.attributes = attributes and save!\n end", " # @return [Hash] A hash with indifferent read access containing any\n # validation errors where the key is the attribute name and the value is\n # an array of error messages.\n # @example\n # account.errors # => {\"account_code\"=>[\"can't be blank\"]}\n # account.errors[:account_code] # => [\"can't be blank\"]\n def errors\n @errors ||= Errors.new { |h, k| h[k] = [] }\n end", " # Marks a record as persisted, i.e. not a new or deleted record, resetting\n # any tracked attribute changes in the process. (This is an internal method\n # and should probably not be called unless you know what you're doing.)\n #\n # @api internal\n # @return [true]\n def persist!(saved = false)\n @new_record, @uri = false\n if changed?\n @previous_changes = changes if saved\n changed_attributes.clear\n end\n true\n end", " # @return [String, nil] The unique resource identifier (URI) of the record\n # (if persisted).\n # @example\n # Recurly::Account.new(:account_code => \"account_code\").uri # => nil\n # Recurly::Account.find(\"account_code\").uri\n # # => \"https://api.recurly.com/v2/accounts/account_code\"\n def uri\n @href ||= ((API.base_uri + path).to_s if persisted?)\n end", " # Attempts to destroy the record.\n #\n # @return [true, false] +true+ if successful, +false+ if unable to destroy\n # (if the record does not persist on Recurly).\n # @raise [NotFound] The record cannot be found.\n # @example\n # account = Recurly::Account.find account_code\n # race_condition = Recurly::Account.find account_code\n # account.destroy # => true\n # account.destroy # => false (already destroyed)\n # race_condition.destroy # raises Recurly::Resource::NotFound\n def destroy\n return false unless persisted?\n @response = API.delete uri\n @destroyed = true\n rescue API::NotFound => e\n raise NotFound, e.description\n end", " def signable_attributes\n Hash[xml_keys.map { |key| [key, self[key]] }]\n end", " def ==(other)\n other.is_a?(self.class) && other.to_s == to_s\n end", " def marshal_dump\n [\n @attributes.reject { |k, v| v.is_a?(Proc) },\n @new_record,\n @destroyed,\n @uri,\n @href,\n changed_attributes,\n previous_changes,\n response,\n etag,\n links\n ]\n end", " def marshal_load(serialization)\n @attributes,\n @new_record,\n @destroyed,\n @uri,\n @href,\n @changed_attributes,\n @previous_changes,\n @response,\n @etag,\n @links = serialization\n end", " # @return [String]\n def inspect(attributes = self.class.attribute_names.to_a)\n string = \"#<#{self.class}\"\n string << \"##@type\" if instance_variable_defined? :@type\n attributes += %w(errors) if errors.any?\n string << \" %s\" % attributes.map { |k|\n \"#{k}: #{self.send(k).inspect}\"\n }.join(', ')\n string << '>'\n end\n alias to_s inspect", " def apply_errors(exception)\n @response = exception.response\n document = XML.new exception.response.body\n document.each_element 'error' do |el|\n attribute_path = el.attribute('field').value.split '.'\n invalid! attribute_path[1, attribute_path.length], el.text\n end\n end", " protected", " def path\n @href or @uri or if persisted?\n self.class.member_path to_param\n else\n self.class.collection_path\n end\n end", " def invalid!(attribute_path, error)\n if attribute_path.length == 1\n errors[attribute_path[0]] << error\n else\n child, k, v = attribute_path.shift.scan(/[^\\[\\]=]+/)\n if c = k ? self[child].find { |d| d[k] == v } : self[child]\n c.invalid! attribute_path, error\n e = errors[child] << 'is invalid' and e.uniq!\n end\n end\n end", " def clear_errors\n errors.clear\n self.class.associations do |association|\n next unless respond_to? \"#{association}=\" # Clear writable only.\n [*self[association]].each do |associated|\n associated.clear_errors if associated.respond_to? :clear_errors\n end\n end\n end", " def copy_from(other)\n other.instance_variables.each do |ivar|\n instance_variable_set ivar, other.instance_variable_get(ivar)\n end\n end", " private", " def fetch_associated(name, value, options = {})\n case value\n when Array\n value.map do |v|\n fetch_associated(Helper.singularize(name), v, association_name: name)\n end\n when Hash\n association_name = options[:association_name] || name\n associated_class_name = self.class.find_association(association_name).class_name\n associated_class_name ||= Helper.classify(name)\n Recurly.const_get(associated_class_name, false).send(:new, value)\n when Proc, Resource, Resource::Pager, nil\n value\n else\n raise \"unexpected association #{name.inspect}=#{value.inspect}\"\n end\n end", " def xml_keys\n changed_attributes.keys.sort\n end\n end\nend" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [77, 45, 341], "buggy_code_start_loc": [17, 45, 338], "filenames": ["lib/recurly/api.rb", "lib/recurly/api/net_http_adapter.rb", "lib/recurly/resource.rb"], "fixing_code_end_loc": [86, 47, 340], "fixing_code_start_loc": [18, 46, 337], "message": "The Recurly Client Ruby Library before 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4, 2.11.3 is vulnerable to a Server-Side Request Forgery vulnerability in the \"Resource#find\" method that could result in compromise of API keys or other critical resources.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "D2111C93-1F01-4B79-B731-14E639037521", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "BE0E6539-B427-4F49-8F7D-9D7778E2174B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.2:*:*:*:*:*:*:*", "matchCriteriaId": "D1DCAD09-8071-4965-88B6-64D83F9FEDB2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.3:*:*:*:*:*:*:*", "matchCriteriaId": "BE1A049E-4B43-4FF8-9AFC-803A85ABF7AA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.4:*:*:*:*:*:*:*", "matchCriteriaId": "6C1515F4-4B33-4A04-8448-A2E4397B1581", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.5:*:*:*:*:*:*:*", "matchCriteriaId": "5215C59F-D763-41F4-9673-77B64481DF16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "667CAF6A-2F8D-498A-9797-CEB2C457F967", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "78812028-9678-48FF-83B4-C6BA0DA5ED95", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "3BC2ABD2-E685-45E4-A423-909DF3C8FABE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.9:*:*:*:*:*:*:*", "matchCriteriaId": "1169885A-59C3-40B8-AC53-625A20A40295", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.10:*:*:*:*:*:*:*", "matchCriteriaId": "B660902B-353C-4917-A607-3DEBB076B130", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.11:*:*:*:*:*:*:*", "matchCriteriaId": "8CE4D650-30B2-461C-BB58-E56112B21E16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.12:*:*:*:*:*:*:*", "matchCriteriaId": "429B0B74-B230-428A-BF7D-FDE45FACBA7E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "62D6ED01-8289-4F93-ADC6-0E5C5E8BD348", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.0:c:*:*:*:*:*:*", "matchCriteriaId": "13ABB028-6997-40DC-B61E-27238BEF99A2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "3746FE6C-CE9F-4267-871D-D585CD404305", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "F725D5E4-E81F-4DB7-AE22-F9A36872CC75", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "29351445-7C64-4409-9B5E-5AEBB96FC4C9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "8516A98B-AE81-48A9-BBBA-9F050FE0AD60", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "7B6F5715-A3D5-4CCC-9645-AFB56E26FD5E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "3FD7D5EB-4C42-4966-ACAA-185DA5ECB72A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "4C65414F-75FC-4C15-8265-F73E9BFAB067", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "16944240-53F2-4F7D-9C29-DF2B0CA5C763", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "ED1A64D2-F06A-490B-8D59-B6F9B83E9152", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.10:*:*:*:*:*:*:*", "matchCriteriaId": "58881236-C96F-461C-BFE0-5880039C1203", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "DC547D0F-E1FB-4C19-A3D0-D3FC48E4EDB1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "99AFBA9B-BFA3-494C-90B9-55F3D18604DF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.2:*:*:*:*:*:*:*", "matchCriteriaId": "066D3983-6BF1-4416-B87E-725122DF82EC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.3:*:*:*:*:*:*:*", "matchCriteriaId": "A9FBEB10-5B34-47F6-85BC-8995CE77AC05", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.4:*:*:*:*:*:*:*", "matchCriteriaId": "869018B3-4286-4D34-B69F-4749A61DC1A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "95919D64-1B0F-4005-BDF8-C390DBA181E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.0:beta1:*:*:*:*:*:*", "matchCriteriaId": "0F8A6E88-C153-440B-AEC6-EBA2BFD3E2E5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.1:*:*:*:*:*:*:*", "matchCriteriaId": "2F8F03AC-BD84-4D2A-B6DC-94BF509C3C67", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.2:*:*:*:*:*:*:*", "matchCriteriaId": "E288DC42-7D2E-404D-85FF-CA02CFD16164", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.3:*:*:*:*:*:*:*", "matchCriteriaId": "9E53C11E-E506-4113-95D8-C526E70A2AAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.4:*:*:*:*:*:*:*", "matchCriteriaId": "D5BC2A4D-D523-4B82-872C-EF2D1F70992D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.5:*:*:*:*:*:*:*", "matchCriteriaId": "33692513-74D9-472C-B3D3-54F06C835832", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.6:*:*:*:*:*:*:*", "matchCriteriaId": "09210851-79D4-49B5-994E-07E40C489D16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.7:*:*:*:*:*:*:*", "matchCriteriaId": "8021F44A-CD23-4D15-9411-20F0E28C7D25", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.8:*:*:*:*:*:*:*", "matchCriteriaId": "A9C5ADAE-E620-4440-8C3D-D071A279FB2E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "A810DF15-CCDF-4D5E-A3A2-4DF852D9CBF4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "8D427209-016F-4115-9447-7F96875A7D86", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.1:*:*:*:*:*:*:*", "matchCriteriaId": "36D5AD56-959D-4990-9B43-170D9083CDF3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "78789F09-77A2-4A86-882D-DEA4E52ED6C9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.3:*:*:*:*:*:*:*", "matchCriteriaId": "0737A57D-411D-4BB5-83FC-15900B0D9150", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.4:*:*:*:*:*:*:*", "matchCriteriaId": "633161B1-1E51-40E9-8EE2-9EDCDDA653D2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.5:*:*:*:*:*:*:*", "matchCriteriaId": "9E2CC4EA-8D08-42D8-A822-78042CD7946D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.6:*:*:*:*:*:*:*", "matchCriteriaId": "91083CF3-8A5C-4178-A91A-BB6DE3C2BAF0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.7:*:*:*:*:*:*:*", "matchCriteriaId": "D9BC8E96-C437-4016-8A22-F402BF6B8E19", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.8:*:*:*:*:*:*:*", "matchCriteriaId": "A9E8AD18-59DF-45BD-AB25-F62CAEC223FE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.9:*:*:*:*:*:*:*", "matchCriteriaId": "D2BDD100-4A8E-4700-9377-22AB1483E76C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.10:*:*:*:*:*:*:*", "matchCriteriaId": "1E580467-9DC2-43CC-8C00-92BCFC4DA49A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.0:*:*:*:*:*:*:*", "matchCriteriaId": "01596D40-6039-4626-AF32-FE4C217EE120", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "ED738A23-EB6C-4BAF-9CDF-209C6EF8E70D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.2:*:*:*:*:*:*:*", "matchCriteriaId": "26315E34-0869-4A18-B9E7-4E3306FAB4B3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.3:*:*:*:*:*:*:*", "matchCriteriaId": "881A7D1C-769C-4B10-9034-E017CD300280", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.0:*:*:*:*:*:*:*", "matchCriteriaId": "B4775539-0309-4FEA-BE79-2D45FE4E0B7C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.1:*:*:*:*:*:*:*", "matchCriteriaId": "7E684118-BCA4-4A8F-A49C-87B06294523F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "D24E0F3B-EA8D-4D67-B16E-244E8954155F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEF8F56B-BEF3-4276-9B38-C8C1A0867B00", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.1:*:*:*:*:*:*:*", "matchCriteriaId": "6A41F7A0-B271-4060-80F2-8E6B2B6051E1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE24079A-61D1-411E-BAA7-6B75251CAAC5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.3:*:*:*:*:*:*:*", "matchCriteriaId": "81EFB16F-267E-417A-AF3E-E20E674FC59D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.4:*:*:*:*:*:*:*", "matchCriteriaId": "7E3C6786-1E84-4906-BE56-938FEC02E7FE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.5:*:*:*:*:*:*:*", "matchCriteriaId": "928F451E-6416-455C-8F3E-56FC918A3AC3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.6:*:*:*:*:*:*:*", "matchCriteriaId": "E3C38ACD-05EB-4EDE-8BDC-CDEA4EDF4C78", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.7:*:*:*:*:*:*:*", "matchCriteriaId": "0148307A-7F03-4B83-BAC5-A090B534DD9B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:*:*:*:*:*:*:*", "matchCriteriaId": "665A2524-FA33-4BF1-B496-160964DB71D1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:rc1:*:*:*:*:*:*", "matchCriteriaId": "5F4373D8-DBC3-4B3C-A911-2EEC94668694", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:rc3:*:*:*:*:*:*", "matchCriteriaId": "50F53821-6B2E-47B5-898A-72BA03DE9889", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.1:*:*:*:*:*:*:*", "matchCriteriaId": "429C418A-A716-4A8D-A8FD-5A895F4BBA11", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "5EE4E79E-5DD5-48D7-8254-14CF61EEAA8E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.9.1:*:*:*:*:*:*:*", "matchCriteriaId": "CF88DD8B-3243-484E-9ED5-BF5C99D69D25", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.0:*:*:*:*:*:*:*", "matchCriteriaId": "9FD6D773-CF96-4E8C-82FC-187116AEE584", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.1:*:*:*:*:*:*:*", "matchCriteriaId": "2FA30686-C9AA-4031-B2F9-C5779B34D8DB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.2:*:*:*:*:*:*:*", "matchCriteriaId": "B8FFF737-4974-43C8-8C2F-475BFB05CA9B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.3:*:*:*:*:*:*:*", "matchCriteriaId": "5BACB549-4C65-4B09-8C0F-ABC662B52016", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.0:*:*:*:*:*:*:*", "matchCriteriaId": "1607963B-FBC3-4A32-A2D8-9ACBAFD97962", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.1:*:*:*:*:*:*:*", "matchCriteriaId": "002E6140-C28B-4CDE-8EFF-90CB4768F4CF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.2:*:*:*:*:*:*:*", "matchCriteriaId": "9C509480-F8E5-4A7D-ADA7-235D5F2C8A94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The Recurly Client Ruby Library before 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4, 2.11.3 is vulnerable to a Server-Side Request Forgery vulnerability in the \"Resource#find\" method that could result in compromise of API keys or other critical resources."}, {"lang": "es", "value": "La biblioteca de Ruby Recurly Client en versiones anteriores a la 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4 y 2.11.3 es vulnerable a Server-Side Request Forgery en el m\u00e9todo \"Resource#find\" que podr\u00eda conllevar el compromiso de las claves API o de otros recursos cr\u00edticos."}], "evaluatorComment": null, "id": "CVE-2017-0905", "lastModified": "2019-10-09T23:21:11.040", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-11-13T17:29:00.427", "references": [{"source": "support@hackerone.com", "tags": ["Vendor Advisory"], "url": "https://dev.recurly.com/page/ruby-updates"}, {"source": "support@hackerone.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/recurly/recurly-client-ruby/commit/1bb0284d6e668b8b3d31167790ed6db1f6ccc4be"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/288635"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-918"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/recurly/recurly-client-ruby/commit/1bb0284d6e668b8b3d31167790ed6db1f6ccc4be"}, "type": "CWE-918"}
355
Determine whether the {function_name} code is vulnerable or not.
[ "require 'date'\nrequire 'erb'", "module Recurly\n # The base class for all Recurly resources (e.g. {Account}, {Subscription},\n # {Transaction}).\n #\n # Resources behave much like\n # {ActiveModel}[http://rubydoc.info/gems/activemodel] classes, especially\n # like {ActiveRecord}[http://rubydoc.info/gems/activerecord].\n #\n # == Life Cycle\n #\n # To take you through the typical life cycle of a resource, we'll use\n # {Recurly::Account} as an example.\n #\n # === Creating a Record\n #\n # You can instantiate a record before attempting to save it.\n #\n # account = Recurly::Account.new :first_name => 'Walter'\n #\n # Once instantiated, you can assign and reassign any attribute.\n #\n # account.first_name = 'Walt'\n # account.last_name = 'White'\n #\n # When you're ready to save, do so.\n #\n # account.save # => false\n #\n # If save returns +false+, validation likely failed. You can check the record\n # for errors.\n #\n # account.errors # => {\"account_code\"=>[\"can't be blank\"]}\n #\n # Once the errors are fixed, you can try again.\n #\n # account.account_code = 'heisenberg'\n # account.save # => true\n #\n # The object will be updated with any information provided by the server\n # (including any UUIDs set).\n #\n # account.created_at # => 2011-04-30 07:13:35 -0700\n #\n # You can also create accounts in one fell swoop.\n #\n # Recurly::Account.create(\n # :first_name => 'Jesse'\n # :last_name => 'Pinkman'\n # :account_code => 'capn_cook'\n # )\n # # => #<Recurly::Account account_code: \"capn_cook\" ...>\n #\n # You can use alternative \"bang\" methods for exception control. If the record\n # fails to save, a Recurly::Resource::Invalid exception will be raised.\n #\n # begin\n # account = Recurly::Account.new :first_name => 'Junior'\n # account.save!\n # rescue Recurly::Resource::Invalid\n # p account.errors\n # end\n #\n # You can access the invalid record from the exception itself (if, for\n # example, you use the <tt>create!</tt> method).\n #\n # begin\n # Recurly::Account.create! :first_name => 'Skylar', :last_name => 'White'\n # rescue Recurly::Resource::Invalid => e\n # p e.record.errors\n # end\n #\n # === Fetching a Record\n #\n # Records are fetched by their unique identifiers.\n #\n # account = Recurly::Account.find 'better_call_saul'\n # # => #<Recurly::Account account_code: \"better_call_saul\" ...>\n #\n # If the record doesn't exist, a Recurly::Resource::NotFound exception will\n # be raised.\n #\n # === Updating a Record\n #\n # Once fetched, a record can be updated with a hash of attributes.\n #\n # account.update_attributes :first_name => 'Saul', :last_name => 'Goodman'\n # # => true\n #\n # (A bang method, update_attributes!, will raise Recurly::Resource::Invalid.)\n #\n # You can also update a record by setting attributes and calling save.\n #\n # account.last_name = 'McGill'\n # account.save # Alternatively, call save!\n #\n # === Deleting a Record\n #\n # To delete (deactivate, close, etc.) a fetched record, merely call destroy\n # on it.\n #\n # account.destroy # => true\n #\n # === Fetching a List of Records\n #\n # If you want to iterate over a list of accounts, you can use a Pager.\n #\n # pager = Account.paginate :per_page => 50\n #\n # If you want to iterate over _every_ record, a convenience method will\n # automatically paginate:\n #\n # Account.find_each { |account| p account }\n class Resource\n require 'recurly/resource/errors'\n require 'recurly/resource/pager'\n require 'recurly/resource/association'", " # Raised when a record cannot be found.\n #\n # @example\n # begin\n # Recurly::Account.find 'tortuga'\n # rescue Recurly::Resource::NotFound => e\n # e.message # => \"Can't find Account with account_code = tortuga\"\n # end\n class NotFound < API::NotFound\n def initialize(message)\n set_message message\n end\n end", " # Raised when a record is invalid.\n #\n # @example\n # begin\n # Recurly::Account.create! :first_name => \"Flynn\"\n # rescue Recurly::Resource::Invalid => e\n # e.record.errors # => errors: {\"account_code\"=>[\"can't be blank\"]}>\n # end\n class Invalid < Error\n # @return [Resource, nil] The invalid record.\n attr_reader :record", " def initialize(message)\n if message.is_a? Resource\n @record = message\n set_message(record_to_message)\n else\n set_message(message)\n end\n end", " private", " def record_to_message\n @record.errors.map do |k, v|\n message = v.join(', ')\n k == 'base' ? message : \"#{k} #{message}\"\n end.join('; ')\n end\n end", " class << self\n # @return [String] The demodulized name of the resource class.\n # @example\n # Recurly::Account.name # => \"Account\"\n def resource_name\n Helper.demodulize name\n end", " # @return [String] The underscored, pluralized name of the resource\n # class.\n # @example\n # Recurly::Account.collection_name # => \"accounts\"\n def collection_name\n Helper.pluralize Helper.underscore(resource_name)\n end\n alias collection_path collection_name", " # @return [String] The underscored name of the resource class.\n # @example\n # Recurly::Account.member_name # => \"account\"\n def member_name\n Helper.underscore resource_name\n end", " # @return [String] The relative path to a resource's identifier from the\n # API's base URI.\n # @param uuid [String, nil]\n # @example\n # Recurly::Account.member_path \"code\" # => \"accounts/code\"\n # Recurly::Account.member_path nil # => \"accounts\"\n def member_path(uuid)\n uuid = ERB::Util.url_encode(uuid) if uuid\n [collection_path, uuid].compact.join '/'\n end", " # @return [Array] Per attribute, defines readers, writers, boolean and\n # change-tracking methods.\n # @param attribute_names [Array] An array of attribute names.\n # @example\n # class Account < Resource\n # define_attribute_methods [:name]\n # end\n #\n # a = Account.new\n # a.name? # => false\n # a.name # => nil\n # a.name = \"Stephen\"\n # a.name? # => true\n # a.name # => \"Stephen\"\n # a.name_changed? # => true\n # a.name_was # => nil\n # a.name_change # => [nil, \"Stephen\"]\n def define_attribute_methods(attribute_names)\n @attribute_names = attribute_names.map! { |m| m.to_s }.sort!.freeze\n remove_const :AttributeMethods if constants.include? :AttributeMethods\n include const_set :AttributeMethods, Module.new {\n attribute_names.each do |name|\n define_method(name) { self[name] } # Get.\n define_method(\"#{name}=\") { |value| self[name] = value } # Set.\n define_method(\"#{name}?\") { !!self[name] } # Present.\n define_method(\"#{name}_change\") { changes[name] } # Dirt...\n define_method(\"#{name}_changed?\") { changed_attributes.key? name }\n define_method(\"#{name}_was\") { changed_attributes[name] }\n define_method(\"#{name}_previously_changed?\") {\n previous_changes.key? name\n }\n define_method(\"#{name}_previously_was\") {\n previous_changes[name].first if previous_changes.key? name\n }\n end\n }\n end", " # @return [Array, nil] The list of attribute names defined for the\n # resource class.\n attr_reader :attribute_names", " # @return [Pager] A pager with an iterable collection of records\n # @param options [Hash] A hash of pagination options\n # @option options [Integer] :per_page The number of records returned per\n # page\n # @option options [DateTime, Time, Integer] :cursor A timestamp that the\n # pager will skim back to and return records created before it\n # @option options [String] :etag When set, will raise\n # {Recurly::API::NotModified} if the pager's loaded page content has\n # not changed\n # @example Fetch 50 records and iterate over them\n # Recurly::Account.paginate(:per_page => 50).each { |a| p a }\n # @example Fetch records before January 1, 2011\n # Recurly::Account.paginate(:cursor => Time.new(2011, 1, 1))\n def paginate(options = {})\n Pager.new self, options\n end\n alias scoped paginate\n alias where paginate", " def all(options = {})\n paginate(options).to_a\n end", " # @return [Hash] Defined scopes per resource.\n def scopes\n @scopes ||= Recurly::Helper.hash_with_indifferent_read_access\n end", " # @return [Module] Module of scopes methods.\n def scopes_helper\n @scopes_helper ||= Module.new.tap { |helper| extend helper }\n end", " # Defines a new resource scope.\n #\n # @return [Proc]\n # @param [Symbol] name the scope name\n # @param [Hash] params the scope params\n def scope(name, params = {})\n scopes[name = name.to_s] = params\n scopes_helper.send(:define_method, name) { paginate scopes[name] }\n end", " # Iterates through every record by automatically paging.\n #\n # @return [nil]\n # @param [Integer] per_page The number of records returned per request.\n # @yield [record]\n # @see Pager#find_each\n # @example\n # Recurly::Account.find_each { |a| p a }\n def find_each(per_page = 50, &block)\n paginate(:per_page => per_page).find_each(&block)\n end", " # @return [Integer] The total record count of the resource in question.\n # @see Pager#count\n # @example\n # Recurly::Account.count # => 42\n def count\n paginate.count\n end", " # @api internal\n # @return [Resource, nil]\n def first\n paginate(:per_page => 1).first\n end", " # @return [Resource] A record matching the designated unique identifier.\n # @param [String] uuid The unique identifier of the resource to be\n # retrieved.\n # @param [Hash] options A hash of options.\n # @option options [String] :etag When set, will raise {API::NotModified}\n # if the record content has not changed.\n # @raise [Error] If the resource has no identifier (and thus cannot be\n # retrieved).\n # @raise [NotFound] If no resource can be found for the supplied\n # identifier (or the supplied identifier is +nil+).\n # @raise [API::NotModified] If the <tt>:etag</tt> option is set and\n # matches the server's.\n # @example\n # Recurly::Account.find \"heisenberg\"\n # # => #<Recurly::Account account_code: \"heisenberg\", ...>\n # Use the following identifiers for these types of objects:\n # for accounts use account_code\n # for plans use plan_code\n # for invoices use invoice_number\n # for subscriptions use uuid\n # for transactions use uuid\n def find(uuid, options = {})\n if uuid.nil? || uuid.to_s.empty?\n raise NotFound, \"can't find a record with nil identifier\"\n end\n", "", " begin", " from_response API.get(member_path(uuid), {}, options)", " rescue API::NotFound => e\n raise NotFound, e.description\n end\n end", " # Instantiates and attempts to save a record.\n #\n # @return [Resource] The record.\n # @raise [Transaction::Error] A monetary transaction failed.\n # @see create!\n def create(attributes = {})\n new(attributes) { |record| record.save }\n end", " # Instantiates and attempts to save a record.\n #\n # @return [Resource] The saved record.\n # @raise [Invalid] The record is invalid.\n # @raise [Transaction::Error] A monetary transaction failed.\n # @see create\n def create!(attributes = {})\n new(attributes) { |record| record.save! }\n end", " # Instantiates a record from an HTTP response, setting the record's\n # response attribute in the process.\n #\n # @return [Resource]\n # @param response [Net::HTTPResponse]\n def from_response(response)\n content_type = response['Content-Type']", " case content_type\n when %r{application/pdf}\n response.body\n when %r{application/xml}\n record = from_xml response.body\n record.instance_eval { @etag, @response = response['ETag'], response }\n record\n else\n raise Recurly::Error, \"Content-Type \\\"#{content_type}\\\" is not accepted\"\n end\n end", " # Instantiates a record from an XML blob: either a String or XML element.\n #\n # Assuming the record is from an API response, the record is flagged as\n # persisted.\n #\n # @return [Resource]\n # @param xml [String, REXML::Element, Nokogiri::XML::Node]\n # @see from_response\n def from_xml(xml)\n xml = XML.new xml", " if self != Resource || xml.name == member_name\n record = new\n elsif Recurly.const_defined?(class_name = Helper.classify(xml.name), false)\n klass = Recurly.const_get class_name, false\n record = klass.send :new\n elsif root = xml.root and root.elements.empty?\n return XML.cast root\n else\n record = {}\n end\n klass ||= self", " xml.root.attributes.each do |name, value|\n record.instance_variable_set \"@#{name}\", value.to_s\n end", " xml.each_element do |el|\n # skip this element if it's an xml comment\n next if defined?(Nokogiri::XML::Node::TEXT_NODE) && el.is_a?(Nokogiri::XML::Comment)", " if el.name == 'a'\n record.links[el.attribute('name').value] = {\n :method => el.attribute('method').to_s,\n :href => el.attribute('href').value\n }\n next\n end", " # Nokogiri on Jruby-1.7.19 likes to throw NullPointer exceptions\n # if you try to run certian operations like el.attribute(''). Since\n # we dont care about text nodes, let's just skip them\n next if defined?(Nokogiri::XML::Node::TEXT_NODE) && el.node_type == Nokogiri::XML::Node::TEXT_NODE", " if el.children.empty? && href = el.attribute('href')\n klass_name = Helper.classify(klass.association_class_name(el.name) ||\n el.attribute('type') ||\n el.name)", " next unless Recurly.const_defined?(klass_name)", " resource_class = Recurly.const_get(klass_name, false)", " case el.name\n when *klass.associations_for_relation(:has_many)\n record[el.name] = Pager.new(\n resource_class, :uri => href.value, :parent => record\n )\n when *(klass.associations_for_relation(:has_one) + klass.associations_for_relation(:belongs_to))\n record.links[el.name] = {\n :resource_class => resource_class,\n :method => :get,\n :href => href.value\n }\n end\n else\n # TODO name tax_type conflicts with the TaxType\n # class so if we get to this point was can assume\n # it's the string. Will need to refactor this\n if el.name == 'tax_type'\n record[el.name] = el.text\n else\n val = XML.cast(el)", " # TODO we have to clear changed attributes after\n # parsing here or else it always serializes. Need\n # a better way of handling changed attributes\n if el.name == 'address' && val.kind_of?(Hash)\n address = Address.new(val)\n address.instance_variable_set(:@changed_attributes, {})\n record[el.name] = address\n else\n record[el.name] = val\n end\n end\n end\n end", " record.persist! if record.respond_to? :persist!\n record\n end", " # @return [Array] A list of associations for the current class.\n def associations\n @associations ||= []\n end", " # @return [Array] A list of associated resource classes with\n # the relation [:has_many, :has_one, :belongs_to] for the current class.\n def associations_for_relation(relation)\n associations.select{ |a| a.relation == relation }.map(&:resource_class)\n end", " # @return [String, nil] The actual associated resource class name\n # for the current class if the resource class does not match the\n # actual class.\n def association_class_name(resource_class)\n association = find_association(resource_class)\n association.class_name if association\n end", " # @return [Association, nil] Find association for the current class\n # with resource class name.\n def find_association(resource_class)\n associations.find{ |a| a.resource_class.to_s == resource_class.to_s }\n end", " def associations_helper\n @associations_helper ||= Module.new.tap { |helper| include helper }\n end", " # Establishes a has_many association.\n #\n # @return [Proc, nil]\n # @param collection_name [Symbol] Association name.\n # @param options [Hash] A hash of association options.\n # @option options [true, false] :readonly Don't define a setter.\n # [String] :class_name Actual associated resource class name\n # if not same as collection_name.\n def has_many(collection_name, options = {})\n associations << Association.new(:has_many, collection_name.to_s, options)\n associations_helper.module_eval do\n define_method collection_name do\n if self[collection_name]\n self[collection_name]\n else\n attributes[collection_name] = []\n end\n end\n if options.key?(:readonly) && options[:readonly] == false\n define_method \"#{collection_name}=\" do |collection|\n self[collection_name] = collection\n end\n end\n end\n end", " # Establishes a has_one association.\n #\n # @return [Proc, nil]\n # @param member_name [Symbol] Association name.\n # @param options [Hash] A hash of association options.\n # @option options [true, false] :readonly Don't define a setter.\n # [String] :class_name Actual associated resource class name\n # if not same as member_name.\n def has_one(member_name, options = {})\n associations << Association.new(:has_one, member_name.to_s, options)\n associations_helper.module_eval do\n define_method(member_name) { self[member_name] }\n if options.key?(:readonly) && options[:readonly] == false\n associated = Recurly.const_get Helper.classify(member_name), false\n define_method \"#{member_name}=\" do |member|\n associated_uri = \"#{path}/#{member_name}\"\n self[member_name] = case member\n when Hash\n associated.send :new, member.merge(:uri => associated_uri)\n when associated\n member.uri = associated_uri and member\n else\n raise ArgumentError, \"expected #{associated}\"\n end\n end\n define_method \"build_#{member_name}\" do |*args|\n attributes = args.shift || {}\n self[member_name] = associated.send(\n :new, attributes.merge(:uri => \"#{path}/#{member_name}\")\n ).tap { |child| child.attributes[self.class.member_name] = self }\n end\n define_method \"create_#{member_name}\" do |*args|\n send(\"build_#{member_name}\", *args).tap { |child| child.save }\n end\n end\n end\n end", " # Establishes a belongs_to association.\n #\n # @return [Proc]\n # @param parent_name [Symbol] Association name.\n # @param options [Hash] A hash of association options.\n # @option options [true, false] :readonly Don't define a setter.\n # [String] :class_name Actual associated resource class name\n # if not same as parent_name.\n def belongs_to(parent_name, options = {})\n associations << Association.new(:belongs_to, parent_name.to_s, options)\n associations_helper.module_eval do\n define_method(parent_name) { self[parent_name] }\n if options.key?(:readonly) && options[:readonly] == false\n define_method \"#{parent_name}=\" do |parent|\n self[parent_name] = parent\n end\n end\n end\n end", " # @return [:has_many, :has_one, :belongs_to, nil] An association type.\n def reflect_on_association(name)\n a = find_association(name)\n a.relation if a\n end", " def embedded!(root_index = false)\n protected :initialize\n private_class_method(*%w(create create!))\n unless root_index\n private_class_method(*%w(all find_each first paginate scoped where))\n end\n end\n end", " # @return [Hash] The raw hash of record attributes.\n attr_reader :attributes", " # @return [Net::HTTPResponse, nil] The most recent response object for the\n # record (updated during {#save} and {#destroy}).\n attr_reader :response", " # @return [String, nil] An ETag for the current record.\n attr_reader :etag", " # @return [String, nil] A writer to override the URI the record saves to.\n attr_writer :uri", " # @return [Resource] A new resource instance.\n # @param attributes [Hash] A hash of attributes.\n def initialize(attributes = {})\n if instance_of? Resource\n raise Error,\n \"#{self.class} is an abstract class and cannot be instantiated\"\n end", " @attributes, @new_record, @destroyed, @uri, @href = {}, true, false\n self.attributes = attributes\n yield self if block_given?\n end", " # @return [self] Reloads the record from the server.\n def reload(response = nil)\n if response\n return if response.body.to_s.length.zero?\n fresh = self.class.from_response response\n else\n fresh = self.class.find(\n @href || to_param, :etag => (etag unless changed?)\n )\n end\n fresh and copy_from fresh\n persist! true\n self\n rescue API::NotModified\n self\n end", " # @return [Hash] Hash of changed attributes.\n # @see #changes\n def changed_attributes\n @changed_attributes ||= {}\n end", " # @return [Array] A list of changed attribute keys.\n def changed\n changed_attributes.keys\n end", " # Do any attributes have unsaved changes?\n # @return [true, false]\n def changed?\n !changed_attributes.empty?\n end", " # @return [Hash] Map of changed attributes to original value and new value.\n def changes\n changed_attributes.inject({}) { |changes, (key, original_value)|\n changes[key] = [original_value, self[key]] and changes\n }\n end", " # @return [Hash] Previously-changed attributes.\n # @see #changes\n def previous_changes\n @previous_changes ||= {}\n end", " # Is the record new (i.e., not saved on Recurly's servers)?\n #\n # @return [true, false]\n # @see #persisted?\n # @see #destroyed?\n def new_record?\n @new_record\n end", " # Has the record been destroyed? (Set +true+ after a successful destroy.)\n # @return [true, false]\n # @see #new_record?\n # @see #persisted?\n def destroyed?\n @destroyed\n end", " # Has the record persisted (i.e., saved on Recurly's servers)?\n #\n # @return [true, false]\n # @see #new_record?\n # @see #destroyed?\n def persisted?\n !(new_record? || destroyed?)\n end", " # The value of a specified attribute, lazily fetching any defined\n # association.\n #\n # @param key [Symbol, String] The name of the attribute to be fetched.\n # @example\n # account.read_attribute :first_name # => \"Ted\"\n # account[:last_name] # => \"Beneke\"\n # @see #write_attribute\n def read_attribute(key)\n key = key.to_s\n if attributes.key? key\n value = attributes[key]\n elsif links.key?(key) && self.class.reflect_on_association(key)\n value = attributes[key] = follow_link key\n end\n value\n end\n alias [] read_attribute", " # Sets the value of a specified attribute.\n #\n # @param key [Symbol, String] The name of the attribute to be set.\n # @param value [Object] The value the attribute will be set to.\n # @example\n # account.write_attribute :first_name, 'Gus'\n # account[:company_name] = 'Los Pollos Hermanos'\n # @see #read_attribute\n def write_attribute(key, value)\n if changed_attributes.key?(key = key.to_s)\n changed_attributes.delete key if changed_attributes[key] == value\n elsif self[key] != value\n changed_attributes[key] = self[key]\n end", " association = self.class.find_association(key)\n if association\n value = fetch_associated(key, value)\n # FIXME: More explicit; less magic.\n elsif value && key.end_with?('_in_cents') && !respond_to?(:currency)\n value = Money.new(value, self, key) unless value.is_a?(Money)\n end", " attributes[key] = value\n end\n alias []= write_attribute", " # Apply a given hash of attributes to a record.\n #\n # @return [Hash]\n # @param attributes [Hash] A hash of attributes.\n def attributes=(attributes = {})\n attributes.each_pair { |k, v|\n respond_to?(name = \"#{k}=\") and send(name, v) or self[k] = v\n }\n end", " def as_json(options = nil)\n attributes.reject { |k, v| v.is_a?(Recurly::Resource::Pager) }\n end", " # @return [Hash] The raw hash of record href links.\n def links\n @links ||= {}\n end", " # Whether a record has a link with the given name.\n #\n # @param key [Symbol, String] The name of the link to check for.\n # @example\n # account.link? :billing_info # => true\n def link?(key)\n links.key?(key.to_s)\n end", " # Fetch the value of a link by following the associated href.\n #\n # @param key [Symbol, String] The name of the link to be followed.\n # @param options [Hash] A hash of API options.\n # @example\n # account.read_link :billing_info # => <Recurly::BillingInfo>\n def follow_link(key, options = {})\n if link = links[key = key.to_s]\n response = API.send link[:method], link[:href], options[:body], options\n if resource_class = link[:resource_class]\n response = resource_class.from_response response\n response.attributes[self.class.member_name] = self\n end\n response\n end\n rescue Recurly::API::NotFound\n raise unless resource_class\n end", " # Serializes the record to XML.\n #\n # @return [String] An XML string.\n # @param options [Hash] A hash of XML options.\n # @example\n # Recurly::Account.new(:account_code => 'code').to_xml\n # # => \"<account><account_code>code</account_code></account>\"\n def to_xml(options = {})\n builder = options[:builder] || XML.new(\"<#{self.class.member_name}/>\")\n xml_keys.each { |key|\n value = respond_to?(key) ? send(key) : self[key]\n node = builder.add_element key", " # Duck-typing here is problematic because of ActiveSupport's #to_xml.\n case value\n when Resource, Subscription::AddOns\n value.to_xml options.merge(:builder => node)\n when Array\n value.each do |e|\n if e.is_a? Recurly::Resource\n # create a node to hold this resource\n e_node = node.add_element Helper.singularize(key)\n # serialize the resource into this node\n e.to_xml(options.merge(builder: e_node))\n else\n # it's just a primitive value\n node.add_element(Helper.singularize(key), e)\n end\n end\n when Hash, Recurly::Money\n value.each_pair { |k, v| node.add_element k.to_s, v }\n else\n node.text = value\n end\n }\n builder.to_s\n end", " # Attempts to save the record, returning the success of the request.\n #\n # @return [true, false]\n # @raise [Transaction::Error] A monetary transaction failed.\n # @example\n # account = Recurly::Account.new\n # account.save # => false\n # account.account_code = 'account_code'\n # account.save # => true\n # @see #save!\n def save\n if new_record? || changed?\n clear_errors\n @response = API.send(\n persisted? ? :put : :post, path, to_xml\n )\n reload response\n persist! true\n end\n true\n rescue API::UnprocessableEntity => e\n apply_errors e\n Transaction::Error.validate! e, (self if is_a?(Transaction))\n false\n end", " # Attempts to save the record, returning +true+ if the record was saved and\n # raising {Invalid} otherwise.\n #\n # @return [true]\n # @raise [Invalid] The record was invalid.\n # @raise [Transaction::Error] A monetary transaction failed.\n # @example\n # account = Recurly::Account.new\n # account.save! # raises Recurly::Resource::Invalid\n # account.account_code = 'account_code'\n # account.save! # => true\n # @see #save\n def save!\n save || raise(Invalid.new(self))\n end", " # @return [true, false, nil] The validity of the record: +true+ if the\n # record was successfully saved (or persisted and unchanged), +false+ if\n # the record was not successfully saved, or +nil+ for a record with an\n # unknown state (i.e. (i.e. new records that haven't been saved and\n # persisted records with changed attributes).\n # @example\n # account = Recurly::Account.new\n # account.valid? # => nil\n # account.save # => false\n # account.valid? # => false\n # account.account_code = 'account_code'\n # account.save # => true\n # account.valid? # => true\n def valid?\n return true if persisted? && !changed?\n errors_empty = errors.values.flatten.empty?\n return if errors_empty && changed?\n errors_empty\n end", " # Update a record with a given hash of attributes.\n #\n # @return [true, false] The success of the update.\n # @param attributes [Hash] A hash of attributes.\n # @raise [Transaction::Error] A monetary transaction failed.\n # @example\n # account = Account.find 'junior'\n # account.update_attributes :account_code => 'flynn' # => true\n # @see #update_attributes!\n def update_attributes(attributes = {})\n self.attributes = attributes and save\n end", " # Update a record with a given hash of attributes.\n #\n # @return [true] The update was successful.\n # @param attributes [Hash] A hash of attributes.\n # @raise [Invalid] The record was invalid.\n # @raise [Transaction::Error] A monetary transaction failed.\n # @example\n # account = Account.find 'gale_boetticher'\n # account.update_attributes! :account_code => nil # Raises an exception.\n # @see #update_attributes\n def update_attributes!(attributes = {})\n self.attributes = attributes and save!\n end", " # @return [Hash] A hash with indifferent read access containing any\n # validation errors where the key is the attribute name and the value is\n # an array of error messages.\n # @example\n # account.errors # => {\"account_code\"=>[\"can't be blank\"]}\n # account.errors[:account_code] # => [\"can't be blank\"]\n def errors\n @errors ||= Errors.new { |h, k| h[k] = [] }\n end", " # Marks a record as persisted, i.e. not a new or deleted record, resetting\n # any tracked attribute changes in the process. (This is an internal method\n # and should probably not be called unless you know what you're doing.)\n #\n # @api internal\n # @return [true]\n def persist!(saved = false)\n @new_record, @uri = false\n if changed?\n @previous_changes = changes if saved\n changed_attributes.clear\n end\n true\n end", " # @return [String, nil] The unique resource identifier (URI) of the record\n # (if persisted).\n # @example\n # Recurly::Account.new(:account_code => \"account_code\").uri # => nil\n # Recurly::Account.find(\"account_code\").uri\n # # => \"https://api.recurly.com/v2/accounts/account_code\"\n def uri\n @href ||= ((API.base_uri + path).to_s if persisted?)\n end", " # Attempts to destroy the record.\n #\n # @return [true, false] +true+ if successful, +false+ if unable to destroy\n # (if the record does not persist on Recurly).\n # @raise [NotFound] The record cannot be found.\n # @example\n # account = Recurly::Account.find account_code\n # race_condition = Recurly::Account.find account_code\n # account.destroy # => true\n # account.destroy # => false (already destroyed)\n # race_condition.destroy # raises Recurly::Resource::NotFound\n def destroy\n return false unless persisted?\n @response = API.delete uri\n @destroyed = true\n rescue API::NotFound => e\n raise NotFound, e.description\n end", " def signable_attributes\n Hash[xml_keys.map { |key| [key, self[key]] }]\n end", " def ==(other)\n other.is_a?(self.class) && other.to_s == to_s\n end", " def marshal_dump\n [\n @attributes.reject { |k, v| v.is_a?(Proc) },\n @new_record,\n @destroyed,\n @uri,\n @href,\n changed_attributes,\n previous_changes,\n response,\n etag,\n links\n ]\n end", " def marshal_load(serialization)\n @attributes,\n @new_record,\n @destroyed,\n @uri,\n @href,\n @changed_attributes,\n @previous_changes,\n @response,\n @etag,\n @links = serialization\n end", " # @return [String]\n def inspect(attributes = self.class.attribute_names.to_a)\n string = \"#<#{self.class}\"\n string << \"##@type\" if instance_variable_defined? :@type\n attributes += %w(errors) if errors.any?\n string << \" %s\" % attributes.map { |k|\n \"#{k}: #{self.send(k).inspect}\"\n }.join(', ')\n string << '>'\n end\n alias to_s inspect", " def apply_errors(exception)\n @response = exception.response\n document = XML.new exception.response.body\n document.each_element 'error' do |el|\n attribute_path = el.attribute('field').value.split '.'\n invalid! attribute_path[1, attribute_path.length], el.text\n end\n end", " protected", " def path\n @href or @uri or if persisted?\n self.class.member_path to_param\n else\n self.class.collection_path\n end\n end", " def invalid!(attribute_path, error)\n if attribute_path.length == 1\n errors[attribute_path[0]] << error\n else\n child, k, v = attribute_path.shift.scan(/[^\\[\\]=]+/)\n if c = k ? self[child].find { |d| d[k] == v } : self[child]\n c.invalid! attribute_path, error\n e = errors[child] << 'is invalid' and e.uniq!\n end\n end\n end", " def clear_errors\n errors.clear\n self.class.associations do |association|\n next unless respond_to? \"#{association}=\" # Clear writable only.\n [*self[association]].each do |associated|\n associated.clear_errors if associated.respond_to? :clear_errors\n end\n end\n end", " def copy_from(other)\n other.instance_variables.each do |ivar|\n instance_variable_set ivar, other.instance_variable_get(ivar)\n end\n end", " private", " def fetch_associated(name, value, options = {})\n case value\n when Array\n value.map do |v|\n fetch_associated(Helper.singularize(name), v, association_name: name)\n end\n when Hash\n association_name = options[:association_name] || name\n associated_class_name = self.class.find_association(association_name).class_name\n associated_class_name ||= Helper.classify(name)\n Recurly.const_get(associated_class_name, false).send(:new, value)\n when Proc, Resource, Resource::Pager, nil\n value\n else\n raise \"unexpected association #{name.inspect}=#{value.inspect}\"\n end\n end", " def xml_keys\n changed_attributes.keys.sort\n end\n end\nend" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [77, 45, 341], "buggy_code_start_loc": [17, 45, 338], "filenames": ["lib/recurly/api.rb", "lib/recurly/api/net_http_adapter.rb", "lib/recurly/resource.rb"], "fixing_code_end_loc": [86, 47, 340], "fixing_code_start_loc": [18, 46, 337], "message": "The Recurly Client Ruby Library before 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4, 2.11.3 is vulnerable to a Server-Side Request Forgery vulnerability in the \"Resource#find\" method that could result in compromise of API keys or other critical resources.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "D2111C93-1F01-4B79-B731-14E639037521", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.1:*:*:*:*:*:*:*", "matchCriteriaId": "BE0E6539-B427-4F49-8F7D-9D7778E2174B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.2:*:*:*:*:*:*:*", "matchCriteriaId": "D1DCAD09-8071-4965-88B6-64D83F9FEDB2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.3:*:*:*:*:*:*:*", "matchCriteriaId": "BE1A049E-4B43-4FF8-9AFC-803A85ABF7AA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.4:*:*:*:*:*:*:*", "matchCriteriaId": "6C1515F4-4B33-4A04-8448-A2E4397B1581", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.5:*:*:*:*:*:*:*", "matchCriteriaId": "5215C59F-D763-41F4-9673-77B64481DF16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.6:*:*:*:*:*:*:*", "matchCriteriaId": "667CAF6A-2F8D-498A-9797-CEB2C457F967", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.7:*:*:*:*:*:*:*", "matchCriteriaId": "78812028-9678-48FF-83B4-C6BA0DA5ED95", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.8:*:*:*:*:*:*:*", "matchCriteriaId": "3BC2ABD2-E685-45E4-A423-909DF3C8FABE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.9:*:*:*:*:*:*:*", "matchCriteriaId": "1169885A-59C3-40B8-AC53-625A20A40295", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.10:*:*:*:*:*:*:*", "matchCriteriaId": "B660902B-353C-4917-A607-3DEBB076B130", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.11:*:*:*:*:*:*:*", "matchCriteriaId": "8CE4D650-30B2-461C-BB58-E56112B21E16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.0.12:*:*:*:*:*:*:*", "matchCriteriaId": "429B0B74-B230-428A-BF7D-FDE45FACBA7E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.0:*:*:*:*:*:*:*", "matchCriteriaId": "62D6ED01-8289-4F93-ADC6-0E5C5E8BD348", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.0:c:*:*:*:*:*:*", "matchCriteriaId": "13ABB028-6997-40DC-B61E-27238BEF99A2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.1:*:*:*:*:*:*:*", "matchCriteriaId": "3746FE6C-CE9F-4267-871D-D585CD404305", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.2:*:*:*:*:*:*:*", "matchCriteriaId": "F725D5E4-E81F-4DB7-AE22-F9A36872CC75", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.3:*:*:*:*:*:*:*", "matchCriteriaId": "29351445-7C64-4409-9B5E-5AEBB96FC4C9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.4:*:*:*:*:*:*:*", "matchCriteriaId": "8516A98B-AE81-48A9-BBBA-9F050FE0AD60", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.5:*:*:*:*:*:*:*", "matchCriteriaId": "7B6F5715-A3D5-4CCC-9645-AFB56E26FD5E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.6:*:*:*:*:*:*:*", "matchCriteriaId": "3FD7D5EB-4C42-4966-ACAA-185DA5ECB72A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.7:*:*:*:*:*:*:*", "matchCriteriaId": "4C65414F-75FC-4C15-8265-F73E9BFAB067", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.8:*:*:*:*:*:*:*", "matchCriteriaId": "16944240-53F2-4F7D-9C29-DF2B0CA5C763", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.9:*:*:*:*:*:*:*", "matchCriteriaId": "ED1A64D2-F06A-490B-8D59-B6F9B83E9152", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.1.10:*:*:*:*:*:*:*", "matchCriteriaId": "58881236-C96F-461C-BFE0-5880039C1203", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.0:*:*:*:*:*:*:*", "matchCriteriaId": "DC547D0F-E1FB-4C19-A3D0-D3FC48E4EDB1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.1:*:*:*:*:*:*:*", "matchCriteriaId": "99AFBA9B-BFA3-494C-90B9-55F3D18604DF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.2:*:*:*:*:*:*:*", "matchCriteriaId": "066D3983-6BF1-4416-B87E-725122DF82EC", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.3:*:*:*:*:*:*:*", "matchCriteriaId": "A9FBEB10-5B34-47F6-85BC-8995CE77AC05", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.2.4:*:*:*:*:*:*:*", "matchCriteriaId": "869018B3-4286-4D34-B69F-4749A61DC1A5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.0:*:*:*:*:*:*:*", "matchCriteriaId": "95919D64-1B0F-4005-BDF8-C390DBA181E4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.0:beta1:*:*:*:*:*:*", "matchCriteriaId": "0F8A6E88-C153-440B-AEC6-EBA2BFD3E2E5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.1:*:*:*:*:*:*:*", "matchCriteriaId": "2F8F03AC-BD84-4D2A-B6DC-94BF509C3C67", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.2:*:*:*:*:*:*:*", "matchCriteriaId": "E288DC42-7D2E-404D-85FF-CA02CFD16164", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.3:*:*:*:*:*:*:*", "matchCriteriaId": "9E53C11E-E506-4113-95D8-C526E70A2AAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.4:*:*:*:*:*:*:*", "matchCriteriaId": "D5BC2A4D-D523-4B82-872C-EF2D1F70992D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.5:*:*:*:*:*:*:*", "matchCriteriaId": "33692513-74D9-472C-B3D3-54F06C835832", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.6:*:*:*:*:*:*:*", "matchCriteriaId": "09210851-79D4-49B5-994E-07E40C489D16", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.7:*:*:*:*:*:*:*", "matchCriteriaId": "8021F44A-CD23-4D15-9411-20F0E28C7D25", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.8:*:*:*:*:*:*:*", "matchCriteriaId": "A9C5ADAE-E620-4440-8C3D-D071A279FB2E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.3.9:*:*:*:*:*:*:*", "matchCriteriaId": "A810DF15-CCDF-4D5E-A3A2-4DF852D9CBF4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.0:*:*:*:*:*:*:*", "matchCriteriaId": "8D427209-016F-4115-9447-7F96875A7D86", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.1:*:*:*:*:*:*:*", "matchCriteriaId": "36D5AD56-959D-4990-9B43-170D9083CDF3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.2:*:*:*:*:*:*:*", "matchCriteriaId": "78789F09-77A2-4A86-882D-DEA4E52ED6C9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.3:*:*:*:*:*:*:*", "matchCriteriaId": "0737A57D-411D-4BB5-83FC-15900B0D9150", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.4:*:*:*:*:*:*:*", "matchCriteriaId": "633161B1-1E51-40E9-8EE2-9EDCDDA653D2", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.5:*:*:*:*:*:*:*", "matchCriteriaId": "9E2CC4EA-8D08-42D8-A822-78042CD7946D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.6:*:*:*:*:*:*:*", "matchCriteriaId": "91083CF3-8A5C-4178-A91A-BB6DE3C2BAF0", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.7:*:*:*:*:*:*:*", "matchCriteriaId": "D9BC8E96-C437-4016-8A22-F402BF6B8E19", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.8:*:*:*:*:*:*:*", "matchCriteriaId": "A9E8AD18-59DF-45BD-AB25-F62CAEC223FE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.9:*:*:*:*:*:*:*", "matchCriteriaId": "D2BDD100-4A8E-4700-9377-22AB1483E76C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.4.10:*:*:*:*:*:*:*", "matchCriteriaId": "1E580467-9DC2-43CC-8C00-92BCFC4DA49A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.0:*:*:*:*:*:*:*", "matchCriteriaId": "01596D40-6039-4626-AF32-FE4C217EE120", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.1:*:*:*:*:*:*:*", "matchCriteriaId": "ED738A23-EB6C-4BAF-9CDF-209C6EF8E70D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.2:*:*:*:*:*:*:*", "matchCriteriaId": "26315E34-0869-4A18-B9E7-4E3306FAB4B3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.5.3:*:*:*:*:*:*:*", "matchCriteriaId": "881A7D1C-769C-4B10-9034-E017CD300280", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.0:*:*:*:*:*:*:*", "matchCriteriaId": "B4775539-0309-4FEA-BE79-2D45FE4E0B7C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.1:*:*:*:*:*:*:*", "matchCriteriaId": "7E684118-BCA4-4A8F-A49C-87B06294523F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.6.2:*:*:*:*:*:*:*", "matchCriteriaId": "D24E0F3B-EA8D-4D67-B16E-244E8954155F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEF8F56B-BEF3-4276-9B38-C8C1A0867B00", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.1:*:*:*:*:*:*:*", "matchCriteriaId": "6A41F7A0-B271-4060-80F2-8E6B2B6051E1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.2:*:*:*:*:*:*:*", "matchCriteriaId": "FE24079A-61D1-411E-BAA7-6B75251CAAC5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.3:*:*:*:*:*:*:*", "matchCriteriaId": "81EFB16F-267E-417A-AF3E-E20E674FC59D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.4:*:*:*:*:*:*:*", "matchCriteriaId": "7E3C6786-1E84-4906-BE56-938FEC02E7FE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.5:*:*:*:*:*:*:*", "matchCriteriaId": "928F451E-6416-455C-8F3E-56FC918A3AC3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.6:*:*:*:*:*:*:*", "matchCriteriaId": "E3C38ACD-05EB-4EDE-8BDC-CDEA4EDF4C78", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.7.7:*:*:*:*:*:*:*", "matchCriteriaId": "0148307A-7F03-4B83-BAC5-A090B534DD9B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:*:*:*:*:*:*:*", "matchCriteriaId": "665A2524-FA33-4BF1-B496-160964DB71D1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:rc1:*:*:*:*:*:*", "matchCriteriaId": "5F4373D8-DBC3-4B3C-A911-2EEC94668694", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.0:rc3:*:*:*:*:*:*", "matchCriteriaId": "50F53821-6B2E-47B5-898A-72BA03DE9889", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.8.1:*:*:*:*:*:*:*", "matchCriteriaId": "429C418A-A716-4A8D-A8FD-5A895F4BBA11", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.9.0:*:*:*:*:*:*:*", "matchCriteriaId": "5EE4E79E-5DD5-48D7-8254-14CF61EEAA8E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.9.1:*:*:*:*:*:*:*", "matchCriteriaId": "CF88DD8B-3243-484E-9ED5-BF5C99D69D25", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.0:*:*:*:*:*:*:*", "matchCriteriaId": "9FD6D773-CF96-4E8C-82FC-187116AEE584", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.1:*:*:*:*:*:*:*", "matchCriteriaId": "2FA30686-C9AA-4031-B2F9-C5779B34D8DB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.2:*:*:*:*:*:*:*", "matchCriteriaId": "B8FFF737-4974-43C8-8C2F-475BFB05CA9B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.10.3:*:*:*:*:*:*:*", "matchCriteriaId": "5BACB549-4C65-4B09-8C0F-ABC662B52016", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.0:*:*:*:*:*:*:*", "matchCriteriaId": "1607963B-FBC3-4A32-A2D8-9ACBAFD97962", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.1:*:*:*:*:*:*:*", "matchCriteriaId": "002E6140-C28B-4CDE-8EFF-90CB4768F4CF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:recurly:recurly_client_ruby:2.11.2:*:*:*:*:*:*:*", "matchCriteriaId": "9C509480-F8E5-4A7D-ADA7-235D5F2C8A94", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The Recurly Client Ruby Library before 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4, 2.11.3 is vulnerable to a Server-Side Request Forgery vulnerability in the \"Resource#find\" method that could result in compromise of API keys or other critical resources."}, {"lang": "es", "value": "La biblioteca de Ruby Recurly Client en versiones anteriores a la 2.0.13, 2.1.11, 2.2.5, 2.3.10, 2.4.11, 2.5.4, 2.6.3, 2.7.8, 2.8.2, 2.9.2, 2.10.4 y 2.11.3 es vulnerable a Server-Side Request Forgery en el m\u00e9todo \"Resource#find\" que podr\u00eda conllevar el compromiso de las claves API o de otros recursos cr\u00edticos."}], "evaluatorComment": null, "id": "CVE-2017-0905", "lastModified": "2019-10-09T23:21:11.040", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-11-13T17:29:00.427", "references": [{"source": "support@hackerone.com", "tags": ["Vendor Advisory"], "url": "https://dev.recurly.com/page/ruby-updates"}, {"source": "support@hackerone.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/recurly/recurly-client-ruby/commit/1bb0284d6e668b8b3d31167790ed6db1f6ccc4be"}, {"source": "support@hackerone.com", "tags": ["Permissions Required"], "url": "https://hackerone.com/reports/288635"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-918"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/recurly/recurly-client-ruby/commit/1bb0284d6e668b8b3d31167790ed6db1f6ccc4be"}, "type": "CWE-918"}
355
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expController\n *\n * @package Core\n * @subpackage Controllers\n */", "abstract class expController {\n protected $classname = ''; // full controller name w/ 'Controller' suffix\n public $baseclassname = ''; // root controller name w/o 'Controller' suffix\n public $classinfo = null; // holds reflection class of class\n// public $module_name = ''; //FIXME not used and not actually set right index needed of -3 instead of -2 below\n// protected $basemodel = null; //FIXME never used, $basemodel_name replaced?\n public $basemodel_name = ''; // holds classname of base model associated w/ this controller\n public $model_table = ''; // holds table name for base model", " public $useractions = array(); // available (displayed) user actions/methods for this module\n public $remove_configs = array(); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)", " // $permissions used to restrict access to module's actions/methods\n protected $permissions = array( // standard set of permissions for all modules unless add'ed or remove'd\n 'manage' => 'Manage',\n 'configure' => 'Configure',\n 'create' => 'Create',\n 'edit' => 'Edit',\n 'delete' => 'Delete',", " 'approve' => 'Approval',", " );\n protected $remove_permissions = array(); // $permissions not applicable for this module from above list", " protected $add_permissions = array(); // additional $permissions processed for this module\n public $requires_login = array(); // actions/methods which ONLY require user be logged in to access...$permissions take priority", "\n public $filepath = ''; // location of this controller's files\n public $viewpath = ''; // location of this controllers views; defaults to controller file location\n public $relative_viewpath = ''; // relative location of controller's views\n public $asset_path = ''; // location of this controller's assets; defaults to controller file location", " public $config = array(); // holds module configuration settings\n public $params = array(); // holds sanitized parameters passed to module\n public $loc = null; // module location object", " public $codequality = 'stable'; // code's level of stability", " public $rss_is_podcast = false;", " /**\n * @param null $src\n * @param array $params\n *\n * @return expController\n *\n */\n public function __construct($src = null, $params = array()) {\n // setup some basic information about this class\n $this->classinfo = new ReflectionClass($this);\n $this->classname = $this->classinfo->getName();\n $this->baseclassname = substr($this->classinfo->getName(), 0, -10);\n $this->filepath = __realpath($this->classinfo->getFileName());", " // figure out which \"module\" we belong to and setup view path information\n $controllerpath = explode('/', $this->filepath);\n// $this->module_name = $controllerpath[(count($controllerpath)-3)];", " // set up the path to this module view files\n array_pop($controllerpath); // remove 'controllers' from array\n $controllerpath[count($controllerpath) - 1] = 'views';\n array_push($controllerpath, $this->baseclassname);\n $this->relative_viewpath = implode('/', array_slice($controllerpath, -3, 3));\n// $this->viewpath = BASE.'framework/modules/'.$this->relative_viewpath;\n //FIXME this requires we move the 'core' controllers into the modules folder or use this hack\n $depth = array_search('core', $controllerpath);\n if ($depth) {\n $this->viewpath = BASE . 'framework/modules/' . $this->relative_viewpath;\n } else {\n $this->viewpath = implode('/', $controllerpath);\n }", " //grab the path to the module's assets\n array_pop($controllerpath);\n $controllerpath[count($controllerpath) - 1] = 'assets';\n// $this->asset_path = PATH_RELATIVE.'framework/'.implode('/', array_slice($controllerpath, -3, 3)).\"/\";\n $depth = array_search('framework', $controllerpath); // is this a system file (or theme)?\n if (!$depth) $depth = array_search('themes', $controllerpath);\n $this->asset_path = PATH_RELATIVE . implode('/', array_slice($controllerpath, $depth)) . \"/\";", " // figure out which model we're using and setup some info about it\n if (empty($this->basemodel_name)) $this->basemodel_name = get_model_for_controller($this->classname);\n $modelname = $this->basemodel_name;\n if (class_exists($modelname)) {\n $this->$modelname = new $modelname(null, false, false);\n $this->model_table = $this->$modelname->tablename;\n } else {\n $this->basemodel_name = 'expRecord';\n $this->$modelname = new expRecord(null, false, false);\n $this->model_table = null;\n }", " // set the location data\n $this->loc = expCore::makeLocation($this->baseclassname, $src, null);", " // flag for needing approval check\n if (ENABLE_WORKFLOW && $this->$modelname->supports_revisions) {\n $uilevel = 99;\n if (expSession::exists(\"uilevel\")) $uilevel = expSession::get(\"uilevel\");\n if (!expPermissions::check('approve', $this->loc)) {\n $this->$modelname->needs_approval = true;\n } elseif ($uilevel == UILEVEL_PREVIEW && isset($uilevel)) {\n $this->$modelname->needs_approval = true; // 'preview' should provide a true preview\n }\n }", " // get this controllers config data if there is any\n $config = new expConfig($this->loc);\n $this->config = $config->config;", " $this->params = $params;", "", " }", " /**\n * name of module for backwards compat with old modules\n *\n * @return string\n */\n public function name() {\n return static::displayname();\n }", " /**\n * name of module\n *\n * @return string\n */\n public static function displayname() {\n return gt(\"Exponent Base Controller\");\n }", " /**\n * description of module\n *\n * @return string\n */\n public static function description() {\n return gt(\"This is the base controller which most Exponent modules inherit their methods from.\");\n }", " /**\n * author of module\n *\n * @return string\n */\n public static function author() {\n return \"OIC Group, Inc\";\n }", " /**\n * does module have sources available? or does it treat content globally\n *\n * @return bool\n */\n public static function hasSources() {\n return true;\n }", " /**\n * does module have views available?\n *\n * @return bool\n */ //NOTE: Never used - equivalent to !empty ($this->useractions) via expModules::listUserRunnableControllers()?\n public static function hasViews() {\n return true;\n }", " /**\n * does module have content (stored items) available?\n *\n * @return bool\n */ //NOTE: Never used, better utilized/implemented as isSearchable()\n public static function hasContent() {\n return true;\n }", " /**\n * does module support workflow?\n *\n * @return bool\n */\n public static function supportsWorkflow() {\n return false;\n }", " /**\n * is module content searchable? should it be added to search index?\n *\n * @return bool\n */\n public static function isSearchable() {\n return false;\n }", " /**\n * can this module import data?\n *\n * @return bool\n */\n public static function canImportData() {\n return false;\n }", " /**\n * can this module export data?\n *\n * @return bool\n */\n public static function canExportData() {\n return false;\n }", " /**\n * does this module require configuration?\n *\n * @return bool\n */ //NOTE: Never Used\n public static function requiresConfiguration() {\n return false;\n }", " /**\n * glue to make the view template aware of the module\n * @deprecated\n */\n public function moduleSelfAwareness() {\n assign_to_template(array(\n 'asset_path' => $this->asset_path,\n 'model_name' => $this->basemodel_name,\n 'table' => $this->model_table,\n 'controller' => $this->baseclassname,\n 'config' => $this->config\n ));\n }", " /**\n * default module view method for all items\n */\n public function showall() {\n expHistory::set('viewable', $this->params);", " $page = new expPaginator(array(\n 'model' => $this->basemodel_name,\n 'where' => static::hasSources() ? $this->aggregateWhereClause() : null,\n 'limit' => (isset($this->params['limit']) && $this->params['limit'] != '') ? $this->params['limit'] : 10,\n 'order' => isset($this->params['order']) ? $this->params['order'] : null,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->baseclassname,\n 'action' => $this->params['action'],\n 'src' => static::hasSources() == true ? $this->loc->src : null,\n 'columns' => array(\n gt('ID#') => 'id',\n gt('Title') => 'title',\n gt('Body') => 'body'\n ),\n ));", " assign_to_template(array(\n 'page' => $page,\n 'items' => $page->records\n ));\n }", " /**\n * default module view method for all items with a specific tag\n */\n public function showall_by_tags() {\n global $db;", " // set history\n expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;", " // get the tag being passed", " $tag = new expTag($this->params['tag']);", "\n // find all the id's of the portfolios for this module\n $item_ids = $db->selectColumn($modelname, 'id', $this->aggregateWhereClause());", " // find all the items that this tag is attached to\n $items = $tag->findWhereAttachedTo($modelname);", " // loop the items for this tag and find out which ones belong to this module\n $items_by_tags = array();\n foreach ($items as $item) {\n if (in_array($item->id, $item_ids)) $items_by_tags[] = $item;\n }", " // create a pagination object for the model and render the action\n $order = 'created_at DESC';\n $page = new expPaginator(array(\n 'records' => $items_by_tags,\n 'limit' => (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10,\n 'order' => $order,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->baseclassname,\n 'action' => $this->params['action'],\n 'src'=>$this->loc->src,\n 'columns' => array(\n gt('Title') => 'title'\n ),\n ));\n// $page->records = expSorter::sort(array('array'=>$page->records, 'sortby'=>'rank', 'order'=>'ASC', 'ignore_case'=>true));\n $page->records = expSorter::sort(array('array' => $page->records, 'sortby' => 'created_at', 'order' => 'DESC', 'ignore_case' => true));", " assign_to_template(array(\n 'page' => $page,\n 'items' => $page->records,", " 'moduletitle' => ucfirst($modelname) . ' ' . gt('items tagged with') . ' \"' . expString::sanitize($this->params['tag']) . '\"',", " 'rank' => ($order === 'rank') ? 1 : 0\n ));\n }", " /**\n * return all tags used by module's items\n */\n public function tags() {\n expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;", " $items = $this->$modelname->find('all', $this->aggregateWhereClause());\n $used_tags = array();\n foreach ($items as $item) {\n foreach ($item->expTag as $tag) {\n if (isset($used_tags[$tag->id])) {\n $used_tags[$tag->id]->count++;\n } else {\n $exptag = new expTag($tag->id);\n $used_tags[$tag->id] = $exptag;\n $used_tags[$tag->id]->count = 1;\n }\n }\n }", "// $order = isset($this->config['order']) ? $this->config['order'] : 'rank';\n// $used_tags = expSorter::sort(array('array'=>$used_tags,'sortby'=>'title', 'order'=>'ASC', 'ignore_case'=>true, 'rank'=>($order==='rank')?1:0));\n// $order = isset($this->config['order']) ? $this->config['order'] : 'title ASC';\n// $used_tags = expSorter::sort(array('array'=>$used_tags, 'order'=>$order, 'ignore_case'=>true, 'rank'=>($order==='rank')?1:0));\n $used_tags = expSorter::sort(array('array' => $used_tags, 'order' => 'count DESC', 'type' => 'a'));\n if (!empty($this->config['limit'])) $used_tags = array_slice($used_tags, 0, $this->config['limit']);\n $order = isset($this->config['order']) ? $this->config['order'] : 'title ASC';\n if ($order != 'hits') {\n $used_tags = expSorter::sort(array('array' => $used_tags, 'order' => $order, 'ignore_case' => true, 'rank' => ($order === 'rank') ? 1 : 0));\n }", " assign_to_template(array(\n 'tags' => $used_tags\n ));\n }", " /**\n * return all categories used by module's items\n */\n public function categories() {\n expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;", " $items = $this->$modelname->find('all', $this->aggregateWhereClause());\n $used_cats = array();\n $used_cats[0] = new stdClass();\n $used_cats[0]->id = 0;\n $used_cats[0]->title = !empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized');\n $used_cats[0]->count = 0;\n foreach ($items as $item) {\n if (!empty($item->expCat)) {\n if (isset($used_cats[$item->expCat[0]->id])) {\n $used_cats[$item->expCat[0]->id]->count++;\n } else {\n $expcat = new expCat($item->expCat[0]->id);\n $used_cats[$item->expCat[0]->id] = $expcat;\n $used_cats[$item->expCat[0]->id]->count = 1;\n }\n } else {\n $used_cats[0]->count++;\n }\n }", "// $order = isset($this->config['order']) ? $this->config['order'] : 'rank';\n// $used_cats = expSorter::sort(array('array'=>$used_cats,'sortby'=>'title', 'order'=>'ASC', 'ignore_case'=>true, 'rank'=>($order==='rank')?1:0));\n// $order = isset($this->config['order']) ? $this->config['order'] : 'title ASC';\n// $used_cats = expSorter::sort(array('array'=>$used_cats, 'order'=>$order, 'ignore_case'=>true, 'rank'=>($order==='rank')?1:0));\n $used_cats = expSorter::sort(array('array' => $used_cats, 'order' => 'count DESC', 'type' => 'a'));\n if (!empty($this->config['limit'])) $used_cats = array_slice($used_cats, 0, $this->config['limit']);\n $order = isset($this->config['order']) ? $this->config['order'] : 'title ASC';\n if ($order != 'count') {\n $used_cats = expSorter::sort(array('array' => $used_cats, 'order' => $order, 'ignore_case' => true, 'rank' => ($order === 'rank') ? 1 : 0));\n }", " assign_to_template(array(\n 'cats' => $used_cats\n ));\n }", " /**\n * return all comments used by module's items\n */\n public function comments() {\n\t expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;", " $items = $this->$modelname->find('all');\n $all_comments = array();\n // get all the blog comments\n foreach ($items as $item) {\n $more_comments = expCommentController::getComments(array('content_type'=>$modelname,'content_id'=>$item->id));\n if (!empty($more_comments)) {\n foreach ($more_comments as $next_comment) {\n $next_comment->ref = $item->title;\n $next_comment->sef_url = $item->sef_url;\n }\n $all_comments = array_merge($all_comments,$more_comments);\n }\n }\n // sort then limit all the blog comments\n $all_comments = expSorter::sort(array('array' => $all_comments, 'sortby' => 'created_at', 'order' => 'DESC', 'ignore_case' => true));\n $limit = (isset($this->config['headcount']) && $this->config['headcount'] != '') ? $this->config['headcount'] : 10;\n $comments = array_slice($all_comments,0,$limit);\n\t assign_to_template(array(\n 'comments'=>$comments,\n ));\n\t}", " /**\n * default view for individual item\n */\n public function show() {\n expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;", " // figure out if we're looking this up by id or title\n $id = null;\n if (isset($this->params['id'])) {\n $id = $this->params['id'];\n } elseif (isset($this->params['title'])) {", " $id = $this->params['title'];", " }", " $record = new $modelname($id);\n if (empty($record->id))\n redirect_to(array('controller'=>'notfound','action'=>'page_not_found','title'=>$this->params['title']));", " $config = expConfig::getConfig($record->location_data);\n if (empty($this->config))\n $this->config = $config;\n if (empty($this->loc->src)) {\n $r_loc = expUnserialize($record->location_data);\n $this->loc = new stdClass();\n $this->loc->src = $r_loc->src;\n }", " assign_to_template(array(\n 'record' => $record,\n 'config' => $config\n ));\n }", " /**\n * view the item by referring to its title\n * @deprecated\n */\n public function showByTitle() {\n expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;\n // first we'll check to see if this matches the sef_url field...if not then we'll look for the\n // title field", "", " $record = $this->$modelname->find('first', \"sef_url='\" . $this->params['title'] . \"'\");\n if (!is_object($record)) {\n $record = $this->$modelname->find('first', \"title='\" . $this->params['title'] . \"'\");\n }\n $this->loc = unserialize($record->location_data);", " assign_to_template(array(\n 'record' => $record,\n ));\n }", " /**\n * view a random item\n */\n public function showRandom() {\n expHistory::set('viewable', $this->params);\n $where = static::hasSources() ? $this->aggregateWhereClause() : null;\n $limit = isset($this->params['limit']) ? $this->params['limit'] : 1;\n $order = 'RAND()';\n assign_to_template(array(\n 'items' => $this->text->find('all', $where, $order, $limit)\n ));\n }", " /**\n * view items referenced by tags\n * @deprecated\n */\n public function showByTags() {\n global $db;", " // set the history point for this action\n expHistory::set('viewable', $this->params);", " // setup some objects\n $tagobj = new expTag();\n $modelname = empty($this->params['model']) ? $this->basemodel_name : $this->params['model'];\n $model = new $modelname();", " // start building the sql query\n $sql = 'SELECT DISTINCT m.id FROM ' . $db->prefix . $model->tablename . ' m ';\n $sql .= 'JOIN ' . $db->prefix . $tagobj->attachable_table . ' ct ';\n $sql .= 'ON m.id = ct.content_id WHERE (';\n $first = true;", " if (isset($this->params['tags'])) {\n $tags = is_array($this->params['tags']) ? $this->params['tags'] : array($this->params['tags']);\n } elseif (isset($this->config['expTags'])) {\n $tags = $this->config['expTags'];\n } else {\n $tags = array();\n }", " foreach ($tags as $tagid) {\n $sql .= ($first) ? 'exptags_id=' . intval($tagid) : ' OR exptags_id=' . intval($tagid);\n $first = false;\n }\n $sql .= \") AND content_type='\" . $model->classname . \"'\";", " // get the objects and render the template\n $tag_assocs = $db->selectObjectsBySql($sql);\n $records = array();\n foreach ($tag_assocs as $assoc) {\n $records[] = new $modelname($assoc->id);\n }", " assign_to_template(array(\n 'items' => $records\n ));\n }", " /**\n * create an item in this module\n * @deprecated in favor of edit w/o id param\n */\n public function create() {\n $args = array('controller' => $this->params['controller'], 'action' => 'edit');\n //if (!empty($this->params['instance'])) $args['instance'] = $this->params['instance'];\n if (!empty($this->params['src'])) $args['src'] = $this->params['src'];\n redirect_to($args);\n }", " /**\n * edit item in module, also used to copy items\n */\n public function edit() {\n expHistory::set('editable', $this->params);\n $taglist = expTag::getAllTags();\n $modelname = $this->basemodel_name;\n// $record = isset($this->params['id']) ? $this->$modelname->find($this->params['id']) : new $modelname($this->params);\n if (isset($this->params['id'])) {\n if (!isset($this->params['revision_id'])) {\n $record = $this->$modelname->find($this->params['id']);\n } else {\n $currentrecord = $this->$modelname->find($this->params['id']);\n $records = $this->$modelname->find('revisions', $this->$modelname->identifier . '=' . intval($this->params['id']) . ' AND revision_id=' . intval($this->params['revision_id']));\n $record = $records[0];\n $record->current_revision_id = $currentrecord->revision_id;\n }\n } else {\n $record = new $modelname($this->params);\n }\n if (!empty($this->params['copy'])) {\n $record->id = null;\n if (isset($record->sef_url)) $record->sef_url = null;\n }\n assign_to_template(array(\n 'record' => $record,\n// 'table' => $this->$modelname->tablename,\n// 'controller' => $this->params['controller'],\n 'taglist' => $taglist\n ));\n }", " /**\n * merge/move aggregated item into this module\n */\n public function merge() {\n expHistory::set('editable', $this->params);\n $modelname = $this->basemodel_name;\n $record = $this->$modelname->find($this->params['id']);", " $loc = expUnserialize($record->location_data);\n $loc->src = $this->loc->src;\n $record->location_data = serialize($loc);\n// $this->$modelname->update($record);\n $record->update();", " expHistory::back();\n }", " /**\n * update (save) item in module\n */\n public function update() {\n global $db;", " //check for and handle tags\n if (array_key_exists('expTag', $this->params)) {\n if (isset($this->params['id'])) {\n $db->delete('content_expTags', 'content_type=\"' . (!empty($this->params['content_type']) ? $this->params['content_type'] : $this->basemodel_name) . '\" AND content_id=' . $this->params['id']);\n }\n $tags = explode(\",\", trim($this->params['expTag']));\n unset($this->params['expTag']);", " foreach ($tags as $tag) {\n if (!empty($tag)) {\n $tag = strtolower(trim($tag));\n $tag = str_replace(array('\"', \"'\"), \"\", $tag); // strip double and single quotes\n if (!empty($tag)) {\n $expTag = new expTag($tag);\n if (empty($expTag->id))\n $expTag->update(array('title' => $tag));\n $this->params['expTag'][] = $expTag->id;\n }\n }\n }\n }", " //check for and handle cats\n if (array_key_exists('expCat', $this->params) && !empty($this->params['expCat'])) {\n $catid = $this->params['expCat'];\n unset($this->params['expCat']);\n $this->params['expCat'][] = $catid;\n }", " $modelname = $this->basemodel_name;\n $this->$modelname->update($this->params);", " if ($this->isSearchable()) {\n $this->addContentToSearch($this->params);\n }", " // check for auto send facebook status\n if (!empty($this->params['send_status'])) {\n if ($this->classname == 'eventController') {\n facebookController::postEvent(\n array('model' => $modelname, 'id' => $this->params['date_id'], 'src' => $this->loc->src, 'config' => $this->config, 'orig_controller' => expModules::getControllerName($this->classname))\n );\n } else {\n facebookController::postStatus(\n array('model' => $modelname, 'id' => $this->$modelname->id, 'src' => $this->loc->src, 'config' => $this->config, 'orig_controller' => expModules::getControllerName($this->classname))\n );\n }\n }", " // check for auto send tweet\n if (!empty($this->params['send_tweet'])) {\n if ($this->classname == 'eventController') {\n twitterController::postEventTweet(\n array('model' => $modelname, 'id' => $this->params['date_id'], 'src' => $this->loc->src, 'config' => $this->config, 'orig_controller' => expModules::getControllerName($this->classname))\n );\n } else {\n twitterController::postTweet(\n array('model' => $modelname, 'id' => $this->$modelname->id, 'src' => $this->loc->src, 'config' => $this->config, 'orig_controller' => expModules::getControllerName($this->classname))\n );\n }\n }", " // check for eAlerts\n if (!empty($this->params['send_ealerts'])) {\n redirect_to(array('controller' => 'ealert', 'action' => 'send_confirm', 'model' => $modelname, 'id' => $this->$modelname->id, 'src' => $this->loc->src, 'orig_controller' => expModules::getControllerName($this->classname)));\n } else {\n expHistory::back();\n }\n }", " /**\n * delete item in module\n */\n public function delete() {\n $modelname = $this->basemodel_name;\n if (empty($this->params['id'])) {\n flash('error', gt('Missing id for the') . ' ' . $modelname . ' ' . gt('you would like to delete'));\n expHistory::back();\n }", " $obj = new $modelname($this->params['id']);\n $rows = $obj->delete();", " // if this module is searchable lets delete spidered content\n if ($this->isSearchable()) {\n $search = new search();\n// $content = $search->find('first', 'original_id=' . $this->params['id'] . \" AND ref_module='\" . $this->classname . \"'\");\n $content = $search->find('first', 'original_id=' . $this->params['id'] . \" AND ref_module='\" . $this->baseclassname . \"'\");\n if (!empty($content->id)) $content->delete();\n }", " expHistory::back();\n }", " /**\n * rerank items in model\n */\n public function rerank() {\n $modelname = $this->basemodel_name;\n $obj = new $modelname($this->params['id']);\n $obj->rerank($this->params['push']);\n expHistory::back();\n }", " /**\n * display module management view\n */\n public function manage() {\n expHistory::set('manageable', $this->params);", " $page = new expPaginator(array(\n 'model' => $this->basemodel_name,\n 'where' => static::hasSources() ? $this->aggregateWhereClause() : null,\n 'limit' => isset($this->params['limit']) ? $this->params['limit'] : 10,\n 'order' => isset($this->params['order']) ? $this->params['order'] : null,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->baseclassname,\n 'action' => $this->params['action'],\n 'src' => static::hasSources() == true ? $this->loc->src : null,\n 'columns' => array(\n gt('ID#') => 'id',\n gt('Title') => 'title',\n gt('Body') => 'body'\n ),\n ));", " assign_to_template(array(\n 'page' => $page,\n 'items' => $page->records\n ));\n }", " /**\n * rerank module items, called from ddrerank\n */\n public function manage_ranks() {\n $rank = 1;\n foreach ($this->params['rerank'] as $id) {\n $modelname = $this->params['model'];\n $obj = new $modelname($id);\n $obj->rank = $rank;\n $obj->save(false, true);\n $rank++;\n }", " if (!expJavascript::inAjaxAction())\n redirect_to($this->params['lastpage']);\n }", " /**\n * Configure the module\n */\n public function configure() {\n global $db;", " expHistory::set('editable', $this->params);\n $views = expTemplate::get_config_templates($this, $this->loc);", " // needed for aggregation list\n $pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc);\n $page = new expPaginator(array(\n 'records' => $pullable_modules,\n 'controller' => $this->loc->mod,\n 'action' => $this->params['action'],\n 'order' => isset($this->params['order']) ? $this->params['order'] : 'section',\n 'dir' => isset($this->params['dir']) ? $this->params['dir'] : '',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'columns' => array(\n gt('Title') => 'title',\n gt('Page') => 'section'\n ),\n ));", "// if (empty($this->params['hcview'])) {\n $containerloc = expCore::makeLocation(expModules::getModuleName($this->loc->mod),$this->loc->src);\n $container = $db->selectObject('container', \"internal='\" . serialize($containerloc) . \"'\");\n if (empty($container)) {\n $container = new stdClass();\n $container->action = 'showall';\n } else {\n $container->internal = unserialize($container->internal);\n }\n if (empty($container->action)) {\n $container->action = 'showall';\n }\n// expSession::clearAllUsersSessionCache('containermodule');", "// $modules_list = expModules::getActiveModulesAndControllersList();\n// foreach ($modules_list as $moduleclass) {\n// $module = new $moduleclass();\n//\n// // Get basic module meta info\n// $mod = new stdClass();\n// $mod->name = $module->name();\n// $mod->author = $module->author();\n// $mod->description = $module->description();\n// if (isset($container->view) && $container->internal->mod == $moduleclass) {\n// $mod->defaultView = $container->view;\n// } else $mod->defaultView = DEFAULT_VIEW;\n//\n// // Get support flags\n// $mod->supportsSources = ($module->hasSources() ? 1 : 0);\n// $mod->supportsViews = ($module->hasViews() ? 1 : 0);\n//\n// // Get a list of views\n// $mod->views = expTemplate::listModuleViews($moduleclass);\n// natsort($mod->views);\n//\n// $modules[$moduleclass] = $mod;\n//// \t\t$mods[$moduleclass] = $module->name();\n// // $mods[$moduleclass] = $moduleclass::name();\n// }", "// array_multisort(array_map('strtolower', $mods), $mods);", " $actions = $this->useractions;\n $mod_views = array();\n if (!empty($actions)) {\n // Language-ize the action names\n foreach ($actions as $key => $value) {\n $actions[$key] = gt($value);\n }\n $mod_views = expTemplate::get_action_views($this->classname, $container->action, $actions[$container->action]);\n if (count($mod_views) < 1) $mod_views[$container->action] = $actions[$container->action] . ' - Default View';\n }", " assign_to_template(array(\n 'container' => $container,\n 'actions' => $actions,\n 'mod_views' => $mod_views,\n ));\n// } else {\n if (!empty($this->params['hcview'])) {\n // this must be a hard-coded module?\n assign_to_template(array(\n 'hcview' => $this->params['hcview'],\n ));\n }", " $expcat = new expCat();\n $cats = $expcat->find('all','module=\"file\"');\n $folders = array();\n $folders[] = 'Root Folder';\n foreach ($cats as $cat) {\n $folders[$cat->id] = $cat->title;\n }", " assign_to_template(array(\n// 'config' => $this->config, //FIXME already assigned in controllertemplate?\n 'page' => $page, // needed for aggregation list\n 'views' => $views,\n 'title' =>static::displayname(),\n 'current_section' => expSession::get('last_section'),\n// 'classname' => $this->classname, //FIXME $controller already assigned baseclassname (short vs long) in controllertemplate?\n 'viewpath' => $this->viewpath,\n 'relative_viewpath' => $this->relative_viewpath,\n 'folders' => $folders,\n ));", " }", " /**\n * save module configuration\n */\n public function saveconfig() {\n global $db;", " // update module title/action/view\n if (!empty($this->params['container_id'])) {\n $container = $db->selectObject('container', \"id=\" . $this->params['container_id']);\n if (!empty($container)) {\n $container->title = $this->params['moduletitle'];\n $container->action = $this->params['actions'];\n $container->view = $this->params['views'];\n $container->is_private = $this->params['is_private'];\n $db->updateObject($container, 'container');\n expSession::clearAllUsersSessionCache('containermodule');\n }\n unset(\n $this->params['container_id'],\n $this->params['moduletitle'],\n $this->params['modcntrol'],\n $this->params['actions'],\n $this->params['views'],\n $this->params['actions'],\n $this->params['is_private']\n );\n }", " // create a new RSS object if enable is checked.\n $params = $this->params;\n if (!empty($this->params['enable_rss'])) {\n $params['title'] = $params['feed_title'];\n unset($params['feed_title']);\n $params['sef_url'] = $params['feed_sef_url'];\n unset($params['feed_sef_url']);\n $rssfeed = new expRss($params);\n $rssfeed->update($params);\n $this->params['feed_sef_url'] = $rssfeed->sef_url;\n } else {\n $rssfeed = new expRss($this->params);\n $params['enable_rss'] = false;\n if (empty($params['advertise']))\n $params['advertise'] = false;\n $params['title'] = $params['feed_title'];\n unset($params['feed_title']);\n $params['sef_url'] = $params['feed_sef_url'];\n unset($params['feed_sef_url']);\n if (!empty($rssfeed->id)) { // do NOT create a new record, only update existing ones\n $rssfeed->update($params);\n $this->params['feed_sef_url'] = $rssfeed->sef_url;\n }\n }", " // create a new eAlerts object if enable is checked.\n if (!empty($this->params['enable_ealerts'])) {\n $ealert = new expeAlerts($this->params);\n $ealert->update($this->params);\n }", " // unset some unneeded params\n unset(\n $this->params['module'],\n $this->params['controller'],\n $this->params['src'],\n $this->params['int'],\n $this->params['id'],\n $this->params['cid'],\n $this->params['action'],\n $this->params['PHPSESSID'],\n $this->params['__utma'],\n $this->params['__utmb'],\n $this->params['__utmc'],\n $this->params['__utmz'],\n $this->params['__utmt'],\n $this->params['__utmli'],\n $this->params['__cfduid']\n );", " // setup and save the config\n $config = new expConfig($this->loc);\n $config->update(array('config' => $this->params));", " flash('message', gt('Configuration updated'));\n expHistory::back();\n }", " /**\n * get the module's items in an rss feed format\n *\n * this function is very general and will most of the time need to be overwritten and customized\n *\n * @return array\n */\n public function getRSSContent($limit = 0) {\n $class = new $this->basemodel_name;\n $items = $class->find('all', $this->aggregateWhereClause(), isset($this->config['order']) ? $this->config['order'] : 'created_at DESC', $limit);", " //Convert the items to rss items\n $rssitems = array();\n foreach ($items as $key => $item) {\n $rss_item = new FeedItem();\n $rss_item->title = expString::convertSmartQuotes($item->title);\n $rss_item->link = $rss_item->guid = makeLink(array('controller' => $this->baseclassname, 'action' => 'show', 'title' => $item->sef_url));\n $rss_item->description = expString::convertSmartQuotes($item->body);\n $rss_item->author = user::getUserById($item->poster)->firstname . ' ' . user::getUserById($item->poster)->lastname;\n $rss_item->authorEmail = user::getEmailById($item->poster);\n// $rss_item->date = isset($item->publish_date) ? date(DATE_RSS, $item->publish_date) : date(DATE_RSS, $item->created_at);\n $rss_item->date = isset($item->publish_date) ? $item->publish_date : $item->created_at;\n if (!empty($item->expCat[0]->title)) $rss_item->category = array($item->expCat[0]->title);\n $comment_count = expCommentController::countComments(array('content_id' => $item->id, 'content_type' => $this->basemodel_name));\n if ($comment_count) {\n $rss_item->comments = makeLink(array('controller' => $this->baseclassname, 'action' => 'show', 'title' => $item->sef_url)) . '#exp-comments';\n// $rss_item->commentsRSS = makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$item->sef_url)).'#exp-comments';\n $rss_item->commentsCount = $comment_count;\n }\n $rssitems[$key] = $rss_item;", " if ($limit && count($rssitems) >= $limit)\n break;\n }\n return $rssitems;\n }", " /**\n * method to display an rss feed from this module\n */\n public function rss() {\n require_once(BASE . 'external/feedcreator.class.php');\n", " $id = isset($this->params['title']) ? $this->params['title'] : (isset($this->params['id']) ? $this->params['id'] : null);", " if (empty($id)) {\n $module = !empty($this->params['module']) ? $this->params['module'] : $this->params['controller'];\n $id = array('module' => $module, 'src' => $this->params['src']);\n }\n $site_rss = new expRss($id);\n if ($site_rss->enable_rss == true && !empty($site_rss->id)) {\n $site_rss->title = empty($site_rss->title) ? gt('RSS for') . ' ' . URL_FULL : $site_rss->title;\n $site_rss->feed_desc = empty($site_rss->feed_desc) ? gt('This is an RSS syndication from') . ' ' . HOSTNAME : $site_rss->feed_desc;\n// if (isset($site_rss->rss_cachetime)) {\n// $ttl = $site_rss->rss_cachetime;\n// }\n if ($site_rss->rss_cachetime == 0) {\n $site_rss->rss_cachetime = 1440;\n }", " if (!empty($site_rss->itunes_cats)) {\n $ic = explode(\";\", $site_rss->itunes_cats);\n $x = 0;\n $itunes_cats = array();\n foreach ($ic as $cat) {\n $cat_sub = explode(\":\", $cat);\n $itunes_cats[$x]->category = $cat_sub[0];\n if (isset($cat_sub[1])) {\n $itunes_cats[$x]->subcategory = $cat_sub[1];\n }\n $x++;\n }\n }", " // NO buffering from here on out or things break unexpectedly. - RAM\n ob_end_clean();", " header('Content-Type: ' . 'application/rss+xml');\n// header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n// header('Content-Transfer-Encoding: binary');\n header('Content-Encoding:');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n header('Vary: User-Agent');\n } else {\n header('Pragma: no-cache');\n }", " if ($site_rss->rss_is_podcast) {\n $feed_type = \"PODCAST\";\n } else {\n $feed_type = \"RSS2.0\";\n }\n $feed_cache = BASE . 'tmp/rsscache/' . $site_rss->sef_url . '.xml';", " $rss = new UniversalFeedCreator();\n// if (file_exists(THEME_ABSOLUTE . \"rss/feed.css\")) // custom css style\n// $rss->cssStyleSheet = THEME_RELATIVE . \"rss/feed.css\";\n if (file_exists(THEME_ABSOLUTE . \"rss/feed.xsl\")) // custom xml style\n $rss->xslStyleSheet = THEME_RELATIVE . \"rss/feed.xsl\";\n $rss->useCached($feed_type, $feed_cache, $site_rss->rss_cachetime); // if cache exists output then redirect", " $rss->title = $site_rss->title;\n if (!empty($this->params['type']))\n $rss->title .= ' ' . ucfirst($this->params['type']);\n $rss->description = $site_rss->feed_desc;\n $rss->image = new FeedImage();\n $rss->image->url = !empty($site_rss->expFile['album'][0]) ? $site_rss->expFile['album'][0]->url : URL_FULL . 'themes/' . DISPLAY_THEME . '/images/logo.png';\n $rss->image->title = $site_rss->title;\n $rss->image->link = URL_FULL;\n // $rss->image->width = 64;\n // $rss->image->height = 64;\n $rss->ttl = $site_rss->rss_cachetime;\n $rss->link = URL_FULL;\n $rss->language = LOCALE;\n $rss->syndicationURL = makeLink(array('module'=>$site_rss->module, 'src'=>$site_rss->src));\n if ($site_rss->rss_is_podcast) {\n $rss->itunes = new iTunes();\n $rss->itunes->author = !empty($site_rss->feed_artist) ? $site_rss->feed_artist : ORGANIZATION_NAME;\n $rss->itunes->image = !empty($site_rss->expFile['album'][0]) ? $site_rss->expFile['album'][0]->url :URL_FULL . 'themes/' . DISPLAY_THEME . '/images/logo.png';\n $rss->itunes->summary = $site_rss->feed_desc;\n if (!empty($itunes_cats)) {\n $rss->itunes->category = $itunes_cats[0]->category;\n $rss->itunes->subcategory = $itunes_cats[0]->subcategory;\n }\n //\t\t$rss->itunes->explicit = 0;\n// $rss->itunes->subtitle = $site_rss->title;\n $rss->itunes->subtitle = $site_rss->feed_desc;\n //\t\t$rss->itunes->keywords = 0;\n $rss->itunes->owner_email = SMTP_FROMADDRESS;\n $rss->itunes->owner_name = ORGANIZATION_NAME;\n }", " $pubDate = '';\n $site_rss->params = $this->params;\n foreach ($site_rss->getFeedItems($site_rss->rss_limit) as $item) {\n if ($item->date > $pubDate) {\n $pubDate = $item->date;\n }\n $rss->addItem($item);\n }\n if (!empty($site_rss->rss_limit)) {\n $rss->items = array_slice($rss->items, 0, $site_rss->rss_limit);\n }\n $rss->pubDate = $pubDate;", "// echo $rss->createFeed($feed_type);\n echo $rss->saveFeed($feed_type, $feed_cache, $site_rss->rss_cachetime); // does redirect after updating cache\n } else {\n flash('notice', gt(\"This RSS feed is not available.\"));\n expHistory::back();\n }", " //Read the file out directly\n exit();\n }", " /**\n * download a file attached to item\n */\n public function downloadfile() {\n if (!isset($this->config['allowdownloads']) || $this->config['allowdownloads'] == true) {\n //if ($db->selectObject('content_expFiles', 'content_type=\"'.$this->baseclassname.'\" AND expfiles_id='.$this->params['id']) != null) {\n expFile::download($this->params['id']);\n //}\n } else {\n flash('error', gt('Downloads have not been enabled for this file'));\n expHistory::back();\n }", " }", " /**", " * permission functions to aggregate a module's permissions based on add/remove permissions", " *\n * @return array\n */\n public function permissions() {\n //set the permissions array\n $perms = array();\n foreach ($this->permissions as $perm => $name) {\n if (!in_array($perm, $this->remove_permissions)) $perms[$perm] = $name;\n }\n $perms = array_merge($perms, $this->add_permissions);", "", " return $perms;\n }", " // create a psuedo global permission specific to the module; return true grants permission, false continues with other permission checks\n public static function checkPermissions($permission, $location) {\n return false;\n }", " /**\n * get the model(s) associated with this module\n *\n * @return array\n */\n public function getModels() {\n return isset($this->models) ? $this->models : array($this->basemodel_name);\n }", " /**\n * type of items searched in the module\n *\n * @return string\n */\n public function searchName() {\n return static::displayname();\n }", " /**\n * category of items searched in the module\n *\n * @return string\n */\n public function searchCategory() {\n return $this->basemodel_name;\n }", " /**\n * add module items to search index\n *\n * @return int\n */\n public function addContentToSearch() {\n// global $db, $router;\n global $db;", " $count = 0;\n $model = new $this->basemodel_name(null, false, false);\n $where = (!empty($this->params['id'])) ? 'id=' . $this->params['id'] : null;\n $content = $db->selectArrays($model->tablename, $where);\n foreach ($content as $cnt) {\n $origid = $cnt['id'];\n unset($cnt['id']);\n //build the search record and save it.\n// $sql = \"original_id=\" . $origid . \" AND ref_module='\" . $this->classname . \"'\";\n $sql = \"original_id=\" . $origid . \" AND ref_module='\" . $this->baseclassname . \"'\";\n $oldindex = $db->selectObject('search', $sql);\n if (!empty($oldindex)) {\n $search_record = new search($oldindex->id, false, false);\n $search_record->update($cnt);\n } else {\n $search_record = new search($cnt, false, false);\n }", " //build the search record and save it.\n $search_record->original_id = $origid;\n $search_record->posted = empty($cnt['created_at']) ? null : $cnt['created_at'];\n // get the location data for this content\n if (isset($cnt['location_data']))\n $loc = expUnserialize($cnt['location_data']);\n $src = isset($loc->src) ? $loc->src : null;\n if (!empty($cnt['sef_url'])) {\n $link = str_replace(URL_FULL, '', makeLink(array('controller' => $this->baseclassname, 'action' => 'show', 'title' => $cnt['sef_url'])));\n } else {\n $link = str_replace(URL_FULL, '', makeLink(array('controller' => $this->baseclassname, 'action' => 'show', 'id' => $origid, 'src' => $src)));\n }\n//\t if (empty($search_record->title)) $search_record->title = 'Untitled';\n $search_record->view_link = $link;\n// $search_record->ref_module = $this->classname;\n $search_record->ref_module = $this->baseclassname;\n $search_record->category = $this->searchName();\n $search_record->ref_type = $this->searchCategory();\n $search_record->save();\n $count++;\n }", " return $count;\n }", " /**\n * additional check for display of search hit\n *\n * @param $record\n *\n * @return bool\n */\n public static function searchHit($record) {\n return true; // default is to display search hit\n }", " /**\n * remove all module items from search index\n */\n public function delete_search() {\n global $db;\n // remove this modules entries from the search table.\n if ($this->isSearchable()) {\n// $where = \"ref_module='\" . $this->classname . \"' AND location_data='\" . serialize($this->loc) . \"'\";\n $where = \"ref_module='\" . $this->baseclassname . \"' AND location_data='\" . serialize($this->loc) . \"'\";\n// $test = $db->selectObjects('search', $where);\n $db->delete('search', $where);\n }\n }", " /**\n * delete module and all its items for backwards compat with old modules\n *\n * @param $loc\n */\n public function delete_In($loc) {\n $this->delete_instance($loc);\n }", " /**\n * delete module, config, and all its items\n * @param bool $loc\n */\n public function delete_instance($loc = false) {\n $model = new $this->basemodel_name();\n $where = 1;\n if ($loc || static::hasSources())\n $where = \"location_data='\" . serialize($this->loc) . \"'\";\n $items = $model->find('all',$where);\n foreach ($items as $item) {\n $item->delete(); // model should delete attachments and other associated objects\n }\n $cfg = new expConfig($this->loc);\n $cfg->delete();\n }", " /**\n * get the metainfo for this module\n *\n * @return array\n */\n public function metainfo() {\n global $router;", " if (empty($router->params['action'])) return false;", " // figure out what metadata to pass back based on the action we are in.\n $action = $router->params['action'];\n $metainfo = array('title' => '', 'keywords' => '', 'description' => '', 'canonical' => '', 'noindex' => false, 'nofollow' => false);\n $modelname = $this->basemodel_name;", " switch ($action) {\n case 'showall':\n $metainfo['title'] = gt(\"Showing\") . \" \" . static::displayname() . ' - ' . SITE_TITLE;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n break;\n case 'show':\n case 'showByTitle':\n // look up the record.\n if (isset($router->params['id']) || isset($router->params['title'])) {\n $lookup = isset($router->params['id']) ? $router->params['id'] : $router->params['title'];\n $object = new $modelname($lookup);\n // set the meta info\n if (!empty($object)) {\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n if (!empty($object->expTag)) {\n $keyw = '';\n foreach ($object->expTag as $tag) {\n if (!empty($keyw)) $keyw .= ', ';\n $keyw .= $tag->title;\n }\n } else {\n $keyw = SITE_KEYWORDS;\n }\n $metainfo['title'] = empty($object->meta_title) ? $object->title : $object->meta_title;\n $metainfo['keywords'] = empty($object->meta_keywords) ? $keyw : $object->meta_keywords;\n $metainfo['description'] = empty($object->meta_description) ? $desc : $object->meta_description;\n// $metainfo['canonical'] = empty($object->canonical) ? URL_FULL.substr($router->sefPath, 1) : $object->canonical;\n $metainfo['canonical'] = empty($object->canonical) ? $router->plainPath() : $object->canonical;\n $metainfo['noindex'] = empty($object->meta_noindex) ? false : $object->meta_noindex;\n $metainfo['nofollow'] = empty($object->meta_nofollow) ? false : $object->meta_nofollow;\n $metainfo['rich'] = $this->meta_rich($router->params, $object);\n $metainfo['fb'] = $this->meta_fb($router->params, $object, $metainfo['canonical']);\n $metainfo['tw'] = $this->meta_tw($router->params, $object, $metainfo['canonical']);\n }\n break;\n }\n default:\n //check for a function in the controller called 'action'_meta and use it if so\n $functionName = $action . \"_meta\";\n $mod = new $this->classname;\n if (method_exists($mod, $functionName)) {\n $metainfo = $mod->$functionName($router->params);\n } else {\n $metainfo['title'] = static::displayname() . \" - \" . SITE_TITLE;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n// $metainfo['canonical'] = URL_FULL.substr($router->sefPath, 1);\n $metainfo['canonical'] = $router->plainPath();\n }\n }", " return $metainfo;\n }", " /**\n * Returns rich snippet PageMap meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_rich($request, $object) {\n return null;\n }", " /**\n * Returns Facebook og: meta data\n *\n * @param $request\n * @param $object\n *\n * @return array\n */\n public function meta_fb($request, $object, $canonical) {\n return array();\n }", " /**\n * Returns Twitter twitter: meta data\n *\n * @param $request\n * @param $object\n *\n * @return array\n */\n public function meta_tw($request, $object, $canonical) {\n return array();\n }", " /**\n * action specific metainfo\n *\n * @param $request\n * @return array\n */\n public function showall_by_tags_meta($request) {\n global $router;", " // look up the record.\n if (isset($request['tag'])) {\n $metainfo = array('title' => '', 'keywords' => '', 'description' => '', 'canonical' => '', 'noindex' => false, 'nofollow' => false);\n $tag = $request['tag'];\n // set the meta info\n $metainfo['title'] = gt('Showing all') . ' ' . ucwords($this->basemodel_name) . ' ' . gt('tagged as') . ' ' . $tag;\n// $metainfo['keywords'] = empty($object->meta_keywords) ? SITE_KEYWORDS : $object->meta_keywords; //FIXME $object not set\n $metainfo['keywords'] = $request['tag'];\n// $metainfo['description'] = empty($object->meta_description) ? SITE_DESCRIPTION : $object->meta_description; //FIXME $object not set\n $metainfo['description'] = SITE_DESCRIPTION;\n// $metainfo['canonical'] = empty($object->canonical) ? URL_FULL . substr($router->sefPath, 1) : $object->canonical; //FIXME $object not set\n// $metainfo['canonical'] = URL_FULL . substr($router->sefPath, 1);\n $metainfo['canonical'] = $router->plainPath();\n return $metainfo;\n }\n return null;\n }", " /**\n * action specific metainfo\n *\n * @param $request\n * @return array\n */\n public function showall_by_date_meta($request) {\n global $router;", " // look up the record.\n if (isset($request['month'])) {\n $metainfo = array('title' => '', 'keywords' => '', 'description' => '', 'canonical' => '', 'noindex' => false, 'nofollow' => false);\n $mk = mktime(0, 0, 0, $request['month'], 01, $request['year']);\n $ts = strftime('%B, %Y', $mk);\n // set the meta info\n $metainfo['title'] = gt('Showing all') . ' ' . ucwords($this->basemodel_name) . ' ' . gt('written in') . ' ' . $ts;\n// $metainfo['keywords'] = empty($object->meta_keywords) ? SITE_KEYWORDS : $object->meta_keywords; //FIXME $object not set\n $metainfo['keywords'] = SITE_KEYWORDS;\n// $metainfo['description'] = empty($object->meta_description) ? SITE_DESCRIPTION : $object->meta_description; //FIXME $object not set\n $metainfo['description'] = SITE_DESCRIPTION;\n// $metainfo['canonical'] = empty($object->canonical) ? URL_FULL . substr($router->sefPath, 1) : $object->canonical; //FIXME $object not set\n// $metainfo['canonical'] = URL_FULL . substr($router->sefPath, 1);\n $metainfo['canonical'] = $router->plainPath();\n return $metainfo;\n }\n return null;\n }", " /**\n * approve module item\n */\n public function approve() {\n $modelname = $this->basemodel_name;\n $lookup = isset($this->params['id']) ? $this->params['id'] : $this->params['title'];\n $object = new $modelname($lookup);\n $object->approved = true;\n $object->save(false, true); // we don't want to add this approval as a new revision\n expHistory::back();\n }", " /**\n * The aggregateWhereClause function creates a sql where clause which also includes aggregated module content\n *\n * @param string $type\n *\n * @return string\n */\n public function aggregateWhereClause($type='') {\n global $user;", " $sql = '';", " if (empty($this->config['add_source']) && !static::hasSources()) {\n return $sql;\n }", " if (!empty($this->config['aggregate'])) $sql .= '(';", " $sql .= \"location_data ='\" . serialize($this->loc) . \"'\";", " if (!empty($this->config['aggregate'])) {\n foreach ($this->config['aggregate'] as $src) {\n $loc = expCore::makeLocation($this->baseclassname, $src);\n $sql .= \" OR location_data ='\" . serialize($loc) . \"'\";\n }", " $sql .= ')';\n }\n $model = $this->basemodel_name;\n if (ENABLE_WORKFLOW && $this->$model->needs_approval) {\n if ($user->id) {\n $sql .= ' AND (approved=1 OR poster=' . $user->id . ' OR editor=' . $user->id . ')';\n } else {\n $sql .= ' AND approved=1';\n }\n }", " return $sql;\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expController\n *\n * @package Core\n * @subpackage Controllers\n */", "abstract class expController {\n protected $classname = ''; // full controller name w/ 'Controller' suffix\n public $baseclassname = ''; // root controller name w/o 'Controller' suffix\n public $classinfo = null; // holds reflection class of class\n// public $module_name = ''; //FIXME not used and not actually set right index needed of -3 instead of -2 below\n// protected $basemodel = null; //FIXME never used, $basemodel_name replaced?\n public $basemodel_name = ''; // holds classname of base model associated w/ this controller\n public $model_table = ''; // holds table name for base model", " public $useractions = array(); // available (displayed) user actions/methods for this module\n public $remove_configs = array(); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)", " // $permissions used to restrict access to module's actions/methods\n protected $permissions = array( // standard set of permissions for all modules unless add'ed or remove'd\n 'manage' => 'Manage',\n 'configure' => 'Configure',\n 'create' => 'Create',\n 'edit' => 'Edit',\n 'delete' => 'Delete',", " );\n protected $m_permissions = array( // standard set of actions requiring manage permission for all modules\n 'activate' => 'Activate',\n 'approve' => 'Approve',\n 'merge' => 'Merge',\n 'rerank' => 'ReRank',\n 'import' => 'Import Items',\n 'export' => 'Export Items'", " );\n protected $remove_permissions = array(); // $permissions not applicable for this module from above list", " protected $add_permissions = array(); // additional $permissions processed and visible for this module\n protected $manage_permissions = array(); // additional actions requiring manage permission in addition to $m_permissions\n public $requires_login = array(); // actions/methods which ONLY require user be logged in to access...$permissions take priority", "\n public $filepath = ''; // location of this controller's files\n public $viewpath = ''; // location of this controllers views; defaults to controller file location\n public $relative_viewpath = ''; // relative location of controller's views\n public $asset_path = ''; // location of this controller's assets; defaults to controller file location", " public $config = array(); // holds module configuration settings\n public $params = array(); // holds sanitized parameters passed to module\n public $loc = null; // module location object", " public $codequality = 'stable'; // code's level of stability", " public $rss_is_podcast = false;", " /**\n * @param null $src\n * @param array $params\n *\n * @return expController\n *\n */\n public function __construct($src = null, $params = array()) {\n // setup some basic information about this class\n $this->classinfo = new ReflectionClass($this);\n $this->classname = $this->classinfo->getName();\n $this->baseclassname = substr($this->classinfo->getName(), 0, -10);\n $this->filepath = __realpath($this->classinfo->getFileName());", " // figure out which \"module\" we belong to and setup view path information\n $controllerpath = explode('/', $this->filepath);\n// $this->module_name = $controllerpath[(count($controllerpath)-3)];", " // set up the path to this module view files\n array_pop($controllerpath); // remove 'controllers' from array\n $controllerpath[count($controllerpath) - 1] = 'views';\n array_push($controllerpath, $this->baseclassname);\n $this->relative_viewpath = implode('/', array_slice($controllerpath, -3, 3));\n// $this->viewpath = BASE.'framework/modules/'.$this->relative_viewpath;\n //FIXME this requires we move the 'core' controllers into the modules folder or use this hack\n $depth = array_search('core', $controllerpath);\n if ($depth) {\n $this->viewpath = BASE . 'framework/modules/' . $this->relative_viewpath;\n } else {\n $this->viewpath = implode('/', $controllerpath);\n }", " //grab the path to the module's assets\n array_pop($controllerpath);\n $controllerpath[count($controllerpath) - 1] = 'assets';\n// $this->asset_path = PATH_RELATIVE.'framework/'.implode('/', array_slice($controllerpath, -3, 3)).\"/\";\n $depth = array_search('framework', $controllerpath); // is this a system file (or theme)?\n if (!$depth) $depth = array_search('themes', $controllerpath);\n $this->asset_path = PATH_RELATIVE . implode('/', array_slice($controllerpath, $depth)) . \"/\";", " // figure out which model we're using and setup some info about it\n if (empty($this->basemodel_name)) $this->basemodel_name = get_model_for_controller($this->classname);\n $modelname = $this->basemodel_name;\n if (class_exists($modelname)) {\n $this->$modelname = new $modelname(null, false, false);\n $this->model_table = $this->$modelname->tablename;\n } else {\n $this->basemodel_name = 'expRecord';\n $this->$modelname = new expRecord(null, false, false);\n $this->model_table = null;\n }", " // set the location data\n $this->loc = expCore::makeLocation($this->baseclassname, $src, null);", " // flag for needing approval check\n if (ENABLE_WORKFLOW && $this->$modelname->supports_revisions) {\n $uilevel = 99;\n if (expSession::exists(\"uilevel\")) $uilevel = expSession::get(\"uilevel\");\n if (!expPermissions::check('approve', $this->loc)) {\n $this->$modelname->needs_approval = true;\n } elseif ($uilevel == UILEVEL_PREVIEW && isset($uilevel)) {\n $this->$modelname->needs_approval = true; // 'preview' should provide a true preview\n }\n }", " // get this controllers config data if there is any\n $config = new expConfig($this->loc);\n $this->config = $config->config;", " $this->params = $params;", " if (ENABLE_WORKFLOW)\n $this->permissions = array_merge($this->permissions, array('approve'=>'Approval'));", " }", " /**\n * name of module for backwards compat with old modules\n *\n * @return string\n */\n public function name() {\n return static::displayname();\n }", " /**\n * name of module\n *\n * @return string\n */\n public static function displayname() {\n return gt(\"Exponent Base Controller\");\n }", " /**\n * description of module\n *\n * @return string\n */\n public static function description() {\n return gt(\"This is the base controller which most Exponent modules inherit their methods from.\");\n }", " /**\n * author of module\n *\n * @return string\n */\n public static function author() {\n return \"OIC Group, Inc\";\n }", " /**\n * does module have sources available? or does it treat content globally\n *\n * @return bool\n */\n public static function hasSources() {\n return true;\n }", " /**\n * does module have views available?\n *\n * @return bool\n */ //NOTE: Never used - equivalent to !empty ($this->useractions) via expModules::listUserRunnableControllers()?\n public static function hasViews() {\n return true;\n }", " /**\n * does module have content (stored items) available?\n *\n * @return bool\n */ //NOTE: Never used, better utilized/implemented as isSearchable()\n public static function hasContent() {\n return true;\n }", " /**\n * does module support workflow?\n *\n * @return bool\n */\n public static function supportsWorkflow() {\n return false;\n }", " /**\n * is module content searchable? should it be added to search index?\n *\n * @return bool\n */\n public static function isSearchable() {\n return false;\n }", " /**\n * can this module import data?\n *\n * @return bool\n */\n public static function canImportData() {\n return false;\n }", " /**\n * can this module export data?\n *\n * @return bool\n */\n public static function canExportData() {\n return false;\n }", " /**\n * does this module require configuration?\n *\n * @return bool\n */ //NOTE: Never Used\n public static function requiresConfiguration() {\n return false;\n }", " /**\n * glue to make the view template aware of the module\n * @deprecated\n */\n public function moduleSelfAwareness() {\n assign_to_template(array(\n 'asset_path' => $this->asset_path,\n 'model_name' => $this->basemodel_name,\n 'table' => $this->model_table,\n 'controller' => $this->baseclassname,\n 'config' => $this->config\n ));\n }", " /**\n * default module view method for all items\n */\n public function showall() {\n expHistory::set('viewable', $this->params);", " $page = new expPaginator(array(\n 'model' => $this->basemodel_name,\n 'where' => static::hasSources() ? $this->aggregateWhereClause() : null,\n 'limit' => (isset($this->params['limit']) && $this->params['limit'] != '') ? $this->params['limit'] : 10,\n 'order' => isset($this->params['order']) ? $this->params['order'] : null,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->baseclassname,\n 'action' => $this->params['action'],\n 'src' => static::hasSources() == true ? $this->loc->src : null,\n 'columns' => array(\n gt('ID#') => 'id',\n gt('Title') => 'title',\n gt('Body') => 'body'\n ),\n ));", " assign_to_template(array(\n 'page' => $page,\n 'items' => $page->records\n ));\n }", " /**\n * default module view method for all items with a specific tag\n */\n public function showall_by_tags() {\n global $db;", " // set history\n expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;", " // get the tag being passed", " $tag = new expTag(expString::escape($this->params['tag']));", "\n // find all the id's of the portfolios for this module\n $item_ids = $db->selectColumn($modelname, 'id', $this->aggregateWhereClause());", " // find all the items that this tag is attached to\n $items = $tag->findWhereAttachedTo($modelname);", " // loop the items for this tag and find out which ones belong to this module\n $items_by_tags = array();\n foreach ($items as $item) {\n if (in_array($item->id, $item_ids)) $items_by_tags[] = $item;\n }", " // create a pagination object for the model and render the action\n $order = 'created_at DESC';\n $page = new expPaginator(array(\n 'records' => $items_by_tags,\n 'limit' => (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10,\n 'order' => $order,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->baseclassname,\n 'action' => $this->params['action'],\n 'src'=>$this->loc->src,\n 'columns' => array(\n gt('Title') => 'title'\n ),\n ));\n// $page->records = expSorter::sort(array('array'=>$page->records, 'sortby'=>'rank', 'order'=>'ASC', 'ignore_case'=>true));\n $page->records = expSorter::sort(array('array' => $page->records, 'sortby' => 'created_at', 'order' => 'DESC', 'ignore_case' => true));", " assign_to_template(array(\n 'page' => $page,\n 'items' => $page->records,", " 'moduletitle' => ucfirst($modelname) . ' ' . gt('items tagged with') . ' \"' . expString::escape($this->params['tag']) . '\"',", " 'rank' => ($order === 'rank') ? 1 : 0\n ));\n }", " /**\n * return all tags used by module's items\n */\n public function tags() {\n expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;", " $items = $this->$modelname->find('all', $this->aggregateWhereClause());\n $used_tags = array();\n foreach ($items as $item) {\n foreach ($item->expTag as $tag) {\n if (isset($used_tags[$tag->id])) {\n $used_tags[$tag->id]->count++;\n } else {\n $exptag = new expTag($tag->id);\n $used_tags[$tag->id] = $exptag;\n $used_tags[$tag->id]->count = 1;\n }\n }\n }", "// $order = isset($this->config['order']) ? $this->config['order'] : 'rank';\n// $used_tags = expSorter::sort(array('array'=>$used_tags,'sortby'=>'title', 'order'=>'ASC', 'ignore_case'=>true, 'rank'=>($order==='rank')?1:0));\n// $order = isset($this->config['order']) ? $this->config['order'] : 'title ASC';\n// $used_tags = expSorter::sort(array('array'=>$used_tags, 'order'=>$order, 'ignore_case'=>true, 'rank'=>($order==='rank')?1:0));\n $used_tags = expSorter::sort(array('array' => $used_tags, 'order' => 'count DESC', 'type' => 'a'));\n if (!empty($this->config['limit'])) $used_tags = array_slice($used_tags, 0, $this->config['limit']);\n $order = isset($this->config['order']) ? $this->config['order'] : 'title ASC';\n if ($order != 'hits') {\n $used_tags = expSorter::sort(array('array' => $used_tags, 'order' => $order, 'ignore_case' => true, 'rank' => ($order === 'rank') ? 1 : 0));\n }", " assign_to_template(array(\n 'tags' => $used_tags\n ));\n }", " /**\n * return all categories used by module's items\n */\n public function categories() {\n expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;", " $items = $this->$modelname->find('all', $this->aggregateWhereClause());\n $used_cats = array();\n $used_cats[0] = new stdClass();\n $used_cats[0]->id = 0;\n $used_cats[0]->title = !empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized');\n $used_cats[0]->count = 0;\n foreach ($items as $item) {\n if (!empty($item->expCat)) {\n if (isset($used_cats[$item->expCat[0]->id])) {\n $used_cats[$item->expCat[0]->id]->count++;\n } else {\n $expcat = new expCat($item->expCat[0]->id);\n $used_cats[$item->expCat[0]->id] = $expcat;\n $used_cats[$item->expCat[0]->id]->count = 1;\n }\n } else {\n $used_cats[0]->count++;\n }\n }", "// $order = isset($this->config['order']) ? $this->config['order'] : 'rank';\n// $used_cats = expSorter::sort(array('array'=>$used_cats,'sortby'=>'title', 'order'=>'ASC', 'ignore_case'=>true, 'rank'=>($order==='rank')?1:0));\n// $order = isset($this->config['order']) ? $this->config['order'] : 'title ASC';\n// $used_cats = expSorter::sort(array('array'=>$used_cats, 'order'=>$order, 'ignore_case'=>true, 'rank'=>($order==='rank')?1:0));\n $used_cats = expSorter::sort(array('array' => $used_cats, 'order' => 'count DESC', 'type' => 'a'));\n if (!empty($this->config['limit'])) $used_cats = array_slice($used_cats, 0, $this->config['limit']);\n $order = isset($this->config['order']) ? $this->config['order'] : 'title ASC';\n if ($order != 'count') {\n $used_cats = expSorter::sort(array('array' => $used_cats, 'order' => $order, 'ignore_case' => true, 'rank' => ($order === 'rank') ? 1 : 0));\n }", " assign_to_template(array(\n 'cats' => $used_cats\n ));\n }", " /**\n * return all comments used by module's items\n */\n public function comments() {\n\t expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;", " $items = $this->$modelname->find('all');\n $all_comments = array();\n // get all the blog comments\n foreach ($items as $item) {\n $more_comments = expCommentController::getComments(array('content_type'=>$modelname,'content_id'=>$item->id));\n if (!empty($more_comments)) {\n foreach ($more_comments as $next_comment) {\n $next_comment->ref = $item->title;\n $next_comment->sef_url = $item->sef_url;\n }\n $all_comments = array_merge($all_comments,$more_comments);\n }\n }\n // sort then limit all the blog comments\n $all_comments = expSorter::sort(array('array' => $all_comments, 'sortby' => 'created_at', 'order' => 'DESC', 'ignore_case' => true));\n $limit = (isset($this->config['headcount']) && $this->config['headcount'] != '') ? $this->config['headcount'] : 10;\n $comments = array_slice($all_comments,0,$limit);\n\t assign_to_template(array(\n 'comments'=>$comments,\n ));\n\t}", " /**\n * default view for individual item\n */\n public function show() {\n expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;", " // figure out if we're looking this up by id or title\n $id = null;\n if (isset($this->params['id'])) {\n $id = $this->params['id'];\n } elseif (isset($this->params['title'])) {", " $id = expString::escape($this->params['title']);", " }", " $record = new $modelname($id);\n if (empty($record->id))\n redirect_to(array('controller'=>'notfound','action'=>'page_not_found','title'=>$this->params['title']));", " $config = expConfig::getConfig($record->location_data);\n if (empty($this->config))\n $this->config = $config;\n if (empty($this->loc->src)) {\n $r_loc = expUnserialize($record->location_data);\n $this->loc = new stdClass();\n $this->loc->src = $r_loc->src;\n }", " assign_to_template(array(\n 'record' => $record,\n 'config' => $config\n ));\n }", " /**\n * view the item by referring to its title\n * @deprecated\n */\n public function showByTitle() {\n expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;\n // first we'll check to see if this matches the sef_url field...if not then we'll look for the\n // title field", " $this->params['title'] = expString::escape($this->params['title']); // escape title to prevent sql injection", " $record = $this->$modelname->find('first', \"sef_url='\" . $this->params['title'] . \"'\");\n if (!is_object($record)) {\n $record = $this->$modelname->find('first', \"title='\" . $this->params['title'] . \"'\");\n }\n $this->loc = unserialize($record->location_data);", " assign_to_template(array(\n 'record' => $record,\n ));\n }", " /**\n * view a random item\n */\n public function showRandom() {\n expHistory::set('viewable', $this->params);\n $where = static::hasSources() ? $this->aggregateWhereClause() : null;\n $limit = isset($this->params['limit']) ? $this->params['limit'] : 1;\n $order = 'RAND()';\n assign_to_template(array(\n 'items' => $this->text->find('all', $where, $order, $limit)\n ));\n }", " /**\n * view items referenced by tags\n * @deprecated\n */\n public function showByTags() {\n global $db;", " // set the history point for this action\n expHistory::set('viewable', $this->params);", " // setup some objects\n $tagobj = new expTag();\n $modelname = empty($this->params['model']) ? $this->basemodel_name : $this->params['model'];\n $model = new $modelname();", " // start building the sql query\n $sql = 'SELECT DISTINCT m.id FROM ' . $db->prefix . $model->tablename . ' m ';\n $sql .= 'JOIN ' . $db->prefix . $tagobj->attachable_table . ' ct ';\n $sql .= 'ON m.id = ct.content_id WHERE (';\n $first = true;", " if (isset($this->params['tags'])) {\n $tags = is_array($this->params['tags']) ? $this->params['tags'] : array($this->params['tags']);\n } elseif (isset($this->config['expTags'])) {\n $tags = $this->config['expTags'];\n } else {\n $tags = array();\n }", " foreach ($tags as $tagid) {\n $sql .= ($first) ? 'exptags_id=' . intval($tagid) : ' OR exptags_id=' . intval($tagid);\n $first = false;\n }\n $sql .= \") AND content_type='\" . $model->classname . \"'\";", " // get the objects and render the template\n $tag_assocs = $db->selectObjectsBySql($sql);\n $records = array();\n foreach ($tag_assocs as $assoc) {\n $records[] = new $modelname($assoc->id);\n }", " assign_to_template(array(\n 'items' => $records\n ));\n }", " /**\n * create an item in this module\n * @deprecated in favor of edit w/o id param\n */\n public function create() {\n $args = array('controller' => $this->params['controller'], 'action' => 'edit');\n //if (!empty($this->params['instance'])) $args['instance'] = $this->params['instance'];\n if (!empty($this->params['src'])) $args['src'] = $this->params['src'];\n redirect_to($args);\n }", " /**\n * edit item in module, also used to copy items\n */\n public function edit() {\n expHistory::set('editable', $this->params);\n $taglist = expTag::getAllTags();\n $modelname = $this->basemodel_name;\n// $record = isset($this->params['id']) ? $this->$modelname->find($this->params['id']) : new $modelname($this->params);\n if (isset($this->params['id'])) {\n if (!isset($this->params['revision_id'])) {\n $record = $this->$modelname->find($this->params['id']);\n } else {\n $currentrecord = $this->$modelname->find($this->params['id']);\n $records = $this->$modelname->find('revisions', $this->$modelname->identifier . '=' . intval($this->params['id']) . ' AND revision_id=' . intval($this->params['revision_id']));\n $record = $records[0];\n $record->current_revision_id = $currentrecord->revision_id;\n }\n } else {\n $record = new $modelname($this->params);\n }\n if (!empty($this->params['copy'])) {\n $record->id = null;\n if (isset($record->sef_url)) $record->sef_url = null;\n }\n assign_to_template(array(\n 'record' => $record,\n// 'table' => $this->$modelname->tablename,\n// 'controller' => $this->params['controller'],\n 'taglist' => $taglist\n ));\n }", " /**\n * merge/move aggregated item into this module\n */\n public function merge() {\n expHistory::set('editable', $this->params);\n $modelname = $this->basemodel_name;\n $record = $this->$modelname->find($this->params['id']);", " $loc = expUnserialize($record->location_data);\n $loc->src = $this->loc->src;\n $record->location_data = serialize($loc);\n// $this->$modelname->update($record);\n $record->update();", " expHistory::back();\n }", " /**\n * update (save) item in module\n */\n public function update() {\n global $db;", " //check for and handle tags\n if (array_key_exists('expTag', $this->params)) {\n if (isset($this->params['id'])) {\n $db->delete('content_expTags', 'content_type=\"' . (!empty($this->params['content_type']) ? $this->params['content_type'] : $this->basemodel_name) . '\" AND content_id=' . $this->params['id']);\n }\n $tags = explode(\",\", trim($this->params['expTag']));\n unset($this->params['expTag']);", " foreach ($tags as $tag) {\n if (!empty($tag)) {\n $tag = strtolower(trim($tag));\n $tag = str_replace(array('\"', \"'\"), \"\", $tag); // strip double and single quotes\n if (!empty($tag)) {\n $expTag = new expTag($tag);\n if (empty($expTag->id))\n $expTag->update(array('title' => $tag));\n $this->params['expTag'][] = $expTag->id;\n }\n }\n }\n }", " //check for and handle cats\n if (array_key_exists('expCat', $this->params) && !empty($this->params['expCat'])) {\n $catid = $this->params['expCat'];\n unset($this->params['expCat']);\n $this->params['expCat'][] = $catid;\n }", " $modelname = $this->basemodel_name;\n $this->$modelname->update($this->params);", " if ($this->isSearchable()) {\n $this->addContentToSearch($this->params);\n }", " // check for auto send facebook status\n if (!empty($this->params['send_status'])) {\n if ($this->classname == 'eventController') {\n facebookController::postEvent(\n array('model' => $modelname, 'id' => $this->params['date_id'], 'src' => $this->loc->src, 'config' => $this->config, 'orig_controller' => expModules::getControllerName($this->classname))\n );\n } else {\n facebookController::postStatus(\n array('model' => $modelname, 'id' => $this->$modelname->id, 'src' => $this->loc->src, 'config' => $this->config, 'orig_controller' => expModules::getControllerName($this->classname))\n );\n }\n }", " // check for auto send tweet\n if (!empty($this->params['send_tweet'])) {\n if ($this->classname == 'eventController') {\n twitterController::postEventTweet(\n array('model' => $modelname, 'id' => $this->params['date_id'], 'src' => $this->loc->src, 'config' => $this->config, 'orig_controller' => expModules::getControllerName($this->classname))\n );\n } else {\n twitterController::postTweet(\n array('model' => $modelname, 'id' => $this->$modelname->id, 'src' => $this->loc->src, 'config' => $this->config, 'orig_controller' => expModules::getControllerName($this->classname))\n );\n }\n }", " // check for eAlerts\n if (!empty($this->params['send_ealerts'])) {\n redirect_to(array('controller' => 'ealert', 'action' => 'send_confirm', 'model' => $modelname, 'id' => $this->$modelname->id, 'src' => $this->loc->src, 'orig_controller' => expModules::getControllerName($this->classname)));\n } else {\n expHistory::back();\n }\n }", " /**\n * delete item in module\n */\n public function delete() {\n $modelname = $this->basemodel_name;\n if (empty($this->params['id'])) {\n flash('error', gt('Missing id for the') . ' ' . $modelname . ' ' . gt('you would like to delete'));\n expHistory::back();\n }", " $obj = new $modelname($this->params['id']);\n $rows = $obj->delete();", " // if this module is searchable lets delete spidered content\n if ($this->isSearchable()) {\n $search = new search();\n// $content = $search->find('first', 'original_id=' . $this->params['id'] . \" AND ref_module='\" . $this->classname . \"'\");\n $content = $search->find('first', 'original_id=' . $this->params['id'] . \" AND ref_module='\" . $this->baseclassname . \"'\");\n if (!empty($content->id)) $content->delete();\n }", " expHistory::back();\n }", " /**\n * rerank items in model\n */\n public function rerank() {\n $modelname = $this->basemodel_name;\n $obj = new $modelname($this->params['id']);\n $obj->rerank($this->params['push']);\n expHistory::back();\n }", " /**\n * display module management view\n */\n public function manage() {\n expHistory::set('manageable', $this->params);", " $page = new expPaginator(array(\n 'model' => $this->basemodel_name,\n 'where' => static::hasSources() ? $this->aggregateWhereClause() : null,\n 'limit' => isset($this->params['limit']) ? $this->params['limit'] : 10,\n 'order' => isset($this->params['order']) ? $this->params['order'] : null,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->baseclassname,\n 'action' => $this->params['action'],\n 'src' => static::hasSources() == true ? $this->loc->src : null,\n 'columns' => array(\n gt('ID#') => 'id',\n gt('Title') => 'title',\n gt('Body') => 'body'\n ),\n ));", " assign_to_template(array(\n 'page' => $page,\n 'items' => $page->records\n ));\n }", " /**\n * rerank module items, called from ddrerank\n */\n public function manage_ranks() {\n $rank = 1;\n foreach ($this->params['rerank'] as $id) {\n $modelname = $this->params['model'];\n $obj = new $modelname($id);\n $obj->rank = $rank;\n $obj->save(false, true);\n $rank++;\n }", " if (!expJavascript::inAjaxAction())\n redirect_to($this->params['lastpage']);\n }", " /**\n * Configure the module\n */\n public function configure() {\n global $db;", " expHistory::set('editable', $this->params);\n $views = expTemplate::get_config_templates($this, $this->loc);", " // needed for aggregation list\n $pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc);\n $page = new expPaginator(array(\n 'records' => $pullable_modules,\n 'controller' => $this->loc->mod,\n 'action' => $this->params['action'],\n 'order' => isset($this->params['order']) ? $this->params['order'] : 'section',\n 'dir' => isset($this->params['dir']) ? $this->params['dir'] : '',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'columns' => array(\n gt('Title') => 'title',\n gt('Page') => 'section'\n ),\n ));", "// if (empty($this->params['hcview'])) {\n $containerloc = expCore::makeLocation(expModules::getModuleName($this->loc->mod),$this->loc->src);\n $container = $db->selectObject('container', \"internal='\" . serialize($containerloc) . \"'\");\n if (empty($container)) {\n $container = new stdClass();\n $container->action = 'showall';\n } else {\n $container->internal = unserialize($container->internal);\n }\n if (empty($container->action)) {\n $container->action = 'showall';\n }\n// expSession::clearAllUsersSessionCache('containermodule');", "// $modules_list = expModules::getActiveModulesAndControllersList();\n// foreach ($modules_list as $moduleclass) {\n// $module = new $moduleclass();\n//\n// // Get basic module meta info\n// $mod = new stdClass();\n// $mod->name = $module->name();\n// $mod->author = $module->author();\n// $mod->description = $module->description();\n// if (isset($container->view) && $container->internal->mod == $moduleclass) {\n// $mod->defaultView = $container->view;\n// } else $mod->defaultView = DEFAULT_VIEW;\n//\n// // Get support flags\n// $mod->supportsSources = ($module->hasSources() ? 1 : 0);\n// $mod->supportsViews = ($module->hasViews() ? 1 : 0);\n//\n// // Get a list of views\n// $mod->views = expTemplate::listModuleViews($moduleclass);\n// natsort($mod->views);\n//\n// $modules[$moduleclass] = $mod;\n//// \t\t$mods[$moduleclass] = $module->name();\n// // $mods[$moduleclass] = $moduleclass::name();\n// }", "// array_multisort(array_map('strtolower', $mods), $mods);", " $actions = $this->useractions;\n $mod_views = array();\n if (!empty($actions)) {\n // Language-ize the action names\n foreach ($actions as $key => $value) {\n $actions[$key] = gt($value);\n }\n $mod_views = expTemplate::get_action_views($this->classname, $container->action, $actions[$container->action]);\n if (count($mod_views) < 1) $mod_views[$container->action] = $actions[$container->action] . ' - Default View';\n }", " assign_to_template(array(\n 'container' => $container,\n 'actions' => $actions,\n 'mod_views' => $mod_views,\n ));\n// } else {\n if (!empty($this->params['hcview'])) {\n // this must be a hard-coded module?\n assign_to_template(array(\n 'hcview' => $this->params['hcview'],\n ));\n }", " $expcat = new expCat();\n $cats = $expcat->find('all','module=\"file\"');\n $folders = array();\n $folders[] = 'Root Folder';\n foreach ($cats as $cat) {\n $folders[$cat->id] = $cat->title;\n }", " assign_to_template(array(\n// 'config' => $this->config, //FIXME already assigned in controllertemplate?\n 'page' => $page, // needed for aggregation list\n 'views' => $views,\n 'title' =>static::displayname(),\n 'current_section' => expSession::get('last_section'),\n// 'classname' => $this->classname, //FIXME $controller already assigned baseclassname (short vs long) in controllertemplate?\n 'viewpath' => $this->viewpath,\n 'relative_viewpath' => $this->relative_viewpath,\n 'folders' => $folders,\n ));", " }", " /**\n * save module configuration\n */\n public function saveconfig() {\n global $db;", " // update module title/action/view\n if (!empty($this->params['container_id'])) {\n $container = $db->selectObject('container', \"id=\" . $this->params['container_id']);\n if (!empty($container)) {\n $container->title = $this->params['moduletitle'];\n $container->action = $this->params['actions'];\n $container->view = $this->params['views'];\n $container->is_private = $this->params['is_private'];\n $db->updateObject($container, 'container');\n expSession::clearAllUsersSessionCache('containermodule');\n }\n unset(\n $this->params['container_id'],\n $this->params['moduletitle'],\n $this->params['modcntrol'],\n $this->params['actions'],\n $this->params['views'],\n $this->params['actions'],\n $this->params['is_private']\n );\n }", " // create a new RSS object if enable is checked.\n $params = $this->params;\n if (!empty($this->params['enable_rss'])) {\n $params['title'] = $params['feed_title'];\n unset($params['feed_title']);\n $params['sef_url'] = $params['feed_sef_url'];\n unset($params['feed_sef_url']);\n $rssfeed = new expRss($params);\n $rssfeed->update($params);\n $this->params['feed_sef_url'] = $rssfeed->sef_url;\n } else {\n $rssfeed = new expRss($this->params);\n $params['enable_rss'] = false;\n if (empty($params['advertise']))\n $params['advertise'] = false;\n $params['title'] = $params['feed_title'];\n unset($params['feed_title']);\n $params['sef_url'] = $params['feed_sef_url'];\n unset($params['feed_sef_url']);\n if (!empty($rssfeed->id)) { // do NOT create a new record, only update existing ones\n $rssfeed->update($params);\n $this->params['feed_sef_url'] = $rssfeed->sef_url;\n }\n }", " // create a new eAlerts object if enable is checked.\n if (!empty($this->params['enable_ealerts'])) {\n $ealert = new expeAlerts($this->params);\n $ealert->update($this->params);\n }", " // unset some unneeded params\n unset(\n $this->params['module'],\n $this->params['controller'],\n $this->params['src'],\n $this->params['int'],\n $this->params['id'],\n $this->params['cid'],\n $this->params['action'],\n $this->params['PHPSESSID'],\n $this->params['__utma'],\n $this->params['__utmb'],\n $this->params['__utmc'],\n $this->params['__utmz'],\n $this->params['__utmt'],\n $this->params['__utmli'],\n $this->params['__cfduid']\n );", " // setup and save the config\n $config = new expConfig($this->loc);\n $config->update(array('config' => $this->params));", " flash('message', gt('Configuration updated'));\n expHistory::back();\n }", " /**\n * get the module's items in an rss feed format\n *\n * this function is very general and will most of the time need to be overwritten and customized\n *\n * @return array\n */\n public function getRSSContent($limit = 0) {\n $class = new $this->basemodel_name;\n $items = $class->find('all', $this->aggregateWhereClause(), isset($this->config['order']) ? $this->config['order'] : 'created_at DESC', $limit);", " //Convert the items to rss items\n $rssitems = array();\n foreach ($items as $key => $item) {\n $rss_item = new FeedItem();\n $rss_item->title = expString::convertSmartQuotes($item->title);\n $rss_item->link = $rss_item->guid = makeLink(array('controller' => $this->baseclassname, 'action' => 'show', 'title' => $item->sef_url));\n $rss_item->description = expString::convertSmartQuotes($item->body);\n $rss_item->author = user::getUserById($item->poster)->firstname . ' ' . user::getUserById($item->poster)->lastname;\n $rss_item->authorEmail = user::getEmailById($item->poster);\n// $rss_item->date = isset($item->publish_date) ? date(DATE_RSS, $item->publish_date) : date(DATE_RSS, $item->created_at);\n $rss_item->date = isset($item->publish_date) ? $item->publish_date : $item->created_at;\n if (!empty($item->expCat[0]->title)) $rss_item->category = array($item->expCat[0]->title);\n $comment_count = expCommentController::countComments(array('content_id' => $item->id, 'content_type' => $this->basemodel_name));\n if ($comment_count) {\n $rss_item->comments = makeLink(array('controller' => $this->baseclassname, 'action' => 'show', 'title' => $item->sef_url)) . '#exp-comments';\n// $rss_item->commentsRSS = makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$item->sef_url)).'#exp-comments';\n $rss_item->commentsCount = $comment_count;\n }\n $rssitems[$key] = $rss_item;", " if ($limit && count($rssitems) >= $limit)\n break;\n }\n return $rssitems;\n }", " /**\n * method to display an rss feed from this module\n */\n public function rss() {\n require_once(BASE . 'external/feedcreator.class.php');\n", " $id = isset($this->params['title']) ? expString::escape($this->params['title']) : (isset($this->params['id']) ? $this->params['id'] : null);", " if (empty($id)) {\n $module = !empty($this->params['module']) ? $this->params['module'] : $this->params['controller'];\n $id = array('module' => $module, 'src' => $this->params['src']);\n }\n $site_rss = new expRss($id);\n if ($site_rss->enable_rss == true && !empty($site_rss->id)) {\n $site_rss->title = empty($site_rss->title) ? gt('RSS for') . ' ' . URL_FULL : $site_rss->title;\n $site_rss->feed_desc = empty($site_rss->feed_desc) ? gt('This is an RSS syndication from') . ' ' . HOSTNAME : $site_rss->feed_desc;\n// if (isset($site_rss->rss_cachetime)) {\n// $ttl = $site_rss->rss_cachetime;\n// }\n if ($site_rss->rss_cachetime == 0) {\n $site_rss->rss_cachetime = 1440;\n }", " if (!empty($site_rss->itunes_cats)) {\n $ic = explode(\";\", $site_rss->itunes_cats);\n $x = 0;\n $itunes_cats = array();\n foreach ($ic as $cat) {\n $cat_sub = explode(\":\", $cat);\n $itunes_cats[$x]->category = $cat_sub[0];\n if (isset($cat_sub[1])) {\n $itunes_cats[$x]->subcategory = $cat_sub[1];\n }\n $x++;\n }\n }", " // NO buffering from here on out or things break unexpectedly. - RAM\n ob_end_clean();", " header('Content-Type: ' . 'application/rss+xml');\n// header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n// header('Content-Transfer-Encoding: binary');\n header('Content-Encoding:');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n header('Vary: User-Agent');\n } else {\n header('Pragma: no-cache');\n }", " if ($site_rss->rss_is_podcast) {\n $feed_type = \"PODCAST\";\n } else {\n $feed_type = \"RSS2.0\";\n }\n $feed_cache = BASE . 'tmp/rsscache/' . $site_rss->sef_url . '.xml';", " $rss = new UniversalFeedCreator();\n// if (file_exists(THEME_ABSOLUTE . \"rss/feed.css\")) // custom css style\n// $rss->cssStyleSheet = THEME_RELATIVE . \"rss/feed.css\";\n if (file_exists(THEME_ABSOLUTE . \"rss/feed.xsl\")) // custom xml style\n $rss->xslStyleSheet = THEME_RELATIVE . \"rss/feed.xsl\";\n $rss->useCached($feed_type, $feed_cache, $site_rss->rss_cachetime); // if cache exists output then redirect", " $rss->title = $site_rss->title;\n if (!empty($this->params['type']))\n $rss->title .= ' ' . ucfirst($this->params['type']);\n $rss->description = $site_rss->feed_desc;\n $rss->image = new FeedImage();\n $rss->image->url = !empty($site_rss->expFile['album'][0]) ? $site_rss->expFile['album'][0]->url : URL_FULL . 'themes/' . DISPLAY_THEME . '/images/logo.png';\n $rss->image->title = $site_rss->title;\n $rss->image->link = URL_FULL;\n // $rss->image->width = 64;\n // $rss->image->height = 64;\n $rss->ttl = $site_rss->rss_cachetime;\n $rss->link = URL_FULL;\n $rss->language = LOCALE;\n $rss->syndicationURL = makeLink(array('module'=>$site_rss->module, 'src'=>$site_rss->src));\n if ($site_rss->rss_is_podcast) {\n $rss->itunes = new iTunes();\n $rss->itunes->author = !empty($site_rss->feed_artist) ? $site_rss->feed_artist : ORGANIZATION_NAME;\n $rss->itunes->image = !empty($site_rss->expFile['album'][0]) ? $site_rss->expFile['album'][0]->url :URL_FULL . 'themes/' . DISPLAY_THEME . '/images/logo.png';\n $rss->itunes->summary = $site_rss->feed_desc;\n if (!empty($itunes_cats)) {\n $rss->itunes->category = $itunes_cats[0]->category;\n $rss->itunes->subcategory = $itunes_cats[0]->subcategory;\n }\n //\t\t$rss->itunes->explicit = 0;\n// $rss->itunes->subtitle = $site_rss->title;\n $rss->itunes->subtitle = $site_rss->feed_desc;\n //\t\t$rss->itunes->keywords = 0;\n $rss->itunes->owner_email = SMTP_FROMADDRESS;\n $rss->itunes->owner_name = ORGANIZATION_NAME;\n }", " $pubDate = '';\n $site_rss->params = $this->params;\n foreach ($site_rss->getFeedItems($site_rss->rss_limit) as $item) {\n if ($item->date > $pubDate) {\n $pubDate = $item->date;\n }\n $rss->addItem($item);\n }\n if (!empty($site_rss->rss_limit)) {\n $rss->items = array_slice($rss->items, 0, $site_rss->rss_limit);\n }\n $rss->pubDate = $pubDate;", "// echo $rss->createFeed($feed_type);\n echo $rss->saveFeed($feed_type, $feed_cache, $site_rss->rss_cachetime); // does redirect after updating cache\n } else {\n flash('notice', gt(\"This RSS feed is not available.\"));\n expHistory::back();\n }", " //Read the file out directly\n exit();\n }", " /**\n * download a file attached to item\n */\n public function downloadfile() {\n if (!isset($this->config['allowdownloads']) || $this->config['allowdownloads'] == true) {\n //if ($db->selectObject('content_expFiles', 'content_type=\"'.$this->baseclassname.'\" AND expfiles_id='.$this->params['id']) != null) {\n expFile::download($this->params['id']);\n //}\n } else {\n flash('error', gt('Downloads have not been enabled for this file'));\n expHistory::back();\n }", " }", " /**", " * permission functions to aggregate a module's visible permissions based on add/remove permissions", " *\n * @return array\n */\n public function permissions() {\n //set the permissions array\n $perms = array();\n foreach ($this->permissions as $perm => $name) {\n if (!in_array($perm, $this->remove_permissions)) $perms[$perm] = $name;\n }\n $perms = array_merge($perms, $this->add_permissions);", " return $perms;\n }", " /**\n * permission functions to aggregate a module's permissions based on add/remove and manage permissions\n *\n * @return array\n */\n public function permissions_all() {\n //set the permissions array\n $perms = array();\n foreach ($this->permissions as $perm => $name) {\n if (!in_array($perm, $this->remove_permissions)) $perms[$perm] = $name;\n }\n $perms = array_merge($perms, $this->m_permissions, $this->add_permissions, $this->manage_permissions);", " return $perms;\n }", " // create a psuedo global permission specific to the module; return true grants permission, false continues with other permission checks\n public static function checkPermissions($permission, $location) {\n return false;\n }", " /**\n * get the model(s) associated with this module\n *\n * @return array\n */\n public function getModels() {\n return isset($this->models) ? $this->models : array($this->basemodel_name);\n }", " /**\n * type of items searched in the module\n *\n * @return string\n */\n public function searchName() {\n return static::displayname();\n }", " /**\n * category of items searched in the module\n *\n * @return string\n */\n public function searchCategory() {\n return $this->basemodel_name;\n }", " /**\n * add module items to search index\n *\n * @return int\n */\n public function addContentToSearch() {\n// global $db, $router;\n global $db;", " $count = 0;\n $model = new $this->basemodel_name(null, false, false);\n $where = (!empty($this->params['id'])) ? 'id=' . $this->params['id'] : null;\n $content = $db->selectArrays($model->tablename, $where);\n foreach ($content as $cnt) {\n $origid = $cnt['id'];\n unset($cnt['id']);\n //build the search record and save it.\n// $sql = \"original_id=\" . $origid . \" AND ref_module='\" . $this->classname . \"'\";\n $sql = \"original_id=\" . $origid . \" AND ref_module='\" . $this->baseclassname . \"'\";\n $oldindex = $db->selectObject('search', $sql);\n if (!empty($oldindex)) {\n $search_record = new search($oldindex->id, false, false);\n $search_record->update($cnt);\n } else {\n $search_record = new search($cnt, false, false);\n }", " //build the search record and save it.\n $search_record->original_id = $origid;\n $search_record->posted = empty($cnt['created_at']) ? null : $cnt['created_at'];\n // get the location data for this content\n if (isset($cnt['location_data']))\n $loc = expUnserialize($cnt['location_data']);\n $src = isset($loc->src) ? $loc->src : null;\n if (!empty($cnt['sef_url'])) {\n $link = str_replace(URL_FULL, '', makeLink(array('controller' => $this->baseclassname, 'action' => 'show', 'title' => $cnt['sef_url'])));\n } else {\n $link = str_replace(URL_FULL, '', makeLink(array('controller' => $this->baseclassname, 'action' => 'show', 'id' => $origid, 'src' => $src)));\n }\n//\t if (empty($search_record->title)) $search_record->title = 'Untitled';\n $search_record->view_link = $link;\n// $search_record->ref_module = $this->classname;\n $search_record->ref_module = $this->baseclassname;\n $search_record->category = $this->searchName();\n $search_record->ref_type = $this->searchCategory();\n $search_record->save();\n $count++;\n }", " return $count;\n }", " /**\n * additional check for display of search hit\n *\n * @param $record\n *\n * @return bool\n */\n public static function searchHit($record) {\n return true; // default is to display search hit\n }", " /**\n * remove all module items from search index\n */\n public function delete_search() {\n global $db;\n // remove this modules entries from the search table.\n if ($this->isSearchable()) {\n// $where = \"ref_module='\" . $this->classname . \"' AND location_data='\" . serialize($this->loc) . \"'\";\n $where = \"ref_module='\" . $this->baseclassname . \"' AND location_data='\" . serialize($this->loc) . \"'\";\n// $test = $db->selectObjects('search', $where);\n $db->delete('search', $where);\n }\n }", " /**\n * delete module and all its items for backwards compat with old modules\n *\n * @param $loc\n */\n public function delete_In($loc) {\n $this->delete_instance($loc);\n }", " /**\n * delete module, config, and all its items\n * @param bool $loc\n */\n public function delete_instance($loc = false) {\n $model = new $this->basemodel_name();\n $where = 1;\n if ($loc || static::hasSources())\n $where = \"location_data='\" . serialize($this->loc) . \"'\";\n $items = $model->find('all',$where);\n foreach ($items as $item) {\n $item->delete(); // model should delete attachments and other associated objects\n }\n $cfg = new expConfig($this->loc);\n $cfg->delete();\n }", " /**\n * get the metainfo for this module\n *\n * @return array\n */\n public function metainfo() {\n global $router;", " if (empty($router->params['action'])) return false;", " // figure out what metadata to pass back based on the action we are in.\n $action = $router->params['action'];\n $metainfo = array('title' => '', 'keywords' => '', 'description' => '', 'canonical' => '', 'noindex' => false, 'nofollow' => false);\n $modelname = $this->basemodel_name;", " switch ($action) {\n case 'showall':\n $metainfo['title'] = gt(\"Showing\") . \" \" . static::displayname() . ' - ' . SITE_TITLE;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n break;\n case 'show':\n case 'showByTitle':\n // look up the record.\n if (isset($router->params['id']) || isset($router->params['title'])) {\n $lookup = isset($router->params['id']) ? $router->params['id'] : $router->params['title'];\n $object = new $modelname($lookup);\n // set the meta info\n if (!empty($object)) {\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n if (!empty($object->expTag)) {\n $keyw = '';\n foreach ($object->expTag as $tag) {\n if (!empty($keyw)) $keyw .= ', ';\n $keyw .= $tag->title;\n }\n } else {\n $keyw = SITE_KEYWORDS;\n }\n $metainfo['title'] = empty($object->meta_title) ? $object->title : $object->meta_title;\n $metainfo['keywords'] = empty($object->meta_keywords) ? $keyw : $object->meta_keywords;\n $metainfo['description'] = empty($object->meta_description) ? $desc : $object->meta_description;\n// $metainfo['canonical'] = empty($object->canonical) ? URL_FULL.substr($router->sefPath, 1) : $object->canonical;\n $metainfo['canonical'] = empty($object->canonical) ? $router->plainPath() : $object->canonical;\n $metainfo['noindex'] = empty($object->meta_noindex) ? false : $object->meta_noindex;\n $metainfo['nofollow'] = empty($object->meta_nofollow) ? false : $object->meta_nofollow;\n $metainfo['rich'] = $this->meta_rich($router->params, $object);\n $metainfo['fb'] = $this->meta_fb($router->params, $object, $metainfo['canonical']);\n $metainfo['tw'] = $this->meta_tw($router->params, $object, $metainfo['canonical']);\n }\n break;\n }\n default:\n //check for a function in the controller called 'action'_meta and use it if so\n $functionName = $action . \"_meta\";\n $mod = new $this->classname;\n if (method_exists($mod, $functionName)) {\n $metainfo = $mod->$functionName($router->params);\n } else {\n $metainfo['title'] = static::displayname() . \" - \" . SITE_TITLE;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n// $metainfo['canonical'] = URL_FULL.substr($router->sefPath, 1);\n $metainfo['canonical'] = $router->plainPath();\n }\n }", " return $metainfo;\n }", " /**\n * Returns rich snippet PageMap meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_rich($request, $object) {\n return null;\n }", " /**\n * Returns Facebook og: meta data\n *\n * @param $request\n * @param $object\n *\n * @return array\n */\n public function meta_fb($request, $object, $canonical) {\n return array();\n }", " /**\n * Returns Twitter twitter: meta data\n *\n * @param $request\n * @param $object\n *\n * @return array\n */\n public function meta_tw($request, $object, $canonical) {\n return array();\n }", " /**\n * action specific metainfo\n *\n * @param $request\n * @return array\n */\n public function showall_by_tags_meta($request) {\n global $router;", " // look up the record.\n if (isset($request['tag'])) {\n $metainfo = array('title' => '', 'keywords' => '', 'description' => '', 'canonical' => '', 'noindex' => false, 'nofollow' => false);\n $tag = $request['tag'];\n // set the meta info\n $metainfo['title'] = gt('Showing all') . ' ' . ucwords($this->basemodel_name) . ' ' . gt('tagged as') . ' ' . $tag;\n// $metainfo['keywords'] = empty($object->meta_keywords) ? SITE_KEYWORDS : $object->meta_keywords; //FIXME $object not set\n $metainfo['keywords'] = $request['tag'];\n// $metainfo['description'] = empty($object->meta_description) ? SITE_DESCRIPTION : $object->meta_description; //FIXME $object not set\n $metainfo['description'] = SITE_DESCRIPTION;\n// $metainfo['canonical'] = empty($object->canonical) ? URL_FULL . substr($router->sefPath, 1) : $object->canonical; //FIXME $object not set\n// $metainfo['canonical'] = URL_FULL . substr($router->sefPath, 1);\n $metainfo['canonical'] = $router->plainPath();\n return $metainfo;\n }\n return null;\n }", " /**\n * action specific metainfo\n *\n * @param $request\n * @return array\n */\n public function showall_by_date_meta($request) {\n global $router;", " // look up the record.\n if (isset($request['month'])) {\n $metainfo = array('title' => '', 'keywords' => '', 'description' => '', 'canonical' => '', 'noindex' => false, 'nofollow' => false);\n $mk = mktime(0, 0, 0, $request['month'], 01, $request['year']);\n $ts = strftime('%B, %Y', $mk);\n // set the meta info\n $metainfo['title'] = gt('Showing all') . ' ' . ucwords($this->basemodel_name) . ' ' . gt('written in') . ' ' . $ts;\n// $metainfo['keywords'] = empty($object->meta_keywords) ? SITE_KEYWORDS : $object->meta_keywords; //FIXME $object not set\n $metainfo['keywords'] = SITE_KEYWORDS;\n// $metainfo['description'] = empty($object->meta_description) ? SITE_DESCRIPTION : $object->meta_description; //FIXME $object not set\n $metainfo['description'] = SITE_DESCRIPTION;\n// $metainfo['canonical'] = empty($object->canonical) ? URL_FULL . substr($router->sefPath, 1) : $object->canonical; //FIXME $object not set\n// $metainfo['canonical'] = URL_FULL . substr($router->sefPath, 1);\n $metainfo['canonical'] = $router->plainPath();\n return $metainfo;\n }\n return null;\n }", " /**\n * approve module item\n */\n public function approve() {\n $modelname = $this->basemodel_name;\n $lookup = isset($this->params['id']) ? $this->params['id'] : $this->params['title'];\n $object = new $modelname($lookup);\n $object->approved = true;\n $object->save(false, true); // we don't want to add this approval as a new revision\n expHistory::back();\n }", " /**\n * The aggregateWhereClause function creates a sql where clause which also includes aggregated module content\n *\n * @param string $type\n *\n * @return string\n */\n public function aggregateWhereClause($type='') {\n global $user;", " $sql = '';", " if (empty($this->config['add_source']) && !static::hasSources()) {\n return $sql;\n }", " if (!empty($this->config['aggregate'])) $sql .= '(';", " $sql .= \"location_data ='\" . serialize($this->loc) . \"'\";", " if (!empty($this->config['aggregate'])) {\n foreach ($this->config['aggregate'] as $src) {\n $loc = expCore::makeLocation($this->baseclassname, $src);\n $sql .= \" OR location_data ='\" . serialize($loc) . \"'\";\n }", " $sql .= ')';\n }\n $model = $this->basemodel_name;\n if (ENABLE_WORKFLOW && $this->$model->needs_approval) {\n if ($user->id) {\n $sql .= ' AND (approved=1 OR poster=' . $user->id . ' OR editor=' . $user->id . ')';\n } else {\n $sql .= ' AND approved=1';\n }\n }", " return $sql;\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "//Global Variables", "// expModules\n/**\n * Stores the list of available/active controllers\n * @var array $available_controllers\n * @name $available_controllers\n */\n$available_controllers = array();", "// expTheme\n/**\n * Stores the theme validation flags\n * @var array $validateTheme does theme have header & footer\n * @name $validateTheme\n */\n$validateTheme = array(\"headerinfo\"=>false,\"footerinfo\"=>false);\n/**\n * Stores the list of module scopes\n * @var array $module_scope\n * @name $module_scope\n */\n$module_scope = array();\n/**\n * Stores the theme framework\n * @var integer $framework\n * @name $framework\n */\n$framework = null;", "// expLang\n/**\n * Stores the list of language strings for the current language\n * @var array $cur_lang\n * @name $cur_lang\n */\n$cur_lang = array();\n/**\n * Stores the list of language strings for the default language (English - US)\n * @var array $default_lang\n * @name $default_lang\n */\n$default_lang = array();\n/**\n * Stores the list of language specific strings specific to the theme\n * @var array $custom_lang\n * @name $custom_lang\n */\n$custom_lang = array();\n/**\n * Stores the name of the default language file\n * @var array $default_lang_file\n * @name $default_lang_file\n */\n$default_lang_file = '';\n/**\n * Stores the name of the language file to be created\n * @var array $target_lang_file\n * @name $target_lang_file\n */\n$target_lang_file = '';", "// expDatabase\n/**\n * Stores the exponent database object\n * @var \\database $db the exponent database object\n * @name $db\n */\n$db = new stdClass();", "// expHistory\n/**\n * Stores the browsing history object\n * @var expHistory $history\n * @name $history\n */\n$history = new stdClass();", "// user model\n/**\n * Stores the current user object\n * @var user $user\n * @name $user\n */\n$user = new stdClass();\n/**\n * This global array belongs exclusively to the user model, and is used to cache\n * users as they are retrieved, to help out with performance when doing a lot of\n * work with user accounts and profile information.\n * @var array $SYS_USERS_CACHE\n * @name $SYS_USERS_CACHE\n */\n$SYS_USERS_CACHE = array();", "// expRouter\n/**\n * Stores the routing/link/url object\n * @var expRouter $router\n * @name $router\n */\n$router = new stdClass();\n/**\n * Stores the routing/link/url object\n * @var section $sectionObj\n * @name $sectionObj\n */\n$sectionObj = new stdClass();", "// expCore\n/**\n * Stores the list of sections/pages for the site\n * @var array $sections\n * @name $sections\n */\n$sections = array();\n// expPermissions\n/**\n * Stores the permission data for the current user.\n * This should not be modified by anything outside of the permissions subsystem.\n * @var array $exponent_permissions_r\n * @name $exponent_permissions_r\n */\n$exponent_permissions_r = array();", "// expJavascript\n/**\n * Stores the page's inline javascript code\n * @var array $js2foot\n * @name $js2foot\n */\n$js2foot = array();\n/**\n * Stores the yui3 javascript files list\n * @var array $yui3js\n * @name $yui3js\n */\n$yui3js = false;\n/**\n * Stores the jquery javascript files list\n * @var array $jqueryjs\n * @name $jqueryjs\n */\n$jqueryjs = array();\n/**\n * Stores the twitter bootstrap javascript file list\n * @var array $bootstrapjs\n * @name $bootstrapjs\n */\n$bootstrapjs = array();\n/**\n * Stores the 'other' javascript files list\n * @var array $expJS\n * @name $expJS\n */\n$expJS = array();", "// expCSS\n/**\n * Stores the user's less global variables\n * @var array $less_vars\n * @name $less_vars\n */\n$less_vars = array();\n/**\n * Stores the user's css files to load first\n * @var array $css_primer\n * @name $css_primer\n */\n$css_primer = array();\n/**\n * Stores the user's css core/system files\n * @var array $css_core\n * @name $css_core\n */\n$css_core = array();\n/**\n * Stores the user's css files\n * @var array $css_links\n * @name $css_links\n */\n$css_links = array();\n/**\n * Stores the user's css files\n * @var array $css_theme\n * @name $css_theme\n */\n$css_theme = array();\n/**\n * Stores the user's css files\n * @var array $css_inline\n * @name $css_inline\n */\n$css_inline = array();\n/**\n * Stores the user's css files\n * @var array $head_config\n * @name $head_config\n */\n$head_config = array();\n/**\n * Stores the user's css files\n * @var string $jsForHead\n * @name $jsForHead\n */\n$jsForHead = \"\";\n/**\n * Stores the user's css files\n * @var string $cssForHead\n * @name $cssForHead\n */\n$cssForHead = \"\";", "// expTemplate\n/**\n * Stores the global template\n * @var \\basetemplate $template\n * @name $template\n */\n$template = null;", "// expTimer\n/**\n * Stores the timer\n * @var expTimer $timer\n * @name $timer\n */\n$timer = null;", "// e-commerce\n/**\n * Stores the order\n * @var \\order $order\n * @name $order\n */\n$order = null;", "/**\n * Main module action/display logic/routine; initializes/checks controller before calling action/method\n *\n * @param array $parms\n * @return bool|mixed|string\n */\nfunction renderAction(array $parms=array()) {\n global $user, $db;", " //Get some info about the controller\n// $baseControllerName = expModules::getControllerName($parms['controller']);\n $fullControllerName = expModules::getControllerClassName($parms['controller']);\n if (expModules::controllerExists($fullControllerName)) {\n $controllerClass = new ReflectionClass($fullControllerName);\n } else {\n return sprintf(gt('The module \"%s\" was not found in the system'), $parms['controller']);\n }", " if (isset($parms['view'])) $parms['view'] = urldecode($parms['view']);\n // Figure out the action to use...if the specified action doesn't exist then we look for the showall action.\n if ($controllerClass->hasMethod($parms['action'])) {\n $action = $parms['action'];\n /* TODO: Not sure if we need to check for private methods to be here. FJD\n\t\t$meth = $controllerClass->getMethod($action);\n if ($meth->isPrivate()) expQueue::flashAndFlow('error', gt('The requested action could not be performed: Action not found'));*/\n } elseif ($controllerClass->hasMethod('showall')) {\n $parms['action'] = 'showall';\n $action = 'showall';\n } else {\n expQueue::flashAndFlow('error', gt('The requested action could not be performed: Action not found'));\n }", " // initialize the controller.\n $src = isset($parms['src']) ? $parms['src'] : null;", " $controller = new $fullControllerName($src, $parms); \n ", " //Set up the correct template to use for this action\n global $template;\n $view = !empty($parms['view']) ? $parms['view'] : $action;\n $template = expTemplate::get_template_for_action($controller, $view, $controller->loc);", " ", " //setup default model(s) for this controller's actions to use\n foreach ($controller->getModels() as $model) {\n $controller->$model = new $model(null,false,false); //added null,false,false to reduce unnecessary queries. FJD\n // flag for needing approval check\n if ($controller->$model->supports_revisions && ENABLE_WORKFLOW) {\n $uilevel = 99;\n if (expSession::exists(\"uilevel\")) $uilevel = expSession::get(\"uilevel\");\n if (!expPermissions::check('approve', $controller->loc)) {\n $controller->$model->needs_approval = true;\n } elseif (isset($uilevel) && $uilevel == UILEVEL_PREVIEW) {\n $controller->$model->needs_approval = true;\n }\n }\n }", "// FIXME this is now handled by the template class during get_template_for_action since it only sets template variables\n // have the controller assign knowledge about itself to the template.\n // this has to be done after the controller gets the template for its actions\n// $controller->moduleSelfAwareness();", " //if this controller is being called by a container then we should have a module title.\n if (isset($parms['moduletitle'])) {\n $template->assign('moduletitle', $parms['moduletitle']);\n } else {\n $title = new stdClass();\n $title->mod = $controller->loc->mod;\n $title->src = $controller->loc->src;\n $title->int = '';\n $template->assign('moduletitle', $db->selectValue('container', 'title', \"internal='\".serialize($title).\"'\"));\n }", " // check the perms for this action", " $perms = $controller->permissions();\n ", " // we have to treat the update permission a little different..it's tied to the create/edit\n // permissions. Really the only way this will fail will be if someone bypasses the perm check\n // on the edit form somehow..like a hacker trying to bypass the form and just submit straight to\n // the action. To safeguard, we'll catch if the action is update and change it either to create or\n // edit depending on whether an id param is passed to. that should be sufficient.", " $common_action = null;\n //FIXME do we also need to account for actions with camelcase action/perm such as editItem ???\n if ($parms['action'] == 'update') {", " $perm_action = (!isset($parms['id']) || $parms['id'] == 0) ? 'create' : 'edit';", " } elseif ($parms['action'] == 'edit' && (!isset($parms['id']) || $parms['id'] == 0)) {", " $perm_action = 'create';\n } elseif ($parms['action'] == 'saveconfig') {\n $perm_action = 'configure';\n } else {", " // action convention for controllers that manage more than one model (datatype). \n // if you preface the name action name with a common crud action name we can check perms on \n // it with the developer needing to specify any...better safe than sorry.\n // i.e if the action is edit_mymodel it will be checked against the edit permission\n if (stristr($parms['action'], '_')) $parts = explode(\"_\", $parms['action']);\n $common_action = isset($parts[0]) ? $parts[0] : null;", " $perm_action = $parms['action'];\n }", " // Here is where we check for ownership of an item and 'create' perm\n if (($parms['action'] == 'edit' || $parms['action'] == 'update' || $parms['action'] == 'delete' ||\n $common_action == 'edit' || $common_action == 'update' || $common_action == 'delete') && !empty($parms['id'])) {\n $theaction = !empty($common_action) ? $common_action : $parms['action'];\n $owner = $db->selectValue($model, 'poster', 'id=' . $parms['id']);\n if ($owner == $user->id && !expPermissions::check($theaction, $controller->loc) && expPermissions::check('create', $controller->loc)) {\n $perm_action = 'create';\n }\n }", " if (!DISABLE_PRIVACY) {\n // check to see if it's on a private page and we shouldn't see it\n if ($perm_action == 'showall' || $perm_action == 'show' || $perm_action == 'downloadfile' || $common_action == 'showall' || $common_action == 'show' || $common_action == 'downloadfile') {\n $loc = null;\n if (!empty($parms['src'])) {\n $loc = expCore::makeLocation($parms['controller'], $parms['src']);\n } elseif (!empty($parms['id']) || !empty($parms['title']) || !empty($parms['sef_url'])) {\n if (!empty($parms['id'])) {\n $record = new $controller->basemodel_name($parms['id']);\n } elseif (!empty($parms['title'])) {\n $record = new $controller->basemodel_name($parms['title']);\n } elseif (!empty($parms['sef_url'])) {\n $record = new $controller->basemodel_name($parms['sef_url']);\n }\n if (!empty($record->location_data)) $loc = expUnserialize($record->location_data);\n }\n if (!empty($loc)) {\n $section = new section();\n $sectionref = new sectionref();\n $container = new container();\n $secref = $sectionref->find('first',\"module='\".$parms['controller'].\"' AND source='\" . $loc->src . \"'\");\n if (!empty($secref->section)) {\n $page = $section->find('first','id=' . $secref->section); // only one page can have the section id#\n $module = $container->find('first',\"internal='\" . serialize($loc) . \"'\"); // only one container can have the internal == location\n if ($page !== null && $module !== null && !empty($page->id) && (empty($page->public) || !empty($module->is_private))) {\n // we've found the page and module/container and it's either a private page or private module\n if (!expPermissions::check('view',expCore::makeLocation('navigation', $page->id))) {\n if (expTheme::inAction()) {\n flash('error', gt(\"You don't have permission to view that item\"));\n notfoundController::handle_not_authorized();\n expHistory::returnTo('viewable');\n } else {\n return false;\n }\n }\n }\n }\n }\n }\n }", " //FIXME? if the assoc $perm doesn't exist, the 'action' will ALWAYS be allowed, e.g., default is to allow action\n if (array_key_exists($perm_action, $perms)) {\n if (!expPermissions::check($perm_action, $controller->loc)) {\n if (expTheme::inAction()) {\n flash('error', gt(\"You don't have permission to\").\" \".$perms[$perm_action]);\n notfoundController::handle_not_authorized();\n expHistory::returnTo('viewable');\n } else {\n return false;\n }\n }\n } elseif (array_key_exists($common_action, $perms)) {\n if (!expPermissions::check($common_action, $controller->loc)) {\n if (expTheme::inAction()) {\n flash('error', gt(\"You don't have permission to\").\" \".$perms[$common_action]);\n notfoundController::handle_not_authorized();\n expHistory::returnTo('viewable');\n } else {\n return false;\n }\n }\n } elseif (array_key_exists($perm_action, $controller->requires_login)) {\n // check if the action requires the user to at least be logged in\n if (!$user->isLoggedIn()) {", " $msg = empty($controller->requires_login[$perm_action]) ? gt(\"You must be logged in to perform this action\") : $controller->requires_login[$perm_action];", " flash('error', $msg);\n notfoundController::handle_not_authorized();\n expHistory::redirecto_login();\n }\n } elseif (array_key_exists($common_action, $controller->requires_login)) {\n // check if the action requires the user to at least be logged in\n if (!$user->isLoggedIn()) {", " $msg = empty($controller->requires_login[$common_action]) ? gt(\"You must be logged in to perform this action\") : $controller->requires_login[$common_action];", " flash('error', $msg);\n notfoundController::handle_not_authorized();\n expHistory::redirecto_login();\n }", " } \n ", " // register this controllers permissions to the view for in view perm checks\n $template->register_permissions(array_keys($perms), $controller->loc);", " ", " // globalizing $user inside all templates\n $template->assign('user', $user);", " // lastly, run the action which can also override the above assignments\n $controller->$action();", " if (empty($parms['no_output'])) {\n $template->output();\n } else {\n $html = $template->render();\n return $html;\n }\n}", "function hotspot($source = null) {\n if (!empty($source)) {\n global $sectionObj;", "\t //FIXME there is NO 'page' object and section has no _construct method\n $page = new section($sectionObj->id);\n $modules = $page->getModulesBySource($source); //FIXME there is no getModulesBySource method anywhere\n //eDebug($modules);exit();", " foreach ($modules as $module) {\n renderAction(array('controller'=>$module->type, 'action'=>$module->action, 'instance'=>$module->id));\n }\n }\n}", "function makeLink($params=array(), $secure=false) {\n global $router;", " if(!is_array($params) || count($params) == 0) return false;\n $secure = empty($secure) ? false : true;\n return $router->makeLink($params, false, $secure);\n}", "function redirect_to($params=array(), $secure=false) {\n global $router;", " $secure = empty($secure) ? false : true;\n $link = (!is_array($params)) ? $params : $router->makeLink($params, false, $secure);\n header(\"Location: \" . $link);\n exit();", "} ", "\nfunction flash($name, $msg) {\n expQueue::flash($name, $msg);\n}", "function flashAndFlow($name, $msg) {\n expQueue::flashAndFlow($name, $msg);\n}", "/**\n * Display the message queue\n *\n * @param null $name\n * @return bool|mixed|string\n */\nfunction show_msg_queue($name=null) {\n return expQueue::show($name);\n}", "/**\n * Assign a variable to the current template\n *\n * @param array $vars\n * @return bool\n */\nfunction assign_to_template(array $vars=array()) {\n global $template;", " ", " if (empty($template) || count($vars) == 0) return false;\n foreach ($vars as $key=>$val) {\n $template->assign($key, $val);\n }\n}", "function get_model_for_controller($controller_name) {\n //FIXME this works by making assumptions\n $start_pos = stripos($controller_name, 'controller');\n if ($start_pos === false) {\n return false;\n } else {\n return substr($controller_name, 0, $start_pos);\n }\n}", "/**\n * @deprecated 2.3.3 moved to expTemplate subsystem\n */\nfunction get_common_template($view, $loc, $controllername='') {\n return expTemplate::get_common_template($view, $loc, $controllername);", " $controller = new stdClass();\n $controller->baseclassname = empty($controllername) ? 'common' : $controllername;\n $controller->loc = $loc;", " ", " $themepath = BASE . 'themes/' . DISPLAY_THEME . '/modules/common/views/' . $controllername . '/' . $view . '.tpl';\n $basenewuipath = BASE . 'framework/modules/common/views/' . $controllername . '/' . $view . '.newui.tpl';\n $basepath = BASE . 'framework/modules/common/views/' . $controllername . '/' . $view . '.tpl';", " if (bs(true)) {\n $basebstrap3path = BASE . 'framework/modules/common/views/' . $controllername . '/' . $view . '.bootstrap3.tpl';\n $basebstrappath = BASE . 'framework/modules/common/views/' . $controllername . '/' . $view . '.bootstrap.tpl';\n if (file_exists($themepath)) {\n return new controllertemplate($controller, $themepath);\n } elseif (bs3(true) && file_exists($basebstrap3path)) {\n return new controllertemplate($controller, $basebstrap3path);\n } elseif (file_exists($basebstrappath)) {\n return new controllertemplate($controller, $basebstrappath);\n } elseif(newui() && file_exists($basenewuipath)) { //FIXME is this the correct sequence spot?\n return new controllertemplate($controller,$basenewuipath);\n } elseif (file_exists($basepath)) {\n return new controllertemplate($controller, $basepath);\n } else {\n return new controllertemplate($controller, BASE.'framework/modules/common/views/scaffold/blank.tpl');\n }\n } else {\n if (file_exists($themepath)) {\n return new controllertemplate($controller,$themepath);\n } elseif (newui() && file_exists($basenewuipath)) {\n return new controllertemplate($controller,$basenewuipath);\n } elseif(file_exists($basepath)) {\n return new controllertemplate($controller,$basepath);\n } else {\n return new controllertemplate($controller, BASE.'framework/modules/common/views/scaffold/blank.tpl');\n }\n }\n}", "/**\n * @deprecated 2.3.3 moved to expTemplate subsystem\n */\nfunction get_config_templates($controller, $loc) {\n return expTemplate::get_config_templates($controller, $loc);", "// global $db;", " ", " // set paths we will search in for the view\n $commonpaths = array(\n BASE.'framework/modules/common/views/configure',\n BASE.'themes/'.DISPLAY_THEME.'/modules/common/views/configure',\n );", " ", " $modpaths = array(\n $controller->viewpath.'/configure',\n\t BASE.'themes/'.DISPLAY_THEME.'/modules/'.$controller->relative_viewpath.'/configure'\n );", " \n // get the common configuration files ", " $common_views = expTemplate::find_config_views($commonpaths, $controller->remove_configs);\n foreach ($common_views as $key=>$value) {\n $common_views[$key]['name'] = gt($value['name']);\n }\n $moduleconfig = array();\n if (!empty($common_views['module'])) $moduleconfig['module'] = $common_views['module'];\n unset($common_views['module']);", " // get the config views for the module\n $module_views = expTemplate::find_config_views($modpaths);\n foreach ($module_views as $key=>$value) {\n $module_views[$key]['name'] = gt($value['name']);\n }\n", " // look for a config form for this module's current view ", "// $controller->loc->mod = expModules::getControllerClassName($controller->loc->mod);\n //check to see if hcview was passed along, indicating a hard-coded module\n// if (!empty($controller->params['hcview'])) {\n// $viewname = $controller->params['hcview'];\n// } else {\n// $viewname = $db->selectValue('container', 'view', \"internal='\".serialize($controller->loc).\"'\");\n// }\n// $viewconfig = $viewname.'.config';\n// foreach ($modpaths as $path) {\n// if (file_exists($path.'/'.$viewconfig)) {\n// $fileparts = explode('_', $viewname);\n// if ($fileparts[0]=='show'||$fileparts[0]=='showall') array_shift($fileparts);\n// $module_views[$viewname]['name'] = ucwords(implode(' ', $fileparts)).' '.gt('View Configuration');\n// $module_views[$viewname]['file'] =$path.'/'.$viewconfig;\n// }\n// }", " ", " // sort the views highest to lowest by filename\n // we are reverse sorting now so our array merge\n // will overwrite property..we will run array_reverse\n // when we're finished to get them back in the right order\n krsort($common_views);\n krsort($module_views);", " if (!empty($moduleconfig)) $common_views = array_merge($common_views, $moduleconfig);\n $views = array_merge($common_views, $module_views);\n $views = array_reverse($views);", " return $views;\n}", "/**\n * @deprecated 2.3.3 moved to expTemplate subsystem\n */\nfunction find_config_views($paths=array(), $excludes=array()) {\n return expTemplate::find_config_views($paths, $excludes);", " $views = array();\n foreach ($paths as $path) {\n if (is_readable($path)) {\n $dh = opendir($path);\n while (($file = readdir($dh)) !== false) {\n if (is_readable($path.'/'.$file) && substr($file, -4) == '.tpl' && substr($file, -14) != '.bootstrap.tpl' && substr($file, -15) != '.bootstrap3.tpl' && substr($file, -10) != '.newui.tpl') {\n $filename = substr($file, 0, -4);\n if (!in_array($filename, $excludes)) {\n $fileparts = explode('_', $filename);\n $views[$filename]['name'] = ucwords(implode(' ', $fileparts));\n $views[$filename]['file'] = $path.'/'.$file;\n if ((bs(true)) && file_exists($path.'/'.$filename.'.bootstrap.tpl')) {\n $views[$filename]['file'] = $path . '/' . $filename . '.bootstrap.tpl';\n }\n if (bs3() && file_exists($path.'/'.$filename.'.bootstrap3.tpl')) {\n $views[$filename]['file'] = $path.'/'.$filename.'.bootstrap3.tpl';\n }\n if (newui() && file_exists($path.'/'.$filename.'.newui.tpl')) { //FIXME newui take priority\n $views[$filename]['file'] = $path.'/'.$filename.'.newui.tpl';\n }\n }\n }\n }\n }\n }", " ", " return $views;\n}", "/**\n * @deprecated 2.3.3 moved to expTemplate subsystem\n */\nfunction get_template_for_action($controller, $action, $loc=null) {\n expTemplate::get_template_for_action($controller, $action, $loc);", " // set paths we will search in for the view\n $themepath = BASE.'themes/'.DISPLAY_THEME.'/modules/'.$controller->relative_viewpath.'/'.$action.'.tpl';\n $basepath = $controller->viewpath.'/'.$action.'.tpl';\n $newuithemepath = BASE.'themes/'.DISPLAY_THEME.'/modules/'.$controller->relative_viewpath.'/'.$action.'.newui.tpl'; //FIXME shoudl there be a theme newui variation?\n $basenewuipath = $controller->viewpath.'/'.$action.'.newui.tpl';", " // the root action will be used if we don't find a view for this action and it is a derivative of\n // action. i.e. showall_by_tags would use the showall.tpl view if we do not have a view named\n // showall_by_tags.tpl\n $root_action = explode('_', $action);\n $rootthemepath = BASE . 'themes/' . DISPLAY_THEME . '/modules/' . $controller->relative_viewpath . '/' . $root_action[0] . '.tpl';\n $rootbasepath = $controller->viewpath . '/' . $root_action[0] . '.tpl';", " if (newui()) {\n if (file_exists($newuithemepath)) {\n return new controllertemplate($controller, $newuithemepath);\n } elseif (file_exists($basenewuipath)) {\n return new controllertemplate($controller, $basenewuipath);\n }\n }\n if (bs(true)) {\n $rootbstrap3path = $controller->viewpath . '/' . $root_action[0] . '.bootstrap3.tpl';\n $basebstrap3path = $controller->viewpath . '/' . $action . '.bootstrap3.tpl';\n $rootbstrappath = $controller->viewpath . '/' . $root_action[0] . '.bootstrap.tpl';\n $basebstrappath = $controller->viewpath . '/' . $action . '.bootstrap.tpl';\n if (file_exists($themepath)) {\n return new controllertemplate($controller, $themepath);\n } elseif (bs3(true) && file_exists($basebstrap3path)) {\n return new controllertemplate($controller, $basebstrap3path);\n } elseif (file_exists($basebstrappath)) {\n return new controllertemplate($controller, $basebstrappath);\n } elseif (file_exists($basepath)) {\n return new controllertemplate($controller, $basepath);\n } elseif ($root_action[0] != $action) {\n if (file_exists($rootthemepath)) {\n return new controllertemplate($controller, $rootthemepath);\n } elseif (bs3(true) && file_exists($rootbstrap3path)) {\n return new controllertemplate($controller, $rootbstrap3path);\n } elseif (file_exists($rootbstrappath)) {\n return new controllertemplate($controller, $rootbstrappath);\n } elseif (file_exists($rootbasepath)) {\n return new controllertemplate($controller, $rootbasepath);\n }\n }\n } else {\n if (file_exists($themepath)) {\n return new controllertemplate($controller, $themepath);\n } elseif (file_exists($basepath)) {\n return new controllertemplate($controller, $basepath);\n } elseif ($root_action[0] != $action) {\n if (file_exists($rootthemepath)) {\n return new controllertemplate($controller, $rootthemepath);\n } elseif (file_exists($rootbasepath)) {\n return new controllertemplate($controller, $rootbasepath);\n }\n }\n }", " // if we get here it means there were no views for the this action to be found.\n // we will check to see if we have a scaffolded version or else just grab a blank template.\n if (file_exists(BASE . 'framework/modules/common/views/scaffold/' . $action . (newui()?'.newui':'') . '.tpl')) {\n return new controllertemplate($controller, BASE . 'framework/modules/common/views/scaffold/' . $action . (newui()?'.newui':'') . '.tpl');\n } else {\n return new controllertemplate($controller, BASE . 'framework/modules/common/views/scaffold/blank.tpl');\n }\n}", "/**\n * @deprecated 2.3.3 moved to expTemplate subsystem\n */\nfunction get_action_views($ctl, $action, $human_readable) {\n expTemplate::get_action_views($ctl, $action, $human_readable);", " // setup the controller\n// $controllerName = expModules::getControllerClassName($ctl);\n// $controller = new $controllerName();\n $controller = expModules::getController($ctl);\n", " // set path information ", " $paths = array(\n $controller->viewpath,\n BASE.'themes/'.DISPLAY_THEME.'/modules/'.$controller->relative_viewpath,\n );", " ", " $views = array();\n foreach ($paths as $path) {\n if (is_readable($path)) {\n $dh = opendir($path);\n while (($file = readdir($dh)) !== false) {\n if (is_readable($path.'/'.$file) && substr($file, -4) == '.tpl' && substr($file, -14) != '.bootstrap.tpl' && substr($file, -15) != '.bootstrap3.tpl' && substr($file, -10) != '.newui.tpl') {\n $filename = substr($file, 0, -4);\n $fileparts = explode('_', $filename);\n if ($fileparts[0] == $action) {\n if (count($fileparts) == 1) {\n $views[$filename] = 'Default';\n } else {\n array_shift($fileparts); //shift the action name off the array of words\n $views[$filename] = ucwords(implode(' ', $fileparts));\n }\n }\n }\n }\n }\n }", " // Language-ize the views names\n foreach ($views as $key=>$value) {\n $views[$key] = gt($value);\n }", " return $views;\n}", "/**\n * @deprecated 2.3.3 moved to expTemplate subsystem\n */\nfunction get_filedisplay_views() {\n expTemplate::get_filedisplay_views();", " $paths = array(\n BASE.'framework/modules/common/views/file/',\n BASE.'themes/'.DISPLAY_THEME.'modules/common/views/file/',\n );", " ", " $views = array();\n foreach ($paths as $path) {\n if (is_readable($path)) {\n $dh = opendir($path);\n while (($file = readdir($dh)) !== false) {\n if (is_readable($path.'/'.$file) && substr($file, -4) == '.tpl' && substr($file, -14) != '.bootstrap.tpl' && substr($file, -15) != '.bootstrap3.tpl' && substr($file, -10) != '.newui.tpl') {\n $filename = substr($file, 0, -4);\n $views[$filename] = gt($filename);\n }\n }\n }\n }", " ", " return $views;\n}", "function object2Array($object=null) {\n $ret_array = array();\n if(empty($object)) return $ret_array;", " foreach($object as $key=>$value) {\n $ret_array[$key] = $value;\n }", " return $ret_array;\n}", "function expUnserialize($serial_str) {\n if ($serial_str === 'Array') return null; // empty array string??\n if (is_array($serial_str) || is_object($serial_str)) return $serial_str; // already unserialized\n// $out1 = @preg_replace('!s:(\\d+):\"(.*?)\";!se', \"'s:'.strlen('$2').':\\\"$2\\\";'\", $serial_str );\n $out = preg_replace_callback(\n '!s:(\\d+):\"(.*?)\";!s',\n create_function ('$m',\n '$m_new = str_replace(\\'\"\\',\\'\\\"\\',$m[2]);\n return \"s:\".strlen($m_new).\\':\"\\'.$m_new.\\'\";\\';'\n ),\n $serial_str );\n// if ($out1 !== $out) {\n// eDebug('problem:<br>'.$out.'<br>'.$out1);\n// }\n $out2 = unserialize($out);\n if (is_array($out2)) {\n if (!empty($out2['moduledescription'])) { // work-around for links in module descriptions\n $out2['moduledescription'] = stripslashes($out2['moduledescription']);\n }\n if (!empty($out2['description'])) { // work-around for links in forms descriptions\n $out2['description'] = stripslashes($out2['description']);\n }\n if (!empty($out2['report_desc'])) { // work-around for links in forms report descriptions\n $out2['report_desc'] = stripslashes($out2['report_desc']);\n }\n if (!empty($out2['response'])) { // work-around for links in forms response\n $out2['response'] = stripslashes($out2['response']);\n }\n if (!empty($out2['auto_respond_body'])) { // work-around for links in forms auto respond\n $out2['auto_respond_body'] = stripslashes($out2['auto_respond_body']);\n }\n } elseif (is_object($out2) && get_class($out2) == 'htmlcontrol') {\n $out2->html = stripslashes($out2->html);\n }\n return $out2;\n}", "/**\n * callback when the buffer gets flushed. Any processing on the page output\n * just before it gets rendered to the screen should happen here.\n * @param $buffer\n * @param null $mode\n * @return mixed\n */\nfunction expProcessBuffer($buffer, $mode=null) {\n global $jsForHead, $cssForHead;", "// return (str_replace(\"<!-- MINIFY REPLACE -->\", $cssForHead.$jsForHead, $buffer));\n return (str_replace(\"<!-- MINIFY REPLACE -->\", $cssForHead, $buffer));\n}", "/**\n * Ensure we have a valid html 'id' attribute\n *\n * @param $id\n * @return mixed\n */\nfunction createValidId($id, $value='') {\n $badvals = array(\"[\", \"]\", \",\", \" \", \"'\", \"\\\"\", \"&\", \"#\", \"%\", \"@\", \"!\", \"$\", \"(\", \")\", \"{\", \"}\"); //FIXME do we need to update this to HTML5 and only include the space?\n if (strpos($id, '[]') !== false)\n $id .= $value;\n $new_id = str_replace($badvals, \"_\", trim($id));\n return $new_id;\n}", "function curPageURL() {\n if (expJavascript::inAjaxAction()) {\n $new_request = $_REQUEST;\n unset($new_request['ajax_action']);\n if ($new_request['controller'] == 'store' && $new_request['action'] == 'edit')\n unset($new_request['view']);\n $pageURL = makeLink($new_request);\n } else {\n $pageURL = 'http';\n if (!empty($_SERVER[\"HTTPS\"]) && $_SERVER[\"HTTPS\"] == \"on\") {\n $pageURL .= \"s\";\n }\n $pageURL .= \"://\";\n if ($_SERVER[\"SERVER_PORT\"] != \"80\") {\n $pageURL .= $_SERVER[\"SERVER_NAME\"] . \":\" . $_SERVER[\"SERVER_PORT\"] . $_SERVER[\"REQUEST_URI\"];\n } else {\n $pageURL .= $_SERVER[\"SERVER_NAME\"] . $_SERVER[\"REQUEST_URI\"];\n }\n }\n return $pageURL;\n}", "/**\n * Return status of e-commerce\n */\nfunction ecom_active() {\n global $db;", " return ($db->selectValue('modstate', 'active', 'module=\"store\"') ||\n $db->selectValue('modstate', 'active', 'module=\"eventregistration\"') ||\n $db->selectValue('modstate', 'active', 'module=\"donation\"') || FORCE_ECOM);\n}", "/**\n * Return the current framework\n *\n * @return bool\n */\nfunction framework() {\n global $framework;", " return $framework;\n}", "/**\n * Is the current framework Bootstrap v2 based?\n *\n * @return bool\n */\nfunction bs2() {\n global $framework;", " if ($framework == 'bootstrap') {\n return true;\n } else {\n return false;\n }\n}", "/**\n * Is the current framework Bootstrap v3 based?\n *\n * @param bool $strict must be bootstrap3 and NOT newui\n * @return bool\n */\nfunction bs3($strict = false) {\n global $framework;", " if ($framework == 'bootstrap3') {\n return true;\n } elseif ($framework == 'newui' && !$strict) {\n return true;\n } else {\n return false;\n }\n}", "/**\n * Is the current framework Bootstrap based?\n *\n * @param bool $strict must be bootstrap 2 or 3 and NOT newui\n * @return bool\n */\nfunction bs($strict = false) {\n global $framework;", " if ($framework == 'bootstrap3' || $framework == 'bootstrap') {\n return true;\n } elseif ($framework == 'newui' && !$strict) {\n return true;\n } else {\n return false;\n }\n}", "/**\n * Is the current framework NEWUI and NOT a Bootstrap framework\n *\n * @return bool\n */\nfunction newui() {\n global $framework;", " if ($framework == 'newui') {\n return true;\n } else {\n return false;\n }\n}", "function gt($s){\n return expLang::gettext($s);\n}", "function glist($s){\n if (is_array($s)) {\n $list = array();\n foreach ($s as $key=>$phrase) {\n $list[$key] = expLang::gettext(trim($phrase));\n }\n } else {\n $list = '';\n $phrases = explode(\",\",$s);\n foreach ($phrases as $key=>$phrase) {\n if ($key) $list .= ',';\n $list .= expLang::gettext(trim($phrase));\n }\n }\n return $list;\n}", "/**\n * called from exponent.php as the ajax error handler\n *\n * @param $errno\n * @param $errstr\n * @param $errfile\n * @param $errline\n */\nfunction handleErrors($errno, $errstr, $errfile, $errline) {\n if (DEVELOPMENT > 0 && AJAX_ERROR_REPORTING == 1) {\n switch ($errno) {\n case E_ERROR:\n case E_USER_ERROR:\n $msg = 'PHP Error('.$errno.'): ';\n break;\n case E_WARNING:\n case E_USER_WARNING:\n $msg = 'PHP Warning('.$errno.'): ';\n break;\n case E_NOTICE:\n case E_USER_NOTICE:\n $msg = 'PHP Notice('.$errno.'): ';\n break;\n default:\n return; // we really don't want other issues printed\n $msg = 'PHP Issue('.$errno.'): ';\n break;\n }\n $msg .= $errstr;\n $msg .= !empty($errfile) ? ' in file '.$errfile : \"\";\n $msg .= !empty($errline) ? ' on line '.$errline : \"\";\n // send to the debug output\n eDebug($msg);\n }\n}", "/**\n * dumps the passed variable to screen/log, but only if in development mode\n *\n * @param mixed $var the variable to dump\n * @param bool $halt if set to true will halt execution\n * @param bool $disable_log if set to true will disable logging and force to screen\n * @return void\n */\nfunction eDebug($var, $halt=false, $disable_log=false){\n\tif (DEVELOPMENT) {\n if (LOGGER && !$disable_log) {\n// if(is_array($var) || is_object($var)) {\n// $pvar = print_r($var, true);\n// } else {\n// $pvar = $var;\n// }\n// echo(\"<script>YUI(EXPONENT.YUI3_CONFIG).use('node', function(Y) {Y.log('\".json_encode($pvar).\"','info','exp')});;</script>\");\n eLog($var, gt('DEBUG'));\n } else {\n if (file_exists(BASE . 'external/kint/Kint.class.php')) {\n require_once BASE . 'external/kint/Kint.class.php';\n d($var); // kint\n } else {\n echo \"<pre>\";\n print_r($var);\n echo \"</pre>\";\n }\n }", "\t\tif ($halt) die();\n\t}\n}", "/**\n * dumps the passed variable to a log, but only if in development mode\n *\n * @param mixed $var the variable to log\n * @param string $type the type of entry to record\n * @param string $path the pathname for the log file\n * @param string $minlevel\n * @return void\n */\nfunction eLog($var, $type='', $path='', $minlevel='0') {\n\tif($type == '') { $type = \"INFO\"; }\n\tif($path == '') { $path = BASE . 'tmp/exponent.log'; }\n\tif (DEVELOPMENT >= $minlevel) {\n\t\tif (is_writable ($path) || !file_exists($path)) {\n\t\t\tif (!$log = fopen ($path, \"ab\")) {\n\t\t\t\teDebug(gt(\"Error opening log file for writing.\"), false, true);\n\t\t\t} else {\n if(is_array($var) || is_object($var)) {\n// $pvar = print_r($var, true);\n $pvar = json_encode($var, true); // json is easier to deal with as data\n } else {\n $pvar = $var;\n }\n\t\t\t\tif (fwrite ($log, $type . \": \" . $pvar . \"\\r\\n\") === FALSE) {\n\t\t\t\t\teDebug(gt(\"Error writing to log file\").\" (\".$path.\").\", false, true);\n\t\t\t\t}\n\t\t\t\tfclose ($log);\n\t\t\t}\n\t\t} else {\n\t\t\teDebug(gt(\"Log file\".\" (\".$path).\" \".gt(\"not writable.\"), false, true);\n\t\t}\n\t}\n}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "//Global Variables", "// expModules\n/**\n * Stores the list of available/active controllers\n * @var array $available_controllers\n * @name $available_controllers\n */\n$available_controllers = array();", "// expTheme\n/**\n * Stores the theme validation flags\n * @var array $validateTheme does theme have header & footer\n * @name $validateTheme\n */\n$validateTheme = array(\"headerinfo\"=>false,\"footerinfo\"=>false);\n/**\n * Stores the list of module scopes\n * @var array $module_scope\n * @name $module_scope\n */\n$module_scope = array();\n/**\n * Stores the theme framework\n * @var integer $framework\n * @name $framework\n */\n$framework = null;", "// expLang\n/**\n * Stores the list of language strings for the current language\n * @var array $cur_lang\n * @name $cur_lang\n */\n$cur_lang = array();\n/**\n * Stores the list of language strings for the default language (English - US)\n * @var array $default_lang\n * @name $default_lang\n */\n$default_lang = array();\n/**\n * Stores the list of language specific strings specific to the theme\n * @var array $custom_lang\n * @name $custom_lang\n */\n$custom_lang = array();\n/**\n * Stores the name of the default language file\n * @var array $default_lang_file\n * @name $default_lang_file\n */\n$default_lang_file = '';\n/**\n * Stores the name of the language file to be created\n * @var array $target_lang_file\n * @name $target_lang_file\n */\n$target_lang_file = '';", "// expDatabase\n/**\n * Stores the exponent database object\n * @var \\database $db the exponent database object\n * @name $db\n */\n$db = new stdClass();", "// expHistory\n/**\n * Stores the browsing history object\n * @var expHistory $history\n * @name $history\n */\n$history = new stdClass();", "// user model\n/**\n * Stores the current user object\n * @var user $user\n * @name $user\n */\n$user = new stdClass();\n/**\n * This global array belongs exclusively to the user model, and is used to cache\n * users as they are retrieved, to help out with performance when doing a lot of\n * work with user accounts and profile information.\n * @var array $SYS_USERS_CACHE\n * @name $SYS_USERS_CACHE\n */\n$SYS_USERS_CACHE = array();", "// expRouter\n/**\n * Stores the routing/link/url object\n * @var expRouter $router\n * @name $router\n */\n$router = new stdClass();\n/**\n * Stores the routing/link/url object\n * @var section $sectionObj\n * @name $sectionObj\n */\n$sectionObj = new stdClass();", "// expCore\n/**\n * Stores the list of sections/pages for the site\n * @var array $sections\n * @name $sections\n */\n$sections = array();\n// expPermissions\n/**\n * Stores the permission data for the current user.\n * This should not be modified by anything outside of the permissions subsystem.\n * @var array $exponent_permissions_r\n * @name $exponent_permissions_r\n */\n$exponent_permissions_r = array();", "// expJavascript\n/**\n * Stores the page's inline javascript code\n * @var array $js2foot\n * @name $js2foot\n */\n$js2foot = array();\n/**\n * Stores the yui3 javascript files list\n * @var array $yui3js\n * @name $yui3js\n */\n$yui3js = false;\n/**\n * Stores the jquery javascript files list\n * @var array $jqueryjs\n * @name $jqueryjs\n */\n$jqueryjs = array();\n/**\n * Stores the twitter bootstrap javascript file list\n * @var array $bootstrapjs\n * @name $bootstrapjs\n */\n$bootstrapjs = array();\n/**\n * Stores the 'other' javascript files list\n * @var array $expJS\n * @name $expJS\n */\n$expJS = array();", "// expCSS\n/**\n * Stores the user's less global variables\n * @var array $less_vars\n * @name $less_vars\n */\n$less_vars = array();\n/**\n * Stores the user's css files to load first\n * @var array $css_primer\n * @name $css_primer\n */\n$css_primer = array();\n/**\n * Stores the user's css core/system files\n * @var array $css_core\n * @name $css_core\n */\n$css_core = array();\n/**\n * Stores the user's css files\n * @var array $css_links\n * @name $css_links\n */\n$css_links = array();\n/**\n * Stores the user's css files\n * @var array $css_theme\n * @name $css_theme\n */\n$css_theme = array();\n/**\n * Stores the user's css files\n * @var array $css_inline\n * @name $css_inline\n */\n$css_inline = array();\n/**\n * Stores the user's css files\n * @var array $head_config\n * @name $head_config\n */\n$head_config = array();\n/**\n * Stores the user's css files\n * @var string $jsForHead\n * @name $jsForHead\n */\n$jsForHead = \"\";\n/**\n * Stores the user's css files\n * @var string $cssForHead\n * @name $cssForHead\n */\n$cssForHead = \"\";", "// expTemplate\n/**\n * Stores the global template\n * @var \\basetemplate $template\n * @name $template\n */\n$template = null;", "// expTimer\n/**\n * Stores the timer\n * @var expTimer $timer\n * @name $timer\n */\n$timer = null;", "// e-commerce\n/**\n * Stores the order\n * @var \\order $order\n * @name $order\n */\n$order = null;", "/**\n * Main module action/display logic/routine; initializes/checks controller before calling action/method\n *\n * @param array $parms\n * @return bool|mixed|string\n */\nfunction renderAction(array $parms=array()) {\n global $user, $db;", " //Get some info about the controller\n// $baseControllerName = expModules::getControllerName($parms['controller']);\n $fullControllerName = expModules::getControllerClassName($parms['controller']);\n if (expModules::controllerExists($fullControllerName)) {\n $controllerClass = new ReflectionClass($fullControllerName);\n } else {\n return sprintf(gt('The module \"%s\" was not found in the system'), $parms['controller']);\n }", " if (isset($parms['view'])) $parms['view'] = urldecode($parms['view']);\n // Figure out the action to use...if the specified action doesn't exist then we look for the showall action.\n if ($controllerClass->hasMethod($parms['action'])) {\n $action = $parms['action'];\n /* TODO: Not sure if we need to check for private methods to be here. FJD\n\t\t$meth = $controllerClass->getMethod($action);\n if ($meth->isPrivate()) expQueue::flashAndFlow('error', gt('The requested action could not be performed: Action not found'));*/\n } elseif ($controllerClass->hasMethod('showall')) {\n $parms['action'] = 'showall';\n $action = 'showall';\n } else {\n expQueue::flashAndFlow('error', gt('The requested action could not be performed: Action not found'));\n }", " // initialize the controller.\n $src = isset($parms['src']) ? $parms['src'] : null;", " $controller = new $fullControllerName($src, $parms);\n", " //Set up the correct template to use for this action\n global $template;\n $view = !empty($parms['view']) ? $parms['view'] : $action;\n $template = expTemplate::get_template_for_action($controller, $view, $controller->loc);", "", " //setup default model(s) for this controller's actions to use\n foreach ($controller->getModels() as $model) {\n $controller->$model = new $model(null,false,false); //added null,false,false to reduce unnecessary queries. FJD\n // flag for needing approval check\n if ($controller->$model->supports_revisions && ENABLE_WORKFLOW) {\n $uilevel = 99;\n if (expSession::exists(\"uilevel\")) $uilevel = expSession::get(\"uilevel\");\n if (!expPermissions::check('approve', $controller->loc)) {\n $controller->$model->needs_approval = true;\n } elseif (isset($uilevel) && $uilevel == UILEVEL_PREVIEW) {\n $controller->$model->needs_approval = true;\n }\n }\n }", "// FIXME this is now handled by the template class during get_template_for_action since it only sets template variables\n // have the controller assign knowledge about itself to the template.\n // this has to be done after the controller gets the template for its actions\n// $controller->moduleSelfAwareness();", " //if this controller is being called by a container then we should have a module title.\n if (isset($parms['moduletitle'])) {\n $template->assign('moduletitle', $parms['moduletitle']);\n } else {\n $title = new stdClass();\n $title->mod = $controller->loc->mod;\n $title->src = $controller->loc->src;\n $title->int = '';\n $template->assign('moduletitle', $db->selectValue('container', 'title', \"internal='\".serialize($title).\"'\"));\n }", " // check the perms for this action", " $perms = $controller->permissions_all();", " $common_action = null;\n // action convention for controllers that manage more than one model (datatype).\n // if you preface the name action name with a common crud action name we can check perms on\n // it with the developer needing to specify any...better safe than sorry.\n // i.e if the action is edit_mymodel it will be checked against the edit permission\n if (stristr($parms['action'], '_'))\n $parts = explode(\"_\", $parms['action']);\n else\n $parts = preg_split('/(?=[A-Z])/', $parms['action']); // account for actions with camelCase action/perm such as editItem\n $common_action = isset($parts[0]) ? $parts[0] : null;", " // we have to treat the update permission a little different..it's tied to the create/edit\n // permissions. Really the only way this will fail will be if someone bypasses the perm check\n // on the edit form somehow..like a hacker trying to bypass the form and just submit straight to\n // the action. To safeguard, we'll catch if the action is update and change it either to create or\n // edit depending on whether an id param is passed to. that should be sufficient.", " if ($parms['action'] == 'update' || $common_action == 'update') {", " $perm_action = (!isset($parms['id']) || $parms['id'] == 0) ? 'create' : 'edit';", " } elseif (($parms['action'] == 'edit' || $common_action == 'edit') && (!isset($parms['id']) || $parms['id'] == 0)) {", " $perm_action = 'create';\n } elseif ($parms['action'] == 'saveconfig') {\n $perm_action = 'configure';\n } else {", "", " $perm_action = $parms['action'];\n }", " // Here is where we check for ownership of an item and 'create' perm\n if (($parms['action'] == 'edit' || $parms['action'] == 'update' || $parms['action'] == 'delete' ||\n $common_action == 'edit' || $common_action == 'update' || $common_action == 'delete') && !empty($parms['id'])) {\n $theaction = !empty($common_action) ? $common_action : $parms['action'];\n $owner = $db->selectValue($model, 'poster', 'id=' . $parms['id']);\n if ($owner == $user->id && !expPermissions::check($theaction, $controller->loc) && expPermissions::check('create', $controller->loc)) {\n $perm_action = 'create';\n }\n }", " if (!DISABLE_PRIVACY) {\n // check to see if it's on a private page and we shouldn't see it\n if ($perm_action == 'showall' || $perm_action == 'show' || $perm_action == 'downloadfile' || $common_action == 'showall' || $common_action == 'show' || $common_action == 'downloadfile') {\n $loc = null;\n if (!empty($parms['src'])) {\n $loc = expCore::makeLocation($parms['controller'], $parms['src']);\n } elseif (!empty($parms['id']) || !empty($parms['title']) || !empty($parms['sef_url'])) {\n if (!empty($parms['id'])) {\n $record = new $controller->basemodel_name($parms['id']);\n } elseif (!empty($parms['title'])) {\n $record = new $controller->basemodel_name($parms['title']);\n } elseif (!empty($parms['sef_url'])) {\n $record = new $controller->basemodel_name($parms['sef_url']);\n }\n if (!empty($record->location_data)) $loc = expUnserialize($record->location_data);\n }\n if (!empty($loc)) {\n $section = new section();\n $sectionref = new sectionref();\n $container = new container();\n $secref = $sectionref->find('first',\"module='\".$parms['controller'].\"' AND source='\" . $loc->src . \"'\");\n if (!empty($secref->section)) {\n $page = $section->find('first','id=' . $secref->section); // only one page can have the section id#\n $module = $container->find('first',\"internal='\" . serialize($loc) . \"'\"); // only one container can have the internal == location\n if ($page !== null && $module !== null && !empty($page->id) && (empty($page->public) || !empty($module->is_private))) {\n // we've found the page and module/container and it's either a private page or private module\n if (!expPermissions::check('view',expCore::makeLocation('navigation', $page->id))) {\n if (expTheme::inAction()) {\n flash('error', gt(\"You don't have permission to view that item\"));\n notfoundController::handle_not_authorized();\n expHistory::returnTo('viewable');\n } else {\n return false;\n }\n }\n }\n }\n }\n }\n }", " //FIXME? if the assoc $perm doesn't exist, the 'action' will ALWAYS be allowed, e.g., default is to allow action\n if (array_key_exists($perm_action, $perms)) {\n if (!expPermissions::check($perm_action, $controller->loc)) {\n if (expTheme::inAction()) {\n flash('error', gt(\"You don't have permission to\").\" \".$perms[$perm_action]);\n notfoundController::handle_not_authorized();\n expHistory::returnTo('viewable');\n } else {\n return false;\n }\n }\n } elseif (array_key_exists($common_action, $perms)) {\n if (!expPermissions::check($common_action, $controller->loc)) {\n if (expTheme::inAction()) {\n flash('error', gt(\"You don't have permission to\").\" \".$perms[$common_action]);\n notfoundController::handle_not_authorized();\n expHistory::returnTo('viewable');\n } else {\n return false;\n }\n }\n } elseif (array_key_exists($perm_action, $controller->requires_login)) {\n // check if the action requires the user to at least be logged in\n if (!$user->isLoggedIn()) {", " $msg = empty($controller->requires_login[$perm_action]) ? gt(\"You must be logged in to perform this action\") : gt($controller->requires_login[$perm_action]);", " flash('error', $msg);\n notfoundController::handle_not_authorized();\n expHistory::redirecto_login();\n }\n } elseif (array_key_exists($common_action, $controller->requires_login)) {\n // check if the action requires the user to at least be logged in\n if (!$user->isLoggedIn()) {", " $msg = empty($controller->requires_login[$common_action]) ? gt(\"You must be logged in to perform this action\") : gt($controller->requires_login[$common_action]);", " flash('error', $msg);\n notfoundController::handle_not_authorized();\n expHistory::redirecto_login();\n }", " }\n", " // register this controllers permissions to the view for in view perm checks\n $template->register_permissions(array_keys($perms), $controller->loc);", "", " // globalizing $user inside all templates\n $template->assign('user', $user);", " // lastly, run the action which can also override the above assignments\n $controller->$action();", " if (empty($parms['no_output'])) {\n $template->output();\n } else {\n $html = $template->render();\n return $html;\n }\n}", "function hotspot($source = null) {\n if (!empty($source)) {\n global $sectionObj;", "\t //FIXME there is NO 'page' object and section has no _construct method\n $page = new section($sectionObj->id);\n $modules = $page->getModulesBySource($source); //FIXME there is no getModulesBySource method anywhere\n //eDebug($modules);exit();", " foreach ($modules as $module) {\n renderAction(array('controller'=>$module->type, 'action'=>$module->action, 'instance'=>$module->id));\n }\n }\n}", "function makeLink($params=array(), $secure=false) {\n global $router;", " if(!is_array($params) || count($params) == 0) return false;\n $secure = empty($secure) ? false : true;\n return $router->makeLink($params, false, $secure);\n}", "function redirect_to($params=array(), $secure=false) {\n global $router;", " $secure = empty($secure) ? false : true;\n $link = (!is_array($params)) ? $params : $router->makeLink($params, false, $secure);\n header(\"Location: \" . $link);\n exit();", "}", "\nfunction flash($name, $msg) {\n expQueue::flash($name, $msg);\n}", "function flashAndFlow($name, $msg) {\n expQueue::flashAndFlow($name, $msg);\n}", "/**\n * Display the message queue\n *\n * @param null $name\n * @return bool|mixed|string\n */\nfunction show_msg_queue($name=null) {\n return expQueue::show($name);\n}", "/**\n * Assign a variable to the current template\n *\n * @param array $vars\n * @return bool\n */\nfunction assign_to_template(array $vars=array()) {\n global $template;", "", " if (empty($template) || count($vars) == 0) return false;\n foreach ($vars as $key=>$val) {\n $template->assign($key, $val);\n }\n}", "function get_model_for_controller($controller_name) {\n //FIXME this works by making assumptions\n $start_pos = stripos($controller_name, 'controller');\n if ($start_pos === false) {\n return false;\n } else {\n return substr($controller_name, 0, $start_pos);\n }\n}", "/**\n * @deprecated 2.3.3 moved to expTemplate subsystem\n */\nfunction get_common_template($view, $loc, $controllername='') {\n return expTemplate::get_common_template($view, $loc, $controllername);", " $controller = new stdClass();\n $controller->baseclassname = empty($controllername) ? 'common' : $controllername;\n $controller->loc = $loc;", "", " $themepath = BASE . 'themes/' . DISPLAY_THEME . '/modules/common/views/' . $controllername . '/' . $view . '.tpl';\n $basenewuipath = BASE . 'framework/modules/common/views/' . $controllername . '/' . $view . '.newui.tpl';\n $basepath = BASE . 'framework/modules/common/views/' . $controllername . '/' . $view . '.tpl';", " if (bs(true)) {\n $basebstrap3path = BASE . 'framework/modules/common/views/' . $controllername . '/' . $view . '.bootstrap3.tpl';\n $basebstrappath = BASE . 'framework/modules/common/views/' . $controllername . '/' . $view . '.bootstrap.tpl';\n if (file_exists($themepath)) {\n return new controllertemplate($controller, $themepath);\n } elseif (bs3(true) && file_exists($basebstrap3path)) {\n return new controllertemplate($controller, $basebstrap3path);\n } elseif (file_exists($basebstrappath)) {\n return new controllertemplate($controller, $basebstrappath);\n } elseif(newui() && file_exists($basenewuipath)) { //FIXME is this the correct sequence spot?\n return new controllertemplate($controller,$basenewuipath);\n } elseif (file_exists($basepath)) {\n return new controllertemplate($controller, $basepath);\n } else {\n return new controllertemplate($controller, BASE.'framework/modules/common/views/scaffold/blank.tpl');\n }\n } else {\n if (file_exists($themepath)) {\n return new controllertemplate($controller,$themepath);\n } elseif (newui() && file_exists($basenewuipath)) {\n return new controllertemplate($controller,$basenewuipath);\n } elseif(file_exists($basepath)) {\n return new controllertemplate($controller,$basepath);\n } else {\n return new controllertemplate($controller, BASE.'framework/modules/common/views/scaffold/blank.tpl');\n }\n }\n}", "/**\n * @deprecated 2.3.3 moved to expTemplate subsystem\n */\nfunction get_config_templates($controller, $loc) {\n return expTemplate::get_config_templates($controller, $loc);", "// global $db;", "", " // set paths we will search in for the view\n $commonpaths = array(\n BASE.'framework/modules/common/views/configure',\n BASE.'themes/'.DISPLAY_THEME.'/modules/common/views/configure',\n );", "", " $modpaths = array(\n $controller->viewpath.'/configure',\n\t BASE.'themes/'.DISPLAY_THEME.'/modules/'.$controller->relative_viewpath.'/configure'\n );", "\n // get the common configuration files", " $common_views = expTemplate::find_config_views($commonpaths, $controller->remove_configs);\n foreach ($common_views as $key=>$value) {\n $common_views[$key]['name'] = gt($value['name']);\n }\n $moduleconfig = array();\n if (!empty($common_views['module'])) $moduleconfig['module'] = $common_views['module'];\n unset($common_views['module']);", " // get the config views for the module\n $module_views = expTemplate::find_config_views($modpaths);\n foreach ($module_views as $key=>$value) {\n $module_views[$key]['name'] = gt($value['name']);\n }\n", " // look for a config form for this module's current view", "// $controller->loc->mod = expModules::getControllerClassName($controller->loc->mod);\n //check to see if hcview was passed along, indicating a hard-coded module\n// if (!empty($controller->params['hcview'])) {\n// $viewname = $controller->params['hcview'];\n// } else {\n// $viewname = $db->selectValue('container', 'view', \"internal='\".serialize($controller->loc).\"'\");\n// }\n// $viewconfig = $viewname.'.config';\n// foreach ($modpaths as $path) {\n// if (file_exists($path.'/'.$viewconfig)) {\n// $fileparts = explode('_', $viewname);\n// if ($fileparts[0]=='show'||$fileparts[0]=='showall') array_shift($fileparts);\n// $module_views[$viewname]['name'] = ucwords(implode(' ', $fileparts)).' '.gt('View Configuration');\n// $module_views[$viewname]['file'] =$path.'/'.$viewconfig;\n// }\n// }", "", " // sort the views highest to lowest by filename\n // we are reverse sorting now so our array merge\n // will overwrite property..we will run array_reverse\n // when we're finished to get them back in the right order\n krsort($common_views);\n krsort($module_views);", " if (!empty($moduleconfig)) $common_views = array_merge($common_views, $moduleconfig);\n $views = array_merge($common_views, $module_views);\n $views = array_reverse($views);", " return $views;\n}", "/**\n * @deprecated 2.3.3 moved to expTemplate subsystem\n */\nfunction find_config_views($paths=array(), $excludes=array()) {\n return expTemplate::find_config_views($paths, $excludes);", " $views = array();\n foreach ($paths as $path) {\n if (is_readable($path)) {\n $dh = opendir($path);\n while (($file = readdir($dh)) !== false) {\n if (is_readable($path.'/'.$file) && substr($file, -4) == '.tpl' && substr($file, -14) != '.bootstrap.tpl' && substr($file, -15) != '.bootstrap3.tpl' && substr($file, -10) != '.newui.tpl') {\n $filename = substr($file, 0, -4);\n if (!in_array($filename, $excludes)) {\n $fileparts = explode('_', $filename);\n $views[$filename]['name'] = ucwords(implode(' ', $fileparts));\n $views[$filename]['file'] = $path.'/'.$file;\n if ((bs(true)) && file_exists($path.'/'.$filename.'.bootstrap.tpl')) {\n $views[$filename]['file'] = $path . '/' . $filename . '.bootstrap.tpl';\n }\n if (bs3() && file_exists($path.'/'.$filename.'.bootstrap3.tpl')) {\n $views[$filename]['file'] = $path.'/'.$filename.'.bootstrap3.tpl';\n }\n if (newui() && file_exists($path.'/'.$filename.'.newui.tpl')) { //FIXME newui take priority\n $views[$filename]['file'] = $path.'/'.$filename.'.newui.tpl';\n }\n }\n }\n }\n }\n }", "", " return $views;\n}", "/**\n * @deprecated 2.3.3 moved to expTemplate subsystem\n */\nfunction get_template_for_action($controller, $action, $loc=null) {\n expTemplate::get_template_for_action($controller, $action, $loc);", " // set paths we will search in for the view\n $themepath = BASE.'themes/'.DISPLAY_THEME.'/modules/'.$controller->relative_viewpath.'/'.$action.'.tpl';\n $basepath = $controller->viewpath.'/'.$action.'.tpl';\n $newuithemepath = BASE.'themes/'.DISPLAY_THEME.'/modules/'.$controller->relative_viewpath.'/'.$action.'.newui.tpl'; //FIXME shoudl there be a theme newui variation?\n $basenewuipath = $controller->viewpath.'/'.$action.'.newui.tpl';", " // the root action will be used if we don't find a view for this action and it is a derivative of\n // action. i.e. showall_by_tags would use the showall.tpl view if we do not have a view named\n // showall_by_tags.tpl\n $root_action = explode('_', $action);\n $rootthemepath = BASE . 'themes/' . DISPLAY_THEME . '/modules/' . $controller->relative_viewpath . '/' . $root_action[0] . '.tpl';\n $rootbasepath = $controller->viewpath . '/' . $root_action[0] . '.tpl';", " if (newui()) {\n if (file_exists($newuithemepath)) {\n return new controllertemplate($controller, $newuithemepath);\n } elseif (file_exists($basenewuipath)) {\n return new controllertemplate($controller, $basenewuipath);\n }\n }\n if (bs(true)) {\n $rootbstrap3path = $controller->viewpath . '/' . $root_action[0] . '.bootstrap3.tpl';\n $basebstrap3path = $controller->viewpath . '/' . $action . '.bootstrap3.tpl';\n $rootbstrappath = $controller->viewpath . '/' . $root_action[0] . '.bootstrap.tpl';\n $basebstrappath = $controller->viewpath . '/' . $action . '.bootstrap.tpl';\n if (file_exists($themepath)) {\n return new controllertemplate($controller, $themepath);\n } elseif (bs3(true) && file_exists($basebstrap3path)) {\n return new controllertemplate($controller, $basebstrap3path);\n } elseif (file_exists($basebstrappath)) {\n return new controllertemplate($controller, $basebstrappath);\n } elseif (file_exists($basepath)) {\n return new controllertemplate($controller, $basepath);\n } elseif ($root_action[0] != $action) {\n if (file_exists($rootthemepath)) {\n return new controllertemplate($controller, $rootthemepath);\n } elseif (bs3(true) && file_exists($rootbstrap3path)) {\n return new controllertemplate($controller, $rootbstrap3path);\n } elseif (file_exists($rootbstrappath)) {\n return new controllertemplate($controller, $rootbstrappath);\n } elseif (file_exists($rootbasepath)) {\n return new controllertemplate($controller, $rootbasepath);\n }\n }\n } else {\n if (file_exists($themepath)) {\n return new controllertemplate($controller, $themepath);\n } elseif (file_exists($basepath)) {\n return new controllertemplate($controller, $basepath);\n } elseif ($root_action[0] != $action) {\n if (file_exists($rootthemepath)) {\n return new controllertemplate($controller, $rootthemepath);\n } elseif (file_exists($rootbasepath)) {\n return new controllertemplate($controller, $rootbasepath);\n }\n }\n }", " // if we get here it means there were no views for the this action to be found.\n // we will check to see if we have a scaffolded version or else just grab a blank template.\n if (file_exists(BASE . 'framework/modules/common/views/scaffold/' . $action . (newui()?'.newui':'') . '.tpl')) {\n return new controllertemplate($controller, BASE . 'framework/modules/common/views/scaffold/' . $action . (newui()?'.newui':'') . '.tpl');\n } else {\n return new controllertemplate($controller, BASE . 'framework/modules/common/views/scaffold/blank.tpl');\n }\n}", "/**\n * @deprecated 2.3.3 moved to expTemplate subsystem\n */\nfunction get_action_views($ctl, $action, $human_readable) {\n expTemplate::get_action_views($ctl, $action, $human_readable);", " // setup the controller\n// $controllerName = expModules::getControllerClassName($ctl);\n// $controller = new $controllerName();\n $controller = expModules::getController($ctl);\n", " // set path information", " $paths = array(\n $controller->viewpath,\n BASE.'themes/'.DISPLAY_THEME.'/modules/'.$controller->relative_viewpath,\n );", "", " $views = array();\n foreach ($paths as $path) {\n if (is_readable($path)) {\n $dh = opendir($path);\n while (($file = readdir($dh)) !== false) {\n if (is_readable($path.'/'.$file) && substr($file, -4) == '.tpl' && substr($file, -14) != '.bootstrap.tpl' && substr($file, -15) != '.bootstrap3.tpl' && substr($file, -10) != '.newui.tpl') {\n $filename = substr($file, 0, -4);\n $fileparts = explode('_', $filename);\n if ($fileparts[0] == $action) {\n if (count($fileparts) == 1) {\n $views[$filename] = 'Default';\n } else {\n array_shift($fileparts); //shift the action name off the array of words\n $views[$filename] = ucwords(implode(' ', $fileparts));\n }\n }\n }\n }\n }\n }", " // Language-ize the views names\n foreach ($views as $key=>$value) {\n $views[$key] = gt($value);\n }", " return $views;\n}", "/**\n * @deprecated 2.3.3 moved to expTemplate subsystem\n */\nfunction get_filedisplay_views() {\n expTemplate::get_filedisplay_views();", " $paths = array(\n BASE.'framework/modules/common/views/file/',\n BASE.'themes/'.DISPLAY_THEME.'modules/common/views/file/',\n );", "", " $views = array();\n foreach ($paths as $path) {\n if (is_readable($path)) {\n $dh = opendir($path);\n while (($file = readdir($dh)) !== false) {\n if (is_readable($path.'/'.$file) && substr($file, -4) == '.tpl' && substr($file, -14) != '.bootstrap.tpl' && substr($file, -15) != '.bootstrap3.tpl' && substr($file, -10) != '.newui.tpl') {\n $filename = substr($file, 0, -4);\n $views[$filename] = gt($filename);\n }\n }\n }\n }", "", " return $views;\n}", "function object2Array($object=null) {\n $ret_array = array();\n if(empty($object)) return $ret_array;", " foreach($object as $key=>$value) {\n $ret_array[$key] = $value;\n }", " return $ret_array;\n}", "function expUnserialize($serial_str) {\n if ($serial_str === 'Array') return null; // empty array string??\n if (is_array($serial_str) || is_object($serial_str)) return $serial_str; // already unserialized\n// $out1 = @preg_replace('!s:(\\d+):\"(.*?)\";!se', \"'s:'.strlen('$2').':\\\"$2\\\";'\", $serial_str );\n $out = preg_replace_callback(\n '!s:(\\d+):\"(.*?)\";!s',\n create_function ('$m',\n '$m_new = str_replace(\\'\"\\',\\'\\\"\\',$m[2]);\n return \"s:\".strlen($m_new).\\':\"\\'.$m_new.\\'\";\\';'\n ),\n $serial_str );\n// if ($out1 !== $out) {\n// eDebug('problem:<br>'.$out.'<br>'.$out1);\n// }\n $out2 = unserialize($out);\n if (is_array($out2)) {\n if (!empty($out2['moduledescription'])) { // work-around for links in module descriptions\n $out2['moduledescription'] = stripslashes($out2['moduledescription']);\n }\n if (!empty($out2['description'])) { // work-around for links in forms descriptions\n $out2['description'] = stripslashes($out2['description']);\n }\n if (!empty($out2['report_desc'])) { // work-around for links in forms report descriptions\n $out2['report_desc'] = stripslashes($out2['report_desc']);\n }\n if (!empty($out2['response'])) { // work-around for links in forms response\n $out2['response'] = stripslashes($out2['response']);\n }\n if (!empty($out2['auto_respond_body'])) { // work-around for links in forms auto respond\n $out2['auto_respond_body'] = stripslashes($out2['auto_respond_body']);\n }\n } elseif (is_object($out2) && get_class($out2) == 'htmlcontrol') {\n $out2->html = stripslashes($out2->html);\n }\n return $out2;\n}", "/**\n * callback when the buffer gets flushed. Any processing on the page output\n * just before it gets rendered to the screen should happen here.\n * @param $buffer\n * @param null $mode\n * @return mixed\n */\nfunction expProcessBuffer($buffer, $mode=null) {\n global $jsForHead, $cssForHead;", "// return (str_replace(\"<!-- MINIFY REPLACE -->\", $cssForHead.$jsForHead, $buffer));\n return (str_replace(\"<!-- MINIFY REPLACE -->\", $cssForHead, $buffer));\n}", "/**\n * Ensure we have a valid html 'id' attribute\n *\n * @param $id\n * @return mixed\n */\nfunction createValidId($id, $value='') {\n $badvals = array(\"[\", \"]\", \",\", \" \", \"'\", \"\\\"\", \"&\", \"#\", \"%\", \"@\", \"!\", \"$\", \"(\", \")\", \"{\", \"}\"); //FIXME do we need to update this to HTML5 and only include the space?\n if (strpos($id, '[]') !== false)\n $id .= $value;\n $new_id = str_replace($badvals, \"_\", trim($id));\n return $new_id;\n}", "function curPageURL() {\n if (expJavascript::inAjaxAction()) {\n $new_request = $_REQUEST;\n unset($new_request['ajax_action']);\n if ($new_request['controller'] == 'store' && $new_request['action'] == 'edit')\n unset($new_request['view']);\n $pageURL = makeLink($new_request);\n } else {\n $pageURL = 'http';\n if (!empty($_SERVER[\"HTTPS\"]) && $_SERVER[\"HTTPS\"] == \"on\") {\n $pageURL .= \"s\";\n }\n $pageURL .= \"://\";\n if ($_SERVER[\"SERVER_PORT\"] != \"80\") {\n $pageURL .= $_SERVER[\"SERVER_NAME\"] . \":\" . $_SERVER[\"SERVER_PORT\"] . $_SERVER[\"REQUEST_URI\"];\n } else {\n $pageURL .= $_SERVER[\"SERVER_NAME\"] . $_SERVER[\"REQUEST_URI\"];\n }\n }\n return $pageURL;\n}", "/**\n * Return status of e-commerce\n */\nfunction ecom_active() {\n global $db;", " return ($db->selectValue('modstate', 'active', 'module=\"store\"') ||\n $db->selectValue('modstate', 'active', 'module=\"eventregistration\"') ||\n $db->selectValue('modstate', 'active', 'module=\"donation\"') || FORCE_ECOM);\n}", "/**\n * Return the current framework\n *\n * @return bool\n */\nfunction framework() {\n global $framework;", " return $framework;\n}", "/**\n * Is the current framework Bootstrap v2 based?\n *\n * @return bool\n */\nfunction bs2() {\n global $framework;", " if ($framework == 'bootstrap') {\n return true;\n } else {\n return false;\n }\n}", "/**\n * Is the current framework Bootstrap v3 based?\n *\n * @param bool $strict must be bootstrap3 and NOT newui\n * @return bool\n */\nfunction bs3($strict = false) {\n global $framework;", " if ($framework == 'bootstrap3') {\n return true;\n } elseif ($framework == 'newui' && !$strict) {\n return true;\n } else {\n return false;\n }\n}", "/**\n * Is the current framework Bootstrap based?\n *\n * @param bool $strict must be bootstrap 2 or 3 and NOT newui\n * @return bool\n */\nfunction bs($strict = false) {\n global $framework;", " if ($framework == 'bootstrap3' || $framework == 'bootstrap') {\n return true;\n } elseif ($framework == 'newui' && !$strict) {\n return true;\n } else {\n return false;\n }\n}", "/**\n * Is the current framework NEWUI and NOT a Bootstrap framework\n *\n * @return bool\n */\nfunction newui() {\n global $framework;", " if ($framework == 'newui') {\n return true;\n } else {\n return false;\n }\n}", "function gt($s){\n return expLang::gettext($s);\n}", "function glist($s){\n if (is_array($s)) {\n $list = array();\n foreach ($s as $key=>$phrase) {\n $list[$key] = expLang::gettext(trim($phrase));\n }\n } else {\n $list = '';\n $phrases = explode(\",\",$s);\n foreach ($phrases as $key=>$phrase) {\n if ($key) $list .= ',';\n $list .= expLang::gettext(trim($phrase));\n }\n }\n return $list;\n}", "/**\n * called from exponent.php as the ajax error handler\n *\n * @param $errno\n * @param $errstr\n * @param $errfile\n * @param $errline\n */\nfunction handleErrors($errno, $errstr, $errfile, $errline) {\n if (DEVELOPMENT > 0 && AJAX_ERROR_REPORTING == 1) {\n switch ($errno) {\n case E_ERROR:\n case E_USER_ERROR:\n $msg = 'PHP Error('.$errno.'): ';\n break;\n case E_WARNING:\n case E_USER_WARNING:\n $msg = 'PHP Warning('.$errno.'): ';\n break;\n case E_NOTICE:\n case E_USER_NOTICE:\n $msg = 'PHP Notice('.$errno.'): ';\n break;\n default:\n return; // we really don't want other issues printed\n $msg = 'PHP Issue('.$errno.'): ';\n break;\n }\n $msg .= $errstr;\n $msg .= !empty($errfile) ? ' in file '.$errfile : \"\";\n $msg .= !empty($errline) ? ' on line '.$errline : \"\";\n // send to the debug output\n eDebug($msg);\n }\n}", "/**\n * dumps the passed variable to screen/log, but only if in development mode\n *\n * @param mixed $var the variable to dump\n * @param bool $halt if set to true will halt execution\n * @param bool $disable_log if set to true will disable logging and force to screen\n * @return void\n */\nfunction eDebug($var, $halt=false, $disable_log=false){\n\tif (DEVELOPMENT) {\n if (LOGGER && !$disable_log) {\n// if(is_array($var) || is_object($var)) {\n// $pvar = print_r($var, true);\n// } else {\n// $pvar = $var;\n// }\n// echo(\"<script>YUI(EXPONENT.YUI3_CONFIG).use('node', function(Y) {Y.log('\".json_encode($pvar).\"','info','exp')});;</script>\");\n eLog($var, gt('DEBUG'));\n } else {\n if (file_exists(BASE . 'external/kint/Kint.class.php')) {\n require_once BASE . 'external/kint/Kint.class.php';\n d($var); // kint\n } else {\n echo \"<pre>\";\n print_r($var);\n echo \"</pre>\";\n }\n }", "\t\tif ($halt) die();\n\t}\n}", "/**\n * dumps the passed variable to a log, but only if in development mode\n *\n * @param mixed $var the variable to log\n * @param string $type the type of entry to record\n * @param string $path the pathname for the log file\n * @param string $minlevel\n * @return void\n */\nfunction eLog($var, $type='', $path='', $minlevel='0') {\n\tif($type == '') { $type = \"INFO\"; }\n\tif($path == '') { $path = BASE . 'tmp/exponent.log'; }\n\tif (DEVELOPMENT >= $minlevel) {\n\t\tif (is_writable ($path) || !file_exists($path)) {\n\t\t\tif (!$log = fopen ($path, \"ab\")) {\n\t\t\t\teDebug(gt(\"Error opening log file for writing.\"), false, true);\n\t\t\t} else {\n if(is_array($var) || is_object($var)) {\n// $pvar = print_r($var, true);\n $pvar = json_encode($var, true); // json is easier to deal with as data\n } else {\n $pvar = $var;\n }\n\t\t\t\tif (fwrite ($log, $type . \": \" . $pvar . \"\\r\\n\") === FALSE) {\n\t\t\t\t\teDebug(gt(\"Error writing to log file\").\" (\".$path.\").\", false, true);\n\t\t\t\t}\n\t\t\t\tfclose ($log);\n\t\t\t}\n\t\t} else {\n\t\t\teDebug(gt(\"Log file\".\" (\".$path).\" \".gt(\"not writable.\"), false, true);\n\t\t}\n\t}\n}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expRecord\n *\n * @subpackage Models\n * @package Core\n */\nclass expRecord {\n protected $classinfo = null;\n public $classname = '';", " // database\n public $tablename = '';\n public $identifier = 'id';\n public $rank_by_field = '';\n // for segregating items into uniqueness within a subgroup instead of unique amongst all like items in system\n public $grouping_sql = '';", " // associated objects\n public $has_extended_fields = array(); // add single object db fields to this object (not the object methods)\n public $has_one = array(); // associate single object w/ matching id\n public $has_many = array(); // associate all objects w/ matching id's\n public $has_many_self = array();\n public $has_and_belongs_to_many = array();\n public $has_and_belongs_to_self = array();\n // sort order/direction for associated objects\n public $default_sort_field = '';\n public $default_sort_direction = '';\n // what associated objects should also receive associated objects when associated\n public $get_assoc_for = array();", " // attachable items\n protected $attachable_item_types = array();\n /* protected $attachable_item_types = array( // list of available attachments\n 'content_expCats'=>'expCat'\n 'content_expComments'=>'expComment',\n 'content_expDefinableFields'=> 'expDefinableField'\n 'content_expFiles'=>'expFile',\n 'content_expRatings'=>'expRating',\n 'content_expSimpleNote'=>'expSimpleNote',\n 'content_expTags'=>'expTag',\n );*/\n public $attachable_items_to_save;\n // what associated objects should also receive their attachments when associated\n public $get_attachable_for = array();", " // field validation settings\n public $validate = array();\n public $do_not_validate = array();", " public $supports_revisions = false; // simple flag to turn on revisions/approval support for module\n public $needs_approval = false; // flag for no approval authority", " /**\n * is model content searchable?\n *\n * @return bool\n */\n static function isSearchable() {\n return false;\n }", " /**\n * @param null $params\n * @param bool $get_assoc\n * @param bool $get_attached\n *\n * @return expRecord\n *\n */\n function __construct($params = null, $get_assoc = true, $get_attached = true) {\n global $db;", " // @TODO Change this conditional check as the default value in argument list\n // if the params come thru as a null value we need to convert to an empty array\n if (empty($params)) {\n $params = array();\n $get_assoc = false;\n $get_attached = false;\n }", " // figure out the basic table info about this model\n $this->classinfo = new ReflectionClass($this);\n $this->classname = $this->classinfo->getName();\n $this->tablename = isset($this->table) ? $this->table : $this->classinfo->getName();", " $supports_revisions = $this->supports_revisions && ENABLE_WORKFLOW;\n $needs_approval = $this->needs_approval && ENABLE_WORKFLOW;", " // if the user passed in arguments to this constructor then we need to", " // retrieve objects ", "\n // If a number was sent in, we assume this is a DB record ID, so pull it\n if (!is_object($params) && !is_array($params)) {\n $where = '';\n if (is_numeric($params)) {\n $this->build($db->selectArray($this->tablename, $this->identifier . '=' . $params, null, $supports_revisions));\n $identifier = $this->identifier;\n $params = array($identifier => $params); // Convert $params (given number value) into an key/value pair\n } else {\n // try to look up by sef_url\n $values = $db->selectArray($this->tablename, \"sef_url='\" . expString::sanitize($params) . \"'\", null, $supports_revisions, $needs_approval);\n // if we didn't find it via sef_url then we should check by title\n if (empty($values)) $values = $db->selectArray($this->tablename, \"title='\" . expString::sanitize($params) . \"'\", null, $supports_revisions, $needs_approval);\n $this->build($values);\n $params = array('title'=> $params);\n }\n } else {", " // Otherwise we assume that in inbound is an array or Object to be processed as is. ", " $this->build($params);\n }", " // establish a pseudo publish date\n if (!empty($this->publish)) {\n $this->publish_date = $this->publish;\n } elseif (!empty($this->edited_at)) {\n $this->publish_date = $this->edited_at;\n } elseif (!empty($this->created_at)) {\n $this->publish_date = $this->created_at;\n }\n", " // setup the exception array if it's not there. This array tells the getAssociatedObjectsForThisModel() function which ", " // modules NOT to setup. This stops us from getting infinite loops with many to many relationships.\n if (is_array($params)){\n $params['except'] = isset($params['except']) ? $params['except'] : array();\n $params['cascade_except'] = isset($params['cascade_except']) ? $params['cascade_except'] : false;", " if ($get_assoc)\n $this->getAssociatedObjectsForThisModel($params['except'], $params['cascade_except']);\n } elseif (is_object($params)) {\n $params->except = isset($params->except) ? $params->except : array();\n $params->cascade_except = isset($params->cascade_except) ? $params->cascade_except : false;", " if ($get_assoc)\n $this->getAssociatedObjectsForThisModel($params->except, $params->cascade_except);\n }\n if ($get_attached) $this->getAttachableItems();\n }", " /**\n * find an item or items\n *\n * @param string $range\n * @param null $where\n * @param null $order\n * @param null $limit\n * @param int $limitstart\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n *\n * @return array\n */\n public function find($range = 'all', $where = null, $order = null, $limit = null, $limitstart = 0, $get_assoc = true, $get_attached = true, $except = array(), $cascade_except = false) {\n global $db, $user;", " if (is_numeric($range)) {\n $where = $this->identifier . '=' . intval($range); // If we hit this then we are expecting just a simple id\n $range = 'first';\n }", " $sql = empty($where) ? 1 : $where;\n //eDebug(\"Supports Revisions:\" . $this->supports_revisions);\n// if ($this->supports_revisions && $range != 'revisions') $sql .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $db->prefix . $this->tablename . \"` WHERE $where)\";\n// $sql .= empty($order) ? '' : ' ORDER BY ' . $order;", "", " $supports_revisions = $this->supports_revisions && ENABLE_WORKFLOW;\n if (ENABLE_WORKFLOW && $this->needs_approval) {\n $needs_approval = $user->id;\n } else {\n $needs_approval = false;\n }", " if (strcasecmp($range, 'all') == 0) { // return all items matching request, most current revision\n// $sql .= empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;\n $limitsql = empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;\n return $db->selectExpObjects($this->tablename, $sql, $this->classname, $get_assoc, $get_attached, $except, $cascade_except, $order, $limitsql, $supports_revisions, $needs_approval);\n } elseif (strcasecmp($range, 'revisions') == 0) { // return all items matching request, all revisions\n// $sql .= empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;\n $limitsql = empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;\n return $db->selectExpObjects($this->tablename, $sql, $this->classname, $get_assoc, $get_attached, $except, $cascade_except, $order, $limitsql);\n } elseif (strcasecmp($range, 'first') == 0) { // return the first item matching request\n// $sql .= ' LIMIT 0,1';\n $limitsql = ' LIMIT 0,1';\n $records = $db->selectExpObjects($this->tablename, $sql, $this->classname, $get_assoc, $get_attached, $except, $cascade_except, $order, $limitsql, $supports_revisions, $needs_approval);\n return empty($records) ? null : $records[0];\n } elseif (strcasecmp($range, 'bytitle') == 0) { // return items requested by title/sef_url (will there be more than one?)\n $limitsql = ' LIMIT 0,1';\n $records = $db->selectExpObjects($this->tablename, \"title='\" . $where . \"' OR sef_url='\" . $where . \"'\", $this->classname, $get_assoc, $get_attached, $except, $cascade_except, $order, $limitsql, $supports_revisions, $needs_approval);\n return empty($records) ? null : $records[0];\n } elseif (strcasecmp($range, 'count') == 0) { // return count of items\n return $db->countObjects($this->tablename, $sql, $supports_revisions, $needs_approval);\n } elseif (strcasecmp($range, 'in') == 0) { // return items requested by array of id#\n if (!is_array($where)) return array();\n foreach ($where as $id)\n $records[] = new $this->classname($id);\n return $records;\n } elseif (strcasecmp($range, 'bytag') == 0) { // return items tagged with request (id or title/sef_url)\n if (!is_int($where)) $where = $db->selectObject($db->prefix . 'expTags',\"title='\" . $where . \"' OR sef_url='\" . $where . \"'\");\n $sql = 'SELECT DISTINCT m.id FROM ' . $db->prefix . $this->tablename . ' m ';\n $sql .= 'JOIN ' . $db->prefix . 'content_expTags ct ';\n $sql .= 'ON m.id = ct.content_id WHERE ct.exptags_id=' . intval($where) . \" AND ct.content_type='\" . $this->classname . \"'\";\n if ($supports_revisions) $sql .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $db->prefix . $this->tablename . \"` WHERE ct.exptags_id=\" . intval($where) . \" AND ct.content_type='\" . $this->classname . \"'\";\n $tag_assocs = $db->selectObjectsBySql($sql);\n $records = array();\n foreach ($tag_assocs as $assoc) {\n $records[] = new $this->classname($assoc->id);\n }\n return $records;\n } elseif (strcasecmp($range, 'bycat') == 0) { // return items categorized/grouped under request (id or title/sef_url)\n if (!is_int($where)) $where = $db->selectObject($db->prefix . 'expCats',\"title='\" . $where . \"' OR sef_url='\" . $where . \"'\");\n $sql = 'SELECT DISTINCT m.id FROM ' . $db->prefix . $this->tablename . ' m ';\n $sql .= 'JOIN ' . $db->prefix . 'content_expCats ct ';\n $sql .= 'ON m.id = ct.content_id WHERE ct.expcats_id=' . intval($where) . \" AND ct.content_type='\" . $this->classname . \"'\";\n if ($supports_revisions) $sql .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $db->prefix . $this->tablename . \"` WHERE ct.expcats_id=\" . intval($where) . \" AND ct.content_type='\" . $this->classname . \"'\";\n $cat_assocs = $db->selectObjectsBySql($sql);\n $records = array();\n foreach ($cat_assocs as $assoc) {\n $records[] = new $this->classname($assoc->id);\n }\n return $records;\n }\n }", " /**\n * find an item by column\n *\n * @param $column\n * @param $value\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n *\n * @return array\n */\n public function findBy($column, $value, $get_assoc = true, $get_attached = true, $except = array(), $cascade_except = false) {\n// global $db;", " $where = \"`\" . $column . \"`=\";\n if (!is_numeric($value)) $where .= \"'\";\n $where .= $value;\n if (!is_numeric($value)) $where .= \"'\";\n return $this->find('first', $where, null, null, 0, $get_assoc, $get_attached, $except, $cascade_except);\n }", " /**\n * find a value(s) by column\n *\n * @param string $range\n * @param string $column\n * @param string $where\n * @param string $order\n * @param bool $distinct\n *\n * @return array|bool\n */\n public function findValue($range = 'all', $column, $where=null, $order=null, $distinct=false) {\n global $db;", " if (strcasecmp($range, 'all') == 0) { // return all items matching request\n return $db->selectColumn($this->tablename, $column, $where, $order, $distinct);\n } elseif (strcasecmp($range, 'first') == 0) { // return single/first item matching request\n return $db->selectValue($this->tablename, $column, $where);\n }\n return false;\n }", " /**\n * update item\n *\n * @param array $params\n */\n public function update($params = array()) {\n if (is_array($params) && isset($params['current_revision_id'])) {\n $params['revision_id'] = $params['current_revision_id'];\n unset($params['current_revision_id']);\n }\n $this->checkForAttachableItems($params);\n $this->build($params);\n if (is_array($params)) {\n $this->save((isset($params['_validate']) ? $params['_validate'] : true));\n } elseif (is_object($params)) {\n $this->save((isset($params->_validate) ? $params->_validate : true));\n } else {\n $this->save(true);\n }\n }", " /**\n * re-construct the item from the database\n *\n * @return bool\n */\n public function refresh() {\n if (empty($this->id))\n return false;\n $this->__construct($this->id);\n }", " /**\n * Adds table fields as class properties to current \"record\" class.\n *\n * Loads Table schema data and creates new class properties based\n * upon the fields in given table.\n *\n * Additionally, if a record ID is given, that record is pulled and\n * field values are also populated into class properties.\n *\n * @name build\n *\n * @category db_record\n * @uses [db_type]::getDataDefinition() Builds a data definition from existing table.\n * @requires $db\n *\n * @access protected\n * @final\n * @PHPUnit Not Defined\n *\n * @global object $db\n *\n * @param mixed $params array or Object for table selection\n */\n public function build($params = array()) {\n global $db;", " // safeguard against bad data...we can only take objects and arrays here\n if (!is_array($params) && !is_object($params)) $params = array();", " // get the table definition and make sure all the params being passed in belong in this table\n $table = $db->getDataDefinition($this->tablename);", " //check for location_data\n if (is_array($params) && ((!empty($params['module']) || !empty($params['controller'])) && !empty($params['src']))) {\n $mod = !empty($params['module']) ? $params['module'] : (!empty($params['controller']) ? $params['controller'] : null);\n if (empty($params['module'])) $params['module'] = $params['controller'];\n $params['location_data'] = serialize(expCore::makeLocation($mod, $params['src']));\n } elseif (is_object($params) && ((!empty($params->module) || !empty($params->controller)) && !empty($params->src))) {\n $mod = !empty($params->module) ? $params->module : (!empty($params->controller) ? $params->controller : null);\n if (empty($params->module)) $params->module = $params->controller;\n $params->location_data = serialize(expCore::makeLocation($mod, $params->src));\n }", " // Build Class properties based off table fields\n foreach ($table as $col=> $colDef) {\n // check if the DB column has a corresponding value in the params array\n // if not, we check to see if the column is boolean...if so we set it to false", " // if not, then we check to see if we had a previous value in this particular ", " // record. if so we reset it to itself so we don't lose the existing value.", " // this is good for when the developer is trying to update just a field or two \n // in an existing record. ", " if (array_key_exists($col, $params)) {\n $value = is_array($params) ? $params[$col] : $params->$col;\n if ($colDef[0] == DB_DEF_INTEGER || $colDef[0] == DB_DEF_ID) {\n $this->$col = preg_replace(\"/[^0-9-]/\", \"\", $value);\n } elseif ($colDef[0] == DB_DEF_DECIMAL) {\n $this->$col = preg_replace(\"/[^0-9.-]/\", \"\", $value);\n } else {\n $this->$col = $value;\n }\n } elseif ($colDef[0] == DB_DEF_BOOLEAN) {\n $this->$col = empty($this->$col) ? 0 : $this->$col;\n } elseif ($colDef[0] == DB_DEF_TIMESTAMP) {\n // yuidatetimecontrol sends in a checkbox and a date e.g., publish & publishdate\n $datename = $col . 'date';\n if (is_array($params) && isset($params[$datename])) {\n $this->$col = yuidatetimecontrol::parseData($col, $params);\n } elseif (is_object($params) && isset($params->$datename)) {\n $this->$col = yuidatetimecontrol::parseData($col, object2Array($params));\n } else {\n $this->$col = !empty($this->$col) ? $this->$col : 0;\n }\n } else {\n $this->$col = !empty($this->$col) ? $this->$col : null;\n }", " //if (isset($this->col)) {\n if ($col != 'data' && is_string($this->$col)) {\n $this->$col = stripslashes($this->$col);\n }\n //}\n if (ENABLE_WORKFLOW && $this->supports_revisions && $col == 'revision_id' && $this->$col == null)\n $this->$col = 1; // first revision is #1\n }\n }", " /**\n * rerank items\n *\n * @param $direction\n * @param string $where\n */\n public function rerank($direction, $where = '') {\n global $db;", " if (!empty($this->rank)) {\n $next_prev = $direction == 'up' ? $this->rank - 1 : $this->rank + 1;\n $where .= empty($this->location_data) ? null : (!empty($where) ? \" AND \" : '') . \"location_data='\" . $this->location_data . \"'\" . $this->grouping_sql;\n $db->switchValues($this->tablename, 'rank', $this->rank, $next_prev, $where);\n }\n }", " /**\n * attach to item\n *\n * @param $item\n * @param string $subtype\n * @param bool $replace\n *\n * @return bool\n */\n public function attachItem($item, $subtype = '', $replace = true) { //FIXME only placed used is in helpController->copydocs (though we don't have attachments), & migration\n global $db;", " // make sure we have the info we need..otherwise return\n if (empty($item->id) && empty($this->id)) return false;\n // save the attachable items\n// $refname = strtolower($item->classname).'s_id'; //FIXME plural vs single?\n// $refname = strtolower($item->classname) . '_id'; //FIXME plural vs single?\n $refname = strtolower($item->tablename) . '_id';\n if ($replace) $db->delete($item->attachable_table, 'content_type=\"' . $this->classname . '\" AND content_id=' . $this->id . ' AND ' . $refname . '=' . $item->id);\n $obj = new stdClass();\n $obj->$refname = $item->id;\n $obj->content_id = $this->id;\n $obj->content_type = $this->classname;\n $obj->subtype = $subtype;\n $obj->rank = 1 + $db->max($item->attachable_table, 'rank', null, 'content_type=\"' . $this->classname . '\" AND subtype=\"' . $subtype . '\" AND content_id' . $this->id);\n $db->insertObject($obj, $item->attachable_table);\n }", " /**\n * save item\n *\n * @param bool $validate\n * @param bool $force_no_revisions\n */\n public function save($validate = false, $force_no_revisions = false) {\n global $db;", " // call the validation callback functions if we need to.\n if ($validate) {\n $this->beforeValidation();\n $this->validate();\n $this->afterValidation();\n }", " $this->beforeSave();", " // Save this object's associated objects to the database.\n // FIXME: we're not going to do this automagically until we get the refreshing figured out.", " //$this->saveAssociatedObjects(); ", "\n //Only grab fields that are valid and save this object\n $saveObj = new stdClass();\n $table = $db->getDataDefinition($this->tablename);\n foreach ($table as $col=> $colDef) {\n $saveObj->$col = empty($this->$col) ? null : $this->$col;\n }", " if (ENABLE_WORKFLOW && $this->supports_revisions && !$this->approved && expPermissions::check('approve', expUnserialize($this->location_data))) {\n $this->approved = true; // auto-approve item if use has approve perm\n $saveObj->approved = true; // also set property in database item\n }\n $identifier = $this->identifier;\n if (!empty($saveObj->$identifier)) {\n $revise = $force_no_revisions ? false : $this->supports_revisions && ENABLE_WORKFLOW;\n $db->updateObject($saveObj, $this->tablename, null, $identifier, $revise);\n $this->afterUpdate();\n } else {\n $this->$identifier = $db->insertObject($saveObj, $this->tablename);\n $this->afterCreate();\n }", " // run the afterSave callback(s)\n $this->afterSave();\n }", " /**\n * before validating item\n */\n public function beforeValidation() {\n $this->runCallback('beforeValidation');\n if (empty($this->id)) {\n $this->beforeValidationOnCreate();\n } else {\n $this->beforeValidationOnUpdate();\n }\n }", " /**\n * before validating item during creation\n */\n public function beforeValidationOnCreate() {\n $this->runCallback('beforeValidationOnCreate');\n }", " /**\n * before validating item during update\n */\n public function beforeValidationOnUpdate() {\n $this->runCallback('beforeValidationOnUpdate');\n }", " /**\n * validate item sef_url\n *\n * @return bool\n */\n public function validate() {\n global $db;\n // check for an sef url field. If it exists make sure it's valid and not a duplicate\n //this needs to check for SEF URLS being turned on also: TODO", " if (property_exists($this, 'sef_url') && !(in_array('sef_url', $this->do_not_validate))) {\n if (empty($this->sef_url)) $this->makeSefUrl();\n if (!isset($this->validates['is_valid_sef_name']['sef_url'])) $this->validates['is_valid_sef_name']['sef_url'] = array();\n if (!isset($this->validates['uniqueness_of']['sef_url'])) $this->validates['uniqueness_of']['sef_url'] = array();\n }", " // safeguard again loc data not being pass via forms...sometimes this happens when you're in a router", " // mapped view and src hasn't been passed in via link to the form ", " if (isset($this->id) && empty($this->location_data)) {\n $loc = $db->selectValue($this->tablename, 'location_data', 'id=' . $this->id);\n if (!empty($loc)) $this->location_data = $loc;\n }", " // run the validation as defined in the models\n if (!isset($this->validates)) return true;\n $messages = array();\n $post = empty($_POST) ? array() : expString::sanitize($_POST);\n foreach ($this->validates as $validation=> $field) {\n foreach ($field as $key=> $value) {\n $fieldname = is_numeric($key) ? $value : $key;\n $opts = is_numeric($key) ? array() : $value;\n $ret = expValidator::$validation($fieldname, $this, $opts);\n if (!is_bool($ret)) {\n $messages[] = $ret;\n expValidator::setErrorField($fieldname);\n unset($post[$fieldname]);\n }\n }\n }", " if (count($messages) >= 1) expValidator::failAndReturnToForm($messages, $post);\n }", " /**\n * after validating item\n */\n public function afterValidation() {\n $this->runCallback('afterValidation');\n if (empty($this->id)) {\n $this->afterValidationOnCreate();\n } else {\n $this->afterValidationOnUpdate();\n }\n }", " /**\n * after validating item during creation\n */\n public function afterValidationOnCreate() {\n $this->runCallback('afterValidationOnCreate');\n }", " /**\n * after validating item during update\n */\n public function afterValidationOnUpdate() {\n $this->runCallback('afterValidationOnUpdate');\n }", " /**\n * before saving item\n */\n public function beforeSave() {\n global $user, $db;", " $this->runCallback('beforeSave');\n // populate the magic fields\n if (empty($this->id)) {\n // timestamp the record\n if (property_exists($this, 'created_at')) $this->created_at = time();\n if (property_exists($this, 'edited_at')) $this->edited_at = time();\n // record the user saving the record.\n if (property_exists($this, 'poster')) $this->poster = empty($this->poster) ? $user->id : $this->poster;\n // fill in the rank field if it exist\n if (property_exists($this, 'rank')) {\n// if (!isset($this->rank)) {\n if (empty($this->rank)) { // ranks begin at 1, so 0 is now last\n $where = \"1 \";\n $where .= empty($this->location_data) ? null : \"AND location_data='\" . $this->location_data . \"' \";\n //FIXME: $where .= empty($this->rank_by_field) ? null : \"AND \" . $this->rank_by_field . \"='\" . $this->$this->rank_by_field . \"'\";\n $groupby = empty($this->location_data) ? null : 'location_data';\n $groupby .= empty($this->rank_by_field) ? null : (empty($groupby) ? null : ',' . $this->rank_by_field);\n $this->rank = $db->max($this->tablename, 'rank', $groupby, $where . $this->grouping_sql) + 1;\n } else {\n // check if this rank is already there..if so increment everything below it.\n $obj = $db->selectObject($this->tablename, 'rank=' . $this->rank . $this->grouping_sql);\n if (!empty($obj)) {\n $db->increment($this->tablename, 'rank', 1, 'rank>=' . $this->rank . $this->grouping_sql);\n }\n }\n }", " $this->beforeCreate();\n } else {\n // put the created_at time back the way it was so we don't set it 0\n if (property_exists($this, 'created_at') && $this->created_at == 0) {\n $this->created_at = $db->selectValue($this->tablename, 'created_at', 'id=' . $this->id);\n }", " // put the original posters id back the way it was so we don't set it 0\n if (property_exists($this, 'poster') && $this->poster == 0) {\n $this->poster = $db->selectValue($this->tablename, 'poster', 'id=' . $this->id);\n }", " //put the rank back to what it was so we don't set it 0\n if (property_exists($this, 'rank') && $this->rank == 0) {\n $this->rank = $db->selectValue($this->tablename, 'rank', 'id=' . $this->id);\n }", " if (property_exists($this, 'edited_at')) $this->edited_at = time();\n if (property_exists($this, 'editor')) $this->editor = $user->id;", " $this->beforeUpdate();\n }\n }", " /**\n * before creating item\n */\n public function beforeCreate() {\n $this->runCallback('beforeCreate');\n }", " /**\n * before updating item\n */\n public function beforeUpdate() {\n // we need some help migrating edited dates\n if (!empty($this->migrated_at)) {\n $this->edited_at = $this->migrated_at;\n unset($this->migrated_at);\n }\n $this->runCallback('beforeUpdate');\n }", " /**\n * after updating item\n */\n public function afterUpdate() {\n $this->runCallback('afterUpdate');\n }", " /**\n * after creating item\n */\n public function afterCreate() {\n $this->runCallback('afterCreate');\n }", " /**\n * after saving item\n */\n public function afterSave() {\n global $db;", " $this->runCallback('afterSave');", " // save all attached items\n if (!empty($this->attachable_items_to_save)) {\n foreach ($this->attachable_item_types as $type) {\n if (!empty($this->attachable_items_to_save[$type])) {\n $itemtype = new $type();\n // clean up (delete) old attachments since we'll create all from scratch\n $db->delete($itemtype->attachable_table, 'content_type=\"' . $this->classname . '\" AND content_id=' . $this->id);\n// $refname = strtolower($type).'s_id'; //FIXME: find a better way to pluralize these names!!!\n $refname = strtolower($itemtype->tablename) . '_id'; //FIXME: find a better way to pluralize these names!!!\n foreach ($this->attachable_items_to_save[$type] as $subtype=> $item) {\n $obj = new stdClass();\n if (is_object($item)) {\n if (!empty($item->id)) {\n $obj->$refname = $item->id;\n $obj->subtype = $subtype;\n $obj->content_id = $this->id;\n $obj->content_type = $this->classname;\n if ($type == 'expFile' || $type == 'expCats') $obj->rank = $item->rank + 1;\n $db->insertObject($obj, $itemtype->attachable_table);\n }\n } elseif (is_array($item)) {\n foreach ($item as $rank=>$value) {\n if (is_numeric($value)) {\n $obj->$refname = $value;\n $obj->subtype = $subtype;\n $obj->content_id = $this->id;\n $obj->content_type = $this->classname;\n if ($type == 'expFile' || $type == 'expCats') $obj->rank = $rank + 1;\n $db->insertObject($obj, $itemtype->attachable_table);\n }\n }\n } elseif (is_numeric($item)) {\n $obj->$refname = $item;\n $obj->content_id = $this->id;\n $obj->content_type = $this->classname;\n if ($type == 'expFile' || $type == 'expCats') $obj->rank = $subtype + 1;\n $db->insertObject($obj, $itemtype->attachable_table);\n }\n }\n }\n }\n }\n }", " /**\n * is run before deleting item\n */\n public function beforeDelete() {\n $this->runCallback('beforeDelete');\n }", " /**\n * delete item\n *\n * @param string $where\n *\n * @return bool\n */\n public function delete($where = '') {\n global $db;", " $id = $this->identifier;\n if (empty($this->$id)) return false;\n $this->beforeDelete();\n $db->delete($this->tablename, $id . '=' . $this->$id);\n if (!empty($where)) $where .= ' AND '; // for help in reranking, NOT deleting object\n if (property_exists($this, 'rank')) $db->decrement($this->tablename, 'rank', 1, $where . 'rank>=' . $this->rank . $this->grouping_sql);", " // delete attached items\n foreach ($this->attachable_item_types as $content_table=> $type) {\n $db->delete($content_table, 'content_type=\"' . $this->classname . '\" AND content_id=' . $this->$id);\n }\n // leave associated items to the model afterDelete method?\n $this->afterDelete();\n }", " /**\n * is run after deleting item\n */\n public function afterDelete() {\n $this->runCallback('afterDelete');\n }", " /**\n * jump to subclass calling routine\n *\n * @param $type\n *\n * @return bool\n */\n private function runCallback($type) {\n if (empty($type)) return false;", " // check for and run any callbacks listed in the $type array.\n if ($this->classinfo->hasProperty($type)) {\n $callbacks = $this->classinfo->getProperty($type);\n foreach ($callbacks->getValue(new $this->classname(null, false, false)) as $func) {\n $this->$func();\n }\n }\n }", " /**\n * make an sef_url for item\n */\n public function makeSefUrl() {\n global $db, $router;", " if (!empty($this->title)) {\n\t\t\t$this->sef_url = $router->encode($this->title);\n\t\t} else {\n\t\t\t$this->sef_url = $router->encode('Untitled');\n\t\t}\n $dupe = $db->selectValue($this->tablename, 'sef_url', 'sef_url=\"'.$this->sef_url.'\"' . $this->grouping_sql);\n\t\tif (!empty($dupe)) {\n\t\t\tlist($u, $s) = explode(' ',microtime());\n\t\t\t$this->sef_url .= '-'.$s.'-'.$u;\n\t\t}\n $this->runCallback('makeSefUrl');\n }", " /**\n * get item's associated objects\n *\n * Type of associations\n * has_one\n * has_many\n * has_and_belongs_to_many\n *\n * @param null $obj\n *\n * @return null\n */\n public function getAssociatedObjects($obj = null) { //FIXME not used??\n global $db;", " $records = array();", " foreach ($this->has_one as $assoc_object) {\n $ret = $db->selectObjects($this->tablename, $assoc_object . '_id=' . $obj->id);\n if (!empty($ret)) $obj->$assoc_object = $ret;\n }", " foreach ($this->has_many as $assoc_object) {\n $ret = $db->selectObjects($assoc_object, $this->tablename . '_id=' . $obj->id);\n if (!empty($ret)) $obj->$assoc_object = $ret;\n }", " foreach ($this->has_and_belongs_to_many as $assoc_object) {\n if (strcmp($this->tablename, $assoc_object) > 0) {\n $tablename = $assoc_object . '_' . $this->tablename;\n } else {\n $tablename = $this->tablename . '_' . $assoc_object;\n }", " //$ret = $db->selectObjects($tablename, $this->tablename.'_id='.$obj->id);\n $instances = $db->selectObjects($tablename, $this->tablename . '_id=' . $obj->id);\n $ret = array();\n foreach ($instances as $instance) {\n $fieldname = $assoc_object . '_id';\n $ret[] = $db->selectObject($assoc_object, 'id=' . $instance->$fieldname);\n }\n if (!empty($ret)) $obj->$assoc_object = $ret;\n }", " return $obj;\n }", " /**\n * this function finds models that have this attachable item attached\n *\n * @param $content_type\n *\n * @return array\n */\n public function findWhereAttachedTo($content_type) {\n global $db;", " $objarray = array();\n if (!empty($this->id) && !empty($this->attachable_table)) {\n// $assocs = $db->selectObjects($this->attachable_table, $this->classname.'s_id='.$this->id.' AND content_type=\"'.$content_type.'\"'); //FIXME is it plural where others are single?\n $assocs = $db->selectObjects($this->attachable_table, strtolower($this->tablename) . '_id=' . $this->id . ' AND content_type=\"' . $content_type . '\"');\n foreach ($assocs as $assoc) {\n if (class_exists($assoc->content_type)) $objarray[] = new $assoc->content_type($assoc->content_id);\n }\n }", " return $objarray;\n }", " /**\n * check for what objects may be attached\n *\n * @param $params\n *\n * @return bool\n */\n protected function checkForAttachableItems($params) {\n if (empty($params)) return false;\n foreach ($this->attachable_item_types as $type) {\n if (array_key_exists($type, $params)) {\n $this->attachable_items_to_save[$type] = is_array($params) ? $params[$type] : $params->$type;\n }\n }\n }", " /**\n * used for import/export\n *\n * @return array\n */\n function getAttachableItemTables() {\n return $this->attachable_item_types; //fixme this is the model name, NOT the table name\n }", " /**\n * get attached objects for this item\n */\n protected function getAttachableItems() {\n global $db;", " foreach ($this->attachable_item_types as $content_table=> $type) {\n if ($this->classname == $type) break;", " $tablename = str_ireplace('content_', '', $content_table);\n if (!isset($this->id)) {\n $this->$type = array();\n } else {\n $sql = 'SELECT ef.*, cef.subtype AS subtype FROM ';\n $sql .= $db->prefix . $tablename . ' ef JOIN ' . $db->prefix . $content_table . ' cef ';\n $sql .= \"ON ef.id = cef.\" . $tablename . \"_id\";\n $sql .= \" WHERE content_id=\" . $this->id;\n $sql .= \" AND content_type='\" . $this->classname . \"'\";\n if ($type == 'expComment') {\n $sql .= \" AND approved='1'\";\n }", " $order = ($type == 'expFile' || $type == 'expCats' || $type == 'expDefinableField') ? ' ORDER BY rank ASC' : null;\n $sql .= $order;", " $items = $db->selectArraysBySql($sql);", " $attacheditems = array();\n foreach ($items as $item) {\n //FIXME: find a better way to unpluralize the name!\n $idname = strtolower($type) . '_id';\n if (empty($item['subtype'])) {\n $attacheditems[] = new $type($item, false, false);\n } else {\n if (!isset($attacheditems[$item['subtype']])) $attacheditems[$item['subtype']] = array();\n $attacheditems[$item['subtype']][] = new $type($item, false, false);\n }\n }", " $this->$type = $attacheditems;\n }\n }\n }", " /**\n * gets associated objects for this model\n *\n * Type of associations\n * has_extended_fields\n * has_one\n * has_many\n * has_many_self\n * has_and_belongs_to_many\n * has_and_belongs_to_self\n *\n * @param array $except\n * @param bool $cascade_except\n *\n */\n private function getAssociatedObjectsForThisModel($except = array(), $cascade_except = false) {\n global $db;", " foreach ($this->has_extended_fields as $assoc_object) {\n // figure out the name of the model based off the models tablename\n $obj = new $assoc_object(null, false, false);\n $this->$assoc_object = $obj->find('first', $this->tablename . '_id = ' . $this->id);\n }", " //this requires a field in the table only with the ID of the associated object we're looking for in its table\n foreach ($this->has_one as $assoc_object) {\n // figure out the name of the model based off the models tablename\n if (!in_array($assoc_object, $except)) {\n $obj = new $assoc_object(null, false, false);\n $id_name = $obj->tablename . '_id';", " // check to see if we have an association yet. if not we'll initialize an empty model\n $id = empty($this->$id_name) ? array() : $this->$id_name;", " $this->$assoc_object = new $assoc_object($id, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n } else {\n $this->$assoc_object = array();\n }\n }", " //TODO: perhaps add a 'in' option to the find so we can pass an array of ids and make ONE db call instead of looping\n foreach ($this->has_many as $assoc_object) {\n if (!in_array($assoc_object, $except)) {\n $assoc_obj = new $assoc_object();", " $ret = $db->selectArrays($assoc_obj->tablename, $this->tablename . '_id=' . $this->id, $assoc_obj->default_sort_field != '' ? $assoc_obj->default_sort_field . \" \" . $assoc_obj->default_sort_direction : null);\n $records = array();\n if ($cascade_except) {\n $record['except'] = $except;\n $record['cascade_except'] = $cascade_except;\n }\n foreach ($ret as $record) {\n $records[] = new $assoc_object($record, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n }\n $this->$assoc_object = $records;\n } else {\n //eDebug(\"No: \" .$assoc_object);\n $this->$assoc_object = array();\n }\n }", " foreach ($this->has_many_self as $assoc_object) {\n if (!in_array($assoc_object, $except)) {\n $assoc_obj = new $assoc_object();", " $ret = $db->selectArrays($assoc_obj->tablename, $assoc_obj->has_many_self_id . '=' . $this->id, $assoc_obj->default_sort_field != '' ? $assoc_obj->default_sort_field . \" \" . $assoc_obj->default_sort_direction : null);\n $records = array();\n foreach ($ret as $record) {\n $records[] = new $assoc_object($record, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n }\n $this->$assoc_object = $records;\n } else {\n $this->$assoc_object = array();\n }\n }", " foreach ($this->has_and_belongs_to_many as $assoc_object) {\n if (!in_array($assoc_object, $except)) {\n $assocObj = new $assoc_object(null, false, false);\n $tablename = $this->makeManyToManyTablename($assocObj->tablename);", " $ret = $db->selectObjects($assocObj->tablename, 'id IN (SELECT ' . $assocObj->tablename . '_id from ' . $db->prefix . $tablename . ' WHERE ' . $this->tablename . '_id=' . $this->id . ')', $assocObj->default_sort_field != '' ? $assocObj->default_sort_field . \" \" . $assocObj->default_sort_direction : null);\n $records = array();\n foreach ($ret as $record) {\n $record_array = object2Array($record);\n // put in the current model as an exception, otherwise the auto assoc's keep initializing instances of each other in an\n // infinite loop\n $record_array['except'] = array($this->classinfo->name);\n if ($cascade_except) {\n $record_array['except'] = array_merge($record_array['except'], $except);\n $record_array['cascade_except'] = $cascade_except;\n }\n $records[] = new $assoc_object($record_array, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n }\n $this->$assoc_object = $records;\n } else {\n $this->$assoc_object = array();\n }\n }", " foreach ($this->has_and_belongs_to_self as $assoc_object) {\n if (!in_array($assoc_object, $except)) {\n $assocObj = new $assoc_object(null, false, false);\n $tablename = $this->makeManyToManyTablename($assocObj->classname);", " $ret = $db->selectObjects($assocObj->tablename, 'id IN (SELECT ' . $assocObj->classname . '_id from ' . $db->prefix . $tablename . ' WHERE ' . $this->tablename . '_id=' . $this->id . ')');\n $records = array();\n foreach ($ret as $record) {\n $record_array = object2Array($record);\n // put in the current model as an exception, otherwise the auto assoc's keep initializing instances of each other in an\n // infinite loop\n $record_array['except'] = array($this->classinfo->name);\n $records[] = new $assoc_object($record_array, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n }\n $this->$assoc_object = $records;\n } else {\n $this->$assoc_object = array();\n }\n }\n }", " /**\n * get objects this item belongs to ??\n *\n * Type of associations\n * has_and_belongs_to_many\n *\n * @param $datatype\n * @param $id\n */\n public function associateWith($datatype, $id) { //FIXME not used??\n global $db;", " $assocObj = new $datatype();", " if (in_array($datatype, $this->has_and_belongs_to_many)) {\n $tablename = $this->makeManyToManyTablename($assocObj->tablename);\n $thisid = $this->tablename . '_id';\n $otherid = $assocObj->tablename . '_id';\n $obj = new stdClass();\n $obj->$thisid = $this->id;\n $obj->$otherid = $id;\n $db->insertObject($obj, $tablename);\n }\n }", " /**\n * save associated objects\n *\n * Type of associations\n * has_one\n *\n */\n public function saveAssociatedObjects() {\n// global $db;", " foreach ($this->has_one as $assoc_object) {\n $obj = $this->$assoc_object;\n $obj->save();", " $assoc_id_name = $assoc_object . '_id';\n $this->$assoc_id_name = $obj->id;\n }\n }", " //why the compare to flip order?\n /**\n * create a many to many table relationship\n *\n * @param $assoc_table\n *\n * @return string\n */\n private function makeManyToManyTablename($assoc_table) {\n if (strcmp($this->tablename, $assoc_table) > 0) {\n $tablename = $assoc_table . '_' . $this->tablename;\n } else {\n $tablename = $this->tablename . '_' . $assoc_table;\n }\n return $tablename;\n }", " /**\n * return the item poster\n *\n * @param null $display\n * @return null|string\n */\n public function getPoster($display = null) {\n if (isset($this->poster)) {\n $user = new user($this->poster);\n return user::getUserAttribution($user->id, $display);\n } else {\n return null;\n }\n }", " /**\n * return the item timestamp\n *\n * @param int $type\n *\n * @return mixed\n */\n public function getTimestamp($type = 0) {\n if ($type == 0) $getType = 'created_at';\n elseif ($type == 'publish') $getType = 'publish';\n else $getType = 'edited_at';\n if (isset($this->$getType)) return expDateTime::format_date($this->$getType, DISPLAY_DATETIME_FORMAT);\n else return null;\n }", "}", ";", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expRecord\n *\n * @subpackage Models\n * @package Core\n */\nclass expRecord {\n protected $classinfo = null;\n public $classname = '';", " // database\n public $tablename = '';\n public $identifier = 'id';\n public $rank_by_field = '';\n // for segregating items into uniqueness within a subgroup instead of unique amongst all like items in system\n public $grouping_sql = '';", " // associated objects\n public $has_extended_fields = array(); // add single object db fields to this object (not the object methods)\n public $has_one = array(); // associate single object w/ matching id\n public $has_many = array(); // associate all objects w/ matching id's\n public $has_many_self = array();\n public $has_and_belongs_to_many = array();\n public $has_and_belongs_to_self = array();\n // sort order/direction for associated objects\n public $default_sort_field = '';\n public $default_sort_direction = '';\n // what associated objects should also receive associated objects when associated\n public $get_assoc_for = array();", " // attachable items\n protected $attachable_item_types = array();\n /* protected $attachable_item_types = array( // list of available attachments\n 'content_expCats'=>'expCat'\n 'content_expComments'=>'expComment',\n 'content_expDefinableFields'=> 'expDefinableField'\n 'content_expFiles'=>'expFile',\n 'content_expRatings'=>'expRating',\n 'content_expSimpleNote'=>'expSimpleNote',\n 'content_expTags'=>'expTag',\n );*/\n public $attachable_items_to_save;\n // what associated objects should also receive their attachments when associated\n public $get_attachable_for = array();", " // field validation settings\n public $validate = array();\n public $do_not_validate = array();", " public $supports_revisions = false; // simple flag to turn on revisions/approval support for module\n public $needs_approval = false; // flag for no approval authority", " /**\n * is model content searchable?\n *\n * @return bool\n */\n static function isSearchable() {\n return false;\n }", " /**\n * @param null $params\n * @param bool $get_assoc\n * @param bool $get_attached\n *\n * @return expRecord\n *\n */\n function __construct($params = null, $get_assoc = true, $get_attached = true) {\n global $db;", " // @TODO Change this conditional check as the default value in argument list\n // if the params come thru as a null value we need to convert to an empty array\n if (empty($params)) {\n $params = array();\n $get_assoc = false;\n $get_attached = false;\n }", " // figure out the basic table info about this model\n $this->classinfo = new ReflectionClass($this);\n $this->classname = $this->classinfo->getName();\n $this->tablename = isset($this->table) ? $this->table : $this->classinfo->getName();", " $supports_revisions = $this->supports_revisions && ENABLE_WORKFLOW;\n $needs_approval = $this->needs_approval && ENABLE_WORKFLOW;", " // if the user passed in arguments to this constructor then we need to", " // retrieve objects", "\n // If a number was sent in, we assume this is a DB record ID, so pull it\n if (!is_object($params) && !is_array($params)) {\n $where = '';\n if (is_numeric($params)) {\n $this->build($db->selectArray($this->tablename, $this->identifier . '=' . $params, null, $supports_revisions));\n $identifier = $this->identifier;\n $params = array($identifier => $params); // Convert $params (given number value) into an key/value pair\n } else {\n // try to look up by sef_url\n $values = $db->selectArray($this->tablename, \"sef_url='\" . expString::sanitize($params) . \"'\", null, $supports_revisions, $needs_approval);\n // if we didn't find it via sef_url then we should check by title\n if (empty($values)) $values = $db->selectArray($this->tablename, \"title='\" . expString::sanitize($params) . \"'\", null, $supports_revisions, $needs_approval);\n $this->build($values);\n $params = array('title'=> $params);\n }\n } else {", " // Otherwise we assume that in inbound is an array or Object to be processed as is.", " $this->build($params);\n }", " // establish a pseudo publish date\n if (!empty($this->publish)) {\n $this->publish_date = $this->publish;\n } elseif (!empty($this->edited_at)) {\n $this->publish_date = $this->edited_at;\n } elseif (!empty($this->created_at)) {\n $this->publish_date = $this->created_at;\n }\n", " // setup the exception array if it's not there. This array tells the getAssociatedObjectsForThisModel() function which", " // modules NOT to setup. This stops us from getting infinite loops with many to many relationships.\n if (is_array($params)){\n $params['except'] = isset($params['except']) ? $params['except'] : array();\n $params['cascade_except'] = isset($params['cascade_except']) ? $params['cascade_except'] : false;", " if ($get_assoc)\n $this->getAssociatedObjectsForThisModel($params['except'], $params['cascade_except']);\n } elseif (is_object($params)) {\n $params->except = isset($params->except) ? $params->except : array();\n $params->cascade_except = isset($params->cascade_except) ? $params->cascade_except : false;", " if ($get_assoc)\n $this->getAssociatedObjectsForThisModel($params->except, $params->cascade_except);\n }\n if ($get_attached) $this->getAttachableItems();\n }", " /**\n * find an item or items\n *\n * @param string $range\n * @param null $where\n * @param null $order\n * @param null $limit\n * @param int $limitstart\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n *\n * @return array\n */\n public function find($range = 'all', $where = null, $order = null, $limit = null, $limitstart = 0, $get_assoc = true, $get_attached = true, $except = array(), $cascade_except = false) {\n global $db, $user;", " if (is_numeric($range)) {\n $where = $this->identifier . '=' . intval($range); // If we hit this then we are expecting just a simple id\n $range = 'first';\n }", " $sql = empty($where) ? 1 : $where;\n //eDebug(\"Supports Revisions:\" . $this->supports_revisions);\n// if ($this->supports_revisions && $range != 'revisions') $sql .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $db->prefix . $this->tablename . \"` WHERE $where)\";\n// $sql .= empty($order) ? '' : ' ORDER BY ' . $order;", " $order = expString::escape($order);\n if ($limit !== null)\n $limit = intval($limit);\n if ($limitstart !== null)\n $limitstart = intval($limitstart);", " $supports_revisions = $this->supports_revisions && ENABLE_WORKFLOW;\n if (ENABLE_WORKFLOW && $this->needs_approval) {\n $needs_approval = $user->id;\n } else {\n $needs_approval = false;\n }", " if (strcasecmp($range, 'all') == 0) { // return all items matching request, most current revision\n// $sql .= empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;\n $limitsql = empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;\n return $db->selectExpObjects($this->tablename, $sql, $this->classname, $get_assoc, $get_attached, $except, $cascade_except, $order, $limitsql, $supports_revisions, $needs_approval);\n } elseif (strcasecmp($range, 'revisions') == 0) { // return all items matching request, all revisions\n// $sql .= empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;\n $limitsql = empty($limit) ? '' : ' LIMIT ' . $limitstart . ',' . $limit;\n return $db->selectExpObjects($this->tablename, $sql, $this->classname, $get_assoc, $get_attached, $except, $cascade_except, $order, $limitsql);\n } elseif (strcasecmp($range, 'first') == 0) { // return the first item matching request\n// $sql .= ' LIMIT 0,1';\n $limitsql = ' LIMIT 0,1';\n $records = $db->selectExpObjects($this->tablename, $sql, $this->classname, $get_assoc, $get_attached, $except, $cascade_except, $order, $limitsql, $supports_revisions, $needs_approval);\n return empty($records) ? null : $records[0];\n } elseif (strcasecmp($range, 'bytitle') == 0) { // return items requested by title/sef_url (will there be more than one?)\n $limitsql = ' LIMIT 0,1';\n $records = $db->selectExpObjects($this->tablename, \"title='\" . $where . \"' OR sef_url='\" . $where . \"'\", $this->classname, $get_assoc, $get_attached, $except, $cascade_except, $order, $limitsql, $supports_revisions, $needs_approval);\n return empty($records) ? null : $records[0];\n } elseif (strcasecmp($range, 'count') == 0) { // return count of items\n return $db->countObjects($this->tablename, $sql, $supports_revisions, $needs_approval);\n } elseif (strcasecmp($range, 'in') == 0) { // return items requested by array of id#\n if (!is_array($where)) return array();\n foreach ($where as $id)\n $records[] = new $this->classname($id);\n return $records;\n } elseif (strcasecmp($range, 'bytag') == 0) { // return items tagged with request (id or title/sef_url)\n if (!is_int($where)) $where = $db->selectObject($db->prefix . 'expTags',\"title='\" . $where . \"' OR sef_url='\" . $where . \"'\");\n $sql = 'SELECT DISTINCT m.id FROM ' . $db->prefix . $this->tablename . ' m ';\n $sql .= 'JOIN ' . $db->prefix . 'content_expTags ct ';\n $sql .= 'ON m.id = ct.content_id WHERE ct.exptags_id=' . intval($where) . \" AND ct.content_type='\" . $this->classname . \"'\";\n if ($supports_revisions) $sql .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $db->prefix . $this->tablename . \"` WHERE ct.exptags_id=\" . intval($where) . \" AND ct.content_type='\" . $this->classname . \"'\";\n $tag_assocs = $db->selectObjectsBySql($sql);\n $records = array();\n foreach ($tag_assocs as $assoc) {\n $records[] = new $this->classname($assoc->id);\n }\n return $records;\n } elseif (strcasecmp($range, 'bycat') == 0) { // return items categorized/grouped under request (id or title/sef_url)\n if (!is_int($where)) $where = $db->selectObject($db->prefix . 'expCats',\"title='\" . $where . \"' OR sef_url='\" . $where . \"'\");\n $sql = 'SELECT DISTINCT m.id FROM ' . $db->prefix . $this->tablename . ' m ';\n $sql .= 'JOIN ' . $db->prefix . 'content_expCats ct ';\n $sql .= 'ON m.id = ct.content_id WHERE ct.expcats_id=' . intval($where) . \" AND ct.content_type='\" . $this->classname . \"'\";\n if ($supports_revisions) $sql .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $db->prefix . $this->tablename . \"` WHERE ct.expcats_id=\" . intval($where) . \" AND ct.content_type='\" . $this->classname . \"'\";\n $cat_assocs = $db->selectObjectsBySql($sql);\n $records = array();\n foreach ($cat_assocs as $assoc) {\n $records[] = new $this->classname($assoc->id);\n }\n return $records;\n }\n }", " /**\n * find an item by column\n *\n * @param $column\n * @param $value\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n *\n * @return array\n */\n public function findBy($column, $value, $get_assoc = true, $get_attached = true, $except = array(), $cascade_except = false) {\n// global $db;", " $where = \"`\" . $column . \"`=\";\n if (!is_numeric($value)) $where .= \"'\";\n $where .= $value;\n if (!is_numeric($value)) $where .= \"'\";\n return $this->find('first', $where, null, null, 0, $get_assoc, $get_attached, $except, $cascade_except);\n }", " /**\n * find a value(s) by column\n *\n * @param string $range\n * @param string $column\n * @param string $where\n * @param string $order\n * @param bool $distinct\n *\n * @return array|bool\n */\n public function findValue($range = 'all', $column, $where=null, $order=null, $distinct=false) {\n global $db;", " if (strcasecmp($range, 'all') == 0) { // return all items matching request\n return $db->selectColumn($this->tablename, $column, $where, $order, $distinct);\n } elseif (strcasecmp($range, 'first') == 0) { // return single/first item matching request\n return $db->selectValue($this->tablename, $column, $where);\n }\n return false;\n }", " /**\n * update item\n *\n * @param array $params\n */\n public function update($params = array()) {\n if (is_array($params) && isset($params['current_revision_id'])) {\n $params['revision_id'] = $params['current_revision_id'];\n unset($params['current_revision_id']);\n }\n $this->checkForAttachableItems($params);\n $this->build($params);\n if (is_array($params)) {\n $this->save((isset($params['_validate']) ? $params['_validate'] : true));\n } elseif (is_object($params)) {\n $this->save((isset($params->_validate) ? $params->_validate : true));\n } else {\n $this->save(true);\n }\n }", " /**\n * re-construct the item from the database\n *\n * @return bool\n */\n public function refresh() {\n if (empty($this->id))\n return false;\n $this->__construct($this->id);\n }", " /**\n * Adds table fields as class properties to current \"record\" class.\n *\n * Loads Table schema data and creates new class properties based\n * upon the fields in given table.\n *\n * Additionally, if a record ID is given, that record is pulled and\n * field values are also populated into class properties.\n *\n * @name build\n *\n * @category db_record\n * @uses [db_type]::getDataDefinition() Builds a data definition from existing table.\n * @requires $db\n *\n * @access protected\n * @final\n * @PHPUnit Not Defined\n *\n * @global object $db\n *\n * @param mixed $params array or Object for table selection\n */\n public function build($params = array()) {\n global $db;", " // safeguard against bad data...we can only take objects and arrays here\n if (!is_array($params) && !is_object($params)) $params = array();", " // get the table definition and make sure all the params being passed in belong in this table\n $table = $db->getDataDefinition($this->tablename);", " //check for location_data\n if (is_array($params) && ((!empty($params['module']) || !empty($params['controller'])) && !empty($params['src']))) {\n $mod = !empty($params['module']) ? $params['module'] : (!empty($params['controller']) ? $params['controller'] : null);\n if (empty($params['module'])) $params['module'] = $params['controller'];\n $params['location_data'] = serialize(expCore::makeLocation($mod, $params['src']));\n } elseif (is_object($params) && ((!empty($params->module) || !empty($params->controller)) && !empty($params->src))) {\n $mod = !empty($params->module) ? $params->module : (!empty($params->controller) ? $params->controller : null);\n if (empty($params->module)) $params->module = $params->controller;\n $params->location_data = serialize(expCore::makeLocation($mod, $params->src));\n }", " // Build Class properties based off table fields\n foreach ($table as $col=> $colDef) {\n // check if the DB column has a corresponding value in the params array\n // if not, we check to see if the column is boolean...if so we set it to false", " // if not, then we check to see if we had a previous value in this particular", " // record. if so we reset it to itself so we don't lose the existing value.", " // this is good for when the developer is trying to update just a field or two\n // in an existing record.", " if (array_key_exists($col, $params)) {\n $value = is_array($params) ? $params[$col] : $params->$col;\n if ($colDef[0] == DB_DEF_INTEGER || $colDef[0] == DB_DEF_ID) {\n $this->$col = preg_replace(\"/[^0-9-]/\", \"\", $value);\n } elseif ($colDef[0] == DB_DEF_DECIMAL) {\n $this->$col = preg_replace(\"/[^0-9.-]/\", \"\", $value);\n } else {\n $this->$col = $value;\n }\n } elseif ($colDef[0] == DB_DEF_BOOLEAN) {\n $this->$col = empty($this->$col) ? 0 : $this->$col;\n } elseif ($colDef[0] == DB_DEF_TIMESTAMP) {\n // yuidatetimecontrol sends in a checkbox and a date e.g., publish & publishdate\n $datename = $col . 'date';\n if (is_array($params) && isset($params[$datename])) {\n $this->$col = yuidatetimecontrol::parseData($col, $params);\n } elseif (is_object($params) && isset($params->$datename)) {\n $this->$col = yuidatetimecontrol::parseData($col, object2Array($params));\n } else {\n $this->$col = !empty($this->$col) ? $this->$col : 0;\n }\n } else {\n $this->$col = !empty($this->$col) ? $this->$col : null;\n }", " //if (isset($this->col)) {\n if ($col != 'data' && is_string($this->$col)) {\n $this->$col = stripslashes($this->$col);\n }\n //}\n if (ENABLE_WORKFLOW && $this->supports_revisions && $col == 'revision_id' && $this->$col == null)\n $this->$col = 1; // first revision is #1\n }\n }", " /**\n * rerank items\n *\n * @param $direction\n * @param string $where\n */\n public function rerank($direction, $where = '') {\n global $db;", " if (!empty($this->rank)) {\n $next_prev = $direction == 'up' ? $this->rank - 1 : $this->rank + 1;\n $where .= empty($this->location_data) ? null : (!empty($where) ? \" AND \" : '') . \"location_data='\" . $this->location_data . \"'\" . $this->grouping_sql;\n $db->switchValues($this->tablename, 'rank', $this->rank, $next_prev, $where);\n }\n }", " /**\n * attach to item\n *\n * @param $item\n * @param string $subtype\n * @param bool $replace\n *\n * @return bool\n */\n public function attachItem($item, $subtype = '', $replace = true) { //FIXME only placed used is in helpController->copydocs (though we don't have attachments), & migration\n global $db;", " // make sure we have the info we need..otherwise return\n if (empty($item->id) && empty($this->id)) return false;\n // save the attachable items\n// $refname = strtolower($item->classname).'s_id'; //FIXME plural vs single?\n// $refname = strtolower($item->classname) . '_id'; //FIXME plural vs single?\n $refname = strtolower($item->tablename) . '_id';\n if ($replace) $db->delete($item->attachable_table, 'content_type=\"' . $this->classname . '\" AND content_id=' . $this->id . ' AND ' . $refname . '=' . $item->id);\n $obj = new stdClass();\n $obj->$refname = $item->id;\n $obj->content_id = $this->id;\n $obj->content_type = $this->classname;\n $obj->subtype = $subtype;\n $obj->rank = 1 + $db->max($item->attachable_table, 'rank', null, 'content_type=\"' . $this->classname . '\" AND subtype=\"' . $subtype . '\" AND content_id' . $this->id);\n $db->insertObject($obj, $item->attachable_table);\n }", " /**\n * save item\n *\n * @param bool $validate\n * @param bool $force_no_revisions\n */\n public function save($validate = false, $force_no_revisions = false) {\n global $db;", " // call the validation callback functions if we need to.\n if ($validate) {\n $this->beforeValidation();\n $this->validate();\n $this->afterValidation();\n }", " $this->beforeSave();", " // Save this object's associated objects to the database.\n // FIXME: we're not going to do this automagically until we get the refreshing figured out.", " //$this->saveAssociatedObjects();", "\n //Only grab fields that are valid and save this object\n $saveObj = new stdClass();\n $table = $db->getDataDefinition($this->tablename);\n foreach ($table as $col=> $colDef) {\n $saveObj->$col = empty($this->$col) ? null : $this->$col;\n }", " if (ENABLE_WORKFLOW && $this->supports_revisions && !$this->approved && expPermissions::check('approve', expUnserialize($this->location_data))) {\n $this->approved = true; // auto-approve item if use has approve perm\n $saveObj->approved = true; // also set property in database item\n }\n $identifier = $this->identifier;\n if (!empty($saveObj->$identifier)) {\n $revise = $force_no_revisions ? false : $this->supports_revisions && ENABLE_WORKFLOW;\n $db->updateObject($saveObj, $this->tablename, null, $identifier, $revise);\n $this->afterUpdate();\n } else {\n $this->$identifier = $db->insertObject($saveObj, $this->tablename);\n $this->afterCreate();\n }", " // run the afterSave callback(s)\n $this->afterSave();\n }", " /**\n * before validating item\n */\n public function beforeValidation() {\n $this->runCallback('beforeValidation');\n if (empty($this->id)) {\n $this->beforeValidationOnCreate();\n } else {\n $this->beforeValidationOnUpdate();\n }\n }", " /**\n * before validating item during creation\n */\n public function beforeValidationOnCreate() {\n $this->runCallback('beforeValidationOnCreate');\n }", " /**\n * before validating item during update\n */\n public function beforeValidationOnUpdate() {\n $this->runCallback('beforeValidationOnUpdate');\n }", " /**\n * validate item sef_url\n *\n * @return bool\n */\n public function validate() {\n global $db;\n // check for an sef url field. If it exists make sure it's valid and not a duplicate\n //this needs to check for SEF URLS being turned on also: TODO", " if (property_exists($this, 'sef_url') && !(in_array('sef_url', $this->do_not_validate))) {\n if (empty($this->sef_url)) $this->makeSefUrl();\n if (!isset($this->validates['is_valid_sef_name']['sef_url'])) $this->validates['is_valid_sef_name']['sef_url'] = array();\n if (!isset($this->validates['uniqueness_of']['sef_url'])) $this->validates['uniqueness_of']['sef_url'] = array();\n }", " // safeguard again loc data not being pass via forms...sometimes this happens when you're in a router", " // mapped view and src hasn't been passed in via link to the form", " if (isset($this->id) && empty($this->location_data)) {\n $loc = $db->selectValue($this->tablename, 'location_data', 'id=' . $this->id);\n if (!empty($loc)) $this->location_data = $loc;\n }", " // run the validation as defined in the models\n if (!isset($this->validates)) return true;\n $messages = array();\n $post = empty($_POST) ? array() : expString::sanitize($_POST);\n foreach ($this->validates as $validation=> $field) {\n foreach ($field as $key=> $value) {\n $fieldname = is_numeric($key) ? $value : $key;\n $opts = is_numeric($key) ? array() : $value;\n $ret = expValidator::$validation($fieldname, $this, $opts);\n if (!is_bool($ret)) {\n $messages[] = $ret;\n expValidator::setErrorField($fieldname);\n unset($post[$fieldname]);\n }\n }\n }", " if (count($messages) >= 1) expValidator::failAndReturnToForm($messages, $post);\n }", " /**\n * after validating item\n */\n public function afterValidation() {\n $this->runCallback('afterValidation');\n if (empty($this->id)) {\n $this->afterValidationOnCreate();\n } else {\n $this->afterValidationOnUpdate();\n }\n }", " /**\n * after validating item during creation\n */\n public function afterValidationOnCreate() {\n $this->runCallback('afterValidationOnCreate');\n }", " /**\n * after validating item during update\n */\n public function afterValidationOnUpdate() {\n $this->runCallback('afterValidationOnUpdate');\n }", " /**\n * before saving item\n */\n public function beforeSave() {\n global $user, $db;", " $this->runCallback('beforeSave');\n // populate the magic fields\n if (empty($this->id)) {\n // timestamp the record\n if (property_exists($this, 'created_at')) $this->created_at = time();\n if (property_exists($this, 'edited_at')) $this->edited_at = time();\n // record the user saving the record.\n if (property_exists($this, 'poster')) $this->poster = empty($this->poster) ? $user->id : $this->poster;\n // fill in the rank field if it exist\n if (property_exists($this, 'rank')) {\n// if (!isset($this->rank)) {\n if (empty($this->rank)) { // ranks begin at 1, so 0 is now last\n $where = \"1 \";\n $where .= empty($this->location_data) ? null : \"AND location_data='\" . $this->location_data . \"' \";\n //FIXME: $where .= empty($this->rank_by_field) ? null : \"AND \" . $this->rank_by_field . \"='\" . $this->$this->rank_by_field . \"'\";\n $groupby = empty($this->location_data) ? null : 'location_data';\n $groupby .= empty($this->rank_by_field) ? null : (empty($groupby) ? null : ',' . $this->rank_by_field);\n $this->rank = $db->max($this->tablename, 'rank', $groupby, $where . $this->grouping_sql) + 1;\n } else {\n // check if this rank is already there..if so increment everything below it.\n $obj = $db->selectObject($this->tablename, 'rank=' . $this->rank . $this->grouping_sql);\n if (!empty($obj)) {\n $db->increment($this->tablename, 'rank', 1, 'rank>=' . $this->rank . $this->grouping_sql);\n }\n }\n }", " $this->beforeCreate();\n } else {\n // put the created_at time back the way it was so we don't set it 0\n if (property_exists($this, 'created_at') && $this->created_at == 0) {\n $this->created_at = $db->selectValue($this->tablename, 'created_at', 'id=' . $this->id);\n }", " // put the original posters id back the way it was so we don't set it 0\n if (property_exists($this, 'poster') && $this->poster == 0) {\n $this->poster = $db->selectValue($this->tablename, 'poster', 'id=' . $this->id);\n }", " //put the rank back to what it was so we don't set it 0\n if (property_exists($this, 'rank') && $this->rank == 0) {\n $this->rank = $db->selectValue($this->tablename, 'rank', 'id=' . $this->id);\n }", " if (property_exists($this, 'edited_at')) $this->edited_at = time();\n if (property_exists($this, 'editor')) $this->editor = $user->id;", " $this->beforeUpdate();\n }\n }", " /**\n * before creating item\n */\n public function beforeCreate() {\n $this->runCallback('beforeCreate');\n }", " /**\n * before updating item\n */\n public function beforeUpdate() {\n // we need some help migrating edited dates\n if (!empty($this->migrated_at)) {\n $this->edited_at = $this->migrated_at;\n unset($this->migrated_at);\n }\n $this->runCallback('beforeUpdate');\n }", " /**\n * after updating item\n */\n public function afterUpdate() {\n $this->runCallback('afterUpdate');\n }", " /**\n * after creating item\n */\n public function afterCreate() {\n $this->runCallback('afterCreate');\n }", " /**\n * after saving item\n */\n public function afterSave() {\n global $db;", " $this->runCallback('afterSave');", " // save all attached items\n if (!empty($this->attachable_items_to_save)) {\n foreach ($this->attachable_item_types as $type) {\n if (!empty($this->attachable_items_to_save[$type])) {\n $itemtype = new $type();\n // clean up (delete) old attachments since we'll create all from scratch\n $db->delete($itemtype->attachable_table, 'content_type=\"' . $this->classname . '\" AND content_id=' . $this->id);\n// $refname = strtolower($type).'s_id'; //FIXME: find a better way to pluralize these names!!!\n $refname = strtolower($itemtype->tablename) . '_id'; //FIXME: find a better way to pluralize these names!!!\n foreach ($this->attachable_items_to_save[$type] as $subtype=> $item) {\n $obj = new stdClass();\n if (is_object($item)) {\n if (!empty($item->id)) {\n $obj->$refname = $item->id;\n $obj->subtype = $subtype;\n $obj->content_id = $this->id;\n $obj->content_type = $this->classname;\n if ($type == 'expFile' || $type == 'expCats') $obj->rank = $item->rank + 1;\n $db->insertObject($obj, $itemtype->attachable_table);\n }\n } elseif (is_array($item)) {\n foreach ($item as $rank=>$value) {\n if (is_numeric($value)) {\n $obj->$refname = $value;\n $obj->subtype = $subtype;\n $obj->content_id = $this->id;\n $obj->content_type = $this->classname;\n if ($type == 'expFile' || $type == 'expCats') $obj->rank = $rank + 1;\n $db->insertObject($obj, $itemtype->attachable_table);\n }\n }\n } elseif (is_numeric($item)) {\n $obj->$refname = $item;\n $obj->content_id = $this->id;\n $obj->content_type = $this->classname;\n if ($type == 'expFile' || $type == 'expCats') $obj->rank = $subtype + 1;\n $db->insertObject($obj, $itemtype->attachable_table);\n }\n }\n }\n }\n }\n }", " /**\n * is run before deleting item\n */\n public function beforeDelete() {\n $this->runCallback('beforeDelete');\n }", " /**\n * delete item\n *\n * @param string $where\n *\n * @return bool\n */\n public function delete($where = '') {\n global $db;", " $id = $this->identifier;\n if (empty($this->$id)) return false;\n $this->beforeDelete();\n $db->delete($this->tablename, $id . '=' . $this->$id);\n if (!empty($where)) $where .= ' AND '; // for help in reranking, NOT deleting object\n if (property_exists($this, 'rank')) $db->decrement($this->tablename, 'rank', 1, $where . 'rank>=' . $this->rank . $this->grouping_sql);", " // delete attached items\n foreach ($this->attachable_item_types as $content_table=> $type) {\n $db->delete($content_table, 'content_type=\"' . $this->classname . '\" AND content_id=' . $this->$id);\n }\n // leave associated items to the model afterDelete method?\n $this->afterDelete();\n }", " /**\n * is run after deleting item\n */\n public function afterDelete() {\n $this->runCallback('afterDelete');\n }", " /**\n * jump to subclass calling routine\n *\n * @param $type\n *\n * @return bool\n */\n private function runCallback($type) {\n if (empty($type)) return false;", " // check for and run any callbacks listed in the $type array.\n if ($this->classinfo->hasProperty($type)) {\n $callbacks = $this->classinfo->getProperty($type);\n foreach ($callbacks->getValue(new $this->classname(null, false, false)) as $func) {\n $this->$func();\n }\n }\n }", " /**\n * make an sef_url for item\n */\n public function makeSefUrl() {\n global $db, $router;", " if (!empty($this->title)) {\n\t\t\t$this->sef_url = $router->encode($this->title);\n\t\t} else {\n\t\t\t$this->sef_url = $router->encode('Untitled');\n\t\t}\n $dupe = $db->selectValue($this->tablename, 'sef_url', 'sef_url=\"'.$this->sef_url.'\"' . $this->grouping_sql);\n\t\tif (!empty($dupe)) {\n\t\t\tlist($u, $s) = explode(' ',microtime());\n\t\t\t$this->sef_url .= '-'.$s.'-'.$u;\n\t\t}\n $this->runCallback('makeSefUrl');\n }", " /**\n * get item's associated objects\n *\n * Type of associations\n * has_one\n * has_many\n * has_and_belongs_to_many\n *\n * @param null $obj\n *\n * @return null\n */\n public function getAssociatedObjects($obj = null) { //FIXME not used??\n global $db;", " $records = array();", " foreach ($this->has_one as $assoc_object) {\n $ret = $db->selectObjects($this->tablename, $assoc_object . '_id=' . $obj->id);\n if (!empty($ret)) $obj->$assoc_object = $ret;\n }", " foreach ($this->has_many as $assoc_object) {\n $ret = $db->selectObjects($assoc_object, $this->tablename . '_id=' . $obj->id);\n if (!empty($ret)) $obj->$assoc_object = $ret;\n }", " foreach ($this->has_and_belongs_to_many as $assoc_object) {\n if (strcmp($this->tablename, $assoc_object) > 0) {\n $tablename = $assoc_object . '_' . $this->tablename;\n } else {\n $tablename = $this->tablename . '_' . $assoc_object;\n }", " //$ret = $db->selectObjects($tablename, $this->tablename.'_id='.$obj->id);\n $instances = $db->selectObjects($tablename, $this->tablename . '_id=' . $obj->id);\n $ret = array();\n foreach ($instances as $instance) {\n $fieldname = $assoc_object . '_id';\n $ret[] = $db->selectObject($assoc_object, 'id=' . $instance->$fieldname);\n }\n if (!empty($ret)) $obj->$assoc_object = $ret;\n }", " return $obj;\n }", " /**\n * this function finds models that have this attachable item attached\n *\n * @param $content_type\n *\n * @return array\n */\n public function findWhereAttachedTo($content_type) {\n global $db;", " $objarray = array();\n if (!empty($this->id) && !empty($this->attachable_table)) {\n// $assocs = $db->selectObjects($this->attachable_table, $this->classname.'s_id='.$this->id.' AND content_type=\"'.$content_type.'\"'); //FIXME is it plural where others are single?\n $assocs = $db->selectObjects($this->attachable_table, strtolower($this->tablename) . '_id=' . $this->id . ' AND content_type=\"' . $content_type . '\"');\n foreach ($assocs as $assoc) {\n if (class_exists($assoc->content_type)) $objarray[] = new $assoc->content_type($assoc->content_id);\n }\n }", " return $objarray;\n }", " /**\n * check for what objects may be attached\n *\n * @param $params\n *\n * @return bool\n */\n protected function checkForAttachableItems($params) {\n if (empty($params)) return false;\n foreach ($this->attachable_item_types as $type) {\n if (array_key_exists($type, $params)) {\n $this->attachable_items_to_save[$type] = is_array($params) ? $params[$type] : $params->$type;\n }\n }\n }", " /**\n * used for import/export\n *\n * @return array\n */\n function getAttachableItemTables() {\n return $this->attachable_item_types; //fixme this is the model name, NOT the table name\n }", " /**\n * get attached objects for this item\n */\n protected function getAttachableItems() {\n global $db;", " foreach ($this->attachable_item_types as $content_table=> $type) {\n if ($this->classname == $type) break;", " $tablename = str_ireplace('content_', '', $content_table);\n if (!isset($this->id)) {\n $this->$type = array();\n } else {\n $sql = 'SELECT ef.*, cef.subtype AS subtype FROM ';\n $sql .= $db->prefix . $tablename . ' ef JOIN ' . $db->prefix . $content_table . ' cef ';\n $sql .= \"ON ef.id = cef.\" . $tablename . \"_id\";\n $sql .= \" WHERE content_id=\" . $this->id;\n $sql .= \" AND content_type='\" . $this->classname . \"'\";\n if ($type == 'expComment') {\n $sql .= \" AND approved='1'\";\n }", " $order = ($type == 'expFile' || $type == 'expCats' || $type == 'expDefinableField') ? ' ORDER BY rank ASC' : null;\n $sql .= $order;", " $items = $db->selectArraysBySql($sql);", " $attacheditems = array();\n foreach ($items as $item) {\n //FIXME: find a better way to unpluralize the name!\n $idname = strtolower($type) . '_id';\n if (empty($item['subtype'])) {\n $attacheditems[] = new $type($item, false, false);\n } else {\n if (!isset($attacheditems[$item['subtype']])) $attacheditems[$item['subtype']] = array();\n $attacheditems[$item['subtype']][] = new $type($item, false, false);\n }\n }", " $this->$type = $attacheditems;\n }\n }\n }", " /**\n * gets associated objects for this model\n *\n * Type of associations\n * has_extended_fields\n * has_one\n * has_many\n * has_many_self\n * has_and_belongs_to_many\n * has_and_belongs_to_self\n *\n * @param array $except\n * @param bool $cascade_except\n *\n */\n private function getAssociatedObjectsForThisModel($except = array(), $cascade_except = false) {\n global $db;", " foreach ($this->has_extended_fields as $assoc_object) {\n // figure out the name of the model based off the models tablename\n $obj = new $assoc_object(null, false, false);\n $this->$assoc_object = $obj->find('first', $this->tablename . '_id = ' . $this->id);\n }", " //this requires a field in the table only with the ID of the associated object we're looking for in its table\n foreach ($this->has_one as $assoc_object) {\n // figure out the name of the model based off the models tablename\n if (!in_array($assoc_object, $except)) {\n $obj = new $assoc_object(null, false, false);\n $id_name = $obj->tablename . '_id';", " // check to see if we have an association yet. if not we'll initialize an empty model\n $id = empty($this->$id_name) ? array() : $this->$id_name;", " $this->$assoc_object = new $assoc_object($id, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n } else {\n $this->$assoc_object = array();\n }\n }", " //TODO: perhaps add a 'in' option to the find so we can pass an array of ids and make ONE db call instead of looping\n foreach ($this->has_many as $assoc_object) {\n if (!in_array($assoc_object, $except)) {\n $assoc_obj = new $assoc_object();", " $ret = $db->selectArrays($assoc_obj->tablename, $this->tablename . '_id=' . $this->id, $assoc_obj->default_sort_field != '' ? $assoc_obj->default_sort_field . \" \" . $assoc_obj->default_sort_direction : null);\n $records = array();\n if ($cascade_except) {\n $record['except'] = $except;\n $record['cascade_except'] = $cascade_except;\n }\n foreach ($ret as $record) {\n $records[] = new $assoc_object($record, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n }\n $this->$assoc_object = $records;\n } else {\n //eDebug(\"No: \" .$assoc_object);\n $this->$assoc_object = array();\n }\n }", " foreach ($this->has_many_self as $assoc_object) {\n if (!in_array($assoc_object, $except)) {\n $assoc_obj = new $assoc_object();", " $ret = $db->selectArrays($assoc_obj->tablename, $assoc_obj->has_many_self_id . '=' . $this->id, $assoc_obj->default_sort_field != '' ? $assoc_obj->default_sort_field . \" \" . $assoc_obj->default_sort_direction : null);\n $records = array();\n foreach ($ret as $record) {\n $records[] = new $assoc_object($record, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n }\n $this->$assoc_object = $records;\n } else {\n $this->$assoc_object = array();\n }\n }", " foreach ($this->has_and_belongs_to_many as $assoc_object) {\n if (!in_array($assoc_object, $except)) {\n $assocObj = new $assoc_object(null, false, false);\n $tablename = $this->makeManyToManyTablename($assocObj->tablename);", " $ret = $db->selectObjects($assocObj->tablename, 'id IN (SELECT ' . $assocObj->tablename . '_id from ' . $db->prefix . $tablename . ' WHERE ' . $this->tablename . '_id=' . $this->id . ')', $assocObj->default_sort_field != '' ? $assocObj->default_sort_field . \" \" . $assocObj->default_sort_direction : null);\n $records = array();\n foreach ($ret as $record) {\n $record_array = object2Array($record);\n // put in the current model as an exception, otherwise the auto assoc's keep initializing instances of each other in an\n // infinite loop\n $record_array['except'] = array($this->classinfo->name);\n if ($cascade_except) {\n $record_array['except'] = array_merge($record_array['except'], $except);\n $record_array['cascade_except'] = $cascade_except;\n }\n $records[] = new $assoc_object($record_array, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n }\n $this->$assoc_object = $records;\n } else {\n $this->$assoc_object = array();\n }\n }", " foreach ($this->has_and_belongs_to_self as $assoc_object) {\n if (!in_array($assoc_object, $except)) {\n $assocObj = new $assoc_object(null, false, false);\n $tablename = $this->makeManyToManyTablename($assocObj->classname);", " $ret = $db->selectObjects($assocObj->tablename, 'id IN (SELECT ' . $assocObj->classname . '_id from ' . $db->prefix . $tablename . ' WHERE ' . $this->tablename . '_id=' . $this->id . ')');\n $records = array();\n foreach ($ret as $record) {\n $record_array = object2Array($record);\n // put in the current model as an exception, otherwise the auto assoc's keep initializing instances of each other in an\n // infinite loop\n $record_array['except'] = array($this->classinfo->name);\n $records[] = new $assoc_object($record_array, in_array($assoc_object, $this->get_assoc_for), in_array($assoc_object, $this->get_attachable_for));\n }\n $this->$assoc_object = $records;\n } else {\n $this->$assoc_object = array();\n }\n }\n }", " /**\n * get objects this item belongs to ??\n *\n * Type of associations\n * has_and_belongs_to_many\n *\n * @param $datatype\n * @param $id\n */\n public function associateWith($datatype, $id) { //FIXME not used??\n global $db;", " $assocObj = new $datatype();", " if (in_array($datatype, $this->has_and_belongs_to_many)) {\n $tablename = $this->makeManyToManyTablename($assocObj->tablename);\n $thisid = $this->tablename . '_id';\n $otherid = $assocObj->tablename . '_id';\n $obj = new stdClass();\n $obj->$thisid = $this->id;\n $obj->$otherid = $id;\n $db->insertObject($obj, $tablename);\n }\n }", " /**\n * save associated objects\n *\n * Type of associations\n * has_one\n *\n */\n public function saveAssociatedObjects() {\n// global $db;", " foreach ($this->has_one as $assoc_object) {\n $obj = $this->$assoc_object;\n $obj->save();", " $assoc_id_name = $assoc_object . '_id';\n $this->$assoc_id_name = $obj->id;\n }\n }", " //why the compare to flip order?\n /**\n * create a many to many table relationship\n *\n * @param $assoc_table\n *\n * @return string\n */\n private function makeManyToManyTablename($assoc_table) {\n if (strcmp($this->tablename, $assoc_table) > 0) {\n $tablename = $assoc_table . '_' . $this->tablename;\n } else {\n $tablename = $this->tablename . '_' . $assoc_table;\n }\n return $tablename;\n }", " /**\n * return the item poster\n *\n * @param null $display\n * @return null|string\n */\n public function getPoster($display = null) {\n if (isset($this->poster)) {\n $user = new user($this->poster);\n return user::getUserAttribution($user->id, $display);\n } else {\n return null;\n }\n }", " /**\n * return the item timestamp\n *\n * @param int $type\n *\n * @return mixed\n */\n public function getTimestamp($type = 0) {\n if ($type == 0) $getType = 'created_at';\n elseif ($type == 'publish') $getType = 'publish';\n else $getType = 'edited_at';\n if (isset($this->$getType)) return expDateTime::format_date($this->$getType, DISPLAY_DATETIME_FORMAT);\n else return null;\n }", "}", ";", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class mysqli_database\n *\n * This is the MySQLi-specific implementation of the database class.\n * @package Subsystems\n * @subpackage Database\n */\n/** @define \"BASE\" \"../..\" */", "class mysqli_database extends database {", " /**\n * Make a connection to the Database Server\n *\n * Takes the supplied credentials (username / password) and tries to\n * connect to the server and select the given database. All the rules\n * governing mysqli_connect also govern this method.\n *\n * @param string $username The username to connect to the server as.\n * @param string $password The password for $username\n * @param string $hostname The hostname of the database server. If\n * localhost is specified, a local socket connection will be attempted.\n * @param string $database The name of the database to use. Multi-database\n * sites are still not yet supported.\n * @param bool $new Whether or not to force the PHP connection function to establish\n * a distinctly new connection handle to the server.\n */", "\tfunction __construct($username, $password, $hostname, $database, $new=false) {\n\t\tif (strstr($hostname,':')) {\n\t\t\tlist ( $host, $port ) = @explode (\":\", $hostname);\n\t\t} else {\n $host = $hostname;\n }\n\t\tif ($this->connection = @mysqli_connect($host, $username, $password, $database, $port)) {\n\t\t\t$this->havedb = true;\n\t\t}\n\t\t//fix to support utf8, warning it only works from a certain mySQL version on\n\t\t//needed on mySQL servers that don't have the default connection encoding setting to utf8", "\t\t//As we do not have any setting for ISAM or InnoDB tables yet, i set the minimum specs\n\t\t// for using this feature to 4.1.2, although isam tables got the support for utf8 already in 4.1\n\t\t//anything else would result in an inconsistent user experience\n\t\t//TODO: determine how to handle encoding on postgres", "\t\tlist($major, $minor, $micro) = sscanf(@mysqli_get_server_info($this->connection), \"%d.%d.%d-%s\");\n\t\tif(defined('DB_ENCODING')) {\n\t\t\t//SET NAMES is possible since version 4.1\n\t\t\tif(($major > 4) OR (($major == 4) AND ($minor >= 1))) {\n\t\t\t\t@mysqli_query($this->connection, \"SET NAMES \" . DB_ENCODING);\n\t\t\t}\n\t\t}", "\t\t$this->prefix = DB_TABLE_PREFIX . '_';\n\t}", " /**\n * Create a new Table\n *\n * Creates a new database table, according to the passed data definition.\n *\n * This function abides by the Exponent Data Definition Language, and interprets\n * its general structure for MySQL.\n *\n * @param string $tablename The name of the table to create\n * @param array $datadef The data definition to create, expressed in\n * the Exponent Data Definition Language.\n * @param array $info Information about the table itself.\n * @return array\n\t */\n\tfunction createTable($tablename, $datadef, $info) {\n\t\tif (!is_array($info))\n $info = array(); // Initialize for later use.", "\t\t$sql = \"CREATE TABLE `\" . $this->prefix . \"$tablename` (\";\n\t\t$primary = array();\n\t\t$fulltext = array();\n\t\t$unique = array();\n\t\t$index = array();\n\t\tforeach ($datadef as $name=>$def) {\n\t\t\tif ($def != null) {\n\t\t\t\t$sql .= $this->fieldSQL($name,$def) . \",\";\n\t\t\t\tif (!empty($def[DB_PRIMARY])) $primary[] = $name;\n\t\t\t\tif (!empty($def[DB_FULLTEXT])) $fulltext[] = $name;\n\t\t\t\tif (isset($def[DB_INDEX]) && ($def[DB_INDEX] > 0)) {\n\t\t\t\t\tif ($def[DB_FIELD_TYPE] == DB_DEF_STRING) {\n\t\t\t\t\t\t$index[$name] = $def[DB_INDEX];\n } else {\n $index[$name] = 0;\n }\n }\n if (isset($def[DB_UNIQUE])) {\n if (!isset($unique[$def[DB_UNIQUE]]))\n $unique[$def[DB_UNIQUE]] = array();\n $unique[$def[DB_UNIQUE]][] = $name;\n }\n }\n }\n $sql = substr($sql, 0, -1);\n if (count($primary)) {\n $sql .= \", PRIMARY KEY ( `\" . implode(\"` , `\", $primary) . \"`)\";\n }\n if (count($fulltext)) {\n// $sql .= \", FULLTEXT ( `\" . implode(\"` , `\", $fulltext) . \"`)\";\n $sql .= \", FULLTEXT `\" . $fulltext[0] . \"`\" . \"( `\" . implode(\"` , `\", $fulltext) . \"`)\";\n }\n if (!empty($unique)) foreach ($unique as $key => $value) {\n $sql .= \", UNIQUE `\" . $key . \"` ( `\" . implode(\"` , `\", $value) . \"`)\";\n }\n foreach ($index as $key => $value) {\n $sql .= \", INDEX (`\" . $key . \"`\" . (($value > 0) ? \"(\" . $value . \")\" : \"\") . \")\";\n }\n $sql .= \")\";\n if (defined(DB_ENCODING)) {\n $sql .= \" ENGINE = MYISAM CHARACTER SET \" . DB_ENCODING;\n } else {\n $sql .= \" ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci\";\n }", " if (isset($info[DB_TABLE_COMMENT])) {\n $sql .= \" COMMENT = '\" . $info[DB_TABLE_COMMENT] . \"'\";\n }", " @mysqli_query($this->connection, $sql);", " $return = array(\n $tablename => ($this->tableExists($tablename) ? DATABASE_TABLE_INSTALLED : DATABASE_TABLE_FAILED)\n );", " return $return;\n }", " /**\n * Alter an existing table\n *\n * Alters the structure of an existing database table to conform to the passed\n * data definition.\n *\n * This function abides by the Exponent Data Definition Language, and interprets\n * its general structure for MySQL.\n *\n * @param string $tablename The name of the table to alter\n * @param array $newdatadef The new data definition for the table.\n * This is expressed in the Exponent Data Definition Language\n * @param array $info Information about the table itself.\n * @param bool $aggressive Whether or not to aggressively update the table definition.\n * An aggressive update will drop columns in the table that are not in the Exponent definition.\n * @return array\n */\n function alterTable($tablename, $newdatadef, $info, $aggressive = false) {\n expSession::clearAllUsersSessionCache();\n $dd = $this->getDataDefinition($tablename);\n $modified = false;", " // collect any indexes & keys to the table\n $primary = array();\n $fulltext = array();\n $unique = array();\n $index = array();\n foreach ($newdatadef as $name=>$def) {\n if ($def != null) {\n if (!empty($def[DB_PRIMARY])) $primary[] = $name;\n if (!empty($def[DB_FULLTEXT])) $fulltext[] = $name;\n if (isset($def[DB_INDEX]) && ($def[DB_INDEX] > 0)) {\n if ($def[DB_FIELD_TYPE] == DB_DEF_STRING) {\n $index[$name] = $def[DB_INDEX];\n } else {\n $index[$name] = 0;\n }\n }\n if (isset($def[DB_UNIQUE])) {\n if (!isset($unique[$def[DB_UNIQUE]]))\n $unique[$def[DB_UNIQUE]] = array();\n $unique[$def[DB_UNIQUE]][] = $name;\n }\n }\n }", " //Drop any old columns from the table if aggressive mode is set.\n if ($aggressive) {\n //update primary keys to 'release' columns\n $sql = \"ALTER IGNORE TABLE `\" . $this->prefix . \"$tablename` \";\n if (count($primary)) {\n $sql .= \" DROP PRIMARY KEY, ADD PRIMARY KEY ( `\" . implode(\"` , `\",$primary) . \"` )\";\n }\n @mysqli_query($this->connection, $sql);", " if (is_array($newdatadef) && is_array($dd)) {\n $oldcols = @array_diff_assoc($dd, $newdatadef);\n if (count($oldcols)) {\n $modified = true;\n $sql = \"ALTER TABLE `\" . $this->prefix . \"$tablename` \";\n foreach ($oldcols as $name => $def) {\n $sql .= \" DROP COLUMN \" . $name . \",\";\n }\n $sql = substr($sql, 0, -1);\n @mysqli_query($this->connection, $sql);\n }\n }\n }", " //Add any new columns to the table\n if (is_array($newdatadef) && is_array($dd)) {\n $diff = @array_diff_assoc($newdatadef, $dd);\n if (count($diff)) {\n $modified = true;\n $sql = \"ALTER TABLE `\" . $this->prefix . \"$tablename` \";\n foreach ($diff as $name => $def) {\n $sql .= \" ADD COLUMN (\" . $this->fieldSQL($name, $def) . \"),\";\n }\n $sql = substr($sql, 0, -1);\n @mysqli_query($this->connection, $sql);\n }", " // alter any existing columns here\n $diff_c = @expCore::array_diff_assoc_recursive($newdatadef, $dd);\n $sql = \"ALTER TABLE `\" . $this->prefix . \"$tablename` \";\n $changed = false;\n if (is_array($diff_c)) {\n foreach ($diff_c as $name => $def) {\n if (!array_key_exists($name, $diff) && (isset($def[DB_FIELD_TYPE]) || isset($def[DB_FIELD_LEN]) || isset($def[DB_DEFAULT]) || isset($def[DB_INCREMENT]))) { // wasn't a new column\n if ($dd[$name][DB_FIELD_TYPE] == DB_DEF_STRING) {\n //check for actual lengths vs. exp placeholder lengths\n $newlen = $newdatadef[$name][DB_FIELD_LEN];\n $len = $dd[$name][DB_FIELD_LEN];\n if ($len >= 16777216 && $newlen >= 16777216) {\n continue;\n }\n if ($len >= 65536 && $newlen >= 65536) {\n continue;\n }\n if ($len >= 256 && $newlen >= 256) {\n continue;\n }\n }\n $changed = true;\n $sql .= ' MODIFY ' . $this->fieldSQL($name,$newdatadef[$name]) . \",\";\n }\n }\n }\n if ($changed) {\n $modified = true;\n $sql = substr($sql, 0, -1);\n @mysqli_query($this->connection, $sql);\n }\n }", " //Add any new indexes & keys to the table\n $sql = \"ALTER\" . (empty($aggressive) ? \"\" : \" IGNORE\") . \" TABLE `\" . $this->prefix . \"$tablename` \";", " $sep = false;\n if (count($primary)) {\n $sql .= \" DROP PRIMARY KEY, ADD PRIMARY KEY ( `\" . implode(\"` , `\",$primary) . \"` )\";\n $sep = true;\n }\n if (count($fulltext)) {\n if ($sep) $sql .= ' ,';\n// $sql .= \" ADD FULLTEXT ( `\" . implode(\"` , `\", $fulltext) . \"`)\";\n // drop the index first so we don't get dupes\n $drop = \"DROP INDEX \" . $fulltext[0] . \" ON \" . $this->prefix . $tablename;\n @mysqli_query($this->connection, $drop);\n $sql .= \" ADD FULLTEXT `\" . $fulltext[0] . \"`\" . \"( `\" . implode(\"` , `\", $fulltext) . \"`)\";\n $sep = true;\n }\n if (!empty($unique)) foreach ($unique as $key=>$value) {\n if ($sep) $sql .= ' ,';\n $sql .= \", ADD UNIQUE `\".$key.\"` ( `\" . implode(\"` , `\",$value) . \" `)\";\n $sep = true;\n }", " foreach ($index as $key => $value) {\n // drop the index first so we don't get dupes\n $drop = \"DROP INDEX \" . $key . \" ON \" . $this->prefix . $tablename;\n @mysqli_query($this->connection, $drop);", " // re-add the index\n if ($sep) $sql .= ' ,';\n// $sql .= \" ADD INDEX (`\" . $key . \"`)\"; //FIXME we don't add column length??\n $sql .= \" ADD INDEX (`\" . $key . \"`\" . (($value > 0) ? \"(\" . $value . \")\" : \"\") . \")\";\n $sep = true;\n }\n @mysqli_query($this->connection, $sql);", " //Get the return code\n $return = array(\n $tablename => ($modified ? TABLE_ALTER_SUCCEEDED : TABLE_ALTER_NOT_NEEDED)\n );", " return $return;\n }", " /**\n * Drop a table from the database\n *\n * Removes an existing table from the database. Returns true if the table was dropped, false if there\n * was an error returned by the MySQL server.\n *\n * @param string $table The name of the table to drop.\n * @return bool\n */\n function dropTable($table) {\n return @mysqli_query($this->connection, \"DROP TABLE `\" . $this->prefix . \"$table`\") !== false;\n }", " /**\n * Run raw SQL. Returns true if the query succeeded, and false\n * if an error was returned from the MySQL server.\n *\n * <div style=\"color:red\">If you can help it, do not use this function. It presents Database Portability Issues.</div>\n *\n * Runs a straight SQL query on the database. This is not a\n * very portable way of dealing with the database, and is only\n * provided as a last resort.\n *\n * @param string $sql The SQL query to run\n\t * @param bool $escape Indicates if the query will be escape\n * @return mixed\n */\n function sql($sql, $escape = true) {\n\t\tif($escape == true) {\n\t\t\t$res = @mysqli_query($this->connection, mysqli_real_escape_string($this->connection, $sql));\n\t\t} else {\n\t\t\t$res = @mysqli_query($this->connection, $sql);\n\t\t}\n return $res;\n }", "\t/**\n\t * Update a column in all records in a table\n\t *\n\t * @param $table\n\t * @param $col\n\t * @param $val\n\t * @param int|null $where\n\t * @return void\n\t */", " function columnUpdate($table, $col, $val, $where=1) { ", " $res = @mysqli_query($this->connection, \"UPDATE `\" . $this->prefix . \"$table` SET `$col`='\" . $val . \"' WHERE $where\");\n /*if ($res == null)\n return array();\n $objects = array();\n for ($i = 0; $i < mysqli_num_rows($res); $i++)\n $objects[] = mysqli_fetch_object($res);*/\n //return $objects;\n }", " /**\n * Select a series of objects\n *\n * Selects a set of objects from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of objects, in any random order.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param null $orderby\n * @return array\n */\n function selectObjects($table, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;", " $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }", "\t/**\n\t * @param $terms\n\t * @param null $where\n\t * @return array\n\t */\n function selectSearch($terms, $where = null) {\n if ($where == null)\n $where = \"1\";", " $sql = \"SELECT *, MATCH (s.title, s.body) AGAINST ('\" . $terms . \"*') as score from \" . $this->prefix . \"search as s \";\n $sql .= \"WHERE MATCH (title, body) against ('\" . $terms . \"*' IN BOOLEAN MODE) ORDER BY score DESC\";\n $res = @mysqli_query($this->connection, $sql);\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }", "\t/**\n\t * @param null $colsA\n\t * @param null $colsB\n\t * @param $tableA\n\t * @param $tableB\n\t * @param $keyA\n\t * @param null $keyB\n\t * @param null $where\n\t * @param null $orderby\n\t * @return array'\n\t */\n function selectAndJoinObjects($colsA=null, $colsB=null, $tableA, $tableB, $keyA, $keyB=null, $where = null, $orderby = null) {\n $sql = 'SELECT ';\n if ($colsA != null) {\n if (!is_array($colsA)) {\n $sql .= 'a.' . $colsA . ', ';\n } else {\n foreach ($colsA as $colA) {\n $sql .= 'a.' . $colA . ', ';\n }\n }\n } else {\n $sql .= ' a.*, ';\n }", " if ($colsB != null) {\n if (!is_array($colsB)) {\n $sql .= 'b.' . $colsB . ' ';\n } else {\n $i = 1;\n foreach ($colsB as $colB) {\n $sql .= 'b.' . $colB;\n if ($i < count($colsB))\n $sql .= ', ';\n $i++;\n }\n }\n } else {\n $sql .= ' b.* ';\n }", " $sql .= ' FROM ' . $this->prefix . $tableA . ' a JOIN ' . $this->prefix . $tableB . ' b ';\n $sql .= is_null($keyB) ? 'USING(' . $keyA . ')' : 'ON a.' . $keyA . ' = b.' . $keyB;", " if ($where == null)\n $where = \"1\";\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;", " $res = @mysqli_query($this->connection, $sql . \" WHERE $where $orderby\");\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }", "\t/**\n * Select a single object by sql\n *\n\t * @param $sql\n\t * @return null|void\n\t */\n function selectObjectBySql($sql) {\n //$logFile = \"C:\\\\xampp\\\\htdocs\\\\supserg\\\\tmp\\\\queryLog.txt\";\n //$lfh = fopen($logFile, 'a');", " //fwrite($lfh, $sql . \"\\n\"); \n //fclose($lfh); ", " $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return null;\n return mysqli_fetch_object($res);\n }", "\t/**\n * Select a series of objects by sql\n *\n\t * @param $sql\n\t * @return array\n\t */\n function selectObjectsBySql($sql) {\n $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }", "\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @param null $orderby\n\t * @param bool $distinct\n\t * @return array\n\t */\n function selectColumn($table, $col, $where = null, $orderby = null, $distinct=false) {\n if ($where == null)\n $where = \"1\";\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;\n $dist = empty($distinct) ? '' : 'DISTINCT ';", " $res = @mysqli_query($this->connection, \"SELECT \" . $dist . $col . \" FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $resarray = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $row = mysqli_fetch_array($res, MYSQLI_NUM);\n $resarray[$i] = $row[0];\n }\n return $resarray;\n }", "\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return int\n\t */\n function selectSum($table, $col, $where = null) {\n if ($where == null)\n $where = \"1\";", " $res = @mysqli_query($this->connection, \"SELECT SUM(\" . $col . \") FROM `\" . $this->prefix . \"$table` WHERE $where\");\n if ($res == null)\n return 0;\n $resarray = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $row = mysqli_fetch_array($res, MYSQLI_NUM);\n $resarray[$i] = $row[0];\n }\n return $resarray[0];\n }", "\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @param null $orderby\n\t * @return array\n\t */\n function selectDropdown($table, $col, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;", " $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $resarray = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $row = mysqli_fetch_object($res);\n $resarray[$row->id] = $row->$col;\n }\n return $resarray;\n }", "\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return null\n\t */\n function selectValue($table, $col, $where=null) {\n if ($where == null)\n $where = \"1\";\n $sql = \"SELECT \" . $col . \" FROM `\" . $this->prefix . \"$table` WHERE $where LIMIT 0,1\";\n $res = @mysqli_query($this->connection, $sql);", " if ($res == null)\n return null;\n $obj = mysqli_fetch_object($res);\n if (is_object($obj)) {\n return $obj->$col;\n } else {\n return null;\n }\n }", "\t/**\n\t * @param $sql\n\t * @return null\n\t */\n function selectValueBySql($sql) {\n $res = $this->sql($sql);\n if ($res == null)\n return null;\n $r = mysqli_fetch_row($res);\n if (is_array($r)) {\n return $r[0];\n } else {\n return null;\n }\n }", " /**\n * Select a series of objects, and return by ID\n *\n * Selects a set of objects from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of objects, in any random order. The indices of the array\n * are the IDs of the objects.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param null $orderby\n * @return array\n */\n function selectObjectsIndexedArray($table, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;\n $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");", " if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $o = mysqli_fetch_object($res);\n $objects[$o->id] = $o;\n }\n return $objects;\n }", " /**\n * Count Objects matching a given criteria\n *\n * @param string $table The name of the table to count objects in.\n * @param string $where Criteria for counting.\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return int\n */\n function countObjects($table, $where = null, $is_revisioned=false, $needs_approval=false) {\n if ($where == null)\n $where = \"1\";\n $as = '';\n if ($is_revisioned) {\n // $where.= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE $where)\";\n $where .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE id = rev.id \";\n if ($needs_approval) $where .= ' AND (approved=1 OR poster=' . $needs_approval . ' OR editor=' . $needs_approval . ')';\n $where .= \")\";\n $as = ' AS rev';\n }\n $res = @mysqli_query($this->connection, \"SELECT COUNT(*) as c FROM `\" . $this->prefix . \"$table`\" . $as . \" WHERE $where\");\n if ($res == null)\n return 0;\n $obj = mysqli_fetch_object($res);\n return $obj->c;\n }", " /**\n * Count Objects matching a given criteria using raw sql\n *\n * @param string $sql The sql query to be run\n * @return int\n */\n function countObjectsBySql($sql) {\n $res = @mysqli_query($this->connection, $sql);\n if ($res == null)\n return 0;\n $obj = mysqli_fetch_object($res);\n return $obj->c;\n }", " /**\n * Count Objects matching a given criteria using raw sql\n *\n * @param string $sql The sql query to be run\n * @return int|void\n */\n function queryRows($sql) {\n $res = @mysqli_query($this->connection, $sql);\n return empty($res) ? 0 : mysqli_num_rows($res);\n }", " /**\n * Select a single object.\n *\n * Selects an objects from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a single record from a database table. Returns the\n * first record/object found (in the case of multiple-result queries,\n * there is no way to determine which of the set will be returned).\n * If no record(s) match the query, null is returned.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set.\n * @return object/null|void\n */\n function selectObject($table, $where) {\n $where = $this->injectProof($where);\n $res = mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where LIMIT 0,1\");\n if ($res == null)\n return null;\n return mysqli_fetch_object($res);\n }", "\t/**\n\t * @param $table\n\t * @param string $lockType\n\t * @return mixed\n\t */\n\tfunction lockTable($table,$lockType=\"WRITE\") {\n $sql = \"LOCK TABLES `\" . $this->prefix . \"$table` $lockType\";", " \n $res = mysqli_query($this->connection, $sql); ", " return $res;\n }", "\t/**\n\t * @return mixed\n\t */\n\tfunction unlockTables() {\n $sql = \"UNLOCK TABLES\";", " ", " $res = mysqli_query($this->connection, $sql);\n return $res;\n }", " ", "\t/**\n * Insert an Object into some table in the Database\n *\n * This method will return the ID assigned to the new record by MySQL. Note that\n * object attributes starting with an underscore ('_') will be ignored and NOT inserted\n * into the table as a field value.\n *\n * @param object $object The object to insert.\n * @param string $table The logical table name to insert into. This does not include the table prefix, which\n * is automagically prepended for you.\n * @return int|void\n */\n function insertObject($object, $table) {", " //if ($table==\"text\") eDebug($object,true); ", " $sql = \"INSERT INTO `\" . $this->prefix . \"$table` (\";\n $values = \") VALUES (\";\n foreach (get_object_vars($object) as $var => $val) {\n //We do not want to save any fields that start with an '_'\n if ($var{0} != '_') {\n $sql .= \"`$var`,\";\n if ($values != \") VALUES (\") {\n $values .= \",\";\n }\n $values .= \"'\" . $this->escapeString($val) . \"'\";\n }\n }\n $sql = substr($sql, 0, -1) . substr($values, 0) . \")\";\n //if($table=='text')eDebug($sql,true);\n if (@mysqli_query($this->connection, $sql) != false) {\n $id = mysqli_insert_id($this->connection);\n return $id;\n } else\n return 0;\n }", " /**\n * Delete one or more objects from the given table.\n *\n * @param string $table The name of the table to delete from.\n * @param string $where Criteria for determining which record(s) to delete.\n * @return mixed\n */\n function delete($table, $where = null) {\n if ($where != null) {\n $res = @mysqli_query($this->connection, \"DELETE FROM `\" . $this->prefix . \"$table` WHERE $where\");\n return $res;\n } else {\n $res = @mysqli_query($this->connection, \"TRUNCATE TABLE `\" . $this->prefix . \"$table`\");\n return $res;\n }\n }", " /**\n * Update one or more objects in the database.\n *\n * This function will only update the attributes of the resulting record(s)\n * that are also member attributes of the $object object.\n *\n * @param object $object An object specifying the fields and values for updating.\n * In most cases, this will be the altered object originally returned from one of\n * the select* methods.\n * @param string $table The table to update in.\n * @param string $where Optional criteria used to narrow the result set.\n * @param string $identifier\n * @param bool $is_revisioned\n * @return bool|int|void\n */\n function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false) {", " if ($is_revisioned) {\n $object->revision_id++;\n //if ($table==\"text\") eDebug($object);\n $res = $this->insertObject($object, $table);", " //if ($table==\"text\") eDebug($object,true); ", " $this->trim_revisions($table, $object->$identifier, WORKFLOW_REVISION_LIMIT);\n return $res;\n }\n $sql = \"UPDATE \" . $this->prefix . \"$table SET \";\n foreach (get_object_vars($object) as $var => $val) {\n //We do not want to save any fields that start with an '_'\n //if($is_revisioned && $var=='revision_id') $val++;\n if ($var{0} != '_') {\n if (is_array($val) || is_object($val)) {", " $val = serialize($val); ", " $sql .= \"`$var`='\".$val.\"',\";\n } else {\n $sql .= \"`$var`='\" . $this->escapeString($val) . \"',\";\n }\n }\n }\n $sql = substr($sql, 0, -1) . \" WHERE \";\n if ($where != null)\n $sql .= $this->injectProof($where);\n else\n $sql .= \"`\" . $identifier . \"`=\" . $object->$identifier;", " //if ($table == 'text') eDebug($sql,true); ", " $res = (@mysqli_query($this->connection, $sql) != false);\n return $res;\n }", "\t/**\n\t * Find the maximum value of a field. This is similar to a standard\n\t * SELECT MAX(field) ... query.\n\t *\n\t * @param string $table The name of the table to select from.\n\t * @param string $attribute The attribute name to find a maximum value for.\n\t * @param string $groupfields A comma-separated list of fields (or a single field) name, used\n\t * for a GROUP BY clause. This can also be passed as an array of fields.\n\t * @param string $where Optional criteria for narrowing the result set.\n\t * @return mixed\n\t */\n function max($table, $attribute, $groupfields = null, $where = null) {\n if (is_array($groupfields))\n $groupfields = implode(\",\", $groupfields);\n $sql = \"SELECT MAX($attribute) as fieldmax FROM `\" . $this->prefix . \"$table`\";\n if ($where != null)\n $sql .= \" WHERE $where\";\n if ($groupfields != null)\n $sql .= \" GROUP BY $groupfields\";", " $res = @mysqli_query($this->connection, $sql);", " if ($res != null)\n $res = mysqli_fetch_object($res);\n if (!$res)\n return null;\n return $res->fieldmax;\n }", "\t/**\n\t * Find the minimum value of a field. This is similar to a standard\n\t * SELECT MIN(field) ... query.\n\t *\n\t * @internal Internal\n\t * @param string $table The name of the table to select from.\n\t * @param string $attribute The attribute name to find a minimum value for.\n\t * @param string $groupfields A comma-separated list of fields (or a single field) name, used\n\t * for a GROUP BY clause. This can also be passed as an array of fields.\n\t * @param string $where Optional criteria for narrowing the result set.\n\t * @return null\n\t */\n function min($table, $attribute, $groupfields = null, $where = null) {\n if (is_array($groupfields))\n $groupfields = implode(\",\", $groupfields);\n $sql = \"SELECT MIN($attribute) as fieldmin FROM `\" . $this->prefix . \"$table`\";\n if ($where != null)\n $sql .= \" WHERE $where\";\n if ($groupfields != null)\n $sql .= \" GROUP BY $groupfields\";", " $res = @mysqli_query($this->connection, $sql);", " if ($res != null)\n $res = mysqli_fetch_object($res);\n if (!$res)\n return null;\n return $res->fieldmin;\n }", " /**\n * Increment a numeric table field in a table.\n *\n * @param string $table The name of the table to increment in.\n * @param string $field The field to increment.\n * @param integer $step The step value. Usually 1. This can be negative, to\n * decrement, but the decrement() method is preferred, for readability.\n * @param string $where Optional criteria to determine which records to update.\n * @return mixed\n */\n function increment($table, $field, $step, $where = null) {\n if ($where == null)\n $where = \"1\";\n $sql = \"UPDATE `\" . $this->prefix . \"$table` SET `$field`=`$field`+$step WHERE $where\";\n return @mysqli_query($this->connection, $sql);\n }", " /**\n * Check to see if the named table exists in the database.\n * Returns true if the table exists, and false if it doesn't.\n *\n * @param string $table Name of the table to look for.\n * @return bool\n */\n function tableExists($table) {\n $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` LIMIT 0,1\");\n return ($res != null);\n }", " /**\n * Get a list of all tables in the database. Optionally, only the tables\n * in the current logical database (tables with the same prefix) can\n * be retrieved.\n *\n * @param bool $prefixed_only Whether to return only the tables\n * for the logical database, or all tables in the physical database.\n * @return array\n */\n function getTables($prefixed_only=true) {\n $res = @mysqli_query($this->connection, \"SHOW TABLES\");\n $tables = array();\n for ($i = 0; $res && $i < mysqli_num_rows($res); $i++) {\n $tmp = mysqli_fetch_array($res);\n if ($prefixed_only && substr($tmp[0], 0, strlen($this->prefix)) == $this->prefix) {\n $tables[] = $tmp[0];\n } else if (!$prefixed_only) {\n $tables[] = $tmp[0];\n }\n }\n return $tables;\n }", " /**\n * Runs whatever table optimization routines the database engine supports.\n *\n * @param string $table The name of the table to optimize.\n * @return bool\n */\n function optimize($table) {\n $res = (@mysqli_query($this->connection, \"OPTIMIZE TABLE `\" . $this->prefix . \"$table`\") != false);\n return $res;\n }", " /**\n * Retrieve table information for a named table.\n * Returns an object, with the following attributes:\n * <ul>\n * <li><b>rows</b> -- The number of rows in the table.</li>\n * <li><b>average_row_length</b> -- The average storage size of a row in the table.</li>\n * <li><b>data_total</b> -- How much total disk space is used by the table.</li>\n * <li><b>data_overhead</b> -- How much storage space in the table is unused (for compacting purposes)</li>\n * </ul>\n * @param $table\n * @return null\n */\n function tableInfo($table) {\n $sql = \"SHOW TABLE STATUS LIKE '\" . $this->prefix . \"$table'\";\n $res = @mysqli_query($this->connection, $sql);\n if (!$res)\n return null;\n return $this->translateTableStatus(mysqli_fetch_object($res));\n }", " /**\n * Returns table information for all tables in the database.\n * This function effectively calls tableInfo() on each table found.\n * @return array\n */\n function databaseInfo() {\n// $sql = \"SHOW TABLE STATUS\";\n $res = @mysqli_query($this->connection, \"SHOW TABLE STATUS LIKE '\" . $this->prefix . \"%'\");\n $info = array();\n for ($i = 0; $res && $i < mysqli_num_rows($res); $i++) {\n $obj = mysqli_fetch_object($res);\n $info[substr($obj->Name, strlen($this->prefix))] = $this->translateTableStatus($obj);\n }\n return $info;\n }", "\t/**\n\t * @param $table\n\t * @return array\n\t */\n function describeTable($table) {\n if (!$this->tableExists($table))\n return array();\n $res = @mysqli_query($this->connection, \"DESCRIBE `\" . $this->prefix . \"$table`\");\n $dd = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $fieldObj = mysqli_fetch_object($res);", " $fieldObj->ExpFieldType = $this->getDDFieldType($fieldObj);\n if ($fieldObj->ExpFieldType == DB_DEF_STRING) {\n $fieldObj->ExpFieldLength = $this->getDDStringLen($fieldObj);\n }", " $dd[$fieldObj->Field] = $fieldObj;\n }", " return $dd;\n }", " /**\n * Build a data definition from a pre-existing table. This is used\n * to intelligently alter tables that have already been installed.\n *\n * @param string $table The name of the table to get a data definition for.\n * @return array|null\n */\n function getDataDefinition($table) {\n // make sure the table exists\n if (!$this->tableExists($table))\n return array();", " // check if we have a cached version of this table description.\n if (expSession::issetTableCache($table))\n return expSession::getTableCache($table);", " $res = @mysqli_query($this->connection, \"DESCRIBE `\" . $this->prefix . \"$table`\");\n $dd = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $fieldObj = mysqli_fetch_object($res);", " $field = array();\n $field[DB_FIELD_TYPE] = $this->getDDFieldType($fieldObj);\n if ($field[DB_FIELD_TYPE] == DB_DEF_STRING) {\n $field[DB_FIELD_LEN] = $this->getDDStringLen($fieldObj);\n }\n //additional field attributes\n $default = $this->getDDDefault($fieldObj);\n if ($default != null)\n $field[DB_DEFAULT] = $default;\n $field[DB_INCREMENT] = $this->getDDAutoIncrement($fieldObj);\n $key = $this->getDDKey($fieldObj);\n if ($key)\n $field[$key] = true;", " $dd[$fieldObj->Field] = $field;\n }", " // save this table description to cache so we don't need to go the DB next time.\n expSession::setTableCache($table, $dd);\n return $dd;\n }", " /**\n * Returns an error message from the database server. This is intended to be\n * used by the implementers of the database wrapper, so that certain\n * cryptic error messages can be reworded.\n * @return string\n */\n function error() {\n if ($this->connection && mysqli_errno($this->connection) != 0) {\n $errno = mysqli_errno($this->connection);\n switch ($errno) {\n case 1046:\n return \"1046 : \".gt(\"Selected database does not exist\");\n default:\n return mysqli_errno($this->connection) . \" : \" . mysqli_error($this->connection);\n }\n } else if ($this->connection == false) {\n return gt(\"Unable to connect to database server\");\n } else\n return \"\";\n }", " /**\n * Checks whether the database connection has experienced an error.\n * @return bool\n */\n function inError() {\n return ($this->connection != null && mysqli_errno($this->connection) != 0);\n }", "\t/**", "\t * Unescape a string based on the database connection", "\t * @param $string\n\t * @return string\n\t */\n\tfunction escapeString($string) {\n\t return (mysqli_real_escape_string($this->connection, $string));\n\t}", " /**\n * Select an array of arrays\n *\n * Selects a set of arrays from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of arrays, in any random order.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param string $orderby\n * @return array\n */\n function selectArrays($table, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;", " $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $arrays = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $arrays[] = mysqli_fetch_assoc($res);\n return $arrays;\n }", " /**\n * Select an array of arrays\n *\n * Selects a set of arrays from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of arrays, in any random order.\n *\n * @param string $sql The name of the table/object to look at\n * @return array\n */", " function selectArraysBySql($sql) { ", " $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return array();\n $arrays = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $arrays[] = mysqli_fetch_assoc($res);\n return $arrays;\n }", " /**\n * Select a record from the database as an array\n * Selects a set of arrays from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of arrays, in any random order.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param null $orderby\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return array|void\n */\n function selectArray($table, $where = null, $orderby = null, $is_revisioned=false, $needs_approval=false) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n $as = '';\n if ($is_revisioned) {\n // $where.= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE $where)\";\n $where .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE id = rev.id \";\n if ($needs_approval) $where .= ' AND (approved=1 OR poster=' . $needs_approval . ' OR editor=' . $needs_approval . ')';\n $where .= \")\";\n $as = ' AS rev';\n }\n $orderby = empty($orderby) ? '' : \"ORDER BY \" . $orderby;\n $sql = \"SELECT * FROM `\" . $this->prefix . \"$table`\" . $as . \" WHERE $where $orderby LIMIT 0,1\";\n $res = @mysqli_query($this->connection, $sql);\n if ($res == null)\n return array();\n return mysqli_fetch_assoc($res);\n }", " /**\n * Instantiate objects from selected records from the database\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param string $classname\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n * @param null $order\n * @param null $limitsql\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return array\n */\n function selectExpObjects($table, $where=null, $classname, $get_assoc=true, $get_attached=true, $except=array(), $cascade_except=false, $order=null, $limitsql=null, $is_revisioned=false, $needs_approval=false) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n $as = '';\n if ($is_revisioned) {\n // $where.= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE $where)\";\n $where .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE id = rev.id \";\n if ($needs_approval) $where .= ' AND (approved=1 OR poster=' . $needs_approval . ' OR editor=' . $needs_approval . ')';\n $where .= \")\";\n $as = ' AS rev';\n }\n $sql = \"SELECT * FROM `\" . $this->prefix . \"$table`\" . $as . \" WHERE $where\";\n $sql .= empty($order) ? '' : ' ORDER BY ' . $order;\n $sql .= empty($limitsql) ? '' : $limitsql;\n $res = @mysqli_query($this->connection, $sql);\n if ($res == null)\n return array();\n $arrays = array();\n $numrows = mysqli_num_rows($res);\n for ($i = 0; $i < $numrows; $i++) { //FIXME this can run us out of memory with too many rows\n $assArr = mysqli_fetch_assoc($res);\n $assArr['except'] = $except;\n if($cascade_except) $assArr['cascade_except'] = $cascade_except;\n $arrays[] = new $classname($assArr, $get_assoc, $get_attached);\n }\n return $arrays;\n }", " /**\n * Instantiate objects from selected records from the database", " * @param string $sql The sql statement to run on the model/classname\n * @param string $classname Can be $this->baseclassname\n * Returns an array of fields\n * @param bool $get_assoc\n * @param bool $get_attached\n * @return array\n */\n function selectExpObjectsBySql($sql, $classname, $get_assoc=true, $get_attached=true) {\n $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return array();\n $arrays = array();\n $numrows = mysqli_num_rows($res);\n for ($i = 0; $i < $numrows; $i++)\n $arrays[] = new $classname(mysqli_fetch_assoc($res), true, true);\n return $arrays;\n }", "\t/**\n\t * This function returns all the text columns in the given table\n\t * @param $table\n\t * @return array\n\t */\n\tfunction getTextColumns($table) {\n\t\t$sql = \"SHOW COLUMNS FROM \" . $this->prefix.$table . \" WHERE type = 'text' OR type like 'varchar%'\";\n\t\t$res = @mysqli_query($this->connection, $sql);\n\t\tif ($res == null)\n return array();\n\t\t$records = array();\n\t\twhile($row = mysqli_fetch_object($res)) {\n\t\t\t$records[] = $row->Field;\n\t\t}", "\t\t", "\t\treturn $records;\n\t}", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class mysqli_database\n *\n * This is the MySQLi-specific implementation of the database class.\n * @package Subsystems\n * @subpackage Database\n */\n/** @define \"BASE\" \"../..\" */", "class mysqli_database extends database {", " /**\n * Make a connection to the Database Server\n *\n * Takes the supplied credentials (username / password) and tries to\n * connect to the server and select the given database. All the rules\n * governing mysqli_connect also govern this method.\n *\n * @param string $username The username to connect to the server as.\n * @param string $password The password for $username\n * @param string $hostname The hostname of the database server. If\n * localhost is specified, a local socket connection will be attempted.\n * @param string $database The name of the database to use. Multi-database\n * sites are still not yet supported.\n * @param bool $new Whether or not to force the PHP connection function to establish\n * a distinctly new connection handle to the server.\n */", "\tfunction __construct($username, $password, $hostname, $database, $new=false) {\n\t\tif (strstr($hostname,':')) {\n\t\t\tlist ( $host, $port ) = @explode (\":\", $hostname);\n\t\t} else {\n $host = $hostname;\n }\n\t\tif ($this->connection = @mysqli_connect($host, $username, $password, $database, $port)) {\n\t\t\t$this->havedb = true;\n\t\t}\n\t\t//fix to support utf8, warning it only works from a certain mySQL version on\n\t\t//needed on mySQL servers that don't have the default connection encoding setting to utf8", "\t\t//As we do not have any setting for ISAM or InnoDB tables yet, i set the minimum specs\n\t\t// for using this feature to 4.1.2, although isam tables got the support for utf8 already in 4.1\n\t\t//anything else would result in an inconsistent user experience\n\t\t//TODO: determine how to handle encoding on postgres", "\t\tlist($major, $minor, $micro) = sscanf(@mysqli_get_server_info($this->connection), \"%d.%d.%d-%s\");\n\t\tif(defined('DB_ENCODING')) {\n\t\t\t//SET NAMES is possible since version 4.1\n\t\t\tif(($major > 4) OR (($major == 4) AND ($minor >= 1))) {\n\t\t\t\t@mysqli_query($this->connection, \"SET NAMES \" . DB_ENCODING);\n\t\t\t}\n\t\t}", "\t\t$this->prefix = DB_TABLE_PREFIX . '_';\n\t}", " /**\n * Create a new Table\n *\n * Creates a new database table, according to the passed data definition.\n *\n * This function abides by the Exponent Data Definition Language, and interprets\n * its general structure for MySQL.\n *\n * @param string $tablename The name of the table to create\n * @param array $datadef The data definition to create, expressed in\n * the Exponent Data Definition Language.\n * @param array $info Information about the table itself.\n * @return array\n\t */\n\tfunction createTable($tablename, $datadef, $info) {\n\t\tif (!is_array($info))\n $info = array(); // Initialize for later use.", "\t\t$sql = \"CREATE TABLE `\" . $this->prefix . \"$tablename` (\";\n\t\t$primary = array();\n\t\t$fulltext = array();\n\t\t$unique = array();\n\t\t$index = array();\n\t\tforeach ($datadef as $name=>$def) {\n\t\t\tif ($def != null) {\n\t\t\t\t$sql .= $this->fieldSQL($name,$def) . \",\";\n\t\t\t\tif (!empty($def[DB_PRIMARY])) $primary[] = $name;\n\t\t\t\tif (!empty($def[DB_FULLTEXT])) $fulltext[] = $name;\n\t\t\t\tif (isset($def[DB_INDEX]) && ($def[DB_INDEX] > 0)) {\n\t\t\t\t\tif ($def[DB_FIELD_TYPE] == DB_DEF_STRING) {\n\t\t\t\t\t\t$index[$name] = $def[DB_INDEX];\n } else {\n $index[$name] = 0;\n }\n }\n if (isset($def[DB_UNIQUE])) {\n if (!isset($unique[$def[DB_UNIQUE]]))\n $unique[$def[DB_UNIQUE]] = array();\n $unique[$def[DB_UNIQUE]][] = $name;\n }\n }\n }\n $sql = substr($sql, 0, -1);\n if (count($primary)) {\n $sql .= \", PRIMARY KEY ( `\" . implode(\"` , `\", $primary) . \"`)\";\n }\n if (count($fulltext)) {\n// $sql .= \", FULLTEXT ( `\" . implode(\"` , `\", $fulltext) . \"`)\";\n $sql .= \", FULLTEXT `\" . $fulltext[0] . \"`\" . \"( `\" . implode(\"` , `\", $fulltext) . \"`)\";\n }\n if (!empty($unique)) foreach ($unique as $key => $value) {\n $sql .= \", UNIQUE `\" . $key . \"` ( `\" . implode(\"` , `\", $value) . \"`)\";\n }\n foreach ($index as $key => $value) {\n $sql .= \", INDEX (`\" . $key . \"`\" . (($value > 0) ? \"(\" . $value . \")\" : \"\") . \")\";\n }\n $sql .= \")\";\n if (defined(DB_ENCODING)) {\n $sql .= \" ENGINE = MYISAM CHARACTER SET \" . DB_ENCODING;\n } else {\n $sql .= \" ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci\";\n }", " if (isset($info[DB_TABLE_COMMENT])) {\n $sql .= \" COMMENT = '\" . $info[DB_TABLE_COMMENT] . \"'\";\n }", " @mysqli_query($this->connection, $sql);", " $return = array(\n $tablename => ($this->tableExists($tablename) ? DATABASE_TABLE_INSTALLED : DATABASE_TABLE_FAILED)\n );", " return $return;\n }", " /**\n * Alter an existing table\n *\n * Alters the structure of an existing database table to conform to the passed\n * data definition.\n *\n * This function abides by the Exponent Data Definition Language, and interprets\n * its general structure for MySQL.\n *\n * @param string $tablename The name of the table to alter\n * @param array $newdatadef The new data definition for the table.\n * This is expressed in the Exponent Data Definition Language\n * @param array $info Information about the table itself.\n * @param bool $aggressive Whether or not to aggressively update the table definition.\n * An aggressive update will drop columns in the table that are not in the Exponent definition.\n * @return array\n */\n function alterTable($tablename, $newdatadef, $info, $aggressive = false) {\n expSession::clearAllUsersSessionCache();\n $dd = $this->getDataDefinition($tablename);\n $modified = false;", " // collect any indexes & keys to the table\n $primary = array();\n $fulltext = array();\n $unique = array();\n $index = array();\n foreach ($newdatadef as $name=>$def) {\n if ($def != null) {\n if (!empty($def[DB_PRIMARY])) $primary[] = $name;\n if (!empty($def[DB_FULLTEXT])) $fulltext[] = $name;\n if (isset($def[DB_INDEX]) && ($def[DB_INDEX] > 0)) {\n if ($def[DB_FIELD_TYPE] == DB_DEF_STRING) {\n $index[$name] = $def[DB_INDEX];\n } else {\n $index[$name] = 0;\n }\n }\n if (isset($def[DB_UNIQUE])) {\n if (!isset($unique[$def[DB_UNIQUE]]))\n $unique[$def[DB_UNIQUE]] = array();\n $unique[$def[DB_UNIQUE]][] = $name;\n }\n }\n }", " //Drop any old columns from the table if aggressive mode is set.\n if ($aggressive) {\n //update primary keys to 'release' columns\n $sql = \"ALTER IGNORE TABLE `\" . $this->prefix . \"$tablename` \";\n if (count($primary)) {\n $sql .= \" DROP PRIMARY KEY, ADD PRIMARY KEY ( `\" . implode(\"` , `\",$primary) . \"` )\";\n }\n @mysqli_query($this->connection, $sql);", " if (is_array($newdatadef) && is_array($dd)) {\n $oldcols = @array_diff_assoc($dd, $newdatadef);\n if (count($oldcols)) {\n $modified = true;\n $sql = \"ALTER TABLE `\" . $this->prefix . \"$tablename` \";\n foreach ($oldcols as $name => $def) {\n $sql .= \" DROP COLUMN \" . $name . \",\";\n }\n $sql = substr($sql, 0, -1);\n @mysqli_query($this->connection, $sql);\n }\n }\n }", " //Add any new columns to the table\n if (is_array($newdatadef) && is_array($dd)) {\n $diff = @array_diff_assoc($newdatadef, $dd);\n if (count($diff)) {\n $modified = true;\n $sql = \"ALTER TABLE `\" . $this->prefix . \"$tablename` \";\n foreach ($diff as $name => $def) {\n $sql .= \" ADD COLUMN (\" . $this->fieldSQL($name, $def) . \"),\";\n }\n $sql = substr($sql, 0, -1);\n @mysqli_query($this->connection, $sql);\n }", " // alter any existing columns here\n $diff_c = @expCore::array_diff_assoc_recursive($newdatadef, $dd);\n $sql = \"ALTER TABLE `\" . $this->prefix . \"$tablename` \";\n $changed = false;\n if (is_array($diff_c)) {\n foreach ($diff_c as $name => $def) {\n if (!array_key_exists($name, $diff) && (isset($def[DB_FIELD_TYPE]) || isset($def[DB_FIELD_LEN]) || isset($def[DB_DEFAULT]) || isset($def[DB_INCREMENT]))) { // wasn't a new column\n if ($dd[$name][DB_FIELD_TYPE] == DB_DEF_STRING) {\n //check for actual lengths vs. exp placeholder lengths\n $newlen = $newdatadef[$name][DB_FIELD_LEN];\n $len = $dd[$name][DB_FIELD_LEN];\n if ($len >= 16777216 && $newlen >= 16777216) {\n continue;\n }\n if ($len >= 65536 && $newlen >= 65536) {\n continue;\n }\n if ($len >= 256 && $newlen >= 256) {\n continue;\n }\n }\n $changed = true;\n $sql .= ' MODIFY ' . $this->fieldSQL($name,$newdatadef[$name]) . \",\";\n }\n }\n }\n if ($changed) {\n $modified = true;\n $sql = substr($sql, 0, -1);\n @mysqli_query($this->connection, $sql);\n }\n }", " //Add any new indexes & keys to the table\n $sql = \"ALTER\" . (empty($aggressive) ? \"\" : \" IGNORE\") . \" TABLE `\" . $this->prefix . \"$tablename` \";", " $sep = false;\n if (count($primary)) {\n $sql .= \" DROP PRIMARY KEY, ADD PRIMARY KEY ( `\" . implode(\"` , `\",$primary) . \"` )\";\n $sep = true;\n }\n if (count($fulltext)) {\n if ($sep) $sql .= ' ,';\n// $sql .= \" ADD FULLTEXT ( `\" . implode(\"` , `\", $fulltext) . \"`)\";\n // drop the index first so we don't get dupes\n $drop = \"DROP INDEX \" . $fulltext[0] . \" ON \" . $this->prefix . $tablename;\n @mysqli_query($this->connection, $drop);\n $sql .= \" ADD FULLTEXT `\" . $fulltext[0] . \"`\" . \"( `\" . implode(\"` , `\", $fulltext) . \"`)\";\n $sep = true;\n }\n if (!empty($unique)) foreach ($unique as $key=>$value) {\n if ($sep) $sql .= ' ,';\n $sql .= \", ADD UNIQUE `\".$key.\"` ( `\" . implode(\"` , `\",$value) . \" `)\";\n $sep = true;\n }", " foreach ($index as $key => $value) {\n // drop the index first so we don't get dupes\n $drop = \"DROP INDEX \" . $key . \" ON \" . $this->prefix . $tablename;\n @mysqli_query($this->connection, $drop);", " // re-add the index\n if ($sep) $sql .= ' ,';\n// $sql .= \" ADD INDEX (`\" . $key . \"`)\"; //FIXME we don't add column length??\n $sql .= \" ADD INDEX (`\" . $key . \"`\" . (($value > 0) ? \"(\" . $value . \")\" : \"\") . \")\";\n $sep = true;\n }\n @mysqli_query($this->connection, $sql);", " //Get the return code\n $return = array(\n $tablename => ($modified ? TABLE_ALTER_SUCCEEDED : TABLE_ALTER_NOT_NEEDED)\n );", " return $return;\n }", " /**\n * Drop a table from the database\n *\n * Removes an existing table from the database. Returns true if the table was dropped, false if there\n * was an error returned by the MySQL server.\n *\n * @param string $table The name of the table to drop.\n * @return bool\n */\n function dropTable($table) {\n return @mysqli_query($this->connection, \"DROP TABLE `\" . $this->prefix . \"$table`\") !== false;\n }", " /**\n * Run raw SQL. Returns true if the query succeeded, and false\n * if an error was returned from the MySQL server.\n *\n * <div style=\"color:red\">If you can help it, do not use this function. It presents Database Portability Issues.</div>\n *\n * Runs a straight SQL query on the database. This is not a\n * very portable way of dealing with the database, and is only\n * provided as a last resort.\n *\n * @param string $sql The SQL query to run\n\t * @param bool $escape Indicates if the query will be escape\n * @return mixed\n */\n function sql($sql, $escape = true) {\n\t\tif($escape == true) {\n\t\t\t$res = @mysqli_query($this->connection, mysqli_real_escape_string($this->connection, $sql));\n\t\t} else {\n\t\t\t$res = @mysqli_query($this->connection, $sql);\n\t\t}\n return $res;\n }", "\t/**\n\t * Update a column in all records in a table\n\t *\n\t * @param $table\n\t * @param $col\n\t * @param $val\n\t * @param int|null $where\n\t * @return void\n\t */", " function columnUpdate($table, $col, $val, $where=1) {", " $res = @mysqli_query($this->connection, \"UPDATE `\" . $this->prefix . \"$table` SET `$col`='\" . $val . \"' WHERE $where\");\n /*if ($res == null)\n return array();\n $objects = array();\n for ($i = 0; $i < mysqli_num_rows($res); $i++)\n $objects[] = mysqli_fetch_object($res);*/\n //return $objects;\n }", " /**\n * Select a series of objects\n *\n * Selects a set of objects from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of objects, in any random order.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param null $orderby\n * @return array\n */\n function selectObjects($table, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;", " $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }", "\t/**\n\t * @param $terms\n\t * @param null $where\n\t * @return array\n\t */\n function selectSearch($terms, $where = null) {\n if ($where == null)\n $where = \"1\";", " $sql = \"SELECT *, MATCH (s.title, s.body) AGAINST ('\" . $terms . \"*') as score from \" . $this->prefix . \"search as s \";\n $sql .= \"WHERE MATCH (title, body) against ('\" . $terms . \"*' IN BOOLEAN MODE) ORDER BY score DESC\";\n $res = @mysqli_query($this->connection, $sql);\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }", "\t/**\n\t * @param null $colsA\n\t * @param null $colsB\n\t * @param $tableA\n\t * @param $tableB\n\t * @param $keyA\n\t * @param null $keyB\n\t * @param null $where\n\t * @param null $orderby\n\t * @return array'\n\t */\n function selectAndJoinObjects($colsA=null, $colsB=null, $tableA, $tableB, $keyA, $keyB=null, $where = null, $orderby = null) {\n $sql = 'SELECT ';\n if ($colsA != null) {\n if (!is_array($colsA)) {\n $sql .= 'a.' . $colsA . ', ';\n } else {\n foreach ($colsA as $colA) {\n $sql .= 'a.' . $colA . ', ';\n }\n }\n } else {\n $sql .= ' a.*, ';\n }", " if ($colsB != null) {\n if (!is_array($colsB)) {\n $sql .= 'b.' . $colsB . ' ';\n } else {\n $i = 1;\n foreach ($colsB as $colB) {\n $sql .= 'b.' . $colB;\n if ($i < count($colsB))\n $sql .= ', ';\n $i++;\n }\n }\n } else {\n $sql .= ' b.* ';\n }", " $sql .= ' FROM ' . $this->prefix . $tableA . ' a JOIN ' . $this->prefix . $tableB . ' b ';\n $sql .= is_null($keyB) ? 'USING(' . $keyA . ')' : 'ON a.' . $keyA . ' = b.' . $keyB;", " if ($where == null)\n $where = \"1\";\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;", " $res = @mysqli_query($this->connection, $sql . \" WHERE $where $orderby\");\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }", "\t/**\n * Select a single object by sql\n *\n\t * @param $sql\n\t * @return null|void\n\t */\n function selectObjectBySql($sql) {\n //$logFile = \"C:\\\\xampp\\\\htdocs\\\\supserg\\\\tmp\\\\queryLog.txt\";\n //$lfh = fopen($logFile, 'a');", " //fwrite($lfh, $sql . \"\\n\");\n //fclose($lfh);", " $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return null;\n return mysqli_fetch_object($res);\n }", "\t/**\n * Select a series of objects by sql\n *\n\t * @param $sql\n\t * @return array\n\t */\n function selectObjectsBySql($sql) {\n $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }", "\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @param null $orderby\n\t * @param bool $distinct\n\t * @return array\n\t */\n function selectColumn($table, $col, $where = null, $orderby = null, $distinct=false) {\n if ($where == null)\n $where = \"1\";\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;\n $dist = empty($distinct) ? '' : 'DISTINCT ';", " $res = @mysqli_query($this->connection, \"SELECT \" . $dist . $col . \" FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $resarray = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $row = mysqli_fetch_array($res, MYSQLI_NUM);\n $resarray[$i] = $row[0];\n }\n return $resarray;\n }", "\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return int\n\t */\n function selectSum($table, $col, $where = null) {\n if ($where == null)\n $where = \"1\";", " $res = @mysqli_query($this->connection, \"SELECT SUM(\" . $col . \") FROM `\" . $this->prefix . \"$table` WHERE $where\");\n if ($res == null)\n return 0;\n $resarray = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $row = mysqli_fetch_array($res, MYSQLI_NUM);\n $resarray[$i] = $row[0];\n }\n return $resarray[0];\n }", "\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @param null $orderby\n\t * @return array\n\t */\n function selectDropdown($table, $col, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;", " $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $resarray = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $row = mysqli_fetch_object($res);\n $resarray[$row->id] = $row->$col;\n }\n return $resarray;\n }", "\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return null\n\t */\n function selectValue($table, $col, $where=null) {\n if ($where == null)\n $where = \"1\";\n $sql = \"SELECT \" . $col . \" FROM `\" . $this->prefix . \"$table` WHERE $where LIMIT 0,1\";\n $res = @mysqli_query($this->connection, $sql);", " if ($res == null)\n return null;\n $obj = mysqli_fetch_object($res);\n if (is_object($obj)) {\n return $obj->$col;\n } else {\n return null;\n }\n }", "\t/**\n\t * @param $sql\n\t * @return null\n\t */\n function selectValueBySql($sql) {\n $res = $this->sql($sql);\n if ($res == null)\n return null;\n $r = mysqli_fetch_row($res);\n if (is_array($r)) {\n return $r[0];\n } else {\n return null;\n }\n }", " /**\n * Select a series of objects, and return by ID\n *\n * Selects a set of objects from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of objects, in any random order. The indices of the array\n * are the IDs of the objects.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param null $orderby\n * @return array\n */\n function selectObjectsIndexedArray($table, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;\n $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");", " if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $o = mysqli_fetch_object($res);\n $objects[$o->id] = $o;\n }\n return $objects;\n }", " /**\n * Count Objects matching a given criteria\n *\n * @param string $table The name of the table to count objects in.\n * @param string $where Criteria for counting.\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return int\n */\n function countObjects($table, $where = null, $is_revisioned=false, $needs_approval=false) {\n if ($where == null)\n $where = \"1\";\n $as = '';\n if ($is_revisioned) {\n // $where.= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE $where)\";\n $where .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE id = rev.id \";\n if ($needs_approval) $where .= ' AND (approved=1 OR poster=' . $needs_approval . ' OR editor=' . $needs_approval . ')';\n $where .= \")\";\n $as = ' AS rev';\n }\n $res = @mysqli_query($this->connection, \"SELECT COUNT(*) as c FROM `\" . $this->prefix . \"$table`\" . $as . \" WHERE $where\");\n if ($res == null)\n return 0;\n $obj = mysqli_fetch_object($res);\n return $obj->c;\n }", " /**\n * Count Objects matching a given criteria using raw sql\n *\n * @param string $sql The sql query to be run\n * @return int\n */\n function countObjectsBySql($sql) {\n $res = @mysqli_query($this->connection, $sql);\n if ($res == null)\n return 0;\n $obj = mysqli_fetch_object($res);\n return $obj->c;\n }", " /**\n * Count Objects matching a given criteria using raw sql\n *\n * @param string $sql The sql query to be run\n * @return int|void\n */\n function queryRows($sql) {\n $res = @mysqli_query($this->connection, $sql);\n return empty($res) ? 0 : mysqli_num_rows($res);\n }", " /**\n * Select a single object.\n *\n * Selects an objects from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a single record from a database table. Returns the\n * first record/object found (in the case of multiple-result queries,\n * there is no way to determine which of the set will be returned).\n * If no record(s) match the query, null is returned.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set.\n * @return object/null|void\n */\n function selectObject($table, $where) {\n $where = $this->injectProof($where);\n $res = mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where LIMIT 0,1\");\n if ($res == null)\n return null;\n return mysqli_fetch_object($res);\n }", "\t/**\n\t * @param $table\n\t * @param string $lockType\n\t * @return mixed\n\t */\n\tfunction lockTable($table,$lockType=\"WRITE\") {\n $sql = \"LOCK TABLES `\" . $this->prefix . \"$table` $lockType\";", "\n $res = mysqli_query($this->connection, $sql);", " return $res;\n }", "\t/**\n\t * @return mixed\n\t */\n\tfunction unlockTables() {\n $sql = \"UNLOCK TABLES\";", "", " $res = mysqli_query($this->connection, $sql);\n return $res;\n }", "", "\t/**\n * Insert an Object into some table in the Database\n *\n * This method will return the ID assigned to the new record by MySQL. Note that\n * object attributes starting with an underscore ('_') will be ignored and NOT inserted\n * into the table as a field value.\n *\n * @param object $object The object to insert.\n * @param string $table The logical table name to insert into. This does not include the table prefix, which\n * is automagically prepended for you.\n * @return int|void\n */\n function insertObject($object, $table) {", " //if ($table==\"text\") eDebug($object,true);", " $sql = \"INSERT INTO `\" . $this->prefix . \"$table` (\";\n $values = \") VALUES (\";\n foreach (get_object_vars($object) as $var => $val) {\n //We do not want to save any fields that start with an '_'\n if ($var{0} != '_') {\n $sql .= \"`$var`,\";\n if ($values != \") VALUES (\") {\n $values .= \",\";\n }\n $values .= \"'\" . $this->escapeString($val) . \"'\";\n }\n }\n $sql = substr($sql, 0, -1) . substr($values, 0) . \")\";\n //if($table=='text')eDebug($sql,true);\n if (@mysqli_query($this->connection, $sql) != false) {\n $id = mysqli_insert_id($this->connection);\n return $id;\n } else\n return 0;\n }", " /**\n * Delete one or more objects from the given table.\n *\n * @param string $table The name of the table to delete from.\n * @param string $where Criteria for determining which record(s) to delete.\n * @return mixed\n */\n function delete($table, $where = null) {\n if ($where != null) {\n $res = @mysqli_query($this->connection, \"DELETE FROM `\" . $this->prefix . \"$table` WHERE $where\");\n return $res;\n } else {\n $res = @mysqli_query($this->connection, \"TRUNCATE TABLE `\" . $this->prefix . \"$table`\");\n return $res;\n }\n }", " /**\n * Update one or more objects in the database.\n *\n * This function will only update the attributes of the resulting record(s)\n * that are also member attributes of the $object object.\n *\n * @param object $object An object specifying the fields and values for updating.\n * In most cases, this will be the altered object originally returned from one of\n * the select* methods.\n * @param string $table The table to update in.\n * @param string $where Optional criteria used to narrow the result set.\n * @param string $identifier\n * @param bool $is_revisioned\n * @return bool|int|void\n */\n function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false) {", " if ($is_revisioned) {\n $object->revision_id++;\n //if ($table==\"text\") eDebug($object);\n $res = $this->insertObject($object, $table);", " //if ($table==\"text\") eDebug($object,true);", " $this->trim_revisions($table, $object->$identifier, WORKFLOW_REVISION_LIMIT);\n return $res;\n }\n $sql = \"UPDATE \" . $this->prefix . \"$table SET \";\n foreach (get_object_vars($object) as $var => $val) {\n //We do not want to save any fields that start with an '_'\n //if($is_revisioned && $var=='revision_id') $val++;\n if ($var{0} != '_') {\n if (is_array($val) || is_object($val)) {", " $val = serialize($val);", " $sql .= \"`$var`='\".$val.\"',\";\n } else {\n $sql .= \"`$var`='\" . $this->escapeString($val) . \"',\";\n }\n }\n }\n $sql = substr($sql, 0, -1) . \" WHERE \";\n if ($where != null)\n $sql .= $this->injectProof($where);\n else\n $sql .= \"`\" . $identifier . \"`=\" . $object->$identifier;", " //if ($table == 'text') eDebug($sql,true);", " $res = (@mysqli_query($this->connection, $sql) != false);\n return $res;\n }", "\t/**\n\t * Find the maximum value of a field. This is similar to a standard\n\t * SELECT MAX(field) ... query.\n\t *\n\t * @param string $table The name of the table to select from.\n\t * @param string $attribute The attribute name to find a maximum value for.\n\t * @param string $groupfields A comma-separated list of fields (or a single field) name, used\n\t * for a GROUP BY clause. This can also be passed as an array of fields.\n\t * @param string $where Optional criteria for narrowing the result set.\n\t * @return mixed\n\t */\n function max($table, $attribute, $groupfields = null, $where = null) {\n if (is_array($groupfields))\n $groupfields = implode(\",\", $groupfields);\n $sql = \"SELECT MAX($attribute) as fieldmax FROM `\" . $this->prefix . \"$table`\";\n if ($where != null)\n $sql .= \" WHERE $where\";\n if ($groupfields != null)\n $sql .= \" GROUP BY $groupfields\";", " $res = @mysqli_query($this->connection, $sql);", " if ($res != null)\n $res = mysqli_fetch_object($res);\n if (!$res)\n return null;\n return $res->fieldmax;\n }", "\t/**\n\t * Find the minimum value of a field. This is similar to a standard\n\t * SELECT MIN(field) ... query.\n\t *\n\t * @internal Internal\n\t * @param string $table The name of the table to select from.\n\t * @param string $attribute The attribute name to find a minimum value for.\n\t * @param string $groupfields A comma-separated list of fields (or a single field) name, used\n\t * for a GROUP BY clause. This can also be passed as an array of fields.\n\t * @param string $where Optional criteria for narrowing the result set.\n\t * @return null\n\t */\n function min($table, $attribute, $groupfields = null, $where = null) {\n if (is_array($groupfields))\n $groupfields = implode(\",\", $groupfields);\n $sql = \"SELECT MIN($attribute) as fieldmin FROM `\" . $this->prefix . \"$table`\";\n if ($where != null)\n $sql .= \" WHERE $where\";\n if ($groupfields != null)\n $sql .= \" GROUP BY $groupfields\";", " $res = @mysqli_query($this->connection, $sql);", " if ($res != null)\n $res = mysqli_fetch_object($res);\n if (!$res)\n return null;\n return $res->fieldmin;\n }", " /**\n * Increment a numeric table field in a table.\n *\n * @param string $table The name of the table to increment in.\n * @param string $field The field to increment.\n * @param integer $step The step value. Usually 1. This can be negative, to\n * decrement, but the decrement() method is preferred, for readability.\n * @param string $where Optional criteria to determine which records to update.\n * @return mixed\n */\n function increment($table, $field, $step, $where = null) {\n if ($where == null)\n $where = \"1\";\n $sql = \"UPDATE `\" . $this->prefix . \"$table` SET `$field`=`$field`+$step WHERE $where\";\n return @mysqli_query($this->connection, $sql);\n }", " /**\n * Check to see if the named table exists in the database.\n * Returns true if the table exists, and false if it doesn't.\n *\n * @param string $table Name of the table to look for.\n * @return bool\n */\n function tableExists($table) {\n $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` LIMIT 0,1\");\n return ($res != null);\n }", " /**\n * Get a list of all tables in the database. Optionally, only the tables\n * in the current logical database (tables with the same prefix) can\n * be retrieved.\n *\n * @param bool $prefixed_only Whether to return only the tables\n * for the logical database, or all tables in the physical database.\n * @return array\n */\n function getTables($prefixed_only=true) {\n $res = @mysqli_query($this->connection, \"SHOW TABLES\");\n $tables = array();\n for ($i = 0; $res && $i < mysqli_num_rows($res); $i++) {\n $tmp = mysqli_fetch_array($res);\n if ($prefixed_only && substr($tmp[0], 0, strlen($this->prefix)) == $this->prefix) {\n $tables[] = $tmp[0];\n } else if (!$prefixed_only) {\n $tables[] = $tmp[0];\n }\n }\n return $tables;\n }", " /**\n * Runs whatever table optimization routines the database engine supports.\n *\n * @param string $table The name of the table to optimize.\n * @return bool\n */\n function optimize($table) {\n $res = (@mysqli_query($this->connection, \"OPTIMIZE TABLE `\" . $this->prefix . \"$table`\") != false);\n return $res;\n }", " /**\n * Retrieve table information for a named table.\n * Returns an object, with the following attributes:\n * <ul>\n * <li><b>rows</b> -- The number of rows in the table.</li>\n * <li><b>average_row_length</b> -- The average storage size of a row in the table.</li>\n * <li><b>data_total</b> -- How much total disk space is used by the table.</li>\n * <li><b>data_overhead</b> -- How much storage space in the table is unused (for compacting purposes)</li>\n * </ul>\n * @param $table\n * @return null\n */\n function tableInfo($table) {\n $sql = \"SHOW TABLE STATUS LIKE '\" . $this->prefix . \"$table'\";\n $res = @mysqli_query($this->connection, $sql);\n if (!$res)\n return null;\n return $this->translateTableStatus(mysqli_fetch_object($res));\n }", " /**\n * Returns table information for all tables in the database.\n * This function effectively calls tableInfo() on each table found.\n * @return array\n */\n function databaseInfo() {\n// $sql = \"SHOW TABLE STATUS\";\n $res = @mysqli_query($this->connection, \"SHOW TABLE STATUS LIKE '\" . $this->prefix . \"%'\");\n $info = array();\n for ($i = 0; $res && $i < mysqli_num_rows($res); $i++) {\n $obj = mysqli_fetch_object($res);\n $info[substr($obj->Name, strlen($this->prefix))] = $this->translateTableStatus($obj);\n }\n return $info;\n }", "\t/**\n\t * @param $table\n\t * @return array\n\t */\n function describeTable($table) {\n if (!$this->tableExists($table))\n return array();\n $res = @mysqli_query($this->connection, \"DESCRIBE `\" . $this->prefix . \"$table`\");\n $dd = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $fieldObj = mysqli_fetch_object($res);", " $fieldObj->ExpFieldType = $this->getDDFieldType($fieldObj);\n if ($fieldObj->ExpFieldType == DB_DEF_STRING) {\n $fieldObj->ExpFieldLength = $this->getDDStringLen($fieldObj);\n }", " $dd[$fieldObj->Field] = $fieldObj;\n }", " return $dd;\n }", " /**\n * Build a data definition from a pre-existing table. This is used\n * to intelligently alter tables that have already been installed.\n *\n * @param string $table The name of the table to get a data definition for.\n * @return array|null\n */\n function getDataDefinition($table) {\n // make sure the table exists\n if (!$this->tableExists($table))\n return array();", " // check if we have a cached version of this table description.\n if (expSession::issetTableCache($table))\n return expSession::getTableCache($table);", " $res = @mysqli_query($this->connection, \"DESCRIBE `\" . $this->prefix . \"$table`\");\n $dd = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) {\n $fieldObj = mysqli_fetch_object($res);", " $field = array();\n $field[DB_FIELD_TYPE] = $this->getDDFieldType($fieldObj);\n if ($field[DB_FIELD_TYPE] == DB_DEF_STRING) {\n $field[DB_FIELD_LEN] = $this->getDDStringLen($fieldObj);\n }\n //additional field attributes\n $default = $this->getDDDefault($fieldObj);\n if ($default != null)\n $field[DB_DEFAULT] = $default;\n $field[DB_INCREMENT] = $this->getDDAutoIncrement($fieldObj);\n $key = $this->getDDKey($fieldObj);\n if ($key)\n $field[$key] = true;", " $dd[$fieldObj->Field] = $field;\n }", " // save this table description to cache so we don't need to go the DB next time.\n expSession::setTableCache($table, $dd);\n return $dd;\n }", " /**\n * Returns an error message from the database server. This is intended to be\n * used by the implementers of the database wrapper, so that certain\n * cryptic error messages can be reworded.\n * @return string\n */\n function error() {\n if ($this->connection && mysqli_errno($this->connection) != 0) {\n $errno = mysqli_errno($this->connection);\n switch ($errno) {\n case 1046:\n return \"1046 : \".gt(\"Selected database does not exist\");\n default:\n return mysqli_errno($this->connection) . \" : \" . mysqli_error($this->connection);\n }\n } else if ($this->connection == false) {\n return gt(\"Unable to connect to database server\");\n } else\n return \"\";\n }", " /**\n * Checks whether the database connection has experienced an error.\n * @return bool\n */\n function inError() {\n return ($this->connection != null && mysqli_errno($this->connection) != 0);\n }", "\t/**", "\t * Escape a string based on the database connection", "\t * @param $string\n\t * @return string\n\t */\n\tfunction escapeString($string) {\n\t return (mysqli_real_escape_string($this->connection, $string));\n\t}", " /**\n * Select an array of arrays\n *\n * Selects a set of arrays from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of arrays, in any random order.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param string $orderby\n * @return array\n */\n function selectArrays($table, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;", " $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $arrays = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $arrays[] = mysqli_fetch_assoc($res);\n return $arrays;\n }", " /**\n * Select an array of arrays\n *\n * Selects a set of arrays from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of arrays, in any random order.\n *\n * @param string $sql The name of the table/object to look at\n * @return array\n */", " function selectArraysBySql($sql) {", " $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return array();\n $arrays = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $arrays[] = mysqli_fetch_assoc($res);\n return $arrays;\n }", " /**\n * Select a record from the database as an array\n * Selects a set of arrays from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of arrays, in any random order.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param null $orderby\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return array|void\n */\n function selectArray($table, $where = null, $orderby = null, $is_revisioned=false, $needs_approval=false) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n $as = '';\n if ($is_revisioned) {\n // $where.= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE $where)\";\n $where .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE id = rev.id \";\n if ($needs_approval) $where .= ' AND (approved=1 OR poster=' . $needs_approval . ' OR editor=' . $needs_approval . ')';\n $where .= \")\";\n $as = ' AS rev';\n }\n $orderby = empty($orderby) ? '' : \"ORDER BY \" . $orderby;\n $sql = \"SELECT * FROM `\" . $this->prefix . \"$table`\" . $as . \" WHERE $where $orderby LIMIT 0,1\";\n $res = @mysqli_query($this->connection, $sql);\n if ($res == null)\n return array();\n return mysqli_fetch_assoc($res);\n }", " /**\n * Instantiate objects from selected records from the database\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param string $classname\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n * @param null $order\n * @param null $limitsql\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return array\n */\n function selectExpObjects($table, $where=null, $classname, $get_assoc=true, $get_attached=true, $except=array(), $cascade_except=false, $order=null, $limitsql=null, $is_revisioned=false, $needs_approval=false) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n $as = '';\n if ($is_revisioned) {\n // $where.= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE $where)\";\n $where .= \" AND revision_id=(SELECT MAX(revision_id) FROM `\" . $this->prefix . \"$table` WHERE id = rev.id \";\n if ($needs_approval) $where .= ' AND (approved=1 OR poster=' . $needs_approval . ' OR editor=' . $needs_approval . ')';\n $where .= \")\";\n $as = ' AS rev';\n }\n $sql = \"SELECT * FROM `\" . $this->prefix . \"$table`\" . $as . \" WHERE $where\";\n $sql .= empty($order) ? '' : ' ORDER BY ' . $order;\n $sql .= empty($limitsql) ? '' : $limitsql;\n $res = @mysqli_query($this->connection, $sql);\n if ($res == null)\n return array();\n $arrays = array();\n $numrows = mysqli_num_rows($res);\n for ($i = 0; $i < $numrows; $i++) { //FIXME this can run us out of memory with too many rows\n $assArr = mysqli_fetch_assoc($res);\n $assArr['except'] = $except;\n if($cascade_except) $assArr['cascade_except'] = $cascade_except;\n $arrays[] = new $classname($assArr, $get_assoc, $get_attached);\n }\n return $arrays;\n }", " /**\n * Instantiate objects from selected records from the database", " * @param string $sql The sql statement to run on the model/classname\n * @param string $classname Can be $this->baseclassname\n * Returns an array of fields\n * @param bool $get_assoc\n * @param bool $get_attached\n * @return array\n */\n function selectExpObjectsBySql($sql, $classname, $get_assoc=true, $get_attached=true) {\n $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return array();\n $arrays = array();\n $numrows = mysqli_num_rows($res);\n for ($i = 0; $i < $numrows; $i++)\n $arrays[] = new $classname(mysqli_fetch_assoc($res), true, true);\n return $arrays;\n }", "\t/**\n\t * This function returns all the text columns in the given table\n\t * @param $table\n\t * @return array\n\t */\n\tfunction getTextColumns($table) {\n\t\t$sql = \"SHOW COLUMNS FROM \" . $this->prefix.$table . \" WHERE type = 'text' OR type like 'varchar%'\";\n\t\t$res = @mysqli_query($this->connection, $sql);\n\t\tif ($res == null)\n return array();\n\t\t$records = array();\n\t\twhile($row = mysqli_fetch_object($res)) {\n\t\t\t$records[] = $row->Field;\n\t\t}", "", "\t\treturn $records;\n\t}", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the expDatabase subsystem\n * Handles all database abstraction in Exponent.\n *\n * @package Subsystems\n * @subpackage Subsystems\n */\nclass expDatabase {", "\t/**\n\t * Connect to the Exponent database\n\t *\n\t * This function attempts to connect to the exponent database,\n\t * and then returns the database object to the caller.\n\t *\n\t * @param string $username the database username\n\t * @param string $password the database password\n\t * @param string $hostname the url of the database server\n\t * @param string $database the name of the database\n\t * @param string $dbclass\n\t * @param bool $new\n\t * @return \\database the database object\n\t */\n\tpublic static function connect($username,$password,$hostname,$database,$dbclass = '',$new=false,$log=null) {\n\t\tif (!defined('DB_ENGINE')) {\n\t\t\t$backends = array_keys(self::backends(1));\n\t\t\tif (count($backends)) {\n\t\t\t\tdefine('DB_ENGINE',$backends[0]);\n\t\t\t} else {\n\t\t\t\tdefine('DB_ENGINE','NOTSUPPORTED');\n\t\t\t}\n\t\t}\n\t\t(include_once(BASE.'framework/core/subsystems/database/'.DB_ENGINE.'.php')) or exit(gt('None of the installed Exponent Database Backends will work with this server\\'s version of PHP.'));\n\t\tif ($dbclass == '' || $dbclass == null) $dbclass = DB_ENGINE;\n\t\t(include_once(BASE.'framework/core/subsystems/database/'.$dbclass.'.php')) or exit(gt('The specified database backend').' ('.$dbclass.') '.gt('is not supported by Exponent'));\n\t\t$dbclass .= '_database';\n\t\t$newdb = new $dbclass($username,$password,$hostname,$database,$new,$log);\n if (!$newdb->tableExists('user')) {\n $newdb->havedb = false;\n }\n\t\treturn $newdb;\n\t}", "\t/**\n\t * List all available database backends\n\t *\n\t * This function looks for available database engines,\n\t * and then returns an array to the caller.\n\t *\n\t * @param int $valid_only\n\t * @return Array An associative array of engine identifiers.\n\t *\tThe internal engine name is the key, and the external\n\t *\tdescriptive name is the value.\n\t */\n\tpublic static function backends($valid_only = 1) {\n\t\t$options = array();\n\t\t$dh = opendir(BASE.'framework/core/subsystems/database');\n\t\twhile (($file = readdir($dh)) !== false) {\n\t\t\tif (is_file(BASE.'framework/core/subsystems/database/'.$file) && is_readable(BASE.'framework/core/subsystems/database/'.$file) && substr($file,-9,9) == '.info.php') {\n\t\t\t\t$info = include(BASE.'framework/core/subsystems/database/'.$file);\n\t\t\t\tif ($info['is_valid'] == 1 || !$valid_only) {\n\t\t\t\t\t$options[substr($file,0,-9)] = $info['name'];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $options;\n\t}", " public static function fix_table_names() {\n global $db;", " // fix table names\n $tablenames = array (\n 'content_expcats'=>'content_expCats',\n 'content_expcomments'=>'content_expComments',\n 'content_expdefinablefields'=>'content_expDefinableFields',\n 'content_expdefinablefields_value'=>'content_expDefinableFields_value',\n 'content_expfiles'=>'content_expFiles',\n 'content_expratings'=>'content_expRatings',\n 'content_expsimplenote'=>'content_expSimpleNote',\n 'content_exptags'=>'content_expTags',\n 'expcats'=>'expCats',\n 'expcomments'=>'expComments',\n 'expdefinablefields'=>'expDefinableFields',\n 'expealerts'=>'expeAlerts',\n 'expealerts_temp'=>'expeAlerts_temp',\n 'expfiles'=>'expFiles',\n 'expratings'=>'expRatings',\n 'exprss'=>'expRss',\n 'expsimplenote'=>'expSimpleNote',\n 'exptags'=>'expTags',\n\t\t\t'bing_product_types_storecategories'=>'bing_product_types_storeCategories',\n\t\t\t'google_product_types_storecategories'=>'google_product_types_storeCategories',\n\t\t\t'nextag_product_types_storecategories'=>'nextag_product_types_storeCategories',\n\t\t\t'pricegrabber_product_types_storecategories'=>'pricegrabber_product_types_storeCategories',\n\t\t\t'shopping_product_types_storecategories'=>'shopping_product_types_storeCategories',\n\t\t\t'shopzilla_product_types_storecategories'=>'shopzilla_product_types_storeCategories',\n\t\t\t'crosssellitem_product'=>'crosssellItem_product',\n\t\t\t'product_storecategories'=>'product_storeCategories',\n\t\t\t'storecategories'=>'storeCategories',\n );", " $renamed = array();\n foreach ($tablenames as $oldtablename=>$newtablename) {\n if (!$db->tableExists($newtablename)) {\n $db->sql('RENAME TABLE '.$db->prefix.$oldtablename.' TO '.$db->prefix.$newtablename);\n $renamed[] = $newtablename;\n }\n }\n return $renamed;\n }", " public static function install_dbtables($aggressive=false, $workflow=ENABLE_WORKFLOW) {\n \t global $db;", " \t\texpSession::clearAllUsersSessionCache();\n \t\t$tables = array();", " \t\t// first the core definitions\n \t\t$coredefs = BASE.'framework/core/definitions';\n \t\tif (is_readable($coredefs)) {\n \t\t\t$dh = opendir($coredefs);\n \t\t\twhile (($file = readdir($dh)) !== false) {\n \t\t\t\tif (is_readable(\"$coredefs/$file\") && is_file(\"$coredefs/$file\") && substr($file,-4,4) == \".php\" && substr($file,-9,9) != \".info.php\") {\n \t\t\t\t\t$tablename = substr($file,0,-4);\n \t\t\t\t\t$dd = include(\"$coredefs/$file\");\n \t\t\t\t\t$info = null;\n \t\t\t\t\tif (is_readable(\"$coredefs/$tablename.info.php\")) $info = include(\"$coredefs/$tablename.info.php\");\n \t\t\t\t\tif (!$db->tableExists($tablename)) {\n \t\t\t\t\t\tforeach ($db->createTable($tablename, $dd, $info) as $key=>$status) {\n \t\t\t\t\t\t\t$tables[$key] = $status;\n \t\t\t\t\t\t}\n \t\t\t\t\t} else {\n \t\t\t\t\t\tforeach ($db->alterTable($tablename, $dd, $info, $aggressive) as $key=>$status) {\n//\t\t\t\t\t\t\tif (isset($tables[$key])) echo \"$tablename, $key<br>\"; //FIXME we shouldn't echo this, already installed?\n \t\t\t\t\t\t\tif ($status == TABLE_ALTER_FAILED){\n \t\t\t\t\t\t\t\t$tables[$key] = $status;\n \t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t$tables[$key] = ($status == TABLE_ALTER_NOT_NEEDED ? DATABASE_TABLE_EXISTED : DATABASE_TABLE_ALTERED);\n \t\t\t\t\t\t\t}", " \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t}", " \t\t// then search for module definitions\n \t\t$moddefs = array(\n \t\t\tBASE.'themes/'.DISPLAY_THEME.'/modules',\n \t\t\tBASE.\"framework/modules\",\n \t\t\t);\n $models = expModules::initializeModels();\n \t\tforeach ($moddefs as $moddef) {\n \t\t\tif (is_readable($moddef)) {\n \t\t\t\t$dh = opendir($moddef);\n \t\t\t\twhile (($file = readdir($dh)) !== false) {\n \t\t\t\t\tif (is_dir($moddef.'/'.$file) && ($file != '..' && $file != '.')) {\n \t\t\t\t\t\t$dirpath = $moddef.'/'.$file.'/definitions';\n \t\t\t\t\t\tif (file_exists($dirpath)) {\n \t\t\t\t\t\t\t$def_dir = opendir($dirpath);\n \t\t\t\t\t\t\twhile (($def = readdir($def_dir)) !== false) {\n \t//\t\t\t\t\t\t\teDebug(\"$dirpath/$def\");\n \t\t\t\t\t\t\t\tif (is_readable(\"$dirpath/$def\") && is_file(\"$dirpath/$def\") && substr($def,-4,4) == \".php\" && substr($def,-9,9) != \".info.php\") {\n \t\t\t\t\t\t\t\t\t$tablename = substr($def,0,-4);\n \t\t\t\t\t\t\t\t\t$dd = include(\"$dirpath/$def\");\n \t\t\t\t\t\t\t\t\t$info = null;\n// foreach ($models as $modelname=>$modelpath) {\n $rev_aggressive = $aggressive;\n // add workflow fields\n if (!empty($models[substr($def,0,-4)])) {\n $modelname = substr($def,0,-4);\n $model = new $modelname();\n if ($model->supports_revisions && $workflow) {\n $dd['revision_id'] = array(\n DB_FIELD_TYPE=>DB_DEF_INTEGER,\n DB_PRIMARY=>true,\n DB_DEFAULT=>1,\n );\n $dd['approved'] = array(\n DB_FIELD_TYPE=>DB_DEF_BOOLEAN\n );\n $rev_aggressive = true;\n }\n }\n \t\t\t\t\t\t\t\t\tif (is_readable(\"$dirpath/$tablename.info.php\")) $info = include(\"$dirpath/$tablename.info.php\");\n \t\t\t\t\t\t\t\t\tif (!$db->tableExists($tablename)) {\n \t\t\t\t\t\t\t\t\t\tforeach ($db->createTable($tablename, $dd, $info) as $key=>$status) {\n \t\t\t\t\t\t\t\t\t\t\t$tables[$key] = $status;\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\tforeach ($db->alterTable($tablename, $dd, $info, $rev_aggressive) as $key=>$status) {\n//\t\t\t\t\t\t\t\t\t\t\tif (isset($tables[$key])) echo \"$tablename, $key<br>\"; //FIXME we shouldn't echo this, already installed?\n \t\t\t\t\t\t\t\t\t\t\tif ($status == TABLE_ALTER_FAILED){\n \t\t\t\t\t\t\t\t\t\t\t\t$tables[$key] = $status;\n \t\t\t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\t\t\t$tables[$key] = ($status == TABLE_ALTER_NOT_NEEDED ? DATABASE_TABLE_EXISTED : DATABASE_TABLE_ALTERED);\n \t\t\t\t\t\t\t\t\t\t\t}", " \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\treturn $tables;\n \t}\n}", "/**\n* This is the class database\n*\n* This is the generic implementation of the database class.\n* @subpackage Database\n* @package Subsystems\n*/", "abstract class database {", "\t/**\n\t* @var string $connection Database connection string\n\t*/\n\tvar $connection = null;\n\t/**\n\t* @var boolean $havedb\n\t*/\n\tvar $havedb = false;\n\t/**\n\t* @var string $prefix Database prefix\n\t*/\n\tvar $prefix = \"\";", "\t/**\n\t * Make a connection to the Database Server\n\t *\n\t * Takes the supplied credentials (username / password) and tries to\n\t * connect to the server and select the given database. All the rules\n\t * governing database connect also govern this method.\n\t *\n\t * @param string $username The username to connect to the server as.\n\t * @param string $password The password for $username\n\t * @param string $hostname The hostname of the database server. If\n\t * localhost is specified, a local socket connection will be attempted.\n\t * @param string $database The name of the database to use. Multi-database\n\t * sites are still not yet supported.\n\t * @param bool $new Whether or not to force the PHP connection function to establish\n\t * a distinctly new connection handle to the server.\n\t */", "\t//\tfunction connect ($username, $password, $hostname, $database, $new=false) {\n\tabstract function __construct($username, $password, $hostname, $database, $new=false);", "\t /**\n\t * Create a new Table\n\t *\n\t * Creates a new database table, according to the passed data definition.\n\t *\n\t * This function abides by the Exponent Data Definition Language, and interprets\n\t * its general structure for databases.\n\t *\n\t * @param string $tablename The name of the table to create\n\t * @param array $datadef The data definition to create, expressed in\n\t * the Exponent Data Definition Language.\n\t * @param array $info Information about the table itself.\n\t * @return array\n\t */\n\tabstract function createTable($tablename, $datadef, $info);", "\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $name\n\t* @param $def\n\t* @return bool|string\n\t*/\n\tfunction fieldSQL($name, $def) {\n\t $sql = \"`$name`\";\n\t if (!isset($def[DB_FIELD_TYPE])) {\n\t return false;\n\t }\n\t $type = $def[DB_FIELD_TYPE];\n\t if ($type == DB_DEF_ID) {\n\t $sql .= \" INT(11)\";\n\t } else if ($type == DB_DEF_BOOLEAN) {\n\t $sql .= \" TINYINT(1)\";\n\t } else if ($type == DB_DEF_TIMESTAMP) {\n\t $sql .= \" INT(14)\";\n } else if ($type == DB_DEF_DATETIME) {\n \t $sql .= \" DATETIME\";\n\t } else if ($type == DB_DEF_INTEGER) {\n\t $sql .= \" INT(8)\";\n\t } else if ($type == DB_DEF_STRING) {\n\t if (isset($def[DB_FIELD_LEN]) && is_int($def[DB_FIELD_LEN])) {\n\t $len = $def[DB_FIELD_LEN];\n\t if ($len < 256)\n\t $sql .= \" VARCHAR($len)\";\n\t else if ($len < 65536)\n\t $sql .= \" TEXT\";\n\t else if ($len < 16777216)\n\t $sql .= \" MEDIUMTEXT\";\n\t else\n\t $sql .= \"LONGTEXT\";\n\t } else { // default size of 'TEXT'instead of error\n $sql .= \" TEXT\";\n\t }\n\t } else if ($type == DB_DEF_DECIMAL) {\n\t $sql .= \" DOUBLE\";\n\t } else {\n\t return false; // must specify known FIELD_TYPE\n\t }\n\t $sql .= \" NOT NULL\";\n\t if (isset($def[DB_DEFAULT]))\n\t $sql .= \" DEFAULT '\" . $def[DB_DEFAULT] . \"'\";", "\t if (isset($def[DB_INCREMENT]) && $def[DB_INCREMENT])\n\t $sql .= \" AUTO_INCREMENT\";\n\t return $sql;\n\t}", "\t/**\n\t* Switch field values between two entries in a Table\n\t*\n\t* Switches values between two table entries for things like swapping rank, etc...\n\t* @param $table\n\t* @param $field\n\t* @param $a\n\t* @param $b\n\t* @param null $additional_where\n\t* @return bool\n\t*/\n\tfunction switchValues($table, $field, $a, $b, $additional_where = null) {\n\t if ($additional_where == null) {\n\t $additional_where = '1';\n\t }\n $a = intval($a);\n $b = intval($b);\n\t $object_a = $this->selectObject($table, \"$field='$a' AND $additional_where\");\n\t $object_b = $this->selectObject($table, \"$field='$b' AND $additional_where\");", "\t if ($object_a && $object_b) {\n\t $tmp = $object_a->$field;\n\t $object_a->$field = $object_b->$field;\n\t $object_b->$field = $tmp;", "\t $this->updateObject($object_a, $table);\n\t $this->updateObject($object_b, $table);", "\t return true;\n\t } else {\n\t return false;\n\t }\n\t}", "\t/**\n\t* Checks to see if the connection for this database object is valid.\n\t* @return bool True if the connection can be used to execute SQL queries.\n\t*/\n\tfunction isValid() {\n\t return ($this->connection != null && $this->havedb);\n\t}", "\t/**\n\t* Test the privileges of the user account for the connection.\n\t* Tests run include:\n\t* <ul>\n\t* <li>CREATE TABLE</li>\n\t* <li>INSERT</li>\n\t* <li>SELECT</li>\n\t* <li>UPDATE</li>\n\t* <li>DELETE</li>\n\t* <li>ALTER TABLE</li>\n\t* <li>DROP TABLE</li>\n\t* </ul>\n\t* These tests must be performed in order, for logical reasons. Execution\n\t* terminates when the first test fails, and the status flag array is returned then.\n\t* Returns an array of status flags. Key is the test name. Value is a boolean,\n\t* true if the test succeeded, and false if it failed.\n\t* @return array\n\t*/\n\tfunction testPrivileges() {", "\t $status = array();", "\t $tablename = \"___testertable\" . uniqid(\"\");\n\t $dd = array(\n\t \"id\" => array(\n\t DB_FIELD_TYPE => DB_DEF_ID,\n\t DB_PRIMARY => true,\n\t DB_INCREMENT => true),\n\t \"name\" => array(\n\t DB_FIELD_TYPE => DB_DEF_STRING,\n\t DB_FIELD_LEN => 100)\n\t );", "\t $this->createTable($tablename, $dd, array());\n\t if (!$this->tableExists($tablename)) {\n\t $status[\"CREATE TABLE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"CREATE TABLE\"] = true;", "\t $o = new stdClass();\n\t $o->name = \"Testing Name\";\n\t $insert_id = $this->insertObject($o, $tablename);\n\t if ($insert_id == 0) {\n\t $status[\"INSERT\"] = false;\n\t return $status;\n\t } else\n\t $status[\"INSERT\"] = true;", "\t $o = $this->selectObject($tablename, \"id=\" . $insert_id);\n\t if ($o == null || $o->name != \"Testing Name\") {\n\t $status[\"SELECT\"] = false;\n\t return $status;\n\t } else\n\t $status[\"SELECT\"] = true;", "\t $o->name = \"Testing 2\";\n\t if (!$this->updateObject($o, $tablename)) {\n\t $status[\"UPDATE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"UPDATE\"] = true;", "\t $this->delete($tablename, \"id=\" . $insert_id);\n\t $o = $this->selectObject($tablename, \"id=\" . $insert_id);\n\t if ($o != null) {\n\t $status[\"DELETE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"DELETE\"] = true;", "\t $dd[\"thirdcol\"] = array(\n\t DB_FIELD_TYPE => DB_DEF_TIMESTAMP);", "\t $this->alterTable($tablename, $dd, array());\n\t $o = new stdClass();\n\t $o->name = \"Alter Test\";\n\t $o->thirdcol = \"Third Column\";\n\t if (!$this->insertObject($o, $tablename)) {\n\t $status[\"ALTER TABLE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"ALTER TABLE\"] = true;", "\t $this->dropTable($tablename);\n\t if ($this->tableExists($tablename)) {\n\t $status[\"DROP TABLE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"DROP TABLE\"] = true;", "\t foreach ($this->getTables() as $t) {\n\t if (substr($t, 0, 14 + strlen($this->prefix)) == $this->prefix . \"___testertable\")\n\t $this->dropTable($t);\n\t }", "\t return $status;\n\t}", "\t/**\n\t* Alter an existing table\n\t*\n\t* Alters the structure of an existing database table to conform to the passed\n\t* data definition.\n\t*\n\t* This function abides by the Exponent Data Definition Language, and interprets\n\t* its general structure for databases.\n\t*\n\t* @param string $tablename The name of the table to alter\n\t* @param array $newdatadef The new data definition for the table.\n\t* This is expressed in the Exponent Data Definition Language\n\t* @param array $info Information about the table itself.\n\t* @param bool $aggressive Whether or not to aggressively update the table definition.\n\t* An aggressive update will drop columns in the table that are not in the Exponent definition.\n\t* @return array\n\t*/\n\tabstract function alterTable($tablename, $newdatadef, $info, $aggressive = false);", "\t/**\n\t* Drop a table from the database\n\t*\n\t* Removes an existing table from the database. Returns true if the table was dropped, false if there\n\t* was an error returned by the database server.\n\t*\n\t* @param string $table The name of the table to drop.\n\t* @return bool\n\t*/\n\tabstract function dropTable($table);", "\t/**\n\t * Run raw SQL. Returns true if the query succeeded, and false\n\t * if an error was returned from the database server.\n\t *\n\t * <div style=\"color:red\">If you can help it, do not use this function. It presents Database Portability Issues.</div>\n\t *\n\t * Runs a straight SQL query on the database. This is not a\n\t * very portable way of dealing with the database, and is only\n\t * provided as a last resort.\n\t *\n\t * @param string $sql The SQL query to run\n\t * @param bool $escape\n\t * @return mixed\n\t */\n\tabstract function sql($sql, $escape = true);", "\t/**\n\t * Toggle a boolean value in a Table Entry\n\t *\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return void\n\t */\n\tfunction toggle($table, $col, $where=null) {\n\t $obj = $this->selectObject($table, $where);\n\t $obj->$col = ($obj->$col == 0) ? 1 : 0;\n\t $this->updateObject($obj, $table);\n\t}", "\t/**\n\t * Update a column in all records in a table\n\t *\n\t * @param $table\n\t * @param $col\n\t * @param $val\n\t * @param int|null $where\n\t * @return void\n\t */\n\tabstract function columnUpdate($table, $col, $val, $where=1);", "\t/**\n\t * @param $object\n\t * @param $table\n\t * @param $col\n\t * @param int|null $where\n\t * @return bool\n\t */\n\tfunction setUniqueFlag($object, $table, $col, $where=1) {\n\t if (isset($object->id)) {\n\t $this->sql(\"UPDATE \" . $this->prefix . $table . \" SET \" . $col . \"=0 WHERE \" . $where);\n\t $this->sql(\"UPDATE \" . $this->prefix . $table . \" SET \" . $col . \"=1 WHERE id=\" . $object->id);\n\t return true;\n\t }\n\t return false;\n\t}", "\t/**\n\t* Select a series of objects\n\t*\n\t* Selects a set of objects from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a set of records from a database table. Returns an\n\t* array of objects, in any random order.\n\t*\n\t* @param string $table The name of the table/object to look at\n\t* @param string $where Criteria used to narrow the result set. If this\n\t* is specified as null, then no criteria is applied, and all objects are\n\t* returned\n\t* @param null $orderby\n\t* @return array\n\t*/\n\tabstract function selectObjects($table, $where = null, $orderby = null);", "\t/**\n\t * @param $terms\n\t * @param null $where\n\t * @return array\n\t */\n\tfunction selectSearch($terms, $where = null) { //FIXME never used", "\t}", "\t/**\n\t * @param null $colsA\n\t * @param null $colsB\n\t * @param $tableA\n\t * @param $tableB\n\t * @param $keyA\n\t * @param null $keyB\n\t * @param null $where\n\t * @param null $orderby\n\t * @return array'\n\t */\n\tfunction selectAndJoinObjects($colsA=null, $colsB=null, $tableA, $tableB, $keyA, $keyB=null, $where = null, $orderby = null) { //FIXME never used", "\t}", "\t/**\n\t * Select a single object by sql\n\t *\n\t * @param $sql\n\t * @return null|void\n\t */\n\tabstract function selectObjectBySql($sql);", "\t/**\n\t * Select a series of objects by sql\n\t *\n\t * @param $sql\n\t * @return array\n\t */\n\tabstract function selectObjectsBySql($sql);", "\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @param null $orderby\n\t * @param bool $distinct\n\t * @return array\n\t */\n\tabstract function selectColumn($table, $col, $where = null, $orderby = null, $distinct=false);", "\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return int\n\t */\n\tfunction selectSum($table, $col, $where = null) { //FIXME never used", "\t}", "\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @param null $orderby\n\t * @return array\n\t */\n\tabstract function selectDropdown($table, $col, $where = null, $orderby = null);", "\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return null\n\t */\n\tabstract function selectValue($table, $col, $where=null);", "\t/**\n\t * @param $sql\n\t * @return null\n\t */\n\tfunction selectValueBySql($sql) { //FIXME never used", "\t}", "\t/**\n\t* This function takes an array of indexes and returns an array with the objects associated with each id\n\t* @param $table\n\t* @param array $array\n\t* @param null $orderby\n\t* @return array\n\t*/\n\tfunction selectObjectsInArray($table, $array=array(), $orderby=null) {\n\t $where = 'id IN ' . implode(\",\", $array);\n\t $res = $this->selectObjects($table, $where, $orderby);\n\t return $res;\n\t}", "\t/**\n\t* Select a series of objects, and return by ID\n\t*\n\t* Selects a set of objects from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a set of records from a database table. Returns an\n\t* array of objects, in any random order. The indices of the array\n\t* are the IDs of the objects.\n\t*\n\t* @param string $table The name of the table/object to look at\n\t* @param string $where Criteria used to narrow the result set. If this\n\t* is specified as null, then no criteria is applied, and all objects are\n\t* returned\n\t* @param null $orderby\n\t* @return array\n\t*/\n\tabstract function selectObjectsIndexedArray($table, $where = null, $orderby = null);", " /**\n * Count Objects matching a given criteria\n *\n * @param string $table The name of the table to count objects in.\n * @param string $where Criteria for counting.\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return int\n */\n\tabstract function countObjects($table, $where = null, $is_revisioned=false, $needs_approval=false);", "\t/**\n\t* Count Objects matching a given criteria using raw sql\n\t*\n\t* @param string $sql The sql query to be run\n\t* @return int\n\t*/\n\tabstract function countObjectsBySql($sql);", "\t/**\n\t* Count Objects matching a given criteria using raw sql\n\t*\n\t* @param string $sql The sql query to be run\n\t* @return int|void\n\t*/\n\tfunction queryRows($sql) { //FIXME never used", "\t}", "\t/**\n\t* Select a single object.\n\t*\n\t* Selects an objects from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a single record from a database table. Returns the\n\t* first record/object found (in the case of multiple-result queries,\n\t* there is no way to determine which of the set will be returned).\n\t* If no record(s) match the query, null is returned.\n\t*\n\t* @param string $table The name of the table/object to look at\n\t* @param string $where Criteria used to narrow the result set.\n\t* @return object|null|void\n\t*/\n\tabstract function selectObject($table, $where);", "\t/**\n\t * @param $table\n\t * @param string $lockType\n\t * @return mixed\n\t */\n\tabstract function lockTable($table,$lockType=\"WRITE\");", "\t/**\n\t * @return mixed\n\t */\n\tabstract function unlockTables();", "\t/**\n\t* Insert an Object into some table in the Database\n\t*\n\t* This method will return the ID assigned to the new record by database. Note that\n\t* object attributes starting with an underscore ('_') will be ignored and NOT inserted\n\t* into the table as a field value.\n\t*\n\t* @param object $object The object to insert.\n\t* @param string $table The logical table name to insert into. This does not include the table prefix, which\n\t* is automagically prepended for you.\n\t* @return int|void\n\t*/\n\tabstract function insertObject($object, $table);", "\t/**\n\t* Delete one or more objects from the given table.\n\t*\n\t* @param string $table The name of the table to delete from.\n\t* @param string $where Criteria for determining which record(s) to delete.\n\t* @return mixed\n\t*/\n\tabstract function delete($table, $where = null);", "\t/**\n\t* Update one or more objects in the database.\n\t*\n\t* This function will only update the attributes of the resulting record(s)\n\t* that are also member attributes of the $object object.\n\t*\n\t* @param object $object An object specifying the fields and values for updating.\n\t* In most cases, this will be the altered object originally returned from one of\n\t* the select* methods.\n\t* @param string $table The table to update in.\n\t* @param string $where Optional criteria used to narrow the result set.\n\t* @param string $identifier\n\t* @param bool $is_revisioned\n\t* @return bool|int|void\n\t*/\n\tabstract function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false);", " /**\n * Reduces table item revisions to a passed total\n *\n * @param string $table The name of the table to trim\n * @param integer $id The item id\n * @param integer $num The number of revisions to retain\n * @param int $workflow is workflow turned on (or force)\n */\n public function trim_revisions($table, $id, $num, $workflow=ENABLE_WORKFLOW) {\n if ($workflow && $num) {\n $max_revision = $this->max($table, 'revision_id', null, 'id='.$id);\n $max_approved = $this->max($table, 'revision_id', null, 'id='.$id.' AND approved=1');\n $min_revision = $this->min($table, 'revision_id', null, 'id='.$id);\n if ($max_revision == null) {\n return;\n }\n if (($max_revision - $num) > $max_approved) {\n $approved_max = ' AND revision_id < ' . $max_approved; // never delete most recent approved item\n } else {\n $approved_max = '';\n }\n if ($max_revision - $min_revision >= $num) {\n $this->delete($table, 'id=' . $id . ' AND revision_id <= ' . ($max_revision - $num) . $approved_max);\n }\n if (!empty($approved_max)) {\n // we've trimmed all the fat below the newest approved item, now trim the dead wood above it\n $this->delete($table, 'id=' . $id . ' AND revision_id <= ' . ($max_revision - $num + 1) . ' AND revision_id > ' . $max_approved);\n }\n }\n }", "\t/**\n\t * Find the maximum value of a field. This is similar to a standard\n\t * SELECT MAX(field) ... query.\n\t *\n\t * @param string $table The name of the table to select from.\n\t * @param string $attribute The attribute name to find a maximum value for.\n\t * @param string $groupfields A comma-separated list of fields (or a single field) name, used\n\t * for a GROUP BY clause. This can also be passed as an array of fields.\n\t * @param string $where Optional criteria for narrowing the result set.\n\t * @return mixed\n\t */\n\tabstract function max($table, $attribute, $groupfields = null, $where = null);", "\t/**\n\t * Find the minimum value of a field. This is similar to a standard\n\t * SELECT MIN(field) ... query.\n\t *\n\t * @internal Internal\n\t * @param string $table The name of the table to select from.\n\t * @param string $attribute The attribute name to find a minimum value for.\n\t * @param string $groupfields A comma-separated list of fields (or a single field) name, used\n\t * for a GROUP BY clause. This can also be passed as an array of fields.\n\t * @param string $where Optional criteria for narrowing the result set.\n\t * @return null\n\t */\n\tabstract function min($table, $attribute, $groupfields = null, $where = null);", "\t/**\n\t* Increment a numeric table field in a table.\n\t*\n\t* @param string $table The name of the table to increment in.\n\t* @param string $field The field to increment.\n\t* @param integer $step The step value. Usually 1. This can be negative, to\n\t* decrement, but the decrement() method is preferred, for readability.\n\t* @param string $where Optional criteria to determine which records to update.\n\t* @return mixed\n\t*/\n\tabstract function increment($table, $field, $step, $where = null);", "\t/**\n\t* Decrement a numeric table field in a table.\n\t*\n\t* @param string $table The name of the table to decrement in.\n\t* @param string $field The field to decrement.\n\t* @param integer $step The step value. Usually 1. This can be negative, to\n\t* increment, but the increment() method is preferred, for readability.\n\t* @param string $where Optional criteria to determine which records to update.\n\t*/", "\tfunction decrement($table, $field, $step, $where = null) {\n\t $this->increment($table, $field, -1 * $step, $where);\n\t}", "\t/**\n\t* Check to see if the named table exists in the database.\n\t* Returns true if the table exists, and false if it doesn't.\n\t*\n\t* @param string $table Name of the table to look for.\n\t* @return bool\n\t*/\n\tabstract function tableExists($table);", "\t/**\n\t* Get a list of all tables in the database. Optionally, only the tables\n\t* in the current logical database (tables with the same prefix) can\n\t* be retrieved.\n\t*\n\t* @param bool $prefixed_only Whether to return only the tables\n\t* for the logical database, or all tables in the physical database.\n\t* @return array\n\t*/\n\tabstract function getTables($prefixed_only=true);", "\t/**\n\t* Runs whatever table optimization routines the database engine supports.\n\t*\n\t* @param string $table The name of the table to optimize.\n\t* @return bool\n\t*/\n\tabstract function optimize($table);", "\t/**\n\t* Retrieve table information for a named table.\n\t* Returns an object, with the following attributes:\n\t* <ul>\n\t* <li><b>rows</b> -- The number of rows in the table.</li>\n\t* <li><b>average_row_length</b> -- The average storage size of a row in the table.</li>\n\t* <li><b>data_total</b> -- How much total disk space is used by the table.</li>\n\t* <li><b>data_overhead</b> -- How much storage space in the table is unused (for compacting purposes)</li>\n\t* </ul>\n\t* @param $table\n\t* @return null\n\t*/\n\tfunction tableInfo($table) { //FIXME never used", "\t}", "\t/**\n\t* Check whether or not a table in the database is empty (0 rows).\n\t* Returns tue of the specified table has no rows, and false if otherwise.\n\t*\n\t* @param string $table Name of the table to check.\n\t* @return bool\n\t*/\n\tfunction tableIsEmpty($table) {\n\t return ($this->countObjects($table) == 0);\n\t}", "\t/**\n\t* Returns table information for all tables in the database.\n\t* This function effectively calls tableInfo() on each table found.\n\t* @return array\n\t*/\n\tabstract function databaseInfo();", "\t/**\n\t* This is an internal function for use only within the database database class\n\t* @internal Internal\n\t* @param $status\n\t* @return null\n\t*/\n\tfunction translateTableStatus($status) {\n\t $data = new stdClass();\n\t $data->rows = $status->Rows;\n\t $data->average_row_lenth = $status->Avg_row_length;\n\t $data->data_overhead = $status->Data_free;\n\t $data->data_total = $status->Data_length;", "\t return $data;\n\t}", "\t/**\n\t * @param $table\n\t * @return array\n\t */\n\tfunction describeTable($table) { //FIXME never used", "\t}", "\t/**\n\t* Build a data definition from a pre-existing table. This is used\n\t* to intelligently alter tables that have already been installed.\n\t*\n\t* @param string $table The name of the table to get a data definition for.\n\t* @return array|null\n\t*/\n\tabstract function getDataDefinition($table);", "\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int\n\t*/\n\tfunction getDDFieldType($fieldObj) {\n\t $type = strtolower($fieldObj->Type);", "\t if ($type == \"int(11)\")\n\t return DB_DEF_ID;\n\t if ($type == \"int(8)\")\n\t return DB_DEF_INTEGER;\n\t elseif ($type == \"tinyint(1)\")\n\t return DB_DEF_BOOLEAN;\n\t elseif ($type == \"int(14)\")\n\t return DB_DEF_TIMESTAMP;\n elseif ($type == \"datetime\")\n \t return DB_DEF_TIMESTAMP;\n\t //else if (substr($type,5) == \"double\")\n //return DB_DEF_DECIMAL;\n\t elseif ($type == \"double\")\n\t return DB_DEF_DECIMAL;\n\t // Strings\n\t elseif ($type == \"text\" || $type == \"mediumtext\" || $type == \"longtext\" || strpos($type, \"varchar(\") !== false) {\n\t return DB_DEF_STRING;\n\t } else {\n return DB_DEF_INTEGER;\n }\n\t}", "\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDStringLen($fieldObj) {\n\t $type = strtolower($fieldObj->Type);\n\t if ($type == \"text\")\n\t return 65535;\n\t else if ($type == \"mediumtext\")\n\t return 16777215;\n\t else if ($type == \"longtext\")\n\t return 16777216;\n\t else if (strpos($type, \"varchar(\") !== false) {\n\t return str_replace(array(\"varchar(\", \")\"), \"\", $type) + 0;\n\t } else {\n return 256;\n }\n\t}", "\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDKey($fieldObj) {\n\t $key = strtolower($fieldObj->Key);\n\t if ($key == \"pri\")\n\t return DB_PRIMARY;\n\t else if ($key == \"uni\") {\n\t return DB_UNIQUE;\n\t } else {\n return false;\n }\n\t}", "\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDAutoIncrement($fieldObj) {\n\t $auto = strtolower($fieldObj->Extra);\n\t if ($auto == \"auto_increment\") {\n\t return true;\n\t } else {\n return false;\n }\n\t}", "\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDIsNull($fieldObj) {\n\t $null = strtolower($fieldObj->Null);\n\t if ($null == \"yes\") {\n\t return true;\n\t } else {\n return false;\n }\n\t}", "\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDDefault($fieldObj) {\n\t\treturn strtolower($fieldObj->Default);\n\t}", "\t/**\n\t* Returns an error message from the database server. This is intended to be\n\t* used by the implementers of the database wrapper, so that certain\n\t* cryptic error messages can be reworded.\n\t* @return string\n\t*/\n\tabstract function error();", "\t/**\n\t* Checks whether the database connection has experienced an error.\n\t* @return bool\n\t*/\n\tabstract function inError();", "\t/**", "\t * Unescape a string based on the database connection", "\t * @param $string\n\t * @return string\n\t */\n\tabstract function escapeString($string);", " /**", " \t * Unescape a string based on the database connection", " \t * @param $string\n \t * @return string\n \t */\n \tfunction injectProof($string) {\n \t $quotes = substr_count(\"'\", $string);\n if ($quotes % 2 != 0)\n $string = $this->escapeString($string);\n $dquotes = substr_count('\"', $string);\n if ($dquotes % 2 != 0)\n $string = $this->escapeString($string);\n return $string;\n }", "\t/**\n\t * Create a SQL \"limit\" phrase\n\t *\n\t * @param $num\n\t * @param $offset\n\t * @return string\n\t */\n\tfunction limit($num, $offset) {\n\t return ' LIMIT ' . $offset . ',' . $num . ' ';\n\t}", "\t/**\n\t* Select an array of arrays\n\t*\n\t* Selects a set of arrays from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a set of records from a database table. Returns an\n\t* array of arrays, in any random order.\n\t*\n\t* @param string $table The name of the table/object to look at\n\t* @param string $where Criteria used to narrow the result set. If this\n\t* is specified as null, then no criteria is applied, and all objects are\n\t* returned\n\t* @param string $orderby\n\t* @return array\n\t*/\n\tabstract function selectArrays($table, $where = null, $orderby = null);", "\t/**\n\t* Select an array of arrays\n\t*\n\t* Selects a set of arrays from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a set of records from a database table. Returns an\n\t* array of arrays, in any random order.\n\t*\n\t* @param string $sql The name of the table/object to look at\n\t* @return array\n\t*/\n\tabstract function selectArraysBySql($sql);", " /**\n * Select a record from the database as an array\n * Selects a set of arrays from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of arrays, in any random order.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param null $orderby\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return array|void\n */\n\tabstract function selectArray($table, $where = null, $orderby = null, $is_revisioned=false, $needs_approval=false);", " /**\n\t * Instantiate objects from selected records from the database\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param $classname\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n * @param null $order\n * @param null $limitsql\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return array\n */\n\tabstract function selectExpObjects($table, $where=null, $classname, $get_assoc=true, $get_attached=true, $except=array(), $cascade_except=false, $order=null, $limitsql=null, $is_revisioned=false, $needs_approval=false);", "\t/**\n\t * Instantiate objects from selected records from the database\n\t *\n\t* @param string $sql The sql statement to run on the model/classname\n\t* @param string $classname Can be $this->baseclassname\n\t* Returns an array of fields\n\t* @param bool $get_assoc\n\t* @param bool $get_attached\n\t* @return array\n\t*/\n\tfunction selectExpObjectsBySql($sql, $classname, $get_assoc=true, $get_attached=true) { //FIXME never used", "\t}", "\t/**\n\t * @param $table\n\t * @return array\n\t */\n\tfunction selectNestedTree($table) {\n\t $sql = 'SELECT node.*, (COUNT(parent.sef_url) - 1) AS depth\n\t\tFROM `' . $this->prefix . $table . '` AS node,\n\t\t`' . $this->prefix . $table . '` AS parent\n\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\tGROUP BY node.sef_url\n\t\tORDER BY node.lft';\n\t return $this->selectObjectsBySql($sql);\n\t}", "\tfunction selectFormattedNestedTree($table) {\n\t\t$sql = \"SELECT CONCAT( REPEAT( '&#160;&#160;&#160;', (COUNT(parent.title) -1) ), node.title) AS title, node.id\n\t\t\t\tFROM \" .$this->prefix . $table. \" as node, \" .$this->prefix . $table. \" as parent\n\t\t\t\tWHERE node.lft BETWEEN parent.lft and parent.rgt\n\t\t\t\tGROUP BY node.title, node.id\n\t\t\t\tORDER BY node.lft\";", "\t\treturn $this->selectObjectsBySql($sql);\n\t}", "\t/**\n\t * @param $table\n\t * @param $start\n\t * @param $width\n\t * @return void\n\t */\n\tfunction adjustNestedTreeFrom($table, $start, $width) {\n\t $table = $this->prefix . $table;\n\t $this->sql('UPDATE `' . $table . '` SET rgt = rgt + ' . $width . ' WHERE rgt >=' . $start);\n\t $this->sql('UPDATE `' . $table . '` SET lft = lft + ' . $width . ' WHERE lft >=' . $start);\n\t //eDebug('UPDATE `'.$table.'` SET rgt = rgt + '.$width.' WHERE rgt >='.$start);\n\t //eDebug('UPDATE `'.$table.'` SET lft = lft + '.$width.' WHERE lft >='.$start);\n\t}", "\t/**\n\t * @param $table\n\t * @param $lft\n\t * @param $rgt\n\t * @param $width\n\t * @return void\n\t */\n\tfunction adjustNestedTreeBetween($table, $lft, $rgt, $width) {\n\t $table = $this->prefix . $table;\n\t $this->sql('UPDATE `' . $table . '` SET rgt = rgt + ' . $width . ' WHERE rgt BETWEEN ' . $lft . ' AND ' . $rgt);\n\t $this->sql('UPDATE `' . $table . '` SET lft = lft + ' . $width . ' WHERE lft BETWEEN ' . $lft . ' AND ' . $rgt);\n\t //eDebug('UPDATE `'.$table.'` SET rgt = rgt + '.$width.' WHERE rgt BETWEEN '.$lft.' AND '.$rgt);\n\t //eDebug('UPDATE `'.$table.'` SET lft = lft + '.$width.' WHERE lft BETWEEN '.$lft.' AND '.$rgt);\n\t}", "\t/**\n\t * @param $table\n\t * @param null $node\n\t * @return array\n\t */\n\tfunction selectNestedBranch($table, $node=null) {\n\t if (empty($node))\n\t return array();", "\t $where = is_numeric($node) ? 'id=' . $node : 'title=\"' . $node . '\"';\n//\t global $db;\n\t $sql = 'SELECT node.*,\n\t (COUNT(parent.title) - (sub_tree.depth + 1)) AS depth\n\t FROM `' . $this->prefix . $table . '` AS node,\n\t `' . $this->prefix . $table . '` AS parent,\n\t `' . $this->prefix . $table . '` AS sub_parent,\n\t ( SELECT node.*, (COUNT(parent.title) - 1) AS depth\n\t FROM `' . $this->prefix . $table . '` AS node,\n\t `' . $this->prefix . $table . '` AS parent\n\t WHERE node.lft BETWEEN parent.lft\n\t AND parent.rgt AND node.' . $where . '\n\t GROUP BY node.title\n\t ORDER BY node.lft )\n\t AS sub_tree\n\t WHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t AND node.lft BETWEEN sub_parent.lft AND sub_parent.rgt\n\t AND sub_parent.title = sub_tree.title\n\t GROUP BY node.title\n\t ORDER BY node.lft;';", "\t return $this->selectObjectsBySql($sql);\n\t}", "\t/**\n\t * @param $table\n\t * @param $lft\n\t * @param $rgt\n\t * @return void\n\t */\n\tfunction deleteNestedNode($table, $lft, $rgt) {\n\t $table = $this->prefix . $table;", "\t $width = ($rgt - $lft) + 1;\n\t $this->sql('DELETE FROM `' . $table . '` WHERE lft BETWEEN ' . $lft . ' AND ' . $rgt);\n\t $this->sql('UPDATE `' . $table . '` SET rgt = rgt - ' . $width . ' WHERE rgt > ' . $rgt);\n\t $this->sql('UPDATE `' . $table . '` SET lft = lft - ' . $width . ' WHERE lft > ' . $rgt);\n\t}", "\t/**\n\t * @param $table\n\t * @param null $node\n\t * @return array\n\t */\n\tfunction selectPathToNestedNode($table, $node=null) {\n\t if (empty($node))\n\t return array();", "\t $where = is_numeric($node) ? 'id=' . $node : 'title=\"' . $node . '\"';\n\t $sql = 'SELECT parent.*\n\t\tFROM `' . $this->prefix . $table . '` AS node,\n\t\t`' . $this->prefix . $table . '` AS parent\n\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\tAND node.' . $where . '\n\t\tORDER BY parent.lft;';\n\t return $this->selectObjectsBySql($sql);\n\t}", "\t/**\n\t * @param $table\n\t * @param null $node\n\t * @return array\n\t */\n\tfunction selectNestedNodeParent($table, $node=null) {\n\t if (empty($node))\n\t return array();", "\t $where = is_numeric($node) ? 'id=' . $node : 'title=\"' . $node . '\"';\n\t $sql = 'SELECT parent.*\n\t\tFROM `' . $this->prefix . $table . '` AS node,\n\t\t`' . $this->prefix . $table . '` AS parent\n\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\tAND node.' . $where . '\n\t\tORDER BY parent.lft DESC\n\t\tLIMIT 1, 1;';\n\t $parent_array = $this->selectObjectsBySql($sql);\n\t return $parent_array[0];\n\t}", "\t/**\n\t * @param $table\n\t * @param null $node\n\t * @return array\n\t */\n\tfunction selectNestedNodeChildren($table, $node=null) {\n\t if (empty($node))\n\t return array();", "\t $where = is_numeric($node) ? 'node.id=' . $node : 'node.title=\"' . $node . '\"';\n\t $sql = '\n\t\tSELECT node.*, (COUNT(parent.title) - (sub_tree.depth + 1)) AS depth\n\t\tFROM ' . $this->prefix . $table . ' AS node,\n\t\t\t' . $this->prefix . $table . ' AS parent,\n\t\t\t' . $this->prefix . $table . ' AS sub_parent,\n\t\t\t(\n\t\t\t\tSELECT node.*, (COUNT(parent.title) - 1) AS depth\n\t\t\t\tFROM ' . $this->prefix . $table . ' AS node,\n\t\t\t\t' . $this->prefix . $table . ' AS parent\n\t\t\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\t\t\tAND ' . $where . '\n\t\t\t\tGROUP BY node.title\n\t\t\t\tORDER BY node.lft\n\t\t\t)AS sub_tree\n\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\t\tAND node.lft BETWEEN sub_parent.lft AND sub_parent.rgt\n\t\t\tAND sub_parent.title = sub_tree.title\n\t\tGROUP BY node.title\n\t\tHAVING depth = 1\n\t\tORDER BY node.lft;';\n\t$children = $this->selectObjectsBySql($sql);\n\t return $children;\n\t}", "\t/**\n\t * This function returns all the text columns in the given table\n\t * @param $table\n\t * @return array\n\t */\n\tabstract function getTextColumns($table);", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the expDatabase subsystem\n * Handles all database abstraction in Exponent.\n *\n * @package Subsystems\n * @subpackage Subsystems\n */\nclass expDatabase {", "\t/**\n\t * Connect to the Exponent database\n\t *\n\t * This function attempts to connect to the exponent database,\n\t * and then returns the database object to the caller.\n\t *\n\t * @param string $username the database username\n\t * @param string $password the database password\n\t * @param string $hostname the url of the database server\n\t * @param string $database the name of the database\n\t * @param string $dbclass\n\t * @param bool $new\n\t * @return \\database the database object\n\t */\n\tpublic static function connect($username,$password,$hostname,$database,$dbclass = '',$new=false,$log=null) {\n\t\tif (!defined('DB_ENGINE')) {\n\t\t\t$backends = array_keys(self::backends(1));\n\t\t\tif (count($backends)) {\n\t\t\t\tdefine('DB_ENGINE',$backends[0]);\n\t\t\t} else {\n\t\t\t\tdefine('DB_ENGINE','NOTSUPPORTED');\n\t\t\t}\n\t\t}\n\t\t(include_once(BASE.'framework/core/subsystems/database/'.DB_ENGINE.'.php')) or exit(gt('None of the installed Exponent Database Backends will work with this server\\'s version of PHP.'));\n\t\tif ($dbclass == '' || $dbclass == null) $dbclass = DB_ENGINE;\n\t\t(include_once(BASE.'framework/core/subsystems/database/'.$dbclass.'.php')) or exit(gt('The specified database backend').' ('.$dbclass.') '.gt('is not supported by Exponent'));\n\t\t$dbclass .= '_database';\n\t\t$newdb = new $dbclass($username,$password,$hostname,$database,$new,$log);\n if (!$newdb->tableExists('user')) {\n $newdb->havedb = false;\n }\n\t\treturn $newdb;\n\t}", "\t/**\n\t * List all available database backends\n\t *\n\t * This function looks for available database engines,\n\t * and then returns an array to the caller.\n\t *\n\t * @param int $valid_only\n\t * @return Array An associative array of engine identifiers.\n\t *\tThe internal engine name is the key, and the external\n\t *\tdescriptive name is the value.\n\t */\n\tpublic static function backends($valid_only = 1) {\n\t\t$options = array();\n\t\t$dh = opendir(BASE.'framework/core/subsystems/database');\n\t\twhile (($file = readdir($dh)) !== false) {\n\t\t\tif (is_file(BASE.'framework/core/subsystems/database/'.$file) && is_readable(BASE.'framework/core/subsystems/database/'.$file) && substr($file,-9,9) == '.info.php') {\n\t\t\t\t$info = include(BASE.'framework/core/subsystems/database/'.$file);\n\t\t\t\tif ($info['is_valid'] == 1 || !$valid_only) {\n\t\t\t\t\t$options[substr($file,0,-9)] = $info['name'];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $options;\n\t}", " public static function fix_table_names() {\n global $db;", " // fix table names\n $tablenames = array (\n 'content_expcats'=>'content_expCats',\n 'content_expcomments'=>'content_expComments',\n 'content_expdefinablefields'=>'content_expDefinableFields',\n 'content_expdefinablefields_value'=>'content_expDefinableFields_value',\n 'content_expfiles'=>'content_expFiles',\n 'content_expratings'=>'content_expRatings',\n 'content_expsimplenote'=>'content_expSimpleNote',\n 'content_exptags'=>'content_expTags',\n 'expcats'=>'expCats',\n 'expcomments'=>'expComments',\n 'expdefinablefields'=>'expDefinableFields',\n 'expealerts'=>'expeAlerts',\n 'expealerts_temp'=>'expeAlerts_temp',\n 'expfiles'=>'expFiles',\n 'expratings'=>'expRatings',\n 'exprss'=>'expRss',\n 'expsimplenote'=>'expSimpleNote',\n 'exptags'=>'expTags',\n\t\t\t'bing_product_types_storecategories'=>'bing_product_types_storeCategories',\n\t\t\t'google_product_types_storecategories'=>'google_product_types_storeCategories',\n\t\t\t'nextag_product_types_storecategories'=>'nextag_product_types_storeCategories',\n\t\t\t'pricegrabber_product_types_storecategories'=>'pricegrabber_product_types_storeCategories',\n\t\t\t'shopping_product_types_storecategories'=>'shopping_product_types_storeCategories',\n\t\t\t'shopzilla_product_types_storecategories'=>'shopzilla_product_types_storeCategories',\n\t\t\t'crosssellitem_product'=>'crosssellItem_product',\n\t\t\t'product_storecategories'=>'product_storeCategories',\n\t\t\t'storecategories'=>'storeCategories',\n );", " $renamed = array();\n foreach ($tablenames as $oldtablename=>$newtablename) {\n if (!$db->tableExists($newtablename)) {\n $db->sql('RENAME TABLE '.$db->prefix.$oldtablename.' TO '.$db->prefix.$newtablename);\n $renamed[] = $newtablename;\n }\n }\n return $renamed;\n }", " public static function install_dbtables($aggressive=false, $workflow=ENABLE_WORKFLOW) {\n \t global $db;", " \t\texpSession::clearAllUsersSessionCache();\n \t\t$tables = array();", " \t\t// first the core definitions\n \t\t$coredefs = BASE.'framework/core/definitions';\n \t\tif (is_readable($coredefs)) {\n \t\t\t$dh = opendir($coredefs);\n \t\t\twhile (($file = readdir($dh)) !== false) {\n \t\t\t\tif (is_readable(\"$coredefs/$file\") && is_file(\"$coredefs/$file\") && substr($file,-4,4) == \".php\" && substr($file,-9,9) != \".info.php\") {\n \t\t\t\t\t$tablename = substr($file,0,-4);\n \t\t\t\t\t$dd = include(\"$coredefs/$file\");\n \t\t\t\t\t$info = null;\n \t\t\t\t\tif (is_readable(\"$coredefs/$tablename.info.php\")) $info = include(\"$coredefs/$tablename.info.php\");\n \t\t\t\t\tif (!$db->tableExists($tablename)) {\n \t\t\t\t\t\tforeach ($db->createTable($tablename, $dd, $info) as $key=>$status) {\n \t\t\t\t\t\t\t$tables[$key] = $status;\n \t\t\t\t\t\t}\n \t\t\t\t\t} else {\n \t\t\t\t\t\tforeach ($db->alterTable($tablename, $dd, $info, $aggressive) as $key=>$status) {\n//\t\t\t\t\t\t\tif (isset($tables[$key])) echo \"$tablename, $key<br>\"; //FIXME we shouldn't echo this, already installed?\n \t\t\t\t\t\t\tif ($status == TABLE_ALTER_FAILED){\n \t\t\t\t\t\t\t\t$tables[$key] = $status;\n \t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t$tables[$key] = ($status == TABLE_ALTER_NOT_NEEDED ? DATABASE_TABLE_EXISTED : DATABASE_TABLE_ALTERED);\n \t\t\t\t\t\t\t}", " \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t}", " \t\t// then search for module definitions\n \t\t$moddefs = array(\n \t\t\tBASE.'themes/'.DISPLAY_THEME.'/modules',\n \t\t\tBASE.\"framework/modules\",\n \t\t\t);\n $models = expModules::initializeModels();\n \t\tforeach ($moddefs as $moddef) {\n \t\t\tif (is_readable($moddef)) {\n \t\t\t\t$dh = opendir($moddef);\n \t\t\t\twhile (($file = readdir($dh)) !== false) {\n \t\t\t\t\tif (is_dir($moddef.'/'.$file) && ($file != '..' && $file != '.')) {\n \t\t\t\t\t\t$dirpath = $moddef.'/'.$file.'/definitions';\n \t\t\t\t\t\tif (file_exists($dirpath)) {\n \t\t\t\t\t\t\t$def_dir = opendir($dirpath);\n \t\t\t\t\t\t\twhile (($def = readdir($def_dir)) !== false) {\n \t//\t\t\t\t\t\t\teDebug(\"$dirpath/$def\");\n \t\t\t\t\t\t\t\tif (is_readable(\"$dirpath/$def\") && is_file(\"$dirpath/$def\") && substr($def,-4,4) == \".php\" && substr($def,-9,9) != \".info.php\") {\n \t\t\t\t\t\t\t\t\t$tablename = substr($def,0,-4);\n \t\t\t\t\t\t\t\t\t$dd = include(\"$dirpath/$def\");\n \t\t\t\t\t\t\t\t\t$info = null;\n// foreach ($models as $modelname=>$modelpath) {\n $rev_aggressive = $aggressive;\n // add workflow fields\n if (!empty($models[substr($def,0,-4)])) {\n $modelname = substr($def,0,-4);\n $model = new $modelname();\n if ($model->supports_revisions && $workflow) {\n $dd['revision_id'] = array(\n DB_FIELD_TYPE=>DB_DEF_INTEGER,\n DB_PRIMARY=>true,\n DB_DEFAULT=>1,\n );\n $dd['approved'] = array(\n DB_FIELD_TYPE=>DB_DEF_BOOLEAN\n );\n $rev_aggressive = true;\n }\n }\n \t\t\t\t\t\t\t\t\tif (is_readable(\"$dirpath/$tablename.info.php\")) $info = include(\"$dirpath/$tablename.info.php\");\n \t\t\t\t\t\t\t\t\tif (!$db->tableExists($tablename)) {\n \t\t\t\t\t\t\t\t\t\tforeach ($db->createTable($tablename, $dd, $info) as $key=>$status) {\n \t\t\t\t\t\t\t\t\t\t\t$tables[$key] = $status;\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\tforeach ($db->alterTable($tablename, $dd, $info, $rev_aggressive) as $key=>$status) {\n//\t\t\t\t\t\t\t\t\t\t\tif (isset($tables[$key])) echo \"$tablename, $key<br>\"; //FIXME we shouldn't echo this, already installed?\n \t\t\t\t\t\t\t\t\t\t\tif ($status == TABLE_ALTER_FAILED){\n \t\t\t\t\t\t\t\t\t\t\t\t$tables[$key] = $status;\n \t\t\t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\t\t\t$tables[$key] = ($status == TABLE_ALTER_NOT_NEEDED ? DATABASE_TABLE_EXISTED : DATABASE_TABLE_ALTERED);\n \t\t\t\t\t\t\t\t\t\t\t}", " \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\treturn $tables;\n \t}\n}", "/**\n* This is the class database\n*\n* This is the generic implementation of the database class.\n* @subpackage Database\n* @package Subsystems\n*/", "abstract class database {", "\t/**\n\t* @var string $connection Database connection string\n\t*/\n\tvar $connection = null;\n\t/**\n\t* @var boolean $havedb\n\t*/\n\tvar $havedb = false;\n\t/**\n\t* @var string $prefix Database prefix\n\t*/\n\tvar $prefix = \"\";", "\t/**\n\t * Make a connection to the Database Server\n\t *\n\t * Takes the supplied credentials (username / password) and tries to\n\t * connect to the server and select the given database. All the rules\n\t * governing database connect also govern this method.\n\t *\n\t * @param string $username The username to connect to the server as.\n\t * @param string $password The password for $username\n\t * @param string $hostname The hostname of the database server. If\n\t * localhost is specified, a local socket connection will be attempted.\n\t * @param string $database The name of the database to use. Multi-database\n\t * sites are still not yet supported.\n\t * @param bool $new Whether or not to force the PHP connection function to establish\n\t * a distinctly new connection handle to the server.\n\t */", "\t//\tfunction connect ($username, $password, $hostname, $database, $new=false) {\n\tabstract function __construct($username, $password, $hostname, $database, $new=false);", "\t /**\n\t * Create a new Table\n\t *\n\t * Creates a new database table, according to the passed data definition.\n\t *\n\t * This function abides by the Exponent Data Definition Language, and interprets\n\t * its general structure for databases.\n\t *\n\t * @param string $tablename The name of the table to create\n\t * @param array $datadef The data definition to create, expressed in\n\t * the Exponent Data Definition Language.\n\t * @param array $info Information about the table itself.\n\t * @return array\n\t */\n\tabstract function createTable($tablename, $datadef, $info);", "\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $name\n\t* @param $def\n\t* @return bool|string\n\t*/\n\tfunction fieldSQL($name, $def) {\n\t $sql = \"`$name`\";\n\t if (!isset($def[DB_FIELD_TYPE])) {\n\t return false;\n\t }\n\t $type = $def[DB_FIELD_TYPE];\n\t if ($type == DB_DEF_ID) {\n\t $sql .= \" INT(11)\";\n\t } else if ($type == DB_DEF_BOOLEAN) {\n\t $sql .= \" TINYINT(1)\";\n\t } else if ($type == DB_DEF_TIMESTAMP) {\n\t $sql .= \" INT(14)\";\n } else if ($type == DB_DEF_DATETIME) {\n \t $sql .= \" DATETIME\";\n\t } else if ($type == DB_DEF_INTEGER) {\n\t $sql .= \" INT(8)\";\n\t } else if ($type == DB_DEF_STRING) {\n\t if (isset($def[DB_FIELD_LEN]) && is_int($def[DB_FIELD_LEN])) {\n\t $len = $def[DB_FIELD_LEN];\n\t if ($len < 256)\n\t $sql .= \" VARCHAR($len)\";\n\t else if ($len < 65536)\n\t $sql .= \" TEXT\";\n\t else if ($len < 16777216)\n\t $sql .= \" MEDIUMTEXT\";\n\t else\n\t $sql .= \"LONGTEXT\";\n\t } else { // default size of 'TEXT'instead of error\n $sql .= \" TEXT\";\n\t }\n\t } else if ($type == DB_DEF_DECIMAL) {\n\t $sql .= \" DOUBLE\";\n\t } else {\n\t return false; // must specify known FIELD_TYPE\n\t }\n\t $sql .= \" NOT NULL\";\n\t if (isset($def[DB_DEFAULT]))\n\t $sql .= \" DEFAULT '\" . $def[DB_DEFAULT] . \"'\";", "\t if (isset($def[DB_INCREMENT]) && $def[DB_INCREMENT])\n\t $sql .= \" AUTO_INCREMENT\";\n\t return $sql;\n\t}", "\t/**\n\t* Switch field values between two entries in a Table\n\t*\n\t* Switches values between two table entries for things like swapping rank, etc...\n\t* @param $table\n\t* @param $field\n\t* @param $a\n\t* @param $b\n\t* @param null $additional_where\n\t* @return bool\n\t*/\n\tfunction switchValues($table, $field, $a, $b, $additional_where = null) {\n\t if ($additional_where == null) {\n\t $additional_where = '1';\n\t }\n $a = intval($a);\n $b = intval($b);\n\t $object_a = $this->selectObject($table, \"$field='$a' AND $additional_where\");\n\t $object_b = $this->selectObject($table, \"$field='$b' AND $additional_where\");", "\t if ($object_a && $object_b) {\n\t $tmp = $object_a->$field;\n\t $object_a->$field = $object_b->$field;\n\t $object_b->$field = $tmp;", "\t $this->updateObject($object_a, $table);\n\t $this->updateObject($object_b, $table);", "\t return true;\n\t } else {\n\t return false;\n\t }\n\t}", "\t/**\n\t* Checks to see if the connection for this database object is valid.\n\t* @return bool True if the connection can be used to execute SQL queries.\n\t*/\n\tfunction isValid() {\n\t return ($this->connection != null && $this->havedb);\n\t}", "\t/**\n\t* Test the privileges of the user account for the connection.\n\t* Tests run include:\n\t* <ul>\n\t* <li>CREATE TABLE</li>\n\t* <li>INSERT</li>\n\t* <li>SELECT</li>\n\t* <li>UPDATE</li>\n\t* <li>DELETE</li>\n\t* <li>ALTER TABLE</li>\n\t* <li>DROP TABLE</li>\n\t* </ul>\n\t* These tests must be performed in order, for logical reasons. Execution\n\t* terminates when the first test fails, and the status flag array is returned then.\n\t* Returns an array of status flags. Key is the test name. Value is a boolean,\n\t* true if the test succeeded, and false if it failed.\n\t* @return array\n\t*/\n\tfunction testPrivileges() {", "\t $status = array();", "\t $tablename = \"___testertable\" . uniqid(\"\");\n\t $dd = array(\n\t \"id\" => array(\n\t DB_FIELD_TYPE => DB_DEF_ID,\n\t DB_PRIMARY => true,\n\t DB_INCREMENT => true),\n\t \"name\" => array(\n\t DB_FIELD_TYPE => DB_DEF_STRING,\n\t DB_FIELD_LEN => 100)\n\t );", "\t $this->createTable($tablename, $dd, array());\n\t if (!$this->tableExists($tablename)) {\n\t $status[\"CREATE TABLE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"CREATE TABLE\"] = true;", "\t $o = new stdClass();\n\t $o->name = \"Testing Name\";\n\t $insert_id = $this->insertObject($o, $tablename);\n\t if ($insert_id == 0) {\n\t $status[\"INSERT\"] = false;\n\t return $status;\n\t } else\n\t $status[\"INSERT\"] = true;", "\t $o = $this->selectObject($tablename, \"id=\" . $insert_id);\n\t if ($o == null || $o->name != \"Testing Name\") {\n\t $status[\"SELECT\"] = false;\n\t return $status;\n\t } else\n\t $status[\"SELECT\"] = true;", "\t $o->name = \"Testing 2\";\n\t if (!$this->updateObject($o, $tablename)) {\n\t $status[\"UPDATE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"UPDATE\"] = true;", "\t $this->delete($tablename, \"id=\" . $insert_id);\n\t $o = $this->selectObject($tablename, \"id=\" . $insert_id);\n\t if ($o != null) {\n\t $status[\"DELETE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"DELETE\"] = true;", "\t $dd[\"thirdcol\"] = array(\n\t DB_FIELD_TYPE => DB_DEF_TIMESTAMP);", "\t $this->alterTable($tablename, $dd, array());\n\t $o = new stdClass();\n\t $o->name = \"Alter Test\";\n\t $o->thirdcol = \"Third Column\";\n\t if (!$this->insertObject($o, $tablename)) {\n\t $status[\"ALTER TABLE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"ALTER TABLE\"] = true;", "\t $this->dropTable($tablename);\n\t if ($this->tableExists($tablename)) {\n\t $status[\"DROP TABLE\"] = false;\n\t return $status;\n\t } else\n\t $status[\"DROP TABLE\"] = true;", "\t foreach ($this->getTables() as $t) {\n\t if (substr($t, 0, 14 + strlen($this->prefix)) == $this->prefix . \"___testertable\")\n\t $this->dropTable($t);\n\t }", "\t return $status;\n\t}", "\t/**\n\t* Alter an existing table\n\t*\n\t* Alters the structure of an existing database table to conform to the passed\n\t* data definition.\n\t*\n\t* This function abides by the Exponent Data Definition Language, and interprets\n\t* its general structure for databases.\n\t*\n\t* @param string $tablename The name of the table to alter\n\t* @param array $newdatadef The new data definition for the table.\n\t* This is expressed in the Exponent Data Definition Language\n\t* @param array $info Information about the table itself.\n\t* @param bool $aggressive Whether or not to aggressively update the table definition.\n\t* An aggressive update will drop columns in the table that are not in the Exponent definition.\n\t* @return array\n\t*/\n\tabstract function alterTable($tablename, $newdatadef, $info, $aggressive = false);", "\t/**\n\t* Drop a table from the database\n\t*\n\t* Removes an existing table from the database. Returns true if the table was dropped, false if there\n\t* was an error returned by the database server.\n\t*\n\t* @param string $table The name of the table to drop.\n\t* @return bool\n\t*/\n\tabstract function dropTable($table);", "\t/**\n\t * Run raw SQL. Returns true if the query succeeded, and false\n\t * if an error was returned from the database server.\n\t *\n\t * <div style=\"color:red\">If you can help it, do not use this function. It presents Database Portability Issues.</div>\n\t *\n\t * Runs a straight SQL query on the database. This is not a\n\t * very portable way of dealing with the database, and is only\n\t * provided as a last resort.\n\t *\n\t * @param string $sql The SQL query to run\n\t * @param bool $escape\n\t * @return mixed\n\t */\n\tabstract function sql($sql, $escape = true);", "\t/**\n\t * Toggle a boolean value in a Table Entry\n\t *\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return void\n\t */\n\tfunction toggle($table, $col, $where=null) {\n\t $obj = $this->selectObject($table, $where);\n\t $obj->$col = ($obj->$col == 0) ? 1 : 0;\n\t $this->updateObject($obj, $table);\n\t}", "\t/**\n\t * Update a column in all records in a table\n\t *\n\t * @param $table\n\t * @param $col\n\t * @param $val\n\t * @param int|null $where\n\t * @return void\n\t */\n\tabstract function columnUpdate($table, $col, $val, $where=1);", "\t/**\n\t * @param $object\n\t * @param $table\n\t * @param $col\n\t * @param int|null $where\n\t * @return bool\n\t */\n\tfunction setUniqueFlag($object, $table, $col, $where=1) {\n\t if (isset($object->id)) {\n\t $this->sql(\"UPDATE \" . $this->prefix . $table . \" SET \" . $col . \"=0 WHERE \" . $where);\n\t $this->sql(\"UPDATE \" . $this->prefix . $table . \" SET \" . $col . \"=1 WHERE id=\" . $object->id);\n\t return true;\n\t }\n\t return false;\n\t}", "\t/**\n\t* Select a series of objects\n\t*\n\t* Selects a set of objects from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a set of records from a database table. Returns an\n\t* array of objects, in any random order.\n\t*\n\t* @param string $table The name of the table/object to look at\n\t* @param string $where Criteria used to narrow the result set. If this\n\t* is specified as null, then no criteria is applied, and all objects are\n\t* returned\n\t* @param null $orderby\n\t* @return array\n\t*/\n\tabstract function selectObjects($table, $where = null, $orderby = null);", "\t/**\n\t * @param $terms\n\t * @param null $where\n\t * @return array\n\t */\n\tfunction selectSearch($terms, $where = null) { //FIXME never used", "\t}", "\t/**\n\t * @param null $colsA\n\t * @param null $colsB\n\t * @param $tableA\n\t * @param $tableB\n\t * @param $keyA\n\t * @param null $keyB\n\t * @param null $where\n\t * @param null $orderby\n\t * @return array'\n\t */\n\tfunction selectAndJoinObjects($colsA=null, $colsB=null, $tableA, $tableB, $keyA, $keyB=null, $where = null, $orderby = null) { //FIXME never used", "\t}", "\t/**\n\t * Select a single object by sql\n\t *\n\t * @param $sql\n\t * @return null|void\n\t */\n\tabstract function selectObjectBySql($sql);", "\t/**\n\t * Select a series of objects by sql\n\t *\n\t * @param $sql\n\t * @return array\n\t */\n\tabstract function selectObjectsBySql($sql);", "\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @param null $orderby\n\t * @param bool $distinct\n\t * @return array\n\t */\n\tabstract function selectColumn($table, $col, $where = null, $orderby = null, $distinct=false);", "\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return int\n\t */\n\tfunction selectSum($table, $col, $where = null) { //FIXME never used", "\t}", "\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @param null $orderby\n\t * @return array\n\t */\n\tabstract function selectDropdown($table, $col, $where = null, $orderby = null);", "\t/**\n\t * @param $table\n\t * @param $col\n\t * @param null $where\n\t * @return null\n\t */\n\tabstract function selectValue($table, $col, $where=null);", "\t/**\n\t * @param $sql\n\t * @return null\n\t */\n\tfunction selectValueBySql($sql) { //FIXME never used", "\t}", "\t/**\n\t* This function takes an array of indexes and returns an array with the objects associated with each id\n\t* @param $table\n\t* @param array $array\n\t* @param null $orderby\n\t* @return array\n\t*/\n\tfunction selectObjectsInArray($table, $array=array(), $orderby=null) {\n\t $where = 'id IN ' . implode(\",\", $array);\n\t $res = $this->selectObjects($table, $where, $orderby);\n\t return $res;\n\t}", "\t/**\n\t* Select a series of objects, and return by ID\n\t*\n\t* Selects a set of objects from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a set of records from a database table. Returns an\n\t* array of objects, in any random order. The indices of the array\n\t* are the IDs of the objects.\n\t*\n\t* @param string $table The name of the table/object to look at\n\t* @param string $where Criteria used to narrow the result set. If this\n\t* is specified as null, then no criteria is applied, and all objects are\n\t* returned\n\t* @param null $orderby\n\t* @return array\n\t*/\n\tabstract function selectObjectsIndexedArray($table, $where = null, $orderby = null);", " /**\n * Count Objects matching a given criteria\n *\n * @param string $table The name of the table to count objects in.\n * @param string $where Criteria for counting.\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return int\n */\n\tabstract function countObjects($table, $where = null, $is_revisioned=false, $needs_approval=false);", "\t/**\n\t* Count Objects matching a given criteria using raw sql\n\t*\n\t* @param string $sql The sql query to be run\n\t* @return int\n\t*/\n\tabstract function countObjectsBySql($sql);", "\t/**\n\t* Count Objects matching a given criteria using raw sql\n\t*\n\t* @param string $sql The sql query to be run\n\t* @return int|void\n\t*/\n\tfunction queryRows($sql) { //FIXME never used", "\t}", "\t/**\n\t* Select a single object.\n\t*\n\t* Selects an objects from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a single record from a database table. Returns the\n\t* first record/object found (in the case of multiple-result queries,\n\t* there is no way to determine which of the set will be returned).\n\t* If no record(s) match the query, null is returned.\n\t*\n\t* @param string $table The name of the table/object to look at\n\t* @param string $where Criteria used to narrow the result set.\n\t* @return object|null|void\n\t*/\n\tabstract function selectObject($table, $where);", "\t/**\n\t * @param $table\n\t * @param string $lockType\n\t * @return mixed\n\t */\n\tabstract function lockTable($table,$lockType=\"WRITE\");", "\t/**\n\t * @return mixed\n\t */\n\tabstract function unlockTables();", "\t/**\n\t* Insert an Object into some table in the Database\n\t*\n\t* This method will return the ID assigned to the new record by database. Note that\n\t* object attributes starting with an underscore ('_') will be ignored and NOT inserted\n\t* into the table as a field value.\n\t*\n\t* @param object $object The object to insert.\n\t* @param string $table The logical table name to insert into. This does not include the table prefix, which\n\t* is automagically prepended for you.\n\t* @return int|void\n\t*/\n\tabstract function insertObject($object, $table);", "\t/**\n\t* Delete one or more objects from the given table.\n\t*\n\t* @param string $table The name of the table to delete from.\n\t* @param string $where Criteria for determining which record(s) to delete.\n\t* @return mixed\n\t*/\n\tabstract function delete($table, $where = null);", "\t/**\n\t* Update one or more objects in the database.\n\t*\n\t* This function will only update the attributes of the resulting record(s)\n\t* that are also member attributes of the $object object.\n\t*\n\t* @param object $object An object specifying the fields and values for updating.\n\t* In most cases, this will be the altered object originally returned from one of\n\t* the select* methods.\n\t* @param string $table The table to update in.\n\t* @param string $where Optional criteria used to narrow the result set.\n\t* @param string $identifier\n\t* @param bool $is_revisioned\n\t* @return bool|int|void\n\t*/\n\tabstract function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false);", " /**\n * Reduces table item revisions to a passed total\n *\n * @param string $table The name of the table to trim\n * @param integer $id The item id\n * @param integer $num The number of revisions to retain\n * @param int $workflow is workflow turned on (or force)\n */\n public function trim_revisions($table, $id, $num, $workflow=ENABLE_WORKFLOW) {\n if ($workflow && $num) {\n $max_revision = $this->max($table, 'revision_id', null, 'id='.$id);\n $max_approved = $this->max($table, 'revision_id', null, 'id='.$id.' AND approved=1');\n $min_revision = $this->min($table, 'revision_id', null, 'id='.$id);\n if ($max_revision == null) {\n return;\n }\n if (($max_revision - $num) > $max_approved) {\n $approved_max = ' AND revision_id < ' . $max_approved; // never delete most recent approved item\n } else {\n $approved_max = '';\n }\n if ($max_revision - $min_revision >= $num) {\n $this->delete($table, 'id=' . $id . ' AND revision_id <= ' . ($max_revision - $num) . $approved_max);\n }\n if (!empty($approved_max)) {\n // we've trimmed all the fat below the newest approved item, now trim the dead wood above it\n $this->delete($table, 'id=' . $id . ' AND revision_id <= ' . ($max_revision - $num + 1) . ' AND revision_id > ' . $max_approved);\n }\n }\n }", "\t/**\n\t * Find the maximum value of a field. This is similar to a standard\n\t * SELECT MAX(field) ... query.\n\t *\n\t * @param string $table The name of the table to select from.\n\t * @param string $attribute The attribute name to find a maximum value for.\n\t * @param string $groupfields A comma-separated list of fields (or a single field) name, used\n\t * for a GROUP BY clause. This can also be passed as an array of fields.\n\t * @param string $where Optional criteria for narrowing the result set.\n\t * @return mixed\n\t */\n\tabstract function max($table, $attribute, $groupfields = null, $where = null);", "\t/**\n\t * Find the minimum value of a field. This is similar to a standard\n\t * SELECT MIN(field) ... query.\n\t *\n\t * @internal Internal\n\t * @param string $table The name of the table to select from.\n\t * @param string $attribute The attribute name to find a minimum value for.\n\t * @param string $groupfields A comma-separated list of fields (or a single field) name, used\n\t * for a GROUP BY clause. This can also be passed as an array of fields.\n\t * @param string $where Optional criteria for narrowing the result set.\n\t * @return null\n\t */\n\tabstract function min($table, $attribute, $groupfields = null, $where = null);", "\t/**\n\t* Increment a numeric table field in a table.\n\t*\n\t* @param string $table The name of the table to increment in.\n\t* @param string $field The field to increment.\n\t* @param integer $step The step value. Usually 1. This can be negative, to\n\t* decrement, but the decrement() method is preferred, for readability.\n\t* @param string $where Optional criteria to determine which records to update.\n\t* @return mixed\n\t*/\n\tabstract function increment($table, $field, $step, $where = null);", "\t/**\n\t* Decrement a numeric table field in a table.\n\t*\n\t* @param string $table The name of the table to decrement in.\n\t* @param string $field The field to decrement.\n\t* @param integer $step The step value. Usually 1. This can be negative, to\n\t* increment, but the increment() method is preferred, for readability.\n\t* @param string $where Optional criteria to determine which records to update.\n\t*/", "\tfunction decrement($table, $field, $step, $where = null) {\n\t $this->increment($table, $field, -1 * $step, $where);\n\t}", "\t/**\n\t* Check to see if the named table exists in the database.\n\t* Returns true if the table exists, and false if it doesn't.\n\t*\n\t* @param string $table Name of the table to look for.\n\t* @return bool\n\t*/\n\tabstract function tableExists($table);", "\t/**\n\t* Get a list of all tables in the database. Optionally, only the tables\n\t* in the current logical database (tables with the same prefix) can\n\t* be retrieved.\n\t*\n\t* @param bool $prefixed_only Whether to return only the tables\n\t* for the logical database, or all tables in the physical database.\n\t* @return array\n\t*/\n\tabstract function getTables($prefixed_only=true);", "\t/**\n\t* Runs whatever table optimization routines the database engine supports.\n\t*\n\t* @param string $table The name of the table to optimize.\n\t* @return bool\n\t*/\n\tabstract function optimize($table);", "\t/**\n\t* Retrieve table information for a named table.\n\t* Returns an object, with the following attributes:\n\t* <ul>\n\t* <li><b>rows</b> -- The number of rows in the table.</li>\n\t* <li><b>average_row_length</b> -- The average storage size of a row in the table.</li>\n\t* <li><b>data_total</b> -- How much total disk space is used by the table.</li>\n\t* <li><b>data_overhead</b> -- How much storage space in the table is unused (for compacting purposes)</li>\n\t* </ul>\n\t* @param $table\n\t* @return null\n\t*/\n\tfunction tableInfo($table) { //FIXME never used", "\t}", "\t/**\n\t* Check whether or not a table in the database is empty (0 rows).\n\t* Returns tue of the specified table has no rows, and false if otherwise.\n\t*\n\t* @param string $table Name of the table to check.\n\t* @return bool\n\t*/\n\tfunction tableIsEmpty($table) {\n\t return ($this->countObjects($table) == 0);\n\t}", "\t/**\n\t* Returns table information for all tables in the database.\n\t* This function effectively calls tableInfo() on each table found.\n\t* @return array\n\t*/\n\tabstract function databaseInfo();", "\t/**\n\t* This is an internal function for use only within the database database class\n\t* @internal Internal\n\t* @param $status\n\t* @return null\n\t*/\n\tfunction translateTableStatus($status) {\n\t $data = new stdClass();\n\t $data->rows = $status->Rows;\n\t $data->average_row_lenth = $status->Avg_row_length;\n\t $data->data_overhead = $status->Data_free;\n\t $data->data_total = $status->Data_length;", "\t return $data;\n\t}", "\t/**\n\t * @param $table\n\t * @return array\n\t */\n\tfunction describeTable($table) { //FIXME never used", "\t}", "\t/**\n\t* Build a data definition from a pre-existing table. This is used\n\t* to intelligently alter tables that have already been installed.\n\t*\n\t* @param string $table The name of the table to get a data definition for.\n\t* @return array|null\n\t*/\n\tabstract function getDataDefinition($table);", "\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int\n\t*/\n\tfunction getDDFieldType($fieldObj) {\n\t $type = strtolower($fieldObj->Type);", "\t if ($type == \"int(11)\")\n\t return DB_DEF_ID;\n\t if ($type == \"int(8)\")\n\t return DB_DEF_INTEGER;\n\t elseif ($type == \"tinyint(1)\")\n\t return DB_DEF_BOOLEAN;\n\t elseif ($type == \"int(14)\")\n\t return DB_DEF_TIMESTAMP;\n elseif ($type == \"datetime\")\n \t return DB_DEF_TIMESTAMP;\n\t //else if (substr($type,5) == \"double\")\n //return DB_DEF_DECIMAL;\n\t elseif ($type == \"double\")\n\t return DB_DEF_DECIMAL;\n\t // Strings\n\t elseif ($type == \"text\" || $type == \"mediumtext\" || $type == \"longtext\" || strpos($type, \"varchar(\") !== false) {\n\t return DB_DEF_STRING;\n\t } else {\n return DB_DEF_INTEGER;\n }\n\t}", "\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDStringLen($fieldObj) {\n\t $type = strtolower($fieldObj->Type);\n\t if ($type == \"text\")\n\t return 65535;\n\t else if ($type == \"mediumtext\")\n\t return 16777215;\n\t else if ($type == \"longtext\")\n\t return 16777216;\n\t else if (strpos($type, \"varchar(\") !== false) {\n\t return str_replace(array(\"varchar(\", \")\"), \"\", $type) + 0;\n\t } else {\n return 256;\n }\n\t}", "\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDKey($fieldObj) {\n\t $key = strtolower($fieldObj->Key);\n\t if ($key == \"pri\")\n\t return DB_PRIMARY;\n\t else if ($key == \"uni\") {\n\t return DB_UNIQUE;\n\t } else {\n return false;\n }\n\t}", "\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDAutoIncrement($fieldObj) {\n\t $auto = strtolower($fieldObj->Extra);\n\t if ($auto == \"auto_increment\") {\n\t return true;\n\t } else {\n return false;\n }\n\t}", "\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDIsNull($fieldObj) {\n\t $null = strtolower($fieldObj->Null);\n\t if ($null == \"yes\") {\n\t return true;\n\t } else {\n return false;\n }\n\t}", "\t/**\n\t* This is an internal function for use only within the database class\n\t* @internal Internal\n\t* @param $fieldObj\n\t* @return int|mixed\n\t*/\n\tfunction getDDDefault($fieldObj) {\n\t\treturn strtolower($fieldObj->Default);\n\t}", "\t/**\n\t* Returns an error message from the database server. This is intended to be\n\t* used by the implementers of the database wrapper, so that certain\n\t* cryptic error messages can be reworded.\n\t* @return string\n\t*/\n\tabstract function error();", "\t/**\n\t* Checks whether the database connection has experienced an error.\n\t* @return bool\n\t*/\n\tabstract function inError();", "\t/**", "\t * Escape a string based on the database connection", "\t * @param $string\n\t * @return string\n\t */\n\tabstract function escapeString($string);", " /**", " \t * Attempt to prevent a sql injection", " \t * @param $string\n \t * @return string\n \t */\n \tfunction injectProof($string) {\n \t $quotes = substr_count(\"'\", $string);\n if ($quotes % 2 != 0)\n $string = $this->escapeString($string);\n $dquotes = substr_count('\"', $string);\n if ($dquotes % 2 != 0)\n $string = $this->escapeString($string);\n return $string;\n }", "\t/**\n\t * Create a SQL \"limit\" phrase\n\t *\n\t * @param $num\n\t * @param $offset\n\t * @return string\n\t */\n\tfunction limit($num, $offset) {\n\t return ' LIMIT ' . $offset . ',' . $num . ' ';\n\t}", "\t/**\n\t* Select an array of arrays\n\t*\n\t* Selects a set of arrays from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a set of records from a database table. Returns an\n\t* array of arrays, in any random order.\n\t*\n\t* @param string $table The name of the table/object to look at\n\t* @param string $where Criteria used to narrow the result set. If this\n\t* is specified as null, then no criteria is applied, and all objects are\n\t* returned\n\t* @param string $orderby\n\t* @return array\n\t*/\n\tabstract function selectArrays($table, $where = null, $orderby = null);", "\t/**\n\t* Select an array of arrays\n\t*\n\t* Selects a set of arrays from the database. Because of the way\n\t* Exponent handles objects and database tables, this is akin to\n\t* SELECTing a set of records from a database table. Returns an\n\t* array of arrays, in any random order.\n\t*\n\t* @param string $sql The name of the table/object to look at\n\t* @return array\n\t*/\n\tabstract function selectArraysBySql($sql);", " /**\n * Select a record from the database as an array\n * Selects a set of arrays from the database. Because of the way\n * Exponent handles objects and database tables, this is akin to\n * SELECTing a set of records from a database table. Returns an\n * array of arrays, in any random order.\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param null $orderby\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return array|void\n */\n\tabstract function selectArray($table, $where = null, $orderby = null, $is_revisioned=false, $needs_approval=false);", " /**\n\t * Instantiate objects from selected records from the database\n *\n * @param string $table The name of the table/object to look at\n * @param string $where Criteria used to narrow the result set. If this\n * is specified as null, then no criteria is applied, and all objects are\n * returned\n * @param $classname\n * @param bool $get_assoc\n * @param bool $get_attached\n * @param array $except\n * @param bool $cascade_except\n * @param null $order\n * @param null $limitsql\n * @param bool $is_revisioned\n * @param bool $needs_approval\n *\n * @return array\n */\n\tabstract function selectExpObjects($table, $where=null, $classname, $get_assoc=true, $get_attached=true, $except=array(), $cascade_except=false, $order=null, $limitsql=null, $is_revisioned=false, $needs_approval=false);", "\t/**\n\t * Instantiate objects from selected records from the database\n\t *\n\t* @param string $sql The sql statement to run on the model/classname\n\t* @param string $classname Can be $this->baseclassname\n\t* Returns an array of fields\n\t* @param bool $get_assoc\n\t* @param bool $get_attached\n\t* @return array\n\t*/\n\tfunction selectExpObjectsBySql($sql, $classname, $get_assoc=true, $get_attached=true) { //FIXME never used", "\t}", "\t/**\n\t * @param $table\n\t * @return array\n\t */\n\tfunction selectNestedTree($table) {\n\t $sql = 'SELECT node.*, (COUNT(parent.sef_url) - 1) AS depth\n\t\tFROM `' . $this->prefix . $table . '` AS node,\n\t\t`' . $this->prefix . $table . '` AS parent\n\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\tGROUP BY node.sef_url\n\t\tORDER BY node.lft';\n\t return $this->selectObjectsBySql($sql);\n\t}", "\tfunction selectFormattedNestedTree($table) {\n\t\t$sql = \"SELECT CONCAT( REPEAT( '&#160;&#160;&#160;', (COUNT(parent.title) -1) ), node.title) AS title, node.id\n\t\t\t\tFROM \" .$this->prefix . $table. \" as node, \" .$this->prefix . $table. \" as parent\n\t\t\t\tWHERE node.lft BETWEEN parent.lft and parent.rgt\n\t\t\t\tGROUP BY node.title, node.id\n\t\t\t\tORDER BY node.lft\";", "\t\treturn $this->selectObjectsBySql($sql);\n\t}", "\t/**\n\t * @param $table\n\t * @param $start\n\t * @param $width\n\t * @return void\n\t */\n\tfunction adjustNestedTreeFrom($table, $start, $width) {\n\t $table = $this->prefix . $table;\n\t $this->sql('UPDATE `' . $table . '` SET rgt = rgt + ' . $width . ' WHERE rgt >=' . $start);\n\t $this->sql('UPDATE `' . $table . '` SET lft = lft + ' . $width . ' WHERE lft >=' . $start);\n\t //eDebug('UPDATE `'.$table.'` SET rgt = rgt + '.$width.' WHERE rgt >='.$start);\n\t //eDebug('UPDATE `'.$table.'` SET lft = lft + '.$width.' WHERE lft >='.$start);\n\t}", "\t/**\n\t * @param $table\n\t * @param $lft\n\t * @param $rgt\n\t * @param $width\n\t * @return void\n\t */\n\tfunction adjustNestedTreeBetween($table, $lft, $rgt, $width) {\n\t $table = $this->prefix . $table;\n\t $this->sql('UPDATE `' . $table . '` SET rgt = rgt + ' . $width . ' WHERE rgt BETWEEN ' . $lft . ' AND ' . $rgt);\n\t $this->sql('UPDATE `' . $table . '` SET lft = lft + ' . $width . ' WHERE lft BETWEEN ' . $lft . ' AND ' . $rgt);\n\t //eDebug('UPDATE `'.$table.'` SET rgt = rgt + '.$width.' WHERE rgt BETWEEN '.$lft.' AND '.$rgt);\n\t //eDebug('UPDATE `'.$table.'` SET lft = lft + '.$width.' WHERE lft BETWEEN '.$lft.' AND '.$rgt);\n\t}", "\t/**\n\t * @param $table\n\t * @param null $node\n\t * @return array\n\t */\n\tfunction selectNestedBranch($table, $node=null) {\n\t if (empty($node))\n\t return array();", "\t $where = is_numeric($node) ? 'id=' . $node : 'title=\"' . $node . '\"';\n//\t global $db;\n\t $sql = 'SELECT node.*,\n\t (COUNT(parent.title) - (sub_tree.depth + 1)) AS depth\n\t FROM `' . $this->prefix . $table . '` AS node,\n\t `' . $this->prefix . $table . '` AS parent,\n\t `' . $this->prefix . $table . '` AS sub_parent,\n\t ( SELECT node.*, (COUNT(parent.title) - 1) AS depth\n\t FROM `' . $this->prefix . $table . '` AS node,\n\t `' . $this->prefix . $table . '` AS parent\n\t WHERE node.lft BETWEEN parent.lft\n\t AND parent.rgt AND node.' . $where . '\n\t GROUP BY node.title\n\t ORDER BY node.lft )\n\t AS sub_tree\n\t WHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t AND node.lft BETWEEN sub_parent.lft AND sub_parent.rgt\n\t AND sub_parent.title = sub_tree.title\n\t GROUP BY node.title\n\t ORDER BY node.lft;';", "\t return $this->selectObjectsBySql($sql);\n\t}", "\t/**\n\t * @param $table\n\t * @param $lft\n\t * @param $rgt\n\t * @return void\n\t */\n\tfunction deleteNestedNode($table, $lft, $rgt) {\n\t $table = $this->prefix . $table;", "\t $width = ($rgt - $lft) + 1;\n\t $this->sql('DELETE FROM `' . $table . '` WHERE lft BETWEEN ' . $lft . ' AND ' . $rgt);\n\t $this->sql('UPDATE `' . $table . '` SET rgt = rgt - ' . $width . ' WHERE rgt > ' . $rgt);\n\t $this->sql('UPDATE `' . $table . '` SET lft = lft - ' . $width . ' WHERE lft > ' . $rgt);\n\t}", "\t/**\n\t * @param $table\n\t * @param null $node\n\t * @return array\n\t */\n\tfunction selectPathToNestedNode($table, $node=null) {\n\t if (empty($node))\n\t return array();", "\t $where = is_numeric($node) ? 'id=' . $node : 'title=\"' . $node . '\"';\n\t $sql = 'SELECT parent.*\n\t\tFROM `' . $this->prefix . $table . '` AS node,\n\t\t`' . $this->prefix . $table . '` AS parent\n\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\tAND node.' . $where . '\n\t\tORDER BY parent.lft;';\n\t return $this->selectObjectsBySql($sql);\n\t}", "\t/**\n\t * @param $table\n\t * @param null $node\n\t * @return array\n\t */\n\tfunction selectNestedNodeParent($table, $node=null) {\n\t if (empty($node))\n\t return array();", "\t $where = is_numeric($node) ? 'id=' . $node : 'title=\"' . $node . '\"';\n\t $sql = 'SELECT parent.*\n\t\tFROM `' . $this->prefix . $table . '` AS node,\n\t\t`' . $this->prefix . $table . '` AS parent\n\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\tAND node.' . $where . '\n\t\tORDER BY parent.lft DESC\n\t\tLIMIT 1, 1;';\n\t $parent_array = $this->selectObjectsBySql($sql);\n\t return $parent_array[0];\n\t}", "\t/**\n\t * @param $table\n\t * @param null $node\n\t * @return array\n\t */\n\tfunction selectNestedNodeChildren($table, $node=null) {\n\t if (empty($node))\n\t return array();", "\t $where = is_numeric($node) ? 'node.id=' . $node : 'node.title=\"' . $node . '\"';\n\t $sql = '\n\t\tSELECT node.*, (COUNT(parent.title) - (sub_tree.depth + 1)) AS depth\n\t\tFROM ' . $this->prefix . $table . ' AS node,\n\t\t\t' . $this->prefix . $table . ' AS parent,\n\t\t\t' . $this->prefix . $table . ' AS sub_parent,\n\t\t\t(\n\t\t\t\tSELECT node.*, (COUNT(parent.title) - 1) AS depth\n\t\t\t\tFROM ' . $this->prefix . $table . ' AS node,\n\t\t\t\t' . $this->prefix . $table . ' AS parent\n\t\t\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\t\t\tAND ' . $where . '\n\t\t\t\tGROUP BY node.title\n\t\t\t\tORDER BY node.lft\n\t\t\t)AS sub_tree\n\t\tWHERE node.lft BETWEEN parent.lft AND parent.rgt\n\t\t\tAND node.lft BETWEEN sub_parent.lft AND sub_parent.rgt\n\t\t\tAND sub_parent.title = sub_tree.title\n\t\tGROUP BY node.title\n\t\tHAVING depth = 1\n\t\tORDER BY node.lft;';\n\t$children = $this->selectObjectsBySql($sql);\n\t return $children;\n\t}", "\t/**\n\t * This function returns all the text columns in the given table\n\t * @param $table\n\t * @return array\n\t */\n\tabstract function getTextColumns($table);", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expPaginator\n * Exponent Pagination Subsystem\n *\n * The expPaginator class is used to retrieve objects from the database\n * and paginate them and optionally group the by category.\n * It automagically handles the calls to other pages\n * and has built-in sorting using the defined column headers.", " * ", " * Usage Example:", " * ", " * <code>\n *\n * $page = new expPaginator(array(\n * 'model'=>'faq',", " * 'where'=>1, ", " * 'limit'=>25,\n * 'order'=>'rank',\n * 'controller'=>$this->baseclassname,\n * 'action'=>$this->params['action'],\n * 'columns'=>array('In FAQ'=>'include_in_faq', 'Submitted'=>'created_at', 'Submitted By'=>'submitter_name'),\n * ));\n * </code>", " * ", " * @package Subsystems\n * @subpackage Subsystems\n */", "class expPaginator {\n /**#@+\n * @access public\n * @var string\n */\n\tpublic $model = null;\n public $search_string = '';\n\tpublic $sql = '';\n public $count_sql = '';", "\tpublic $where = '';\t", "\tpublic $controller = '';\n\tpublic $action = '';\n\tpublic $order = '';\n\tpublic $order_direction = '';\n\tpublic $firstpage = '';\n\tpublic $lastpage = '';\n\tpublic $previous_page = '';\n\tpublic $next_page = '';\n\tpublic $previous_shift = '';\n\tpublic $next_shift = '';\n\tpublic $pagelink = '';\n\tpublic $header_columns = '';\n\tpublic $default = '';\n\tpublic $view = null;\n public $uncat ='';\n// public $content_type = '';\n// public $author = '';\n// public $tag = '';\n// public $tags = '';\n\t/**#@+\n * @access public\n * @var integer\n */\n\tpublic $page = 1;\n//\tpublic $limit = 10;\n public $limit = 0;\n\tpublic $start = 0;\n\tpublic $last = 0;\n\tpublic $pages_to_show = 10;\n\tpublic $total_records = 0;\n\tpublic $total_pages = 0;\n\tpublic $page_offset = 0;\n public $categorize = false;\n// public $version = 0;\n// public $content_id = 0;\n\t/**#@+\n * @access public\n * @var array", " */\t", "\tpublic $pages = array();\n\tpublic $records = array();\n public $cats = array();\n public $sort_dropdown = array();", "\t/**\n\t * expPaginator Constructor\n\t *\n\t * This is the main entry point for using the expPaginator. See example above.\n\t *\n\t * @param array $params Use this to set any of the class variables. Ones not passed will be set to a default.\n\t * @return \\expPaginator\n\t */\n\tpublic function __construct($params=array()) {", "\t\tglobal $router,$db;", "\n $this->pages_to_show = expTheme::is_mobile() ? 6 : 10; // fewer paging links for small devices\n\t\t$this->where = empty($params['where']) ? null : $params['where'];\n\t\t$this->records = empty($params['records']) ? array() : $params['records'];\n//\t\t$this->limit = empty($params['limit']) ? 10 : $params['limit'];", " $this->limit = empty($params['limit']) ? 0 : $params['limit'];", " $this->page = empty($params['page']) ? 1 : intval($params['page']);\n\t\t$this->action = empty($params['action']) ? '' : $params['action'];\n\t\t$this->controller = empty($params['controller']) ? '' : $params['controller'];\n\t\t$this->sql = empty($params['sql']) ? '' : $params['sql'];\n $this->count_sql = empty($params['count_sql']) ? '' : $params['count_sql'];", "\t\t$this->order = empty($params['order']) ? 'id' : $params['order'];\n\t\t$this->dir = empty($params['dir']) ? 'ASC' : $params['dir'];\n\t\t$this->src = empty($params['src']) ? null : $params['src'];", " $this->categorize = empty($params['categorize']) ? false : $params['categorize'];\n $this->uncat = !empty($params['uncat']) ? $params['uncat'] : gt('Not Categorized');\n $this->groups = !empty($params['groups']) ? $params['groups'] : array();\n $this->grouplimit = !empty($params['grouplimit']) ? $params['grouplimit'] : null;\n $this->dontsortwithincat = !empty($params['dontsortwithincat']) ? $params['dontsortwithincat'] : null;\n $this->dontsort = !empty($params['dontsort']) ? $params['dontsort'] : null;", "\t\t// if a view was passed we'll use it.\n\t\tif (isset($params['view']))\n $this->view = $params['view'];", " // setup the model if one was passed.\n if (isset($params['model'])) {\n $this->model = $params['model'];\n $class = new $this->model(null, false, false);\n }", "\t", "\t // auto-include the CSS for pagination links\n\t expCSS::pushToHead(array(\n//\t\t \"unique\"=>\"pagination\",\n//\t\t \"link\"=>PATH_RELATIVE.\"framework/core/assets/css/pagination.css\",\n 'corecss'=>'pagination'\n\t\t )\n\t\t);", "\t\t", "\t\tif ($this->limit)\n $this->start = (($this->page * $this->limit) - $this->limit);\n if ($this->start < 0)\n $this->start = 0;", "\t\t//setup the columns\n $this->columns = array();\n\t\tif (isset($params['columns'])) {\n\t\t foreach($params['columns'] as $key=>$col){\n\t\t $colparse[$key] = explode('|',$col);\n\t\t $column = array($key=>$colparse[$key][0]);\n\t\t $this->columns = array_merge($this->columns,$column);\n\t\t if (!empty($colparse[$key][1])) {\n\t\t $params = explode(',',$colparse[$key][1]);\n\t\t foreach ($params as $paramval) {\n\t\t $prm = explode('=',$paramval);\n\t\t $this->linkables[$key][$prm[0]] = $prm[1];\n\t\t }\n\t\t }\n\t\t }\n\t\t}", "\t\t", "\t\t//setup the default ordering of records\n\t\t// if we are in an action, see if the action is for this controller/action..if so pull the order\n\t\t// and order direction from the request params...this is how the params are passed via the column\n\t\t// headers.", "\t\t$this->order_direction = $this->dir;\t", "\n // allow passing of a single order/dir as stored in config\n if (strstr($this->order,\" \")) {\n $orderby = explode(\" \",$this->order);\n $this->order = $orderby[0];\n $this->order_direction = $orderby[1];\n }", "", " if ($this->dontsort)\n $sort = null;\n else\n $sort = $this->order.' '.$this->order_direction;", "\t\t// figure out how many records we're dealing with & grab the records\n\t\t//if (!empty($this->records)) { //from Merge <~~ this doesn't work. Could be empty, but still need to hit.\n if (!empty($this->categorize))\n $limit = null;\n else\n $limit = $this->limit;", "\t\tif (isset($params['records'])) { // if we pass $params['records'], we WANT to hit this\n\t\t // sort the records that were passed in to us\n if (!empty($sort))\n usort($this->records,array('expPaginator', strtolower($this->order_direction)));\n//\t\t $this->total_records = count($this->records);\n\t\t} elseif (!empty($class)) { //where clause //FJD: was $this->class, but wasn't working...\n\t\t\t$this->total_records = $class->find('count', $this->where);\n $this->records = $class->find('all', $this->where, $sort, $limit, $this->start);\n\t\t} elseif (!empty($this->where)) { //from Merge....where clause\n\t\t\t$this->total_records = $class->find('count', $this->where);\n $this->records = $class->find('all', $this->where, $sort, $limit, $this->start);\n\t\t} else { //sql clause //FIXME we don't get attachments in this approach\n\t\t\t//$records = $db->selectObjectsBySql($this->sql);\n\t\t\t//$this->total_records = count($records);\n //this is MUCH faster if you supply a proper count_sql param using a COUNT() function; if not,\n //we'll run the standard sql and do a queryRows with it\n\t\t\t//$this->total_records = $this->count_sql == '' ? $db->queryRows($this->sql) : $db->selectValueBySql($this->count_sql); //From Merge", " ", "//\t\t\t$this->total_records = $db->countObjectsBySql($this->count_sql); //$db->queryRows($this->sql); //From most current Trunk", " if (!empty($sort)) $this->sql .= ' ORDER BY '.$sort;\n if (!empty($this->count_sql)) $this->total_records = $db->countObjectsBySql($this->count_sql);\n\t\t\tif (!empty($this->limit)) $this->sql .= ' LIMIT '.$this->start.','.$this->limit;", "\t\t\t", "\t\t\t$this->records = array();\n\t\t\tif (isset($this->model) || isset($params['model_field'])) {\n\t\t\t foreach($db->selectObjectsBySql($this->sql) as $record) {\n $type = $params['model_field'];\n\t\t\t $classname = isset($params['model_field']) ? $record->$type : $this->model;\n\t\t\t //$this->records[] = new $classname($record->id, true, true); //From current trunk // added false, true, as we shouldn't need associated items here, but do need attached. FJD.\n\t\t\t\t\t$this->records[] = new $classname($record->id, false, true); //From Merge //added false, true, as we shouldn't need associated items here, but do need attached. FJD.\n\t\t\t }\n\t\t\t} else {\n\t\t\t $this->records = $db->selectObjectsBySql($this->sql);\n\t\t\t}", "\t\t}\t", "\n // next we'll sort them based on categories if needed\n if (!empty($this->categorize) && $this->categorize && empty($this->dontsort))\n expCatController::addCats($this->records,$sort,$this->uncat,$this->groups,$this->dontsortwithincat);", " // let's see how many total records there are\n if (empty($this->total_records))\n $this->total_records = count($this->records);\n if ($this->limit && $this->start >= $this->total_records)\n $this->start = $this->total_records - $this->limit;", " // at this point we generally have all our records, now we'll trim the records to the number requested\n //FIXME we may want some more intelligent selection here based on cats/groups, e.g., don't break groups across pages, number of picture rows, etc...\n if (empty($this->grouplimit) && ($this->limit) && count($this->records) > $this->limit)\n $this->records = array_slice($this->records, $this->start, $this->limit);\n // finally, we'll create another multi-dimensional array of categories populated with assoc items\n if (empty($this->dontsort)) {\n if (!empty($this->categorize) && $this->categorize) {\n expCatController::sortedByCats($this->records,$this->cats,$this->groups,$this->grouplimit);\n } elseif (empty($this->dontsortwithincat)) { // categorized is off, so let's categorize by alpha instead for 'rolodex' type use\n $order = $this->order;\n if (in_array($order,array('created_at','edited_at','publish'))) {\n if ($this->total_records && (abs($this->records[0]->$order - $this->records[count($this->records)-1]->$order) >= (60 * 60 * 24 *365 *2))) {\n $datetype = 'Y'; // more than 2 years of records, so break down by year\n } else {\n $datetype = 'M Y'; // less than 2 years of records, so break down by month/year\n }\n foreach ($this->records as $record) {\n if (is_numeric($record->$order)) {\n $title = date($datetype,$record->$order);\n $title = empty($title)?gt('Undated'):$title;\n } else {\n $title = gt('Undated');\n }\n if (empty($this->cats[$title])) {\n $this->cats[$title] = new stdClass();\n $this->cats[$title]->count = 1;\n $this->cats[$title]->name = $title;\n } else {\n $this->cats[$title]->count++;\n }\n $this->cats[$title]->records[] = $record;\n }\n } else {\n foreach ($this->records as $record) {\n if (!empty($record->$order) && is_string($record->$order) && !is_numeric($record->$order)) {\n $title = ucfirst($record->$order);\n $title = empty($title[0])?'':$title[0];\n } else {\n $title = '';\n }\n if (empty($this->cats[$title])) {\n $this->cats[$title] = new stdClass();\n $this->cats[$title]->count = 1;\n $this->cats[$title]->name = $title;\n } else {\n $this->cats[$title]->count++;\n }\n $this->cats[$title]->records[] = $record;\n }\n }\n }\n if (!empty($this->grouplimit)) {\n if ($this->limit)\n $this->records = array_slice($this->records, $this->start, $this->limit);\n } else {\n if ($this->limit)\n $this->cats = array_slice($this->cats, $this->start, $this->limit);\n }\n }", " if (isset($params['records']))\n $this->runCallback(); // isset($params['records']) added to correct search for products.", " //eDebug($this->records);\n\t\t// get the number of the last record we are showing...this is used in the page links.\n\t\t// i.e. \"showing 10-19 of 57\"...$this->last would be the 19 in that string\n\t\tif ($this->total_records > 0) {\n\t\t\t$this->firstrecord = $this->start + 1;\n\t\t\t$this->lastrecord = ($this->total_records < $this->limit) ? ($this->start + $this->total_records) : ($this->start + $this->limit);\n\t\t\tif ($this->lastrecord > $this->total_records || $this->lastrecord == 0)\n $this->lastrecord = $this->total_records;\n\t\t} else {\n\t\t\t$this->firstrecord = 0;\n\t\t\t$this->lastrecord = 0;\n\t\t}", "\t\t\t", "\t\t// get the page parameters from the router to build the links\n $page_params = $router->params;\n//\t\t$page_params = $this->cleanParams($router->params);\n foreach (array(\"__utma\", \"__utmz\", \"route_sanitized\") as $key) {\n if (isset($page_params[$key]))\n unset($page_params[$key]);\n }\n if (!empty($page_params['search_string']))\n $page_params['search_string'] = urlencode($page_params['search_string']);", "\t\t//if (empty($page_params['module'])) $page_params['module'] = $this->controller;\n\t\t//if (empty($page_params['action'])) $page_params['action'] = $this->action;\n\t\t//if (empty($page_params['src']) && isset($params['src'])) $page_params['src'] = $params['src'];\n\t\tif (!empty($this->controller)) {\n\t\t unset($page_params['module']);\n\t\t $page_params['controller'] = expModules::getModuleName($this->controller);\n\t\t} else {\n if (expTheme::inAction() && empty($params)) {\n //FIXME: module/controller glue code\n //\t\t $mod = !empty($_REQUEST['controller']) ? expString::sanitize($_REQUEST['controller']) : expString::sanitize($_REQUEST['module']);\n //\t\t if ($this->controller == $mod && $this->action == $_REQUEST['action']) {\n //\t\t\t $this->order = isset($_REQUEST['order']) ? $_REQUEST['order'] : $this->order;\n //\t\t\t $this->order_direction = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : $this->dir;\n //\t\t\t}\n $mod = !empty($router->params['controller']) ? $router->params['controller'] : $router->params['module'];\n if ($this->controller == $mod && $this->action == $router->params['action']) {\n $this->order = isset($router->params['order']) ? $router->params['order'] : $this->order;\n $this->order_direction = isset($router->params['dir']) ? $router->params['dir'] : $this->dir;", "", " }\n } else {\n if (isset($params->controller)) {\n $mod = $params->controller;\n } else {\n $mod = '';\n }\n }\n $page_params['controller'] = $mod; // we can't be passing an empty controller or module to the router\n }", "\t\t", "\t\tif (!empty($this->action))\n $page_params['action'] = $this->action;\n\t\tif (!empty($this->src))\n $page_params['src'] = $this->src;", "\t\t", "\t\tif (isset($page_params['section']))\n unset($page_params['section']);", "\t\t//build a 'more' link we can use in the headlines views.\n\t\t$this->morelink = $router->makeLink($page_params, false, false, true);", "\t\tif (!empty($this->view))\n $page_params['view'] = $this->view;", "\t\t//build a couple more links we can use in the views.\n\t\t$this->pagelink = $router->makeLink($page_params, false, false, true);", "\t\t", "\t\t// if don't have enough records for more than one page then we're done.\n\t\t//if ($this->total_records <= $this->limit) return true;", "\t\t", "\t\t$this->total_pages = ($this->limit > 0) ? ceil($this->total_records/$this->limit) : 0;", " // correct current page # to be within limits of number of pages\n\t\tif ($this->page > $this->total_pages) {\n\t\t\t$this->page = $this->total_pages;\n //FIXME return 404 error for infinite page scroll plugin\n if (!empty($this->total_pages)) header(':', true, 404);\n\t\t}", " // setup the previous link\n if ($this->page > 1) {\n $page_params['page'] = $this->page - 1;\n $this->previous_pagenum = $this->page - 1;\n $this->previous_page = $router->makeLink($page_params, false, false, true);\n if (expTheme::is_mobile())\n $this->pages_to_show--;\n }", " // setup the next link\n if ($this->page < $this->total_pages) {\n $page_params['page'] = $this->page + 1;\n $this->next_pagenum = $this->page + 1;\n $this->next_page = $router->makeLink($page_params, false, false, true);\n if (expTheme::is_mobile())\n $this->pages_to_show--;\n }", "\t\t//setup the pages for the links\n\t\tif ($this->total_pages > $this->pages_to_show) {\n\t\t\t$this->first_pagelink = max(1, floor(($this->page) - ($this->pages_to_show) / 2));\n\t\t $this->last_pagelink = $this->first_pagelink + $this->pages_to_show - 1;\n\t\t if ($this->last_pagelink > $this->total_pages) {\n\t\t $this->first_pagelink = max(1, $this->total_pages - $this->pages_to_show) + 1;", "\t\t $this->last_pagelink = $this->total_pages; ", "\t\t }\n\t\t} else {\n\t\t\t$this->first_pagelink = 1;\n\t\t\t$this->last_pagelink = $this->total_pages;\n\t\t}", "\t\t// setup the previous 10 'group jump' link\n\t\tif ($this->page > $this->pages_to_show) {\n\t\t\t$page_params['page'] = $this->first_pagelink - 1;\n $this->previous_shiftnum = $this->first_pagelink - 1;\n \t$this->previous_shift = $router->makeLink($page_params, false, false, true);\n\t\t\t$page_params['page'] = 1;\n\t\t\t$this->firstpage = $router->makeLink($page_params, false, false, true);\n\t\t}", "\t\t// setup the next 10 'group jump' link\n\t\tif ($this->page < ($this->total_pages - $this->pages_to_show)) {\n $page_params['page'] = $this->last_pagelink + 1;\n $this->next_shiftnum = $this->last_pagelink + 1;\n $this->next_shift = $router->makeLink($page_params, false, false, true);\n\t\t\t$page_params['page'] = $this->total_pages;\n\t\t\t$this->lastpage = $router->makeLink($page_params, false, false, true);\n }", "\t\t// setup the links to the remaining pages being displayed.", "\t\tfor($i=$this->first_pagelink; $i<=$this->last_pagelink; $i++) { ", "\t\t\t$page_params['page'] = $i;\n\t\t\t$this->pages[$i] = $router->makeLink($page_params, false, false, true);", "\t\t} \t", "\n\t\t$links_template = expTemplate::get_common_template('pagination_links', null, 'common');\n\t\t$links_template->assign('page', $this);\n\t\t$this->links = $links_template->render();", "\t\t", "\t\t$this->makeHeaderCols($page_params); // headers for table view", " ", " $sortparams = array_merge($page_params, $router->params);", "\t\t", "\t\t//From Merge ****\n if (isset($router->params['page']))\n $sortparams['page'] = $router->params['page'];\n else\n unset($sortparams['page']);\n //End From Merge ****", "\t\t$this->makeSortDropdown($sortparams); // used on non-table views", " ", " $table_template = expTemplate::get_common_template('pagination_table', null, 'common');\n $table_template->assign('page', $this);\n $this->table = $table_template->render(); // table view", " ", "\t}", "\t", "\t//From Merge\n private function cleanParams($params) {\n $defaultParams = array('title'=>'','module'=>'','controller'=>'','src'=>'','id'=>'','dir'=>'','_common'=>'');\n $newParams = array();", " $func = new ReflectionClass($this); ", " foreach ($params as $pKey=>$pVal) {\n $propname = $pKey;\n if (array_key_exists($propname,$defaultParams)) {", " $newParams[$propname] = $params[$propname]; \n } \n } ", " foreach ($func->getProperties() as $p) {\n $propname = $p->name;\n if (array_key_exists($propname,$params)) {", " $newParams[$propname] = $params[$propname]; \n } \n } \n ", " return $newParams;\n }", " ", " public function makeHeaderCols($params) {\n global $router;", " if (!empty($this->columns) && is_array($this->columns)) {\n $this->header_columns = '';", " ", " // get the parameters used to make this page.\n if (!expTheme::inAction()) {\n unset($params['section']);\n if (empty($params['controller'])) $params['controller'] = $this->controller;\n if (empty($params['action'])) $params['action'] = $this->action;\n }", " ", "// $current = '';\n if (isset($params['order'])) {\n $current = $params['order'];\n unset($params['order']);\n } else {\n $current = $this->order;\n }", " ", " //loop over the columns and build out a list of <th>'s to be used in the page table\n foreach ($this->columns as $colname=>$col) {\n // if this is the column we are sorting on right now we need to setup some class info\n $class = isset($this->class) ? $this->class : 'page';\n $params['dir'] = 'ASC';", " ", " if ($col == $current) {\n $class = 'current '.strtolower($this->order_direction);\n $params['dir'] = $this->order_direction == 'ASC' ? 'DESC' : 'ASC';", " } ", "\n $params['order'] = $col;", " ", " $this->header_columns .= '<th class=\"'.$class.'\">';\n // if this column is empty then it's not supposed to be a sortable column", " if (empty($col)) {\n $this->header_columns .= '<span>'.$colname.'</span>';\n $this->columns[$colname] = ' ';\n } else if($colname==\"actupon\") {\n $this->header_columns .= '<input type=checkbox name=selall id=selall value=1 class=\"select-all\"/>';", " ", "// $js = \"\n// YUI(EXPONENT.YUI3_CONFIG).use('node', function(Y) {\n// Y.all('input[type=checkbox]').on('click',function(e){\n// if (e.target.test('.select-all')) {\n// if (!e.target.get('checked')) {\n// this.each(function(n){\n// n.set('checked',false);\n// });\n// } else {\n// this.each(function(n){\n// n.set('checked',true);\n// });\n// };\n// };\n// });\n// });\n// \";", " $js = \"\n $('#selall').change(function () {\n $('input[name=\\\"act-upon[]\\\"]').prop('checked', this.checked);\n });\n \";", " expJavascript::pushToFoot(array(\n \"unique\"=>'select-all',\n// \"yui3mods\"=>1,\n \"jquery\"=>1,\n \"content\"=>$js,\n// \"src\"=>\"\"\n ));", " } else {\n\t\t\t\t\tunset($params['page']); // we want to go back to the first page on a re-sort\n if ($col == 'no-sort') {\n $this->header_columns .= $colname;\n } else {\n $this->header_columns .= '<a href=\"'.$router->makeLink($params, false, false, true).'\" alt=\"sort by '.$colname.'\" rel=\"nofollow\">'.$colname.'</a>';\n }\n }", " ", " $this->header_columns .= '</th>';\n }\n }\n }", " ", " //here if we want to modify the record for some reason. e.g. Using in search results w/ products\n private function runCallback() {\n foreach ($this->records as &$record) {\n if (isset($record->ref_type)) {\n $refType = $record->ref_type;\n if (class_exists($record->ref_type)) {\n $type = new $refType();\n $classinfo = new ReflectionClass($type);\n if ($classinfo->hasMethod('paginationCallback')) {\n $item = new $type($record->original_id);\n $item->paginationCallback($record);\n }\n }\n }", " } ", " }", " ", "\tpublic function makeSortDropdown($params) {\n\t\tglobal $router;", "\t\tif (!empty($this->columns) && is_array($this->columns)) {\n\t\t\t$this->sort_dropdown = array();", "\t\t\t// get the parameters used to make this page.\n\t\t\tif (!expTheme::inAction()) {\n\t\t\t\tunset($params['section']);\n\t\t\t\tif (empty($params['controller'])) $params['controller'] = $this->controller;\n\t\t\t\tif (empty($params['action'])) $params['action'] = $this->action;\n\t\t\t}", "\t\t\t", "\t\t\t/*$current = '';\n\t\t\tif (isset($params['order'])) {\n\t\t\t\t$current = $params['order'];\n\t\t\t\tunset($params['order']);\n\t\t\t} else {\n\t\t\t\t$current = $this->order;\n\t\t\t} */", "\t\t\t", "\t\t\t//loop over the columns and build out a list of <th>'s to be used in the page table\n // eDebug($router);\n $defaultParams['controller'] = $params['controller'];\n $defaultParams['action'] = $params['action'];\n if (isset($params['title']))\n $defaultParams['title'] = $params['title'];\n if (isset($params['page']))\n $defaultParams['page'] = $params['page'];", " ", " $this->sort_dropdown[$router->makeLink($defaultParams, false, false, true)] = \"Default\";\n\t\t\tforeach ($this->columns as $colname=>$col) {\n\t\t\t\t// if this is the column we are sorting on right now we need to setup some class info\n\t\t\t\t/*$class = isset($this->class) ? $this->class : 'page';\n\t\t\t\t$params['dir'] = 'ASC';*/", "\t\t\t\t", "\t\t\t\t/*if ($col == $current) {\n\t\t\t\t\t$class = 'current';\n\t\t\t\t\t$class .= ' '.$this->order_direction;\n\t\t\t\t\tif (isset($params['dir'])) {\n\t\t\t\t\t\t$params['dir'] = $params['dir'] == 'ASC' ? 'DESC' : 'ASC';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$params['dir'] = $this->order_direction == 'ASC' ? 'DESC' : 'ASC';\n\t\t\t\t\t}", "\t\t\t\t} ", " */", "\t\t\t\t$params['order'] = $col; \t\t\t\t \n\t\t\t\t\n\t\t\t\tif (!empty($col)) {\t", " if ($colname == 'Price') {", " $params['dir'] = 'ASC'; ", " $this->sort_dropdown[$router->makeLink($params, false, false, true)] = $colname . \" - Lowest to Highest\";", " $params['dir'] = 'DESC'; ", " $this->sort_dropdown[$router->makeLink($params, false, false, true)] = $colname . \" - Highest to Lowest\";\n } else {", " $params['dir'] = 'ASC'; ", " $this->sort_dropdown[$router->makeLink($params, false, false, true)] = $colname . \" - A-Z\";\n $params['dir'] = 'DESC';\n $this->sort_dropdown[$router->makeLink($params, false, false, true)] = $colname . \" - Z-A\";", " }\t\n\t\t\t\t} \t\t\t\t\t\t\t\t", "\t\t\t}\n\t\t}\n\t}", "\t", " /** exdoc\n * Object/Array sorting comparison function -- sorts by a specified column in ascending order.\n * @node Subsystems:expPaginator\n */\n public function asc($a,$b) {\n $col = $this->order;\n if (is_object($a)) {\n return ($a->$col < $b->$col ? -1 : 1);\n } elseif (is_array($a)) {\n return ($a[$col] < $b[$col] ? -1 : 1);\n } else {\n return ($a < $b ? -1 : 1);\n }\n }", " /** exdoc\n * Object/Array sorting comparison function -- sorts by a specified column in descending order.\n * @node Subsystems:expPaginator\n */\n public function desc($a,$b) {\n $col = $this->order;\n if (is_object($a)) {\n return ($a->$col > $b->$col ? -1 : 1);\n } elseif (is_array($a)) {\n return ($a[$col] > $b[$col] ? -1 : 1);\n } else {\n return ($a > $b ? -1 : 1);\n }\n }\n}", "?>" ]
[ 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expPaginator\n * Exponent Pagination Subsystem\n *\n * The expPaginator class is used to retrieve objects from the database\n * and paginate them and optionally group the by category.\n * It automagically handles the calls to other pages\n * and has built-in sorting using the defined column headers.", " *", " * Usage Example:", " *", " * <code>\n *\n * $page = new expPaginator(array(\n * 'model'=>'faq',", " * 'where'=>1,", " * 'limit'=>25,\n * 'order'=>'rank',\n * 'controller'=>$this->baseclassname,\n * 'action'=>$this->params['action'],\n * 'columns'=>array('In FAQ'=>'include_in_faq', 'Submitted'=>'created_at', 'Submitted By'=>'submitter_name'),\n * ));\n * </code>", " *", " * @package Subsystems\n * @subpackage Subsystems\n */", "class expPaginator {\n /**#@+\n * @access public\n * @var string\n */\n\tpublic $model = null;\n public $search_string = '';\n\tpublic $sql = '';\n public $count_sql = '';", "\tpublic $where = '';", "\tpublic $controller = '';\n\tpublic $action = '';\n\tpublic $order = '';\n\tpublic $order_direction = '';\n\tpublic $firstpage = '';\n\tpublic $lastpage = '';\n\tpublic $previous_page = '';\n\tpublic $next_page = '';\n\tpublic $previous_shift = '';\n\tpublic $next_shift = '';\n\tpublic $pagelink = '';\n\tpublic $header_columns = '';\n\tpublic $default = '';\n\tpublic $view = null;\n public $uncat ='';\n// public $content_type = '';\n// public $author = '';\n// public $tag = '';\n// public $tags = '';\n\t/**#@+\n * @access public\n * @var integer\n */\n\tpublic $page = 1;\n//\tpublic $limit = 10;\n public $limit = 0;\n\tpublic $start = 0;\n\tpublic $last = 0;\n\tpublic $pages_to_show = 10;\n\tpublic $total_records = 0;\n\tpublic $total_pages = 0;\n\tpublic $page_offset = 0;\n public $categorize = false;\n// public $version = 0;\n// public $content_id = 0;\n\t/**#@+\n * @access public\n * @var array", " */", "\tpublic $pages = array();\n\tpublic $records = array();\n public $cats = array();\n public $sort_dropdown = array();", "\t/**\n\t * expPaginator Constructor\n\t *\n\t * This is the main entry point for using the expPaginator. See example above.\n\t *\n\t * @param array $params Use this to set any of the class variables. Ones not passed will be set to a default.\n\t * @return \\expPaginator\n\t */\n\tpublic function __construct($params=array()) {", "\t\tglobal $router, $db;", "\n $this->pages_to_show = expTheme::is_mobile() ? 6 : 10; // fewer paging links for small devices\n\t\t$this->where = empty($params['where']) ? null : $params['where'];\n\t\t$this->records = empty($params['records']) ? array() : $params['records'];\n//\t\t$this->limit = empty($params['limit']) ? 10 : $params['limit'];", " $this->limit = empty($params['limit']) ? 0 : intval($params['limit']);", " $this->page = empty($params['page']) ? 1 : intval($params['page']);\n\t\t$this->action = empty($params['action']) ? '' : $params['action'];\n\t\t$this->controller = empty($params['controller']) ? '' : $params['controller'];\n\t\t$this->sql = empty($params['sql']) ? '' : $params['sql'];\n $this->count_sql = empty($params['count_sql']) ? '' : $params['count_sql'];", "\t\t$this->order = empty($params['order']) ? 'id' : expString::escape($params['order']);\n\t\t$this->dir = empty($params['dir']) || !in_array($params['dir'], array('ASC', 'DESC')) ? 'ASC' : $params['dir'];\n\t\t$this->src = empty($params['src']) ? null : expString::escape($params['src']);", " $this->categorize = empty($params['categorize']) ? false : $params['categorize'];\n $this->uncat = !empty($params['uncat']) ? $params['uncat'] : gt('Not Categorized');\n $this->groups = !empty($params['groups']) ? $params['groups'] : array();\n $this->grouplimit = !empty($params['grouplimit']) ? $params['grouplimit'] : null;\n $this->dontsortwithincat = !empty($params['dontsortwithincat']) ? $params['dontsortwithincat'] : null;\n $this->dontsort = !empty($params['dontsort']) ? $params['dontsort'] : null;", "\t\t// if a view was passed we'll use it.\n\t\tif (isset($params['view']))\n $this->view = $params['view'];", " // setup the model if one was passed.\n if (isset($params['model'])) {\n $this->model = $params['model'];\n $class = new $this->model(null, false, false);\n }", "", "\t // auto-include the CSS for pagination links\n\t expCSS::pushToHead(array(\n//\t\t \"unique\"=>\"pagination\",\n//\t\t \"link\"=>PATH_RELATIVE.\"framework/core/assets/css/pagination.css\",\n 'corecss'=>'pagination'\n\t\t )\n\t\t);", "", "\t\tif ($this->limit)\n $this->start = (($this->page * $this->limit) - $this->limit);\n if ($this->start < 0)\n $this->start = 0;", "\t\t//setup the columns\n $this->columns = array();\n\t\tif (isset($params['columns'])) {\n\t\t foreach($params['columns'] as $key=>$col){\n\t\t $colparse[$key] = explode('|',$col);\n\t\t $column = array($key=>$colparse[$key][0]);\n\t\t $this->columns = array_merge($this->columns,$column);\n\t\t if (!empty($colparse[$key][1])) {\n\t\t $params = explode(',',$colparse[$key][1]);\n\t\t foreach ($params as $paramval) {\n\t\t $prm = explode('=',$paramval);\n\t\t $this->linkables[$key][$prm[0]] = $prm[1];\n\t\t }\n\t\t }\n\t\t }\n\t\t}", "", "\t\t//setup the default ordering of records\n\t\t// if we are in an action, see if the action is for this controller/action..if so pull the order\n\t\t// and order direction from the request params...this is how the params are passed via the column\n\t\t// headers.", "\t\t$this->order_direction = $this->dir;", "\n // allow passing of a single order/dir as stored in config\n if (strstr($this->order,\" \")) {\n $orderby = explode(\" \",$this->order);\n $this->order = $orderby[0];\n $this->order_direction = $orderby[1];\n }", " if(!preg_match('/[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*/', $this->order))\n $this->order = 'id';\n if (!in_array($this->order_direction, array('ASC', 'DESC')))\n $this->order_direction = 'ASC';", " if ($this->dontsort)\n $sort = null;\n else\n $sort = $this->order.' '.$this->order_direction;", "\t\t// figure out how many records we're dealing with & grab the records\n\t\t//if (!empty($this->records)) { //from Merge <~~ this doesn't work. Could be empty, but still need to hit.\n if (!empty($this->categorize))\n $limit = null;\n else\n $limit = $this->limit;", "\t\tif (isset($params['records'])) { // if we pass $params['records'], we WANT to hit this\n\t\t // sort the records that were passed in to us\n if (!empty($sort))\n usort($this->records,array('expPaginator', strtolower($this->order_direction)));\n//\t\t $this->total_records = count($this->records);\n\t\t} elseif (!empty($class)) { //where clause //FJD: was $this->class, but wasn't working...\n\t\t\t$this->total_records = $class->find('count', $this->where);\n $this->records = $class->find('all', $this->where, $sort, $limit, $this->start);\n\t\t} elseif (!empty($this->where)) { //from Merge....where clause\n\t\t\t$this->total_records = $class->find('count', $this->where);\n $this->records = $class->find('all', $this->where, $sort, $limit, $this->start);\n\t\t} else { //sql clause //FIXME we don't get attachments in this approach\n\t\t\t//$records = $db->selectObjectsBySql($this->sql);\n\t\t\t//$this->total_records = count($records);\n //this is MUCH faster if you supply a proper count_sql param using a COUNT() function; if not,\n //we'll run the standard sql and do a queryRows with it\n\t\t\t//$this->total_records = $this->count_sql == '' ? $db->queryRows($this->sql) : $db->selectValueBySql($this->count_sql); //From Merge", "", "//\t\t\t$this->total_records = $db->countObjectsBySql($this->count_sql); //$db->queryRows($this->sql); //From most current Trunk", " if (!empty($sort)) $this->sql .= ' ORDER BY '.$sort;\n if (!empty($this->count_sql)) $this->total_records = $db->countObjectsBySql($this->count_sql);\n\t\t\tif (!empty($this->limit)) $this->sql .= ' LIMIT '.$this->start.','.$this->limit;", "", "\t\t\t$this->records = array();\n\t\t\tif (isset($this->model) || isset($params['model_field'])) {\n\t\t\t foreach($db->selectObjectsBySql($this->sql) as $record) {\n $type = $params['model_field'];\n\t\t\t $classname = isset($params['model_field']) ? $record->$type : $this->model;\n\t\t\t //$this->records[] = new $classname($record->id, true, true); //From current trunk // added false, true, as we shouldn't need associated items here, but do need attached. FJD.\n\t\t\t\t\t$this->records[] = new $classname($record->id, false, true); //From Merge //added false, true, as we shouldn't need associated items here, but do need attached. FJD.\n\t\t\t }\n\t\t\t} else {\n\t\t\t $this->records = $db->selectObjectsBySql($this->sql);\n\t\t\t}", "\t\t}", "\n // next we'll sort them based on categories if needed\n if (!empty($this->categorize) && $this->categorize && empty($this->dontsort))\n expCatController::addCats($this->records,$sort,$this->uncat,$this->groups,$this->dontsortwithincat);", " // let's see how many total records there are\n if (empty($this->total_records))\n $this->total_records = count($this->records);\n if ($this->limit && $this->start >= $this->total_records)\n $this->start = $this->total_records - $this->limit;", " // at this point we generally have all our records, now we'll trim the records to the number requested\n //FIXME we may want some more intelligent selection here based on cats/groups, e.g., don't break groups across pages, number of picture rows, etc...\n if (empty($this->grouplimit) && ($this->limit) && count($this->records) > $this->limit)\n $this->records = array_slice($this->records, $this->start, $this->limit);\n // finally, we'll create another multi-dimensional array of categories populated with assoc items\n if (empty($this->dontsort)) {\n if (!empty($this->categorize) && $this->categorize) {\n expCatController::sortedByCats($this->records,$this->cats,$this->groups,$this->grouplimit);\n } elseif (empty($this->dontsortwithincat)) { // categorized is off, so let's categorize by alpha instead for 'rolodex' type use\n $order = $this->order;\n if (in_array($order,array('created_at','edited_at','publish'))) {\n if ($this->total_records && (abs($this->records[0]->$order - $this->records[count($this->records)-1]->$order) >= (60 * 60 * 24 *365 *2))) {\n $datetype = 'Y'; // more than 2 years of records, so break down by year\n } else {\n $datetype = 'M Y'; // less than 2 years of records, so break down by month/year\n }\n foreach ($this->records as $record) {\n if (is_numeric($record->$order)) {\n $title = date($datetype,$record->$order);\n $title = empty($title)?gt('Undated'):$title;\n } else {\n $title = gt('Undated');\n }\n if (empty($this->cats[$title])) {\n $this->cats[$title] = new stdClass();\n $this->cats[$title]->count = 1;\n $this->cats[$title]->name = $title;\n } else {\n $this->cats[$title]->count++;\n }\n $this->cats[$title]->records[] = $record;\n }\n } else {\n foreach ($this->records as $record) {\n if (!empty($record->$order) && is_string($record->$order) && !is_numeric($record->$order)) {\n $title = ucfirst($record->$order);\n $title = empty($title[0])?'':$title[0];\n } else {\n $title = '';\n }\n if (empty($this->cats[$title])) {\n $this->cats[$title] = new stdClass();\n $this->cats[$title]->count = 1;\n $this->cats[$title]->name = $title;\n } else {\n $this->cats[$title]->count++;\n }\n $this->cats[$title]->records[] = $record;\n }\n }\n }\n if (!empty($this->grouplimit)) {\n if ($this->limit)\n $this->records = array_slice($this->records, $this->start, $this->limit);\n } else {\n if ($this->limit)\n $this->cats = array_slice($this->cats, $this->start, $this->limit);\n }\n }", " if (isset($params['records']))\n $this->runCallback(); // isset($params['records']) added to correct search for products.", " //eDebug($this->records);\n\t\t// get the number of the last record we are showing...this is used in the page links.\n\t\t// i.e. \"showing 10-19 of 57\"...$this->last would be the 19 in that string\n\t\tif ($this->total_records > 0) {\n\t\t\t$this->firstrecord = $this->start + 1;\n\t\t\t$this->lastrecord = ($this->total_records < $this->limit) ? ($this->start + $this->total_records) : ($this->start + $this->limit);\n\t\t\tif ($this->lastrecord > $this->total_records || $this->lastrecord == 0)\n $this->lastrecord = $this->total_records;\n\t\t} else {\n\t\t\t$this->firstrecord = 0;\n\t\t\t$this->lastrecord = 0;\n\t\t}", "", "\t\t// get the page parameters from the router to build the links\n $page_params = $router->params;\n//\t\t$page_params = $this->cleanParams($router->params);\n foreach (array(\"__utma\", \"__utmz\", \"route_sanitized\") as $key) {\n if (isset($page_params[$key]))\n unset($page_params[$key]);\n }\n if (!empty($page_params['search_string']))\n $page_params['search_string'] = urlencode($page_params['search_string']);", "\t\t//if (empty($page_params['module'])) $page_params['module'] = $this->controller;\n\t\t//if (empty($page_params['action'])) $page_params['action'] = $this->action;\n\t\t//if (empty($page_params['src']) && isset($params['src'])) $page_params['src'] = $params['src'];\n\t\tif (!empty($this->controller)) {\n\t\t unset($page_params['module']);\n\t\t $page_params['controller'] = expModules::getModuleName($this->controller);\n\t\t} else {\n if (expTheme::inAction() && empty($params)) {\n //FIXME: module/controller glue code\n //\t\t $mod = !empty($_REQUEST['controller']) ? expString::sanitize($_REQUEST['controller']) : expString::sanitize($_REQUEST['module']);\n //\t\t if ($this->controller == $mod && $this->action == $_REQUEST['action']) {\n //\t\t\t $this->order = isset($_REQUEST['order']) ? $_REQUEST['order'] : $this->order;\n //\t\t\t $this->order_direction = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : $this->dir;\n //\t\t\t}\n $mod = !empty($router->params['controller']) ? $router->params['controller'] : $router->params['module'];\n if ($this->controller == $mod && $this->action == $router->params['action']) {\n $this->order = isset($router->params['order']) ? $router->params['order'] : $this->order;\n $this->order_direction = isset($router->params['dir']) ? $router->params['dir'] : $this->dir;", " if(!preg_match('/[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*/', $this->order))\n $this->order = 'id';\n if (!in_array($this->order_direction, array('ASC', 'DESC')))\n $this->order_direction = 'ASC';", " }\n } else {\n if (isset($params->controller)) {\n $mod = $params->controller;\n } else {\n $mod = '';\n }\n }\n $page_params['controller'] = $mod; // we can't be passing an empty controller or module to the router\n }", "", "\t\tif (!empty($this->action))\n $page_params['action'] = $this->action;\n\t\tif (!empty($this->src))\n $page_params['src'] = $this->src;", "", "\t\tif (isset($page_params['section']))\n unset($page_params['section']);", "\t\t//build a 'more' link we can use in the headlines views.\n\t\t$this->morelink = $router->makeLink($page_params, false, false, true);", "\t\tif (!empty($this->view))\n $page_params['view'] = $this->view;", "\t\t//build a couple more links we can use in the views.\n\t\t$this->pagelink = $router->makeLink($page_params, false, false, true);", "", "\t\t// if don't have enough records for more than one page then we're done.\n\t\t//if ($this->total_records <= $this->limit) return true;", "", "\t\t$this->total_pages = ($this->limit > 0) ? ceil($this->total_records/$this->limit) : 0;", " // correct current page # to be within limits of number of pages\n\t\tif ($this->page > $this->total_pages) {\n\t\t\t$this->page = $this->total_pages;\n //FIXME return 404 error for infinite page scroll plugin\n if (!empty($this->total_pages)) header(':', true, 404);\n\t\t}", " // setup the previous link\n if ($this->page > 1) {\n $page_params['page'] = $this->page - 1;\n $this->previous_pagenum = $this->page - 1;\n $this->previous_page = $router->makeLink($page_params, false, false, true);\n if (expTheme::is_mobile())\n $this->pages_to_show--;\n }", " // setup the next link\n if ($this->page < $this->total_pages) {\n $page_params['page'] = $this->page + 1;\n $this->next_pagenum = $this->page + 1;\n $this->next_page = $router->makeLink($page_params, false, false, true);\n if (expTheme::is_mobile())\n $this->pages_to_show--;\n }", "\t\t//setup the pages for the links\n\t\tif ($this->total_pages > $this->pages_to_show) {\n\t\t\t$this->first_pagelink = max(1, floor(($this->page) - ($this->pages_to_show) / 2));\n\t\t $this->last_pagelink = $this->first_pagelink + $this->pages_to_show - 1;\n\t\t if ($this->last_pagelink > $this->total_pages) {\n\t\t $this->first_pagelink = max(1, $this->total_pages - $this->pages_to_show) + 1;", "\t\t $this->last_pagelink = $this->total_pages;", "\t\t }\n\t\t} else {\n\t\t\t$this->first_pagelink = 1;\n\t\t\t$this->last_pagelink = $this->total_pages;\n\t\t}", "\t\t// setup the previous 10 'group jump' link\n\t\tif ($this->page > $this->pages_to_show) {\n\t\t\t$page_params['page'] = $this->first_pagelink - 1;\n $this->previous_shiftnum = $this->first_pagelink - 1;\n \t$this->previous_shift = $router->makeLink($page_params, false, false, true);\n\t\t\t$page_params['page'] = 1;\n\t\t\t$this->firstpage = $router->makeLink($page_params, false, false, true);\n\t\t}", "\t\t// setup the next 10 'group jump' link\n\t\tif ($this->page < ($this->total_pages - $this->pages_to_show)) {\n $page_params['page'] = $this->last_pagelink + 1;\n $this->next_shiftnum = $this->last_pagelink + 1;\n $this->next_shift = $router->makeLink($page_params, false, false, true);\n\t\t\t$page_params['page'] = $this->total_pages;\n\t\t\t$this->lastpage = $router->makeLink($page_params, false, false, true);\n }", "\t\t// setup the links to the remaining pages being displayed.", "\t\tfor($i=$this->first_pagelink; $i<=$this->last_pagelink; $i++) {", "\t\t\t$page_params['page'] = $i;\n\t\t\t$this->pages[$i] = $router->makeLink($page_params, false, false, true);", "\t\t}", "\n\t\t$links_template = expTemplate::get_common_template('pagination_links', null, 'common');\n\t\t$links_template->assign('page', $this);\n\t\t$this->links = $links_template->render();", "", "\t\t$this->makeHeaderCols($page_params); // headers for table view", "", " $sortparams = array_merge($page_params, $router->params);", "", "\t\t//From Merge ****\n if (isset($router->params['page']))\n $sortparams['page'] = $router->params['page'];\n else\n unset($sortparams['page']);\n //End From Merge ****", "\t\t$this->makeSortDropdown($sortparams); // used on non-table views", "", " $table_template = expTemplate::get_common_template('pagination_table', null, 'common');\n $table_template->assign('page', $this);\n $this->table = $table_template->render(); // table view", "", "\t}", "", "\t//From Merge\n private function cleanParams($params) {\n $defaultParams = array('title'=>'','module'=>'','controller'=>'','src'=>'','id'=>'','dir'=>'','_common'=>'');\n $newParams = array();", " $func = new ReflectionClass($this);", " foreach ($params as $pKey=>$pVal) {\n $propname = $pKey;\n if (array_key_exists($propname,$defaultParams)) {", " $newParams[$propname] = $params[$propname];\n }\n }", " foreach ($func->getProperties() as $p) {\n $propname = $p->name;\n if (array_key_exists($propname,$params)) {", " $newParams[$propname] = $params[$propname];\n }\n }\n", " return $newParams;\n }", "", " public function makeHeaderCols($params) {\n global $router;", " if (!empty($this->columns) && is_array($this->columns)) {\n $this->header_columns = '';", "", " // get the parameters used to make this page.\n if (!expTheme::inAction()) {\n unset($params['section']);\n if (empty($params['controller'])) $params['controller'] = $this->controller;\n if (empty($params['action'])) $params['action'] = $this->action;\n }", "", "// $current = '';\n if (isset($params['order'])) {\n $current = $params['order'];\n unset($params['order']);\n } else {\n $current = $this->order;\n }", "", " //loop over the columns and build out a list of <th>'s to be used in the page table\n foreach ($this->columns as $colname=>$col) {\n // if this is the column we are sorting on right now we need to setup some class info\n $class = isset($this->class) ? $this->class : 'page';\n $params['dir'] = 'ASC';", "", " if ($col == $current) {\n $class = 'current '.strtolower($this->order_direction);\n $params['dir'] = $this->order_direction == 'ASC' ? 'DESC' : 'ASC';", " }", "\n $params['order'] = $col;", "", " $this->header_columns .= '<th class=\"'.$class.'\">';\n // if this column is empty then it's not supposed to be a sortable column", " if (empty($col)) {\n $this->header_columns .= '<span>'.$colname.'</span>';\n $this->columns[$colname] = ' ';\n } else if($colname==\"actupon\") {\n $this->header_columns .= '<input type=checkbox name=selall id=selall value=1 class=\"select-all\"/>';", "", "// $js = \"\n// YUI(EXPONENT.YUI3_CONFIG).use('node', function(Y) {\n// Y.all('input[type=checkbox]').on('click',function(e){\n// if (e.target.test('.select-all')) {\n// if (!e.target.get('checked')) {\n// this.each(function(n){\n// n.set('checked',false);\n// });\n// } else {\n// this.each(function(n){\n// n.set('checked',true);\n// });\n// };\n// };\n// });\n// });\n// \";", " $js = \"\n $('#selall').change(function () {\n $('input[name=\\\"act-upon[]\\\"]').prop('checked', this.checked);\n });\n \";", " expJavascript::pushToFoot(array(\n \"unique\"=>'select-all',\n// \"yui3mods\"=>1,\n \"jquery\"=>1,\n \"content\"=>$js,\n// \"src\"=>\"\"\n ));", " } else {\n\t\t\t\t\tunset($params['page']); // we want to go back to the first page on a re-sort\n if ($col == 'no-sort') {\n $this->header_columns .= $colname;\n } else {\n $this->header_columns .= '<a href=\"'.$router->makeLink($params, false, false, true).'\" alt=\"sort by '.$colname.'\" rel=\"nofollow\">'.$colname.'</a>';\n }\n }", "", " $this->header_columns .= '</th>';\n }\n }\n }", "", " //here if we want to modify the record for some reason. e.g. Using in search results w/ products\n private function runCallback() {\n foreach ($this->records as &$record) {\n if (isset($record->ref_type)) {\n $refType = $record->ref_type;\n if (class_exists($record->ref_type)) {\n $type = new $refType();\n $classinfo = new ReflectionClass($type);\n if ($classinfo->hasMethod('paginationCallback')) {\n $item = new $type($record->original_id);\n $item->paginationCallback($record);\n }\n }\n }", " }", " }", "", "\tpublic function makeSortDropdown($params) {\n\t\tglobal $router;", "\t\tif (!empty($this->columns) && is_array($this->columns)) {\n\t\t\t$this->sort_dropdown = array();", "\t\t\t// get the parameters used to make this page.\n\t\t\tif (!expTheme::inAction()) {\n\t\t\t\tunset($params['section']);\n\t\t\t\tif (empty($params['controller'])) $params['controller'] = $this->controller;\n\t\t\t\tif (empty($params['action'])) $params['action'] = $this->action;\n\t\t\t}", "", "\t\t\t/*$current = '';\n\t\t\tif (isset($params['order'])) {\n\t\t\t\t$current = $params['order'];\n\t\t\t\tunset($params['order']);\n\t\t\t} else {\n\t\t\t\t$current = $this->order;\n\t\t\t} */", "", "\t\t\t//loop over the columns and build out a list of <th>'s to be used in the page table\n // eDebug($router);\n $defaultParams['controller'] = $params['controller'];\n $defaultParams['action'] = $params['action'];\n if (isset($params['title']))\n $defaultParams['title'] = $params['title'];\n if (isset($params['page']))\n $defaultParams['page'] = $params['page'];", "", " $this->sort_dropdown[$router->makeLink($defaultParams, false, false, true)] = \"Default\";\n\t\t\tforeach ($this->columns as $colname=>$col) {\n\t\t\t\t// if this is the column we are sorting on right now we need to setup some class info\n\t\t\t\t/*$class = isset($this->class) ? $this->class : 'page';\n\t\t\t\t$params['dir'] = 'ASC';*/", "", "\t\t\t\t/*if ($col == $current) {\n\t\t\t\t\t$class = 'current';\n\t\t\t\t\t$class .= ' '.$this->order_direction;\n\t\t\t\t\tif (isset($params['dir'])) {\n\t\t\t\t\t\t$params['dir'] = $params['dir'] == 'ASC' ? 'DESC' : 'ASC';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$params['dir'] = $this->order_direction == 'ASC' ? 'DESC' : 'ASC';\n\t\t\t\t\t}", "\t\t\t\t}", " */", "\t\t\t\t$params['order'] = $col;", "\t\t\t\tif (!empty($col)) {", " if ($colname == 'Price') {", " $params['dir'] = 'ASC';", " $this->sort_dropdown[$router->makeLink($params, false, false, true)] = $colname . \" - Lowest to Highest\";", " $params['dir'] = 'DESC';", " $this->sort_dropdown[$router->makeLink($params, false, false, true)] = $colname . \" - Highest to Lowest\";\n } else {", " $params['dir'] = 'ASC';", " $this->sort_dropdown[$router->makeLink($params, false, false, true)] = $colname . \" - A-Z\";\n $params['dir'] = 'DESC';\n $this->sort_dropdown[$router->makeLink($params, false, false, true)] = $colname . \" - Z-A\";", " }\n\t\t\t\t}", "\t\t\t}\n\t\t}\n\t}", "", " /** exdoc\n * Object/Array sorting comparison function -- sorts by a specified column in ascending order.\n * @node Subsystems:expPaginator\n */\n public function asc($a,$b) {\n $col = $this->order;\n if (is_object($a)) {\n return ($a->$col < $b->$col ? -1 : 1);\n } elseif (is_array($a)) {\n return ($a[$col] < $b[$col] ? -1 : 1);\n } else {\n return ($a < $b ? -1 : 1);\n }\n }", " /** exdoc\n * Object/Array sorting comparison function -- sorts by a specified column in descending order.\n * @node Subsystems:expPaginator\n */\n public function desc($a,$b) {\n $col = $this->order;\n if (is_object($a)) {\n return ($a->$col > $b->$col ? -1 : 1);\n } elseif (is_array($a)) {\n return ($a[$col] > $b[$col] ? -1 : 1);\n } else {\n return ($a > $b ? -1 : 1);\n }\n }\n}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expSettings\n *\n * @package Subsystems\n * @subpackage Subsystems\n */", "/** @define \"BASE\" \"../../..\" */\nclass expSettings\n{", " public static function initialize()\n {\n /**\n * overides function html entity decode\n *\n * @param $str\n *\n * @return string\n */\n function exponent_unhtmlentities($str)\n {\n $trans = get_html_translation_table(HTML_ENTITIES);\n $trans['&apos;'] = '\\'';\n $trans = array_flip($trans);", " $trans['&apos;'] = '\\'';\n $trans['&#039;'] = '\\'';\n return strtr($str, $trans);\n }", " // include global constants\n @include_once(BASE . \"framework/conf/config.php\");\n if (!defined('SITE_TITLE')) { // check for upgrade from older file structure\n if (!file_exists(BASE . \"framework/conf/config.php\") && file_exists(BASE . \"conf/config.php\")) {\n rename(BASE . \"conf/config.php\", BASE . \"framework/conf/config.php\");\n @include_once(BASE . \"framework/conf/config.php\");\n }\n }", " // include default constants, fill in missing pieces\n if (is_readable(BASE . \"framework/conf/extensions\")) {\n $dh = opendir(BASE . \"framework/conf/extensions\");\n while (($file = readdir($dh)) !== false) {\n if (is_readable(BASE . \"framework/conf/extensions/$file\") && substr(\n $file,\n -13,\n 13\n ) == \".defaults.php\"\n ) {\n @include_once(BASE . \"framework/conf/extensions/$file\");\n }\n }\n }\n }", " /** exdoc\n * Uses magical regular expressions voodoo to pull the\n * actual define() calls out of a configuration PHP file,\n * and return them in an associative array, for use in\n * viewing and analyzing configs. Returns an associative\n * array of constant names => values\n *\n * @param string $configname Configuration Profile name\n * @param null $site_root\n *\n * @return array\n * @node Subsystems:Config\n */\n public static function parse($configname = '', $site_root = null)\n {\n if ($site_root == null) {\n $site_root = BASE;\n }", " if ($configname == '') {\n $file = $site_root . 'framework/conf/config.php';\n } else {\n $file = $site_root . \"framework/conf/profiles/$configname.php\";\n }\n $options = array();\n//\t\t$valid = array();\n if (is_readable($file)) {\n $options = self::parseFile($file);\n }\n // include default constants, fill in missing pieces\n if (is_readable($site_root . 'framework/conf/extensions')) {\n $dh = opendir($site_root . 'framework/conf/extensions');\n while (($file = readdir($dh)) !== false) {\n if (substr($file, -13, 13) == '.defaults.php') {\n $options = array_merge(\n self::parseFile($site_root . 'framework/conf/extensions/' . $file),\n $options\n );\n }\n//\t\t\t\telse if (substr($file,-14,14) == '.structure.php') {\n//\t\t\t\t\t$tmp = include($site_root.'framework/conf/extensions/'.$file);\n//\t\t\t\t\t$valid = array_merge($valid,array_keys($tmp[1]));\n//\t\t\t\t}\n }\n }", "//\t\t$valid = array_flip($valid);", "//\t\tforeach ($options as $key=>$value) {\n//\t\t\tif (!isset($valid[$key])) unset($options[$key]);\n//\t\t}", " return $options;\n }", " /** exdoc\n * Looks through the source of a given configuration PHP file,\n * and pulls out (by mysterious regular expressions) the define()\n * calls and returns those values. Returns an associative array\n * of constant names => values\n *\n * @param string $file The full path to the file to parse.\n *\n * @return array\n * @node Subsystems:Config\n */\n public static function parseFile($file)\n {\n $options = array();\n foreach (file($file) as $line) {\n //$line = trim(preg_replace(array(\"/^.*define\\([\\\"']/\",\"/[^&][#].*$/\"),\"\",$line));\n $line = trim(preg_replace(array(\"/^.*define\\([\\\"']/\", \"/[^&][#][@].*$/\"), \"\", $line));\n if ($line != \"\" && substr($line, 0, 2) != \"<?\" && substr($line, -2, 2) != \"?>\") {\n $line = str_replace(array(\"<?php\", \"?>\", \"<?\",), \"\", $line);", " $opts = preg_split(\"/[\\\"'],/\", $line);", " if (count($opts) == 2) {\n if (substr($opts[1], 0, 1) == '\"' || substr($opts[1], 0, 1) == \"'\") {\n $opts[1] = substr($opts[1], 1, -3);\n } else {\n $opts[1] = substr($opts[1], 0, -2);\n }", " if (substr($opts[0], -5, 5) == \"_HTML\") {\n $opts[1] = eval(\"return \" . $opts[1] . \";\");\n /*\t\t\t\t\t$opts[1] = preg_replace('/<[bB][rR]\\s?\\/?>/',\"\\r\\n\",$opts[1]); */\n }\n $options[$opts[0]] = str_replace(\"\\'\", \"'\", $opts[1]);\n }\n }\n }\n return $options;\n }", " /**\n * Saves values to config file\n *\n * @param $values\n * @param string $configname\n */\n public static function saveValues($values, $configname = '') //FIXME only used with themes and self::change() method\n {\n $profile = null;\n $str = \"<?php\\n\";\n foreach ($values as $directive => $value) {\n $directive = trim(strtoupper($directive));\n if ($directive == 'CURRENTCONFIGNAME') { // save and strip out the profile name\n $profile = $value;\n continue;\n }\n $str .= \"define(\\\"$directive\\\",\";\n $value = stripslashes($value); // slashes added by POST\n if (substr($directive, -5, 5) == \"_HTML\") {\n $value = htmlentities($value, ENT_QUOTES, LANG_CHARSET);\n// $value = str_replace(array(\"\\r\\n\",\"\\r\",\"\\n\"),\"<br />\",$value);\n $value = str_replace(array(\"\\r\\n\", \"\\r\", \"\\n\"), \"\", $value);\n// $value = str_replace(array('\\r\\n', '\\r', '\\n'), \"\", $value);\n $str .= \"exponent_unhtmlentities('$value')\";\n } elseif (is_int($value)) {", " $str .= \"'\" . $value . \"'\";", " } else {\n if ($directive != 'SESSION_TIMEOUT') {", " $str .= \"'\" . str_replace(\"'\", \"\\'\", $value) . \"'\"; //FIXME is this still necessary since we stripslashes above???", " } // $str .= \"'\".$value.\"'\";\n else {", " $str .= \"'\" . str_replace(\"'\", '', $value) . \"'\";", " }\n }\n $str .= \");\\n\";\n }", " $str .= '?>';\n//\t\t$configname = empty($values['CURRENTCONFIGNAME']) ? '' : $values['CURRENTCONFIGNAME'];\n if ($configname == '') {\n $str .= \"\\n<?php\\ndefine(\\\"CURRENTCONFIGNAME\\\",\\\"$profile\\\");\\n?>\"; // add profile name to end of active profile\n }\n self::writeFile($str, $configname);\n }", " /**\n * Update/Add a single configuration setting to the current/active site configuration\n *\n * @param $var\n * @param $val\n */\n public static function change($var, $val)\n {\n $conf = self::parseFile(BASE . 'framework/conf/config.php');\n $conf[$var] = $val;\n self::saveValues($conf);\n }", " public static function writeFile($str, $configname = '')\n {\n // if ($configname != \"\") {\n // // Wishing to save\n // if ((file_exists(BASE.\"framework/conf/profiles/$configname.php\") && expUtil::isReallyWritable(BASE.\"framework/conf/profiles/$configname.php\")) ||\n // expUtil::isReallyWritable($BASE.\"framework/conf/profiles\")) {\n //\n // $fh = fopen(BASE.\"framework/conf/profiles/$configname.php\",\"w\");\n // fwrite($fh,$str);\n // fclose($fh);\n // } else {\n // echo gt('Unable to write profile configuration').'<br />';\n // }\n // }", " //if (isset($values['activate']) || $configname == \"\") {\n if ($configname == \"\") {\n $configname = BASE . \"framework/conf/config.php\";\n }\n//\t\tif ((file_exists(BASE.\"framework/conf/config.php\") && expUtil::isReallyWritable(BASE.\"framework/conf/config.php\")) || expUtil::isReallyWritable(BASE.\"framework/conf\")) {\n $conffolder = pathinfo($configname);\n if ((file_exists($configname) && expUtil::isReallyWritable($configname)) || expUtil::isReallyWritable(\n $conffolder['dirname']\n )\n ) {\n $fh = fopen($configname, \"w\");\n fwrite($fh, $str);\n /*fwrite($fh,\"\\n<?php\\ndefine(\\\"CURRENTCONFIGNAME\\\",\\\"$configname\\\");\\n?>\\n\");*/\n fclose($fh);\n } else {\n echo gt('Unable to write configuration') . '<br />';\n }\n //}\n }", " /** exdoc\n * Processes the POSTed data from the configuration form\n * object generated by self::configurationForm, and writes\n * a bunch of define() statements to the profiles config file.\n *\n * @param array $values The _POST array to pull configuration data from.\n * @param null $site_root\n *\n * @node Subsystems:Config\n */\n public static function saveConfiguration($values, $site_root = null) //FIXME this method is only used in install, and doesn't deal with profiles\n {\n if ($site_root == null) {\n $site_root = BASE;\n }", " if (empty($values['configname']) || $values['configname'] == 'Default') {\n $configname = '';\n } else {\n //\t\t$configname = str_replace(\" \",\"_\",$values['configname']);\n $configname = expFile::fixName($values['configname']);\n }", " $original_config = self::parse($configname, $site_root);", " $str = \"<?php\\n\\n\";\n foreach ($values['c'] as $directive => $value) {\n $directive = strtoupper($directive);", " // Because we may not have all config options in the POST,\n // we need to unset the ones we do have from the original config.\n unset($original_config[$directive]);", " $str .= \"define(\\\"$directive\\\",\";\n if (substr($directive, -5, 5) == \"_HTML\") {\n $value = htmlentities(stripslashes($value), ENT_QUOTES, LANG_CHARSET); // slashes added by POST\n $value = str_replace(array(\"\\r\\n\", \"\\r\", \"\\n\"), \"<br />\", $value);\n $str .= \"exponent_unhtmlentities('$value')\";\n } elseif (is_int($value)) {\n $str .= $value;\n } else {\n if ($directive != 'SESSION_TIMEOUT') {\n $str .= \"'\" . str_replace(\"'\", \"\\'\", $value) . \"'\";\n } else {\n $str .= str_replace(\"'\", '', $value);\n }\n }\n $str .= \");\\n\";\n }\n foreach ($values['opts'] as $directive => $val) {\n $directive = strtoupper($directive);", " // Because we may not have all config options in the POST,\n // we need to unset the ones we do have from the original config.\n unset($original_config[$directive]);", " $str .= \"define(\\\"$directive\\\",\" . (isset($values['o'][$directive]) ? 1 : 0) . \");\\n\";\n }\n // Now pick up all of the unspecified values\n // THIS MAY SCREW UP on checkboxes.\n foreach ($original_config as $directive => $value) {\n $str .= \"define(\\\"$directive\\\",\";\n if (substr($directive, -5, 5) == \"_HTML\") {\n $value = htmlentities(stripslashes($value), ENT_QUOTES, LANG_CHARSET); // slashes added by POST\n $str .= \"exponent_unhtmlentities('$value')\";\n } else {\n if (is_int($value)) {\n $str .= $value;\n } else {\n $str .= \"'\" . str_replace(\"'\", \"\\'\", $value) . \"'\";\n }\n }\n $str .= \");\\n\";\n }\n $str .= \"\\n?>\";", " // if ($configname != \"\") {\n // // Wishing to save\n // if ( (file_exists($site_root.\"framework/conf/profiles/$configname.php\") && expUtil::isReallyWritable($site_root.\"framework/conf/profiles/$configname.php\")) ||\n // expUtil::isReallyWritable($site_root.\"framework/conf/profiles\")) {\n //\n // $fh = fopen($site_root.\"framework/conf/profiles/$configname.php\",\"w\");\n // fwrite($fh,$str);\n // fclose($fh);\n // } else {\n // echo gt('Unable to write profile configuration').'<br />';\n // }\n // }", "//\t\tif (isset($values['activate']) || $configname == \"\") {\n//\t\t\tif ((file_exists($site_root.\"framework/conf/config.php\") && expUtil::isReallyWritable($site_root.\"framework/conf/config.php\")) ||\n//\t\t\t\t expUtil::isReallyWritable($site_root.\"framework/conf\")) {\n//\t\t\t\t$fh = fopen($site_root.\"framework/conf/config.php\",\"w\");\n//\t\t\t\tfwrite($fh,$str);\n//\n /*\t\t\t\t/*fwrite($fh,\"\\n<?php\\ndefine(\\\"CURRENTCONFIGNAME\\\",\\\"$configname\\\");\\n?>\\n\");*/\n//\t\t\t\tfclose($fh);\n//\t\t\t} else {\n//\t\t\t\techo gt('Unable to write profile configuration').'<br />';\n//\t\t\t}\n//\t\t}\n self::writeFile($str);\n }", " /** exdoc\n * This function looks through all of the available configuration\n * extensions, and generates a form object consisting of each\n * extension's form part. This can then be used to edit the full\n * site configuration. Returns a form object intended for editing the profile.\n *\n * @param string $configname The name of the configuration profile,\n * for filling in default values.\n * @param bool $database\n *\n * @return \\form\n * @node Subsystems:Config\n */\n public static function configurationForm($configname, $database = false) //FIXME this method is never used\n {\n // $configname = \"\" for active config\n if (is_readable(BASE . \"framework/conf/extensions\")) {\n global $user;\n $options = self::parse($configname);", " $form = new form();", " $form->register(null, '', new htmlcontrol('<h3 id=\"config_top\">' . gt('Configuration Options') . '</h3>'));\n $form->register('configname', gt('Profile Name'), new textcontrol($configname));\n $form->register(\n 'activate',\n gt('Activate'),\n new checkboxcontrol((!defined('CURRENTCONFIGNAME') || CURRENTCONFIGNAME == $configname))\n );", " $sections = array();", " $dh = opendir(BASE . 'framework/conf/extensions');\n while (($file = readdir($dh)) !== false) {\n if (is_readable(BASE . 'framework/conf/extensions/' . $file) && substr(\n $file,\n -14,\n 14\n ) == '.structure.php'\n ) {\n $arr = include(BASE . 'framework/conf/extensions/' . $file);\n // Check to see if the current user is a super admin, and only include database if so\n if (substr($file, 0, -14) != 'database' || $user->is_admin == 1) {\n $form->register(\n null,\n '',\n new htmlcontrol('<div id=\"config_' . count(\n $sections\n ) . '\" style=\"font-weight: bold; margin-top: 1.5em; border-top: 1px solid black; border-bottom: 1px solid black; background-color: #ccc; font-size: 12pt;\">' . $arr[0] . '</div><a href=\"#config_top\">Top</a>')\n );\n $sections[] = '<a href=\"#config_' . count($sections) . '\">' . $arr[0] . '</a>';\n foreach ($arr[1] as $directive => $info) {", " if ($info['description'] != '') {\n $form->register(\n null,\n '',\n new htmlcontrol('<br /><br />' . $info['description'], false)\n );\n }\n if (is_a($info['control'], \"checkboxcontrol\")) {\n $form->meta(\"opts[$directive]\", 1);\n $info['control']->default = $options[$directive];\n $info['control']->flip = true;\n $form->register(\n \"o[$directive]\",\n '<strong>' . $info['title'] . '</strong>',\n $info['control']\n );\n } else {\n if (isset($options[$directive])) {\n $info[\"control\"]->default = $options[$directive];\n }\n $form->register(\n \"c[$directive]\",\n '<strong>' . $info['title'] . '</strong>',\n $info['control'],\n $info['description']\n );\n }\n }\n //$form->register(null,'',new buttongroupcontrol(gt('Save'),'',gt('Cancel')));\n }\n }\n }\n// $form->registerAfter('activate',null,'',new htmlcontrol('<hr size=\"1\" />'.implode('&#160;&#160;|&#160;&#160;')));\n $form->register('submit', '', new buttongroupcontrol(gt('Save'), '', gt('Cancel')));", " return $form;\n }\n return null;\n }", " /** exdoc\n * Takes care of setting the appropriate template variables\n * to be used when viewing a profile or set of profiles.\n * Returns the initializes template.\n *\n * @param template $template The template object to assign to.\n * @param string $configname The name of the configuration profile.\n *\n * @return \\template\n * @node Subsystems:Config\n */\n public static function outputConfigurationTemplate($template, $configname) //FIXME this method is never used\n {\n if (is_readable(BASE . \"framework/conf/extensions\")) {\n $categorized = array();\n $options = self::parse($configname);", " $dh = opendir(BASE . \"framework/conf/extensions\");\n while (($file = readdir($dh)) !== false) {\n if (is_readable(BASE . \"framework/conf/extensions/$file\") && substr(\n $file,\n -14,\n 14\n ) == \".structure.php\"\n ) {\n $arr = include(BASE . \"framework/conf/extensions/$file\");\n $categorized[$arr[0]] = array();\n foreach ($arr[1] as $directive => $info) {\n if (is_a($info[\"control\"], \"passwordcontrol\")) {\n $info[\"value\"] = '&lt;' . gt('hidden') . '&gt;';\n } else {\n if (is_a($info[\"control\"], \"checkboxcontrol\")) {\n $info[\"value\"] = (isset($options[$directive]) ? ($options[$directive] ? \"yes\" : \"no\") : \"no\");\n } else {\n if (is_a($info[\"control\"], \"dropdowncontrol\") && isset($options[$directive])) {\n $info[\"value\"] = @$info[\"control\"]->items[$options[$directive]];\n } else {\n $info[\"value\"] = (isset($options[$directive]) ? $options[$directive] : \"\");\n }\n }\n }\n unset($info[\"control\"]);", " $categorized[$arr[0]][$directive] = $info;\n }\n }\n }\n $template->assign(\"configuration\", $categorized);\n }\n return $template;\n }", " /** exdoc\n * Looks through the framework/conf/profiles directory, and finds all of\n * the configuration profiles in existence. This function also\n * performs some minor name-mangling, to make the Profile Names\n * more user friendly. Returns an array of Profile names.\n *\n * @node Subsystems:Config\n * @return array\n */\n public static function profiles()\n {\n $profiles = array();\n if (is_readable(BASE . \"framework/conf/profiles\")) {\n $dh = opendir(BASE . \"framework/conf/profiles\");\n while (($file = readdir($dh)) !== false) {\n if (is_readable(BASE . \"framework/conf/profiles/$file\") && substr($file, -4, 4) == \".php\") {\n $name = substr($file, 0, -4);\n $profiles[$name] = str_replace(\"_\", \" \", $name);\n }\n }\n }\n return $profiles;\n }", " /** exdoc\n * Creates a configuration profile from the current configuration\n *\n * @param string $profile The name of the Profile to remove.\n *\n * @return string\n *\n * @node Subsystems:Config\n */\n public static function createProfile($profile)\n {\n if (!file_exists(BASE . \"framework/conf/profiles\")) {\n @mkdir(\n BASE . \"framework/conf/profiles\",\n DIR_DEFAULT_MODE_STR,\n true\n );\n }\n //FIXME do we need to delete an existing profile first??\n $profile = expFile::fixName($profile);\n// copy(BASE.\"framework/conf/config.php\",BASE.\"framework/conf/profiles/\".$profile.\".php\");\n// $baseprofile = self::parseFile(BASE . \"framework/conf/config.php\");\n $baseprofile = self::parse(); // get current configuration plus missing defaults\n unset($baseprofile['CURRENTCONFIGNAME']); // don't save profile name within actual profile\n self::saveValues($baseprofile, BASE . \"framework/conf/profiles/\" . $profile . \".php\");\n return $profile;\n }", " /** exdoc\n * Deletes a configuration profile from the framework/conf/profiles\n * directory.\n *\n * @param string $profile The name of the Profile to remove.\n *\n * @node Subsystems:Config\n */\n public static function deleteProfile($profile) //FIXME this method is never used\n {\n if (file_exists(BASE . \"framework/conf/profiles/$profile.php\")) {\n unlink(BASE . \"framework/conf/profiles/$profile.php\");\n }\n }", " /** exdoc\n * Activates a Configuration Profile.\n *\n * @param string $profile The name of the Profile to activate.\n *\n * @node Subsystems:Config\n */\n public static function activateProfile($profile)\n {", "", " if (is_readable(BASE . \"framework/conf/profiles/$profile.php\") && expUtil::isReallyWritable(\n BASE . \"framework/conf\"\n )\n ) {\n //FIXME do we need to delete current config first??\n copy(BASE . \"framework/conf/profiles/$profile.php\", BASE . \"framework/conf/config.php\");\n // tag it with the profile name\n $fh = fopen(BASE . \"framework/conf/config.php\", \"a\");\n fwrite(\n $fh,\n \"\\n<?php\\ndefine(\\\"CURRENTCONFIGNAME\\\",\\\"$profile\\\");\\n?>\"\n ); // add activated profile name to end of profile\n fclose($fh);\n }\n }", " /** exdoc\n * Parse Drop Down options from a file.\n *\n * @param string $dropdown_name The name of the dropdown type. The name of the\n * file will be retrieved by adding .dropdown as a suffix, and searching the framework/conf/data directory.\n *\n * @return array\n * @node Subsystems:Config\n */\n public static function dropdownData($dropdown_name)\n {\n $array = array();\n if (is_readable(BASE . \"framework/conf/data/$dropdown_name.dropdown\")) {\n $t = array();\n foreach (file(BASE . \"framework/conf/data/$dropdown_name.dropdown\") as $l) {\n $l = trim($l);\n if ($l != \"\" && substr($l, 0, 1) != \"#\") {\n $go = count($t);", " $t[] = trim($l);", " if ($go) {\n $array[$t[0]] = gt($t[1]);\n $t = array();\n }\n }\n }\n }\n return $array;\n }", "}", "expSettings::initialize(); // auto-initialize when loaded", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expSettings\n *\n * @package Subsystems\n * @subpackage Subsystems\n */", "/** @define \"BASE\" \"../../..\" */\nclass expSettings\n{", " public static function initialize()\n {\n /**\n * overides function html entity decode\n *\n * @param $str\n *\n * @return string\n */\n function exponent_unhtmlentities($str)\n {\n $trans = get_html_translation_table(HTML_ENTITIES);\n $trans['&apos;'] = '\\'';\n $trans = array_flip($trans);", " $trans['&apos;'] = '\\'';\n $trans['&#039;'] = '\\'';\n return strtr($str, $trans);\n }", " // include global constants\n @include_once(BASE . \"framework/conf/config.php\");\n if (!defined('SITE_TITLE')) { // check for upgrade from older file structure\n if (!file_exists(BASE . \"framework/conf/config.php\") && file_exists(BASE . \"conf/config.php\")) {\n rename(BASE . \"conf/config.php\", BASE . \"framework/conf/config.php\");\n @include_once(BASE . \"framework/conf/config.php\");\n }\n }", " // include default constants, fill in missing pieces\n if (is_readable(BASE . \"framework/conf/extensions\")) {\n $dh = opendir(BASE . \"framework/conf/extensions\");\n while (($file = readdir($dh)) !== false) {\n if (is_readable(BASE . \"framework/conf/extensions/$file\") && substr(\n $file,\n -13,\n 13\n ) == \".defaults.php\"\n ) {\n @include_once(BASE . \"framework/conf/extensions/$file\");\n }\n }\n }\n }", " /** exdoc\n * Uses magical regular expressions voodoo to pull the\n * actual define() calls out of a configuration PHP file,\n * and return them in an associative array, for use in\n * viewing and analyzing configs. Returns an associative\n * array of constant names => values\n *\n * @param string $configname Configuration Profile name\n * @param null $site_root\n *\n * @return array\n * @node Subsystems:Config\n */\n public static function parse($configname = '', $site_root = null)\n {\n if ($site_root == null) {\n $site_root = BASE;\n }", " if ($configname == '') {\n $file = $site_root . 'framework/conf/config.php';\n } else {\n $file = $site_root . \"framework/conf/profiles/$configname.php\";\n }\n $options = array();\n//\t\t$valid = array();\n if (is_readable($file)) {\n $options = self::parseFile($file);\n }\n // include default constants, fill in missing pieces\n if (is_readable($site_root . 'framework/conf/extensions')) {\n $dh = opendir($site_root . 'framework/conf/extensions');\n while (($file = readdir($dh)) !== false) {\n if (substr($file, -13, 13) == '.defaults.php') {\n $options = array_merge(\n self::parseFile($site_root . 'framework/conf/extensions/' . $file),\n $options\n );\n }\n//\t\t\t\telse if (substr($file,-14,14) == '.structure.php') {\n//\t\t\t\t\t$tmp = include($site_root.'framework/conf/extensions/'.$file);\n//\t\t\t\t\t$valid = array_merge($valid,array_keys($tmp[1]));\n//\t\t\t\t}\n }\n }", "//\t\t$valid = array_flip($valid);", "//\t\tforeach ($options as $key=>$value) {\n//\t\t\tif (!isset($valid[$key])) unset($options[$key]);\n//\t\t}", " return $options;\n }", " /** exdoc\n * Looks through the source of a given configuration PHP file,\n * and pulls out (by mysterious regular expressions) the define()\n * calls and returns those values. Returns an associative array\n * of constant names => values\n *\n * @param string $file The full path to the file to parse.\n *\n * @return array\n * @node Subsystems:Config\n */\n public static function parseFile($file)\n {\n $options = array();\n foreach (file($file) as $line) {\n //$line = trim(preg_replace(array(\"/^.*define\\([\\\"']/\",\"/[^&][#].*$/\"),\"\",$line));\n $line = trim(preg_replace(array(\"/^.*define\\([\\\"']/\", \"/[^&][#][@].*$/\"), \"\", $line));\n if ($line != \"\" && substr($line, 0, 2) != \"<?\" && substr($line, -2, 2) != \"?>\") {\n $line = str_replace(array(\"<?php\", \"?>\", \"<?\",), \"\", $line);", " $opts = preg_split(\"/[\\\"'],/\", $line);", " if (count($opts) == 2) {\n if (substr($opts[1], 0, 1) == '\"' || substr($opts[1], 0, 1) == \"'\") {\n $opts[1] = substr($opts[1], 1, -3);\n } else {\n $opts[1] = substr($opts[1], 0, -2);\n }", " if (substr($opts[0], -5, 5) == \"_HTML\") {\n $opts[1] = eval(\"return \" . $opts[1] . \";\");\n /*\t\t\t\t\t$opts[1] = preg_replace('/<[bB][rR]\\s?\\/?>/',\"\\r\\n\",$opts[1]); */\n }\n $options[$opts[0]] = str_replace(\"\\'\", \"'\", $opts[1]);\n }\n }\n }\n return $options;\n }", " /**\n * Saves values to config file\n *\n * @param $values\n * @param string $configname\n */\n public static function saveValues($values, $configname = '') //FIXME only used with themes and self::change() method\n {\n $profile = null;\n $str = \"<?php\\n\";\n foreach ($values as $directive => $value) {\n $directive = trim(strtoupper($directive));\n if ($directive == 'CURRENTCONFIGNAME') { // save and strip out the profile name\n $profile = $value;\n continue;\n }\n $str .= \"define(\\\"$directive\\\",\";\n $value = stripslashes($value); // slashes added by POST\n if (substr($directive, -5, 5) == \"_HTML\") {\n $value = htmlentities($value, ENT_QUOTES, LANG_CHARSET);\n// $value = str_replace(array(\"\\r\\n\",\"\\r\",\"\\n\"),\"<br />\",$value);\n $value = str_replace(array(\"\\r\\n\", \"\\r\", \"\\n\"), \"\", $value);\n// $value = str_replace(array('\\r\\n', '\\r', '\\n'), \"\", $value);\n $str .= \"exponent_unhtmlentities('$value')\";\n } elseif (is_int($value)) {", " $str .= \"'\" . intval($value) . \"'\";", " } else {\n if ($directive != 'SESSION_TIMEOUT') {", " $str .= \"'\" . expString::escape(str_replace(\"'\", \"\\'\", $value)) . \"'\"; //FIXME is this still necessary since we stripslashes above???", " } // $str .= \"'\".$value.\"'\";\n else {", " $str .= \"'\" . expString::escape(str_replace(\"'\", '', $value)) . \"'\";", " }\n }\n $str .= \");\\n\";\n }", " $str .= '?>';\n//\t\t$configname = empty($values['CURRENTCONFIGNAME']) ? '' : $values['CURRENTCONFIGNAME'];\n if ($configname == '') {\n $str .= \"\\n<?php\\ndefine(\\\"CURRENTCONFIGNAME\\\",\\\"$profile\\\");\\n?>\"; // add profile name to end of active profile\n }\n self::writeFile($str, $configname);\n }", " /**\n * Update/Add a single configuration setting to the current/active site configuration\n *\n * @param $var\n * @param $val\n */\n public static function change($var, $val)\n {\n $conf = self::parseFile(BASE . 'framework/conf/config.php');\n $conf[$var] = $val;\n self::saveValues($conf);\n }", " public static function writeFile($str, $configname = '')\n {\n // if ($configname != \"\") {\n // // Wishing to save\n // if ((file_exists(BASE.\"framework/conf/profiles/$configname.php\") && expUtil::isReallyWritable(BASE.\"framework/conf/profiles/$configname.php\")) ||\n // expUtil::isReallyWritable($BASE.\"framework/conf/profiles\")) {\n //\n // $fh = fopen(BASE.\"framework/conf/profiles/$configname.php\",\"w\");\n // fwrite($fh,$str);\n // fclose($fh);\n // } else {\n // echo gt('Unable to write profile configuration').'<br />';\n // }\n // }", " //if (isset($values['activate']) || $configname == \"\") {\n if ($configname == \"\") {\n $configname = BASE . \"framework/conf/config.php\";\n }\n//\t\tif ((file_exists(BASE.\"framework/conf/config.php\") && expUtil::isReallyWritable(BASE.\"framework/conf/config.php\")) || expUtil::isReallyWritable(BASE.\"framework/conf\")) {\n $conffolder = pathinfo($configname);\n if ((file_exists($configname) && expUtil::isReallyWritable($configname)) || expUtil::isReallyWritable(\n $conffolder['dirname']\n )\n ) {\n $fh = fopen($configname, \"w\");\n fwrite($fh, $str);\n /*fwrite($fh,\"\\n<?php\\ndefine(\\\"CURRENTCONFIGNAME\\\",\\\"$configname\\\");\\n?>\\n\");*/\n fclose($fh);\n } else {\n echo gt('Unable to write configuration') . '<br />';\n }\n //}\n }", " /** exdoc\n * Processes the POSTed data from the configuration form\n * object generated by self::configurationForm, and writes\n * a bunch of define() statements to the profiles config file.\n *\n * @param array $values The _POST array to pull configuration data from.\n * @param null $site_root\n *\n * @node Subsystems:Config\n */\n public static function saveConfiguration($values, $site_root = null) //FIXME this method is only used in install, and doesn't deal with profiles\n {\n if ($site_root == null) {\n $site_root = BASE;\n }", " if (empty($values['configname']) || $values['configname'] == 'Default') {\n $configname = '';\n } else {\n //\t\t$configname = str_replace(\" \",\"_\",$values['configname']);\n $configname = expFile::fixName($values['configname']);\n }", " $original_config = self::parse($configname, $site_root);", " $str = \"<?php\\n\\n\";\n foreach ($values['c'] as $directive => $value) {\n $directive = strtoupper($directive);", " // Because we may not have all config options in the POST,\n // we need to unset the ones we do have from the original config.\n unset($original_config[$directive]);", " $str .= \"define(\\\"$directive\\\",\";\n if (substr($directive, -5, 5) == \"_HTML\") {\n $value = htmlentities(stripslashes($value), ENT_QUOTES, LANG_CHARSET); // slashes added by POST\n $value = str_replace(array(\"\\r\\n\", \"\\r\", \"\\n\"), \"<br />\", $value);\n $str .= \"exponent_unhtmlentities('$value')\";\n } elseif (is_int($value)) {\n $str .= $value;\n } else {\n if ($directive != 'SESSION_TIMEOUT') {\n $str .= \"'\" . str_replace(\"'\", \"\\'\", $value) . \"'\";\n } else {\n $str .= str_replace(\"'\", '', $value);\n }\n }\n $str .= \");\\n\";\n }\n foreach ($values['opts'] as $directive => $val) {\n $directive = strtoupper($directive);", " // Because we may not have all config options in the POST,\n // we need to unset the ones we do have from the original config.\n unset($original_config[$directive]);", " $str .= \"define(\\\"$directive\\\",\" . (isset($values['o'][$directive]) ? 1 : 0) . \");\\n\";\n }\n // Now pick up all of the unspecified values\n // THIS MAY SCREW UP on checkboxes.\n foreach ($original_config as $directive => $value) {\n $str .= \"define(\\\"$directive\\\",\";\n if (substr($directive, -5, 5) == \"_HTML\") {\n $value = htmlentities(stripslashes($value), ENT_QUOTES, LANG_CHARSET); // slashes added by POST\n $str .= \"exponent_unhtmlentities('$value')\";\n } else {\n if (is_int($value)) {\n $str .= $value;\n } else {\n $str .= \"'\" . str_replace(\"'\", \"\\'\", $value) . \"'\";\n }\n }\n $str .= \");\\n\";\n }\n $str .= \"\\n?>\";", " // if ($configname != \"\") {\n // // Wishing to save\n // if ( (file_exists($site_root.\"framework/conf/profiles/$configname.php\") && expUtil::isReallyWritable($site_root.\"framework/conf/profiles/$configname.php\")) ||\n // expUtil::isReallyWritable($site_root.\"framework/conf/profiles\")) {\n //\n // $fh = fopen($site_root.\"framework/conf/profiles/$configname.php\",\"w\");\n // fwrite($fh,$str);\n // fclose($fh);\n // } else {\n // echo gt('Unable to write profile configuration').'<br />';\n // }\n // }", "//\t\tif (isset($values['activate']) || $configname == \"\") {\n//\t\t\tif ((file_exists($site_root.\"framework/conf/config.php\") && expUtil::isReallyWritable($site_root.\"framework/conf/config.php\")) ||\n//\t\t\t\t expUtil::isReallyWritable($site_root.\"framework/conf\")) {\n//\t\t\t\t$fh = fopen($site_root.\"framework/conf/config.php\",\"w\");\n//\t\t\t\tfwrite($fh,$str);\n//\n /*\t\t\t\t/*fwrite($fh,\"\\n<?php\\ndefine(\\\"CURRENTCONFIGNAME\\\",\\\"$configname\\\");\\n?>\\n\");*/\n//\t\t\t\tfclose($fh);\n//\t\t\t} else {\n//\t\t\t\techo gt('Unable to write profile configuration').'<br />';\n//\t\t\t}\n//\t\t}\n self::writeFile($str);\n }", " /** exdoc\n * This function looks through all of the available configuration\n * extensions, and generates a form object consisting of each\n * extension's form part. This can then be used to edit the full\n * site configuration. Returns a form object intended for editing the profile.\n *\n * @param string $configname The name of the configuration profile,\n * for filling in default values.\n * @param bool $database\n *\n * @return \\form\n * @node Subsystems:Config\n */\n public static function configurationForm($configname, $database = false) //FIXME this method is never used\n {\n // $configname = \"\" for active config\n if (is_readable(BASE . \"framework/conf/extensions\")) {\n global $user;\n $options = self::parse($configname);", " $form = new form();", " $form->register(null, '', new htmlcontrol('<h3 id=\"config_top\">' . gt('Configuration Options') . '</h3>'));\n $form->register('configname', gt('Profile Name'), new textcontrol($configname));\n $form->register(\n 'activate',\n gt('Activate'),\n new checkboxcontrol((!defined('CURRENTCONFIGNAME') || CURRENTCONFIGNAME == $configname))\n );", " $sections = array();", " $dh = opendir(BASE . 'framework/conf/extensions');\n while (($file = readdir($dh)) !== false) {\n if (is_readable(BASE . 'framework/conf/extensions/' . $file) && substr(\n $file,\n -14,\n 14\n ) == '.structure.php'\n ) {\n $arr = include(BASE . 'framework/conf/extensions/' . $file);\n // Check to see if the current user is a super admin, and only include database if so\n if (substr($file, 0, -14) != 'database' || $user->is_admin == 1) {\n $form->register(\n null,\n '',\n new htmlcontrol('<div id=\"config_' . count(\n $sections\n ) . '\" style=\"font-weight: bold; margin-top: 1.5em; border-top: 1px solid black; border-bottom: 1px solid black; background-color: #ccc; font-size: 12pt;\">' . $arr[0] . '</div><a href=\"#config_top\">Top</a>')\n );\n $sections[] = '<a href=\"#config_' . count($sections) . '\">' . $arr[0] . '</a>';\n foreach ($arr[1] as $directive => $info) {", " if ($info['description'] != '') {\n $form->register(\n null,\n '',\n new htmlcontrol('<br /><br />' . $info['description'], false)\n );\n }\n if (is_a($info['control'], \"checkboxcontrol\")) {\n $form->meta(\"opts[$directive]\", 1);\n $info['control']->default = $options[$directive];\n $info['control']->flip = true;\n $form->register(\n \"o[$directive]\",\n '<strong>' . $info['title'] . '</strong>',\n $info['control']\n );\n } else {\n if (isset($options[$directive])) {\n $info[\"control\"]->default = $options[$directive];\n }\n $form->register(\n \"c[$directive]\",\n '<strong>' . $info['title'] . '</strong>',\n $info['control'],\n $info['description']\n );\n }\n }\n //$form->register(null,'',new buttongroupcontrol(gt('Save'),'',gt('Cancel')));\n }\n }\n }\n// $form->registerAfter('activate',null,'',new htmlcontrol('<hr size=\"1\" />'.implode('&#160;&#160;|&#160;&#160;')));\n $form->register('submit', '', new buttongroupcontrol(gt('Save'), '', gt('Cancel')));", " return $form;\n }\n return null;\n }", " /** exdoc\n * Takes care of setting the appropriate template variables\n * to be used when viewing a profile or set of profiles.\n * Returns the initializes template.\n *\n * @param template $template The template object to assign to.\n * @param string $configname The name of the configuration profile.\n *\n * @return \\template\n * @node Subsystems:Config\n */\n public static function outputConfigurationTemplate($template, $configname) //FIXME this method is never used\n {\n if (is_readable(BASE . \"framework/conf/extensions\")) {\n $categorized = array();\n $options = self::parse($configname);", " $dh = opendir(BASE . \"framework/conf/extensions\");\n while (($file = readdir($dh)) !== false) {\n if (is_readable(BASE . \"framework/conf/extensions/$file\") && substr(\n $file,\n -14,\n 14\n ) == \".structure.php\"\n ) {\n $arr = include(BASE . \"framework/conf/extensions/$file\");\n $categorized[$arr[0]] = array();\n foreach ($arr[1] as $directive => $info) {\n if (is_a($info[\"control\"], \"passwordcontrol\")) {\n $info[\"value\"] = '&lt;' . gt('hidden') . '&gt;';\n } else {\n if (is_a($info[\"control\"], \"checkboxcontrol\")) {\n $info[\"value\"] = (isset($options[$directive]) ? ($options[$directive] ? \"yes\" : \"no\") : \"no\");\n } else {\n if (is_a($info[\"control\"], \"dropdowncontrol\") && isset($options[$directive])) {\n $info[\"value\"] = @$info[\"control\"]->items[$options[$directive]];\n } else {\n $info[\"value\"] = (isset($options[$directive]) ? $options[$directive] : \"\");\n }\n }\n }\n unset($info[\"control\"]);", " $categorized[$arr[0]][$directive] = $info;\n }\n }\n }\n $template->assign(\"configuration\", $categorized);\n }\n return $template;\n }", " /** exdoc\n * Looks through the framework/conf/profiles directory, and finds all of\n * the configuration profiles in existence. This function also\n * performs some minor name-mangling, to make the Profile Names\n * more user friendly. Returns an array of Profile names.\n *\n * @node Subsystems:Config\n * @return array\n */\n public static function profiles()\n {\n $profiles = array();\n if (is_readable(BASE . \"framework/conf/profiles\")) {\n $dh = opendir(BASE . \"framework/conf/profiles\");\n while (($file = readdir($dh)) !== false) {\n if (is_readable(BASE . \"framework/conf/profiles/$file\") && substr($file, -4, 4) == \".php\") {\n $name = substr($file, 0, -4);\n $profiles[$name] = str_replace(\"_\", \" \", $name);\n }\n }\n }\n return $profiles;\n }", " /** exdoc\n * Creates a configuration profile from the current configuration\n *\n * @param string $profile The name of the Profile to remove.\n *\n * @return string\n *\n * @node Subsystems:Config\n */\n public static function createProfile($profile)\n {\n if (!file_exists(BASE . \"framework/conf/profiles\")) {\n @mkdir(\n BASE . \"framework/conf/profiles\",\n DIR_DEFAULT_MODE_STR,\n true\n );\n }\n //FIXME do we need to delete an existing profile first??\n $profile = expFile::fixName($profile);\n// copy(BASE.\"framework/conf/config.php\",BASE.\"framework/conf/profiles/\".$profile.\".php\");\n// $baseprofile = self::parseFile(BASE . \"framework/conf/config.php\");\n $baseprofile = self::parse(); // get current configuration plus missing defaults\n unset($baseprofile['CURRENTCONFIGNAME']); // don't save profile name within actual profile\n self::saveValues($baseprofile, BASE . \"framework/conf/profiles/\" . $profile . \".php\");\n return $profile;\n }", " /** exdoc\n * Deletes a configuration profile from the framework/conf/profiles\n * directory.\n *\n * @param string $profile The name of the Profile to remove.\n *\n * @node Subsystems:Config\n */\n public static function deleteProfile($profile) //FIXME this method is never used\n {\n if (file_exists(BASE . \"framework/conf/profiles/$profile.php\")) {\n unlink(BASE . \"framework/conf/profiles/$profile.php\");\n }\n }", " /** exdoc\n * Activates a Configuration Profile.\n *\n * @param string $profile The name of the Profile to activate.\n *\n * @node Subsystems:Config\n */\n public static function activateProfile($profile)\n {", " if (!empty($profile) && (strpos($profile, '..') !== false || strpos($profile, '/') !== false)) {\n header('Location: ' . URL_FULL);\n exit(); // attempt to hack the site\n }", " if (is_readable(BASE . \"framework/conf/profiles/$profile.php\") && expUtil::isReallyWritable(\n BASE . \"framework/conf\"\n )\n ) {\n //FIXME do we need to delete current config first??\n copy(BASE . \"framework/conf/profiles/$profile.php\", BASE . \"framework/conf/config.php\");\n // tag it with the profile name\n $fh = fopen(BASE . \"framework/conf/config.php\", \"a\");\n fwrite(\n $fh,\n \"\\n<?php\\ndefine(\\\"CURRENTCONFIGNAME\\\",\\\"$profile\\\");\\n?>\"\n ); // add activated profile name to end of profile\n fclose($fh);\n }\n }", " /** exdoc\n * Parse Drop Down options from a file.\n *\n * @param string $dropdown_name The name of the dropdown type. The name of the\n * file will be retrieved by adding .dropdown as a suffix, and searching the framework/conf/data directory.\n *\n * @return array\n * @node Subsystems:Config\n */\n public static function dropdownData($dropdown_name)\n {\n $array = array();\n if (is_readable(BASE . \"framework/conf/data/$dropdown_name.dropdown\")) {\n $t = array();\n foreach (file(BASE . \"framework/conf/data/$dropdown_name.dropdown\") as $l) {\n $l = trim($l);\n if ($l != \"\" && substr($l, 0, 1) != \"#\") {\n $go = count($t);", " $t[] = trim($l);", " if ($go) {\n $array[$t[0]] = gt($t[1]);\n $t = array();\n }\n }\n }\n }\n return $array;\n }", "}", "expSettings::initialize(); // auto-initialize when loaded", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expString\n *\n * @package Subsystems\n * @subpackage Subsystems\n */\n/** @define \"BASE\" \"../../..\" */", "class expString {", " /**\n * Routine to convert string to UTF\n *\n * @static\n * @param string $string\n * @return string\n */\n\tstatic function convertUTF($string) {\n\t\treturn $string = str_replace('?', '', htmlspecialchars($string, ENT_IGNORE, 'UTF-8'));", "\t} ", "\n /**\n * Routine to check if string is valid UTF string\n *\n * @static\n * @param string $string\n * @return bool\n */\n\tstatic function validUTF($string) {\n\t\tif(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) {\n\t\t\treturn false;", "\t\t}\t\t", "\t\treturn true;\n\t}", " /**\n * Routine to strip unreadable characters from string - ascii 32 to 126\n *\n * @static\n * @param string $string\n * @return string\n */\n\tstatic function onlyReadables($string) {\n for ($i = 0, $iMax = strlen($string); $i < $iMax; $i++) {\n\t\t\t$chr = $string{$i};\n\t\t\t$ord = ord($chr);\n\t\t\tif ($ord<32 or $ord>126) {\n\t\t\t$chr = \"~\";\n\t\t\t$string{$i} = $chr;\n\t\t\t}\n\t\t}\n\t\treturn str_replace(\"~\", \"\", $string);\n\t}", " /**\n * Routine to\n *\n * @static\n * @param string $str\n * @param bool $unescape should the string also be unescaped?\n * @return mixed|string\n */\n\tstatic function parseAndTrim($str, $unescape=false) {\n if (is_array($str)) {\n $rst = array();\n foreach ($str as $key=>$st) {\n $rst[$key] = self::parseAndTrim($st, $unescape);\n }\n return $rst;\n }", " $str = str_replace(\"<br>\",\" \",$str);\n $str = str_replace(\"</br>\",\" \",$str);\n $str = str_replace(\"<br/>\",\" \",$str);\n $str = str_replace(\"<br />\",\" \",$str);\n $str = str_replace(\"\\r\\n\",\" \",$str);\n $str = str_replace('\"',\"&quot;\",$str);\n $str = str_replace(\"'\",\"&#39;\",$str);\n $str = str_replace(\"’\",\"&rsquo;\",$str);\n $str = str_replace(\"‘\",\"&lsquo;\",$str);\n $str = str_replace(\"®\",\"&#174;\",$str);\n $str = str_replace(\"–\",\"-\", $str);\n $str = str_replace(\"—\",\"&#151;\", $str);\n $str = str_replace(\"”\",\"&rdquo;\", $str);\n $str = str_replace(\"“\",\"&ldquo;\", $str);\n $str = str_replace(\"¼\",\"&#188;\",$str);\n $str = str_replace(\"½\",\"&#189;\",$str);\n $str = str_replace(\"¾\",\"&#190;\",$str);\n\t\t$str = str_replace(\"™\",\"&trade;\", $str);\n\t\t$str = trim($str);", "\t\t", " if ($unescape) {", "\t\t\t$str = stripcslashes($str); ", "\t\t} else {\n\t $str = addslashes($str);\n }", " return $str;\n }", " /**\n * Routine to convert string to an XML safe string\n *\n * @static\n * @param string $str\n * @return string\n */\n\tstatic function convertXMLFeedSafeChar($str) {\n\t\t$str = str_replace(\"<br>\",\"\",$str);\n $str = str_replace(\"</br>\",\"\",$str);\n $str = str_replace(\"<br/>\",\"\",$str);\n $str = str_replace(\"<br />\",\"\",$str);\n $str = str_replace(\"&quot;\",'\"',$str);\n $str = str_replace(\"&#39;\",\"'\",$str);\n $str = str_replace(\"&rsquo;\",\"'\",$str);", " $str = str_replace(\"&lsquo;\",\"'\",$str); ", " $str = str_replace(\"&#174;\",\"\",$str);\n $str = str_replace(\"�\",\"-\", $str);", " $str = str_replace(\"�\",\"-\", $str); ", " $str = str_replace(\"�\", '\"', $str);\n $str = str_replace(\"&rdquo;\",'\"', $str);\n $str = str_replace(\"�\", '\"', $str);\n $str = str_replace(\"&ldquo;\",'\"', $str);", " $str = str_replace(\"\\r\\n\",\" \",$str); ", " $str = str_replace(\"�\",\" 1/4\",$str);\n $str = str_replace(\"&#188;\",\" 1/4\", $str);\n $str = str_replace(\"�\",\" 1/2\",$str);\n $str = str_replace(\"&#189;\",\" 1/2\",$str);\n $str = str_replace(\"�\",\" 3/4\",$str);\n $str = str_replace(\"&#190;\",\" 3/4\",$str);\n $str = str_replace(\"�\", \"(TM)\", $str);\n $str = str_replace(\"&trade;\",\"(TM)\", $str);\n $str = str_replace(\"&reg;\",\"(R)\", $str);", " $str = str_replace(\"�\",\"(R)\",$str); \n $str = str_replace(\"&\",\"&amp;\",$str); \n\t\t$str = str_replace(\">\",\"&gt;\",$str); \t\t", " return trim($str);\n\t}", " /**\n * Routine to convert any smart quotes into normal quotes\n *\n * @param string $str\n * @return string\n */\n public static function convertSmartQuotes($str) {\n \t$find[] = '�'; // left side double smart quote\n \t$find[] = '�'; // right side double smart quote\n \t$find[] = '�'; // left side single smart quote\n \t$find[] = '�'; // right side single smart quote\n \t$find[] = '�'; // elipsis\n \t$find[] = '�'; // em dash\n \t$find[] = '�'; // en dash", " $replace[] = '\"';\n \t$replace[] = '\"';\n \t$replace[] = \"'\";\n \t$replace[] = \"'\";\n \t$replace[] = \"...\";\n \t$replace[] = \"-\";\n \t$replace[] = \"-\";", " $find[] = '“'; // left side double smart quote\n $find[] = '”'; // right side double smart quote\n $find[] = '‘'; // left side single smart quote\n $find[] = '’'; // right side single smart quote\n $find[] = '…'; // ellipsis\n $find[] = '—'; // em dash\n $find[] = '–'; // en dash", " $replace[] = '\"';\n $replace[] = '\"';\n $replace[] = \"'\";\n $replace[] = \"'\";\n $replace[] = \"...\";\n $replace[] = \"-\";\n $replace[] = \"-\";", "// $find[] = chr(145);\n// $find[] = chr(146);\n// $find[] = chr(147);\n// $find[] = chr(148);\n// $find[] = chr(150);\n// $find[] = chr(151);\n// $find[] = chr(133);\n// $find[] = chr(149);\n// $find[] = chr(11);\n//\n// $replace[] = \"'\";\n// $replace[] = \"'\";\n// $replace[] = \"\\\"\";\n// $replace[] = \"\\\"\";\n// $replace[] = \"-\";\n// $replace[] = \"-\";\n// $replace[] = \"...\";\n// $replace[] = \"&bull;\";\n// $replace[] = \"\\n\";", " \treturn str_replace($find, $replace, $str);\n }", " /**\n * Enhanced variation of strip_tags with 'invert' option to remove specific tags\n *\n * @param $text\n * @param string $tags\n * @param bool $invert\n * @return mixed\n */\n public static function strip_tags_content($text, $tags = '', $invert = false)\n {\n preg_match_all('/<(.+?)[\\s]*\\/?[\\s]*>/si', trim($tags), $tags);\n $tags = array_unique($tags[1]);", " if (is_array($tags) AND count($tags) > 0) {\n if ($invert == false) {\n return preg_replace('@<(?!(?:' . implode('|', $tags) . ')\\b)(\\w+)\\b.*?>.*?</\\1>@si', '', $text);\n } else {\n return preg_replace('@<(' . implode('|', $tags) . ')\\b.*?>.*?</\\1>@si', '', $text);\n }\n } elseif ($invert == false) {\n return preg_replace('@<(\\w+)\\b.*?>.*?</\\1>@si', '', $text);\n }\n return $text;\n }", " /**\\\n * Replace any non-ascii character with its hex code with NO active db connection\n */\n public static function escape($value) {\n global $db;", " if ($db->havedb) {\n return $db->escapeString($value);\n }", " $return = '';\n for ($i = 0, $iMax = strlen($value); $i < $iMax; $i++) {\n $char = $value[$i];\n $ord = ord($char);\n if($char !== \"'\" && $char !== \"\\\"\" && $char !== '\\\\' && $ord >= 32 && $ord <= 126)\n $return .= $char;\n else\n $return .= '\\\\x' . dechex($ord);\n }\n return $return;\n }", " /**\n * Summarize or short a long string\n *\n * @param $string\n * @param string $strtype\n * @param string $type\n *\n * @return string\n */\n public static function summarize($string, $strtype='html', $type='para', $more='...') {\n $sep = ($strtype == \"html\" ? array(\"</p>\", \"</div>\") : array(\"\\r\\n\", \"\\n\", \"\\r\"));\n $origstring = $string;", " switch ($type) {\n case \"para\":\n foreach ($sep as $s) {\n $para = explode($s, $string);\n $string = $para[0];\n }\n if (strlen($string) < strlen($origstring)) {\n $string .= \" \" . $more;\n }\n //\t\t\treturn str_replace(\"&amp;#160;\",\" \",htmlentities(expString::convertSmartQuotes(strip_tags($string)),ENT_QUOTES));\n return expString::convertSmartQuotes(strip_tags($string));\n break;\n case \"paralinks\":\n foreach ($sep as $s) {\n $para = explode($s, $string);\n $string = $para[0];\n }\n if (strlen($string) < strlen($origstring)) {\n $string .= \" \" . $more;\n }\n //\t\t\treturn str_replace(\"&#160;\",\" \",htmlspecialchars_decode(htmlentities(expString::convertSmartQuotes(strip_tags($string,'<a>')),ENT_QUOTES)));\n return expString::convertSmartQuotes(strip_tags($string, '<a>'));\n break;\n case \"parapaged\":\n// $s = '<div style=\"page-break-after: always;\"><span style=\"display: none;\">&nbsp;</span></div>';\n $s = '<div style=\"page-break-after: always';\n $para = explode($s, $string);\n $string = $para[0];\n return expString::convertSmartQuotes($string);\n break;\n case \"parahtml\":\n foreach ($sep as $s) {\n $para = explode($s, $string);\n $string = $para[0];\n }\n if (strlen($string) < strlen($origstring)) {\n $string .= \" \" . $more;\n }\n if (!empty($string)) {\n $isText = true;\n $ret = \"\";\n $i = 0;\n // $currentChar = \"\";\n // $lastSpacePosition = -1;\n // $lastChar = \"\";\n $tagsArray = array();\n $currentTag = \"\";\n // $tagLevel = 0;\n // $noTagLength = strlen(strip_tags($string));", " // Parser loop\n for ($j = 0, $jMax = strlen($string); $j < $jMax; $j++) {", " $currentChar = substr($string, $j, 1);\n $ret .= $currentChar;", " // Lesser than event\n if ($currentChar == \"<\") $isText = false;", " // Character handler\n if ($isText) {", " // Memorize last space position\n if ($currentChar == \" \") {\n $lastSpacePosition = $j;\n } else {\n $lastChar = $currentChar;\n }", " $i++;\n } else {\n $currentTag .= $currentChar;\n }", " // Greater than event\n if ($currentChar == \">\") {\n $isText = true;", " // Opening tag handler\n if ((strpos($currentTag, \"<\") !== FALSE) &&\n (strpos($currentTag, \"/>\") === FALSE) &&\n (strpos($currentTag, \"</\") === FALSE)\n ) {", " // Tag has attribute(s)\n if (strpos($currentTag, \" \") !== FALSE) {\n $currentTag = substr($currentTag, 1, strpos($currentTag, \" \") - 1);\n } else {\n // Tag doesn't have attribute(s)\n $currentTag = substr($currentTag, 1, -1);\n }", " array_push($tagsArray, $currentTag);", " } else if (strpos($currentTag, \"</\") !== FALSE) {\n array_pop($tagsArray);\n }", " $currentTag = \"\";\n }\n }\n // Cut HTML string at last space position\n // if ($length < $noTagLength) {\n // if ($lastSpacePosition != -1) {\n // $ret = substr($string, 0, $lastSpacePosition);\n // } else {\n // $ret = substr($string, $j);\n // }\n // }\n if (sizeof($tagsArray) != 0) {\n // Close broken XHTML elements\n while (sizeof($tagsArray) != 0) {\n if (sizeof($tagsArray) > 1) {\n $aTag = array_pop($tagsArray);\n $string .= \"</\" . $aTag . \">\";\n } // You may add more tags here to put the link and added text before the closing tag\n elseif ($aTag == 'p' || 'div') {\n $aTag = array_pop($tagsArray);\n $string .= \"</\" . $aTag . \">\";\n } else {\n $aTag = array_pop($tagsArray);\n $string .= \"</\" . $aTag . \">\";\n }\n }\n }\n }\n return expString::convertSmartQuotes($string);\n break;\n default:\n $words = explode(\" \", strip_tags($string));\n $string = implode(\" \", array_slice($words, 0, $type + 0));\n if (strlen($string) < strlen($origstring)) {\n $string .= \" \" . $more;\n }\n //\t\t\treturn str_replace(\"&amp;#160;\",\" \",htmlentities(expString::convertSmartQuotes($string),ENT_QUOTES));\n return expString::convertSmartQuotes($string);\n break;\n }\n }", " public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? �\n //echo \"1<br>\"; eDebug($str);", " $str = str_replace(\"�\", \"&rsquo;\", $str);\n $str = str_replace(\"�\", \"&lsquo;\", $str);\n $str = str_replace(\"�\", \"&#174;\", $str);\n $str = str_replace(\"�\", \"-\", $str);\n $str = str_replace(\"�\", \"&#151;\", $str);\n $str = str_replace(\"�\", \"&rdquo;\", $str);\n $str = str_replace(\"�\", \"&ldquo;\", $str);\n $str = str_replace(\"\\r\\n\", \" \", $str);\n $str = str_replace(\"\\t\", \" \", $str);\n $str = str_replace(\",\", \"\\,\", $str);\n $str = str_replace(\"�\", \"&#188;\", $str);\n $str = str_replace(\"�\", \"&#189;\", $str);\n $str = str_replace(\"�\", \"&#190;\", $str);", " if (!$isHTML) {\n $str = str_replace('\\\"', \"&quot;\", $str);\n $str = str_replace('\"', \"&quot;\", $str);\n } else {\n $str = str_replace('\"', '\"\"', $str);\n }", " //$str = htmlspecialchars($str);\n //$str = utf8_encode($str);\n $str = trim(str_replace(\"�\", \"&trade;\", $str));\n //echo \"2<br>\"; eDebug($str,die);\n return $str;\n }", " public static function parseAndTrimImport($str, $isHTML = false) { //�Death from above�? �\n //echo \"1<br>\"; eDebug($str);", " global $db;", "\n $str = str_replace(\"�\", \"&rsquo;\", $str);\n $str = str_replace(\"�\", \"&lsquo;\", $str);\n $str = str_replace(\"�\", \"&#174;\", $str);\n $str = str_replace(\"�\", \"-\", $str);\n $str = str_replace(\"�\", \"&#151;\", $str);\n $str = str_replace(\"�\", \"&rdquo;\", $str);\n $str = str_replace(\"�\", \"&ldquo;\", $str);\n $str = str_replace(\"\\r\\n\", \" \", $str);\n $str = str_replace(\"\\,\", \",\", $str);\n $str = str_replace('\"\"', '\"', $str); //do this no matter what...in case someone added a quote in a non HTML field\n if (!$isHTML) {\n //if HTML, then leave the single quotes alone, otheriwse replace w/ special Char\n $str = str_replace('\"', \"&quot;\", $str);\n }\n $str = str_replace(\"�\", \"&#188;\", $str);\n $str = str_replace(\"�\", \"&#189;\", $str);\n $str = str_replace(\"�\", \"&#190;\", $str);\n //$str = htmlspecialchars($str);\n //$str = utf8_encode($str);\n// if (DB_ENGINE=='mysqli') {", "//\t $str = @mysqli_real_escape_string($db->connection,trim(str_replace(\"�\", \"&trade;\", $str)));", "// } elseif(DB_ENGINE=='mysql') {", "// $str = @mysql_real_escape_string(trim(str_replace(\"�\", \"&trade;\", $str)),$db->connection);", "// } else {\n//\t $str = trim(str_replace(\"�\", \"&trade;\", $str));\n// }", " $str = @$db->escapeString($db->connection, trim(str_replace(\"�\", \"&trade;\", $str)));", " //echo \"2<br>\"; eDebug($str,die);\n return $str;\n }", " public static function outputField($val, $eof = ',', $isHTML = false) {\n $newVal = self::parseAndTrimExport($val, $isHTML);\n if ($newVal != '') return '\"' . $newVal . '\"' . $eof;\n else return $eof;\n }", " public static function stripLineEndings($val) {\n return preg_replace('/\\r\\n/', ' ', trim($val));\n }", " /**\n * Scrub input string for possible security issues.\n *\n * @static\n * @param $data string\n * @return string\n */\n public static function sanitize(&$data) {\n// return $data;", " if (is_array($data)) {\n $saved_params = array();\n if (!empty($data['controller']) && $data['controller'] == 'snippet') {\n $saved_params['body'] = $data['body']; // store snippet body\n }\n foreach ($data as $var=>$val) {\n// $data[$var] = self::sanitize($val);\n $data[$var] = self::xss_clean($val);\n }\n if (!empty($saved_params)) {\n $data = array_merge($data, $saved_params); // add stored snippet body\n }\n } else {\n if (empty($data)) {\n return $data;\n }", " $data = self::xss_clean($data);", " //fixme orig exp method\n// if(0) {\n// // remove whitespaces and tags\n//// $data = strip_tags(trim($data));\n// // remove whitespaces and script tags\n// $data = self::strip_tags_content(trim($data), '<script>', true);\n//// $data = self::strip_tags_content(trim($data), '<iframe>', true);\n//\n// // apply stripslashes if magic_quotes_gpc is enabled\n// if (get_magic_quotes_gpc()) {\n// $data = stripslashes($data);\n// }\n//\n// $data = self::escape($data);\n//\n// // re-escape newlines\n// $data = str_replace(array('\\r', '\\n'), array(\"\\r\", \"\\n\"), $data);\n// }\n }\n return $data;\n }", " // xss_clean //", " /**\n \t * Character set\n \t *\n \t * Will be overridden by the constructor.\n \t *\n \t * @var\tstring\n \t */\n \tpublic static $charset = 'UTF-8';", " /**\n \t * XSS Hash\n \t *\n \t * Random Hash for protecting URLs.\n \t *\n \t * @var\tstring\n \t */\n \tprotected static $_xss_hash;", " /**\n \t * List of never allowed strings\n \t *\n \t * @var\tarray\n \t */\n protected static $_never_allowed_str =\tarray(\n \t\t'document.cookie'\t=> '[removed]',\n \t\t'document.write'\t=> '[removed]',\n \t\t'.parentNode'\t\t=> '[removed]',\n \t\t'.innerHTML'\t\t=> '[removed]',\n \t\t'-moz-binding'\t\t=> '[removed]',\n \t\t'<!--'\t\t\t\t=> '&lt;!--',\n \t\t'-->'\t\t\t\t=> '--&gt;',\n \t\t'<![CDATA['\t\t\t=> '&lt;![CDATA[',\n \t\t'<comment>'\t\t\t=> '&lt;comment&gt;'\n \t);", " \t/**\n \t * List of never allowed regex replacements\n \t *\n \t * @var\tarray\n \t */\n protected static $_never_allowed_regex = array(\n \t\t'javascript\\s*:',\n \t\t'(document|(document\\.)?window)\\.(location|on\\w*)',\n \t\t'expression\\s*(\\(|&\\#40;)', // CSS and IE\n \t\t'vbscript\\s*:', // IE, surprise!\n \t\t'wscript\\s*:', // IE\n \t\t'jscript\\s*:', // IE\n \t\t'vbs\\s*:', // IE\n \t\t'Redirect\\s+30\\d',\n \t\t\"([\\\"'])?data\\s*:[^\\\\1]*?base64[^\\\\1]*?,[^\\\\1]*?\\\\1?\"\n \t);", " /**\n \t * XSS Clean\n \t *\n \t * Sanitizes data so that Cross Site Scripting Hacks can be\n \t * prevented. This method does a fair amount of work but\n \t * it is extremely thorough, designed to prevent even the\n \t * most obscure XSS attempts. Nothing is ever 100% foolproof,\n \t * of course, but I haven't been able to get anything passed\n \t * the filter.\n \t *\n \t * Note: Should only be used to deal with data upon submission.\n \t *\t It's not something that should be used for general\n \t *\t runtime processing.\n \t *\n \t * @link\thttp://channel.bitflux.ch/wiki/XSS_Prevention\n \t * \t\tBased in part on some code and ideas from Bitflux.\n \t *\n \t * @link\thttp://ha.ckers.org/xss.html\n \t * \t\tTo help develop this script I used this great list of\n \t *\t\tvulnerabilities along with a few other hacks I've\n \t *\t\tharvested from examining vulnerabilities in other programs.\n \t *\n \t * @param\tstring|string[]\t$str\t\tInput data\n \t * @param \tbool\t\t$is_image\tWhether the input is an image\n \t * @return\tstring\n \t */\n \tpublic static function xss_clean($str, $is_image = FALSE)\n \t{\n \t\t// Is the string an array?\n \t\tif (is_array($str))\n \t\t{\n \t\t\twhile (list($key) = each($str))\n \t\t\t{\n if (preg_match('/^[a-zA-Z0-9_\\x7f-\\xff]*$/', $key)) { // check for valid array name\n $str[$key] = self::xss_clean($str[$key]);\n } else {\n return null;\n }\n \t\t\t}", " \t\t\treturn $str;\n \t\t}", " \t\t// Remove Invisible Characters\n \t\t$str = self::remove_invisible_characters($str);", " \t\t/*\n \t\t * URL Decode\n \t\t *\n \t\t * Just in case stuff like this is submitted:\n \t\t *\n \t\t * <a href=\"http://%77%77%77%2E%67%6F%6F%67%6C%65%2E%63%6F%6D\">Google</a>\n \t\t *\n \t\t * Note: Use rawurldecode() so it does not remove plus signs\n \t\t */\n \t\tdo\n \t\t{\n \t\t\t$str = rawurldecode($str);\n \t\t}\n \t\twhile (preg_match('/%[0-9a-f]{2,}/i', $str));", " \t\t/*\n \t\t * Convert character entities to ASCII\n \t\t *\n \t\t * This permits our tests below to work reliably.\n \t\t * We only convert entities that are within tags since\n \t\t * these are the ones that will pose security problems.\n \t\t */\n \t\t$str = preg_replace_callback(\"/[^a-z0-9>]+[a-z0-9]+=([\\'\\\"]).*?\\\\1/si\", array('self', '_convert_attribute'), $str);\n \t\t$str = preg_replace_callback('/<\\w+.*/si', array('self', '_decode_entity'), $str);", " \t\t// Remove Invisible Characters Again!\n \t\t$str = self::remove_invisible_characters($str);", " \t\t/*\n \t\t * Convert all tabs to spaces\n \t\t *\n \t\t * This prevents strings like this: ja\tvascript\n \t\t * NOTE: we deal with spaces between characters later.\n \t\t * NOTE: preg_replace was found to be amazingly slow here on\n \t\t * large blocks of data, so we use str_replace.\n \t\t */\n \t\t$str = str_replace(\"\\t\", ' ', $str);", " \t\t// Capture converted string for later comparison\n \t\t$converted_string = $str;", " \t\t// Remove Strings that are never allowed\n \t\t$str = self::_do_never_allowed($str);", " \t\t/*\n \t\t * Makes PHP tags safe\n \t\t *\n \t\t * Note: XML tags are inadvertently replaced too:\n \t\t *\n \t\t * <?xml\n \t\t *\n \t\t * But it doesn't seem to pose a problem.\n \t\t */\n \t\tif ($is_image === TRUE)\n \t\t{\n \t\t\t// Images have a tendency to have the PHP short opening and\n \t\t\t// closing tags every so often so we skip those and only\n \t\t\t// do the long opening tags.\n \t\t\t$str = preg_replace('/<\\?(php)/i', '&lt;?\\\\1', $str);\n \t\t}\n \t\telse\n \t\t{\n \t\t\t$str = str_replace(array('<?', '?'.'>'), array('&lt;?', '?&gt;'), $str);\n \t\t}", " \t\t/*\n \t\t * Compact any exploded words\n \t\t *\n \t\t * This corrects words like: j a v a s c r i p t\n \t\t * These words are compacted back to their correct state.\n \t\t */\n \t\t$words = array(\n \t\t\t'javascript', 'expression', 'vbscript', 'jscript', 'wscript',\n \t\t\t'vbs', 'script', 'base64', 'applet', 'alert', 'document',\n \t\t\t'write', 'cookie', 'window', 'confirm', 'prompt', 'eval'\n \t\t);", " \t\tforeach ($words as $word)\n \t\t{\n \t\t\t$word = implode('\\s*', str_split($word)).'\\s*';", " \t\t\t// We only want to do this when it is followed by a non-word character\n \t\t\t// That way valid stuff like \"dealer to\" does not become \"dealerto\"\n \t\t\t$str = preg_replace_callback('#('.substr($word, 0, -3).')(\\W)#is', array('self', '_compact_exploded_words'), $str);\n \t\t}", " \t\t/*\n \t\t * Remove disallowed Javascript in links or img tags\n \t\t * We used to do some version comparisons and use of stripos(),\n \t\t * but it is dog slow compared to these simplified non-capturing\n \t\t * preg_match(), especially if the pattern exists in the string\n \t\t *\n \t\t * Note: It was reported that not only space characters, but all in\n \t\t * the following pattern can be parsed as separators between a tag name\n \t\t * and its attributes: [\\d\\s\"\\'`;,\\/\\=\\(\\x00\\x0B\\x09\\x0C]\n \t\t * ... however, remove_invisible_characters() above already strips the\n \t\t * hex-encoded ones, so we'll skip them below.\n \t\t */\n \t\tdo\n \t\t{\n \t\t\t$original = $str;", " \t\t\tif (preg_match('/<a/i', $str))\n \t\t\t{\n \t\t\t\t$str = preg_replace_callback('#<a[^a-z0-9>]+([^>]*?)(?:>|$)#si', array('self', '_js_link_removal'), $str);\n \t\t\t}", " \t\t\tif (preg_match('/<img/i', $str))\n \t\t\t{\n \t\t\t\t$str = preg_replace_callback('#<img[^a-z0-9]+([^>]*?)(?:\\s?/?>|$)#si', array('self', '_js_img_removal'), $str);\n \t\t\t}", " \t\t\tif (preg_match('/script|xss/i', $str))\n \t\t\t{\n \t\t\t\t$str = preg_replace('#</*(?:script|xss).*?>#si', '[removed]', $str);\n \t\t\t}\n \t\t}\n \t\twhile ($original !== $str);\n \t\tunset($original);", " \t\t/*\n \t\t * Sanitize naughty HTML elements\n \t\t *\n \t\t * If a tag containing any of the words in the list\n \t\t * below is found, the tag gets converted to entities.\n \t\t *\n \t\t * So this: <blink>\n \t\t * Becomes: &lt;blink&gt;\n \t\t */\n \t\t$pattern = '#'\n \t\t\t.'<((?<slash>/*\\s*)(?<tagName>[a-z0-9]+)(?=[^a-z0-9]|$)' // tag start and name, followed by a non-tag character\n \t\t\t.'[^\\s\\042\\047a-z0-9>/=]*' // a valid attribute character immediately after the tag would count as a separator\n \t\t\t// optional attributes\n \t\t\t.'(?<attributes>(?:[\\s\\042\\047/=]*' // non-attribute characters, excluding > (tag close) for obvious reasons\n \t\t\t.'[^\\s\\042\\047>/=]+' // attribute characters\n \t\t\t// optional attribute-value\n \t\t\t\t.'(?:\\s*=' // attribute-value separator\n \t\t\t\t\t.'(?:[^\\s\\042\\047=><`]+|\\s*\\042[^\\042]*\\042|\\s*\\047[^\\047]*\\047|\\s*(?U:[^\\s\\042\\047=><`]*))' // single, double or non-quoted value\n \t\t\t\t.')?' // end optional attribute-value group\n \t\t\t.')*)' // end optional attributes group\n \t\t\t.'[^>]*)(?<closeTag>\\>)?#isS';", " \t\t// Note: It would be nice to optimize this for speed, BUT\n \t\t// only matching the naughty elements here results in\n \t\t// false positives and in turn - vulnerabilities!\n \t\tdo\n \t\t{\n \t\t\t$old_str = $str;\n \t\t\t$str = preg_replace_callback($pattern, array('self', '_sanitize_naughty_html'), $str);\n \t\t}\n \t\twhile ($old_str !== $str);\n \t\tunset($old_str);", " \t\t/*\n \t\t * Sanitize naughty scripting elements\n \t\t *\n \t\t * Similar to above, only instead of looking for\n \t\t * tags it looks for PHP and JavaScript commands\n \t\t * that are disallowed. Rather than removing the\n \t\t * code, it simply converts the parenthesis to entities\n \t\t * rendering the code un-executable.\n \t\t *\n \t\t * For example:\teval('some code')\n \t\t * Becomes:\teval&#40;'some code'&#41;\n \t\t */\n \t\t$str = preg_replace(\n \t\t\t'#(alert|prompt|confirm|cmd|passthru|eval|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\\s*)\\((.*?)\\)#si',\n \t\t\t'\\\\1\\\\2&#40;\\\\3&#41;',\n \t\t\t$str\n \t\t);", " \t\t// Final clean up\n \t\t// This adds a bit of extra precaution in case\n \t\t// something got through the above filters\n \t\t$str = self::_do_never_allowed($str);", " \t\t/*\n \t\t * Images are Handled in a Special Way\n \t\t * - Essentially, we want to know that after all of the character\n \t\t * conversion is done whether any unwanted, likely XSS, code was found.\n \t\t * If not, we return TRUE, as the image is clean.\n \t\t * However, if the string post-conversion does not matched the\n \t\t * string post-removal of XSS, then it fails, as there was unwanted XSS\n \t\t * code found and removed/changed during processing.\n \t\t */\n \t\tif ($is_image === TRUE)\n \t\t{\n \t\t\treturn ($str === $converted_string);\n \t\t}", " \t\treturn $str;\n \t}", " /**\n \t * Do Never Allowed\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param \tstring\n \t * @return \tstring\n \t */\n \tprotected static function _do_never_allowed($str)\n \t{\n \t\t$str = str_replace(array_keys(self::$_never_allowed_str), self::$_never_allowed_str, $str);", " \t\tforeach (self::$_never_allowed_regex as $regex)\n \t\t{\n \t\t\t$str = preg_replace('#'.$regex.'#is', '[removed]', $str);\n \t\t}", " \t\treturn $str;\n \t}", "\t/**\n\t * Remove Invisible Characters\n\t *\n\t * This prevents sandwiching null characters\n\t * between ascii characters, like Java\\0script.\n\t *\n\t * @param\tstring\n\t * @param\tbool\n\t * @return\tstring\n\t */\n\tpublic static function remove_invisible_characters($str, $url_encoded = TRUE)\n\t{\n\t\t$non_displayables = array();", "\t\t// every control character except newline (dec 10),\n\t\t// carriage return (dec 13) and horizontal tab (dec 09)\n\t\tif ($url_encoded)\n\t\t{\n\t\t\t$non_displayables[] = '/%0[0-8bcef]/';\t// url encoded 00-08, 11, 12, 14, 15\n\t\t\t$non_displayables[] = '/%1[0-9a-f]/';\t// url encoded 16-31\n\t\t}", "\t\t$non_displayables[] = '/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]+/S';\t// 00-08, 11, 12, 14-31, 127", "\t\tdo\n\t\t{\n\t\t\t$str = preg_replace($non_displayables, '', $str, -1, $count);\n\t\t}\n\t\twhile ($count);", "\t\treturn $str;\n\t}", " /**\n \t * HTML Entity Decode Callback\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$match\n \t * @return\tstring\n \t */\n \tprotected static function _decode_entity($match)\n \t{\n \t\t// Protect GET variables in URLs\n \t\t// 901119URL5918AMP18930PROTECT8198\n \t\t$match = preg_replace('|\\&([a-z\\_0-9\\-]+)\\=([a-z\\_0-9\\-/]+)|i', self::xss_hash().'\\\\1=\\\\2', $match[0]);", " \t\t// Decode, then un-protect URL GET vars\n \t\treturn str_replace(\n self::xss_hash(),\n \t\t\t'&',\n self::entity_decode($match, self::$charset)\n \t\t);\n \t}", " /**\n \t * XSS Hash\n \t *\n \t * Generates the XSS hash if needed and returns it.\n \t *\n \t * @see\t\tCI_Security::$_xss_hash\n \t * @return\tstring\tXSS hash\n \t */\n \tpublic static function xss_hash()\n \t{\n \t\tif (self::$_xss_hash === NULL)\n \t\t{\n \t\t\t$rand = self::get_random_bytes(16);\n self::$_xss_hash = ($rand === FALSE)\n \t\t\t\t? md5(uniqid(mt_rand(), TRUE))\n \t\t\t\t: bin2hex($rand);\n \t\t}", " \t\treturn self::$_xss_hash;\n \t}", " /**\n \t * HTML Entities Decode\n \t *\n \t * A replacement for html_entity_decode()\n \t *\n \t * The reason we are not using html_entity_decode() by itself is because\n \t * while it is not technically correct to leave out the semicolon\n \t * at the end of an entity most browsers will still interpret the entity\n \t * correctly. html_entity_decode() does not convert entities without\n \t * semicolons, so we are left with our own little solution here. Bummer.\n \t *\n \t * @link\thttp://php.net/html-entity-decode\n \t *\n \t * @param\tstring\t$str\t\tInput\n \t * @param\tstring\t$charset\tCharacter set\n \t * @return\tstring\n \t */\n \tpublic static function entity_decode($str, $charset = NULL)\n \t{\n \t\tif (strpos($str, '&') === FALSE)\n \t\t{\n \t\t\treturn $str;\n \t\t}", " \t\tstatic $_entities;", " \t\tisset($charset) OR $charset = self::$charset;\n \t\t$flag = expCore::is_php('5.4')\n \t\t\t? ENT_COMPAT | ENT_HTML5\n \t\t\t: ENT_COMPAT;", " \t\tdo\n \t\t{\n \t\t\t$str_compare = $str;", " \t\t\t// Decode standard entities, avoiding false positives\n \t\t\tif (preg_match_all('/&[a-z]{2,}(?![a-z;])/i', $str, $matches))\n \t\t\t{\n \t\t\t\tif ( ! isset($_entities))\n \t\t\t\t{\n \t\t\t\t\t$_entities = array_map(\n \t\t\t\t\t\t'strtolower',\n expCore::is_php('5.3.4')\n \t\t\t\t\t\t\t? get_html_translation_table(HTML_ENTITIES, $flag, $charset)\n \t\t\t\t\t\t\t: get_html_translation_table(HTML_ENTITIES, $flag)\n \t\t\t\t\t);", " \t\t\t\t\t// If we're not on PHP 5.4+, add the possibly dangerous HTML 5\n \t\t\t\t\t// entities to the array manually\n \t\t\t\t\tif ($flag === ENT_COMPAT)\n \t\t\t\t\t{\n \t\t\t\t\t\t$_entities[':'] = '&colon;';\n \t\t\t\t\t\t$_entities['('] = '&lpar;';\n \t\t\t\t\t\t$_entities[')'] = '&rpar;';\n \t\t\t\t\t\t$_entities[\"\\n\"] = '&newline;';\n \t\t\t\t\t\t$_entities[\"\\t\"] = '&tab;';\n \t\t\t\t\t}\n \t\t\t\t}", " \t\t\t\t$replace = array();\n \t\t\t\t$matches = array_unique(array_map('strtolower', $matches[0]));\n \t\t\t\tforeach ($matches as &$match)\n \t\t\t\t{\n \t\t\t\t\tif (($char = array_search($match.';', $_entities, TRUE)) !== FALSE)\n \t\t\t\t\t{\n \t\t\t\t\t\t$replace[$match] = $char;\n \t\t\t\t\t}\n \t\t\t\t}", " \t\t\t\t$str = str_ireplace(array_keys($replace), array_values($replace), $str);\n \t\t\t}", " \t\t\t// Decode numeric & UTF16 two byte entities\n \t\t\t$str = html_entity_decode(\n \t\t\t\tpreg_replace('/(&#(?:x0*[0-9a-f]{2,5}(?![0-9a-f;])|(?:0*\\d{2,4}(?![0-9;]))))/iS', '$1;', $str),\n \t\t\t\t$flag,\n \t\t\t\t$charset\n \t\t\t);\n \t\t}\n \t\twhile ($str_compare !== $str);\n \t\treturn $str;\n \t}", " /**\n \t * Get random bytes\n \t *\n \t * @param\tint\t$length\tOutput length\n \t * @return\tstring\n \t */\n \tpublic static function get_random_bytes($length)\n \t{\n \t\tif (empty($length) OR ! ctype_digit((string) $length))\n \t\t{\n \t\t\treturn FALSE;\n \t\t}", " if (function_exists('random_bytes'))\n {\n try\n {\n // The cast is required to avoid TypeError\n return random_bytes((int) $length);\n }\n catch (Exception $e)\n {\n // If random_bytes() can't do the job, we can't either ...\n // There's no point in using fallbacks.\n log_message('error', $e->getMessage());\n return FALSE;\n }\n }", " \t\t// Unfortunately, none of the following PRNGs is guaranteed to exist ...\n \t\tif (defined('MCRYPT_DEV_URANDOM') && ($output = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM)) !== FALSE)\n \t\t{\n \t\t\treturn $output;\n \t\t}", "\n \t\tif (is_readable('/dev/urandom') && ($fp = fopen('/dev/urandom', 'rb')) !== FALSE)\n \t\t{\n \t\t\t// Try not to waste entropy ...\n expCore::is_php('5.4') && stream_set_chunk_size($fp, $length);\n \t\t\t$output = fread($fp, $length);\n \t\t\tfclose($fp);\n \t\t\tif ($output !== FALSE)\n \t\t\t{\n \t\t\t\treturn $output;\n \t\t\t}\n \t\t}", " \t\tif (function_exists('openssl_random_pseudo_bytes'))\n \t\t{\n \t\t\treturn openssl_random_pseudo_bytes($length);\n \t\t}", " \t\treturn FALSE;\n \t}", " /**\n \t * Attribute Conversion\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$match\n \t * @return\tstring\n \t */\n \tprotected static function _convert_attribute($match)\n \t{\n \t\treturn str_replace(array('>', '<', '\\\\'), array('&gt;', '&lt;', '\\\\\\\\'), $match[0]);\n \t}", " /**\n \t * Compact Exploded Words\n \t *\n \t * Callback method for xss_clean() to remove whitespace from\n \t * things like 'j a v a s c r i p t'.\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$matches\n \t * @return\tstring\n \t */\n \tprotected static function _compact_exploded_words($matches)\n \t{\n \t\treturn preg_replace('/\\s+/s', '', $matches[1]).$matches[2];\n \t}", " /**\n \t * JS Link Removal\n \t *\n \t * Callback method for xss_clean() to sanitize links.\n \t *\n \t * This limits the PCRE backtracks, making it more performance friendly\n \t * and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in\n \t * PHP 5.2+ on link-heavy strings.\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$match\n \t * @return\tstring\n \t */\n \tprotected static function _js_link_removal($match)\n \t{\n \t\treturn str_replace(\n \t\t\t$match[1],\n \t\t\tpreg_replace(\n \t\t\t\t'#href=.*?(?:(?:alert|prompt|confirm)(?:\\(|&\\#40;)|javascript:|livescript:|mocha:|charset=|window\\.|document\\.|\\.cookie|<script|<xss|data\\s*:)#si',\n \t\t\t\t'',\n \t\t\t\tself::_filter_attributes($match[1])\n \t\t\t),\n \t\t\t$match[0]\n \t\t);\n \t}", " /**\n \t * JS Image Removal\n \t *\n \t * Callback method for xss_clean() to sanitize image tags.\n \t *\n \t * This limits the PCRE backtracks, making it more performance friendly\n \t * and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in\n \t * PHP 5.2+ on image tag heavy strings.\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$match\n \t * @return\tstring\n \t */\n \tprotected static function _js_img_removal($match)\n \t{\n \t\treturn str_replace(\n \t\t\t$match[1],\n \t\t\tpreg_replace(\n \t\t\t\t'#src=.*?(?:(?:alert|prompt|confirm|eval)(?:\\(|&\\#40;)|javascript:|livescript:|mocha:|charset=|window\\.|document\\.|\\.cookie|<script|<xss|base64\\s*,)#si',\n \t\t\t\t'',\n \t\t\t\tself::_filter_attributes($match[1])\n \t\t\t),\n \t\t\t$match[0]\n \t\t);\n \t}", " /**\n \t * Filter Attributes\n \t *\n \t * Filters tag attributes for consistency and safety.\n \t *\n \t * @used-by\tCI_Security::_js_img_removal()\n \t * @used-by\tCI_Security::_js_link_removal()\n \t * @param\tstring\t$str\n \t * @return\tstring\n \t */\n \tprotected static function _filter_attributes($str)\n \t{\n \t\t$out = '';\n \t\tif (preg_match_all('#\\s*[a-z\\-]+\\s*=\\s*(\\042|\\047)([^\\\\1]*?)\\\\1#is', $str, $matches))\n \t\t{\n \t\t\tforeach ($matches[0] as $match)\n \t\t\t{\n \t\t\t\t$out .= preg_replace('#/\\*.*?\\*/#s', '', $match);\n \t\t\t}\n \t\t}", " \t\treturn $out;\n \t}", " /**\n \t * Sanitize Naughty HTML\n \t *\n \t * Callback method for xss_clean() to remove naughty HTML elements.\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$matches\n \t * @return\tstring\n \t */\n \tprotected static function _sanitize_naughty_html($matches)\n \t{\n \t\tstatic $naughty_tags = array(\n \t\t\t'alert', 'prompt', 'confirm', 'applet', 'audio', 'basefont', 'base', 'behavior', 'bgsound',\n \t\t\t'blink', 'body', 'embed', 'expression', 'form', 'frameset', 'frame', 'head', 'html', 'ilayer',\n \t\t\t'input', 'button', 'select', 'isindex', 'layer', 'link', 'meta', 'keygen', 'object',\n \t\t\t'plaintext', 'script', 'textarea', 'title', 'math', 'video', 'svg', 'xml', 'xss'\n //,'style', 'iframe'\n \t\t);", " \t\tstatic $evil_attributes = array(\n \t\t\t'on\\w+', 'xmlns', 'formaction', 'form', 'xlink:href', 'FSCommand', 'seekSegmentTime'\n //, 'style'\n \t\t);", " \t\t// First, escape unclosed tags\n \t\tif (empty($matches['closeTag']))\n \t\t{\n \t\t\treturn '&lt;'.$matches[1];\n \t\t}\n \t\t// Is the element that we caught naughty? If so, escape it\n \t\telseif (in_array(strtolower($matches['tagName']), $naughty_tags, TRUE))\n \t\t{\n \t\t\treturn '&lt;'.$matches[1].'&gt;';\n \t\t}\n \t\t// For other tags, see if their attributes are \"evil\" and strip those\n \t\telseif (isset($matches['attributes']))\n \t\t{\n \t\t\t// We'll store the already fitlered attributes here\n \t\t\t$attributes = array();", " \t\t\t// Attribute-catching pattern\n \t\t\t$attributes_pattern = '#'\n \t\t\t\t.'(?<name>[^\\s\\042\\047>/=]+)' // attribute characters\n \t\t\t\t// optional attribute-value\n \t\t\t\t.'(?:\\s*=(?<value>[^\\s\\042\\047=><`]+|\\s*\\042[^\\042]*\\042|\\s*\\047[^\\047]*\\047|\\s*(?U:[^\\s\\042\\047=><`]*)))' // attribute-value separator\n \t\t\t\t.'#i';", " \t\t\t// Blacklist pattern for evil attribute names\n \t\t\t$is_evil_pattern = '#^('.implode('|', $evil_attributes).')$#i';", " \t\t\t// Each iteration filters a single attribute\n \t\t\tdo\n \t\t\t{\n \t\t\t\t// Strip any non-alpha characters that may preceed an attribute.\n \t\t\t\t// Browsers often parse these incorrectly and that has been a\n \t\t\t\t// of numerous XSS issues we've had.\n \t\t\t\t$matches['attributes'] = preg_replace('#^[^a-z]+#i', '', $matches['attributes']);", " \t\t\t\tif ( ! preg_match($attributes_pattern, $matches['attributes'], $attribute, PREG_OFFSET_CAPTURE))\n \t\t\t\t{\n \t\t\t\t\t// No (valid) attribute found? Discard everything else inside the tag\n \t\t\t\t\tbreak;\n \t\t\t\t}", " \t\t\t\tif (\n \t\t\t\t\t// Is it indeed an \"evil\" attribute?\n \t\t\t\t\tpreg_match($is_evil_pattern, $attribute['name'][0])\n \t\t\t\t\t// Or does it have an equals sign, but no value and not quoted? Strip that too!\n \t\t\t\t\tOR (trim($attribute['value'][0]) === '')\n \t\t\t\t)\n \t\t\t\t{\n \t\t\t\t\t$attributes[] = 'xss=removed';\n \t\t\t\t}\n \t\t\t\telse\n \t\t\t\t{\n \t\t\t\t\t$attributes[] = $attribute[0][0];\n \t\t\t\t}", " \t\t\t\t$matches['attributes'] = substr($matches['attributes'], $attribute[0][1] + strlen($attribute[0][0]));\n \t\t\t}\n \t\t\twhile ($matches['attributes'] !== '');", " \t\t\t$attributes = empty($attributes)\n \t\t\t\t? ''\n \t\t\t\t: ' '.implode(' ', $attributes);\n \t\t\treturn '<'.$matches['slash'].$matches['tagName'].$attributes.'>';\n \t\t}", " \t\treturn $matches[0];\n \t}", "}", "?>" ]
[ 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expString\n *\n * @package Subsystems\n * @subpackage Subsystems\n */\n/** @define \"BASE\" \"../../..\" */", "class expString {", " /**\n * Routine to convert string to UTF\n *\n * @static\n * @param string $string\n * @return string\n */\n\tstatic function convertUTF($string) {\n\t\treturn $string = str_replace('?', '', htmlspecialchars($string, ENT_IGNORE, 'UTF-8'));", "\t}", "\n /**\n * Routine to check if string is valid UTF string\n *\n * @static\n * @param string $string\n * @return bool\n */\n\tstatic function validUTF($string) {\n\t\tif(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) {\n\t\t\treturn false;", "\t\t}", "\t\treturn true;\n\t}", " /**\n * Routine to strip unreadable characters from string - ascii 32 to 126\n *\n * @static\n * @param string $string\n * @return string\n */\n\tstatic function onlyReadables($string) {\n for ($i = 0, $iMax = strlen($string); $i < $iMax; $i++) {\n\t\t\t$chr = $string{$i};\n\t\t\t$ord = ord($chr);\n\t\t\tif ($ord<32 or $ord>126) {\n\t\t\t$chr = \"~\";\n\t\t\t$string{$i} = $chr;\n\t\t\t}\n\t\t}\n\t\treturn str_replace(\"~\", \"\", $string);\n\t}", " /**\n * Routine to\n *\n * @static\n * @param string $str\n * @param bool $unescape should the string also be unescaped?\n * @return mixed|string\n */\n\tstatic function parseAndTrim($str, $unescape=false) {\n if (is_array($str)) {\n $rst = array();\n foreach ($str as $key=>$st) {\n $rst[$key] = self::parseAndTrim($st, $unescape);\n }\n return $rst;\n }", " $str = str_replace(\"<br>\",\" \",$str);\n $str = str_replace(\"</br>\",\" \",$str);\n $str = str_replace(\"<br/>\",\" \",$str);\n $str = str_replace(\"<br />\",\" \",$str);\n $str = str_replace(\"\\r\\n\",\" \",$str);\n $str = str_replace('\"',\"&quot;\",$str);\n $str = str_replace(\"'\",\"&#39;\",$str);\n $str = str_replace(\"’\",\"&rsquo;\",$str);\n $str = str_replace(\"‘\",\"&lsquo;\",$str);\n $str = str_replace(\"®\",\"&#174;\",$str);\n $str = str_replace(\"–\",\"-\", $str);\n $str = str_replace(\"—\",\"&#151;\", $str);\n $str = str_replace(\"”\",\"&rdquo;\", $str);\n $str = str_replace(\"“\",\"&ldquo;\", $str);\n $str = str_replace(\"¼\",\"&#188;\",$str);\n $str = str_replace(\"½\",\"&#189;\",$str);\n $str = str_replace(\"¾\",\"&#190;\",$str);\n\t\t$str = str_replace(\"™\",\"&trade;\", $str);\n\t\t$str = trim($str);", "", " if ($unescape) {", "\t\t\t$str = stripcslashes($str);", "\t\t} else {\n\t $str = addslashes($str);\n }", " return $str;\n }", " /**\n * Routine to convert string to an XML safe string\n *\n * @static\n * @param string $str\n * @return string\n */\n\tstatic function convertXMLFeedSafeChar($str) {\n\t\t$str = str_replace(\"<br>\",\"\",$str);\n $str = str_replace(\"</br>\",\"\",$str);\n $str = str_replace(\"<br/>\",\"\",$str);\n $str = str_replace(\"<br />\",\"\",$str);\n $str = str_replace(\"&quot;\",'\"',$str);\n $str = str_replace(\"&#39;\",\"'\",$str);\n $str = str_replace(\"&rsquo;\",\"'\",$str);", " $str = str_replace(\"&lsquo;\",\"'\",$str);", " $str = str_replace(\"&#174;\",\"\",$str);\n $str = str_replace(\"�\",\"-\", $str);", " $str = str_replace(\"�\",\"-\", $str);", " $str = str_replace(\"�\", '\"', $str);\n $str = str_replace(\"&rdquo;\",'\"', $str);\n $str = str_replace(\"�\", '\"', $str);\n $str = str_replace(\"&ldquo;\",'\"', $str);", " $str = str_replace(\"\\r\\n\",\" \",$str);", " $str = str_replace(\"�\",\" 1/4\",$str);\n $str = str_replace(\"&#188;\",\" 1/4\", $str);\n $str = str_replace(\"�\",\" 1/2\",$str);\n $str = str_replace(\"&#189;\",\" 1/2\",$str);\n $str = str_replace(\"�\",\" 3/4\",$str);\n $str = str_replace(\"&#190;\",\" 3/4\",$str);\n $str = str_replace(\"�\", \"(TM)\", $str);\n $str = str_replace(\"&trade;\",\"(TM)\", $str);\n $str = str_replace(\"&reg;\",\"(R)\", $str);", " $str = str_replace(\"�\",\"(R)\",$str);\n $str = str_replace(\"&\",\"&amp;\",$str);\n\t\t$str = str_replace(\">\",\"&gt;\",$str);", " return trim($str);\n\t}", " /**\n * Routine to convert any smart quotes into normal quotes\n *\n * @param string $str\n * @return string\n */\n public static function convertSmartQuotes($str) {\n \t$find[] = '�'; // left side double smart quote\n \t$find[] = '�'; // right side double smart quote\n \t$find[] = '�'; // left side single smart quote\n \t$find[] = '�'; // right side single smart quote\n \t$find[] = '�'; // elipsis\n \t$find[] = '�'; // em dash\n \t$find[] = '�'; // en dash", " $replace[] = '\"';\n \t$replace[] = '\"';\n \t$replace[] = \"'\";\n \t$replace[] = \"'\";\n \t$replace[] = \"...\";\n \t$replace[] = \"-\";\n \t$replace[] = \"-\";", " $find[] = '“'; // left side double smart quote\n $find[] = '”'; // right side double smart quote\n $find[] = '‘'; // left side single smart quote\n $find[] = '’'; // right side single smart quote\n $find[] = '…'; // ellipsis\n $find[] = '—'; // em dash\n $find[] = '–'; // en dash", " $replace[] = '\"';\n $replace[] = '\"';\n $replace[] = \"'\";\n $replace[] = \"'\";\n $replace[] = \"...\";\n $replace[] = \"-\";\n $replace[] = \"-\";", "// $find[] = chr(145);\n// $find[] = chr(146);\n// $find[] = chr(147);\n// $find[] = chr(148);\n// $find[] = chr(150);\n// $find[] = chr(151);\n// $find[] = chr(133);\n// $find[] = chr(149);\n// $find[] = chr(11);\n//\n// $replace[] = \"'\";\n// $replace[] = \"'\";\n// $replace[] = \"\\\"\";\n// $replace[] = \"\\\"\";\n// $replace[] = \"-\";\n// $replace[] = \"-\";\n// $replace[] = \"...\";\n// $replace[] = \"&bull;\";\n// $replace[] = \"\\n\";", " \treturn str_replace($find, $replace, $str);\n }", " /**\n * Enhanced variation of strip_tags with 'invert' option to remove specific tags\n *\n * @param $text\n * @param string $tags\n * @param bool $invert\n * @return mixed\n */\n public static function strip_tags_content($text, $tags = '', $invert = false)\n {\n preg_match_all('/<(.+?)[\\s]*\\/?[\\s]*>/si', trim($tags), $tags);\n $tags = array_unique($tags[1]);", " if (is_array($tags) AND count($tags) > 0) {\n if ($invert == false) {\n return preg_replace('@<(?!(?:' . implode('|', $tags) . ')\\b)(\\w+)\\b.*?>.*?</\\1>@si', '', $text);\n } else {\n return preg_replace('@<(' . implode('|', $tags) . ')\\b.*?>.*?</\\1>@si', '', $text);\n }\n } elseif ($invert == false) {\n return preg_replace('@<(\\w+)\\b.*?>.*?</\\1>@si', '', $text);\n }\n return $text;\n }", " /**\\\n * Replace any non-ascii character with its hex code with NO active db connection\n */\n public static function escape($value) {\n global $db;", " if ($db->havedb) {\n return $db->escapeString($value);\n }", " $return = '';\n for ($i = 0, $iMax = strlen($value); $i < $iMax; $i++) {\n $char = $value[$i];\n $ord = ord($char);\n if($char !== \"'\" && $char !== \"\\\"\" && $char !== '\\\\' && $ord >= 32 && $ord <= 126)\n $return .= $char;\n else\n $return .= '\\\\x' . dechex($ord);\n }\n return $return;\n }", " /**\n * Summarize or short a long string\n *\n * @param $string\n * @param string $strtype\n * @param string $type\n *\n * @return string\n */\n public static function summarize($string, $strtype='html', $type='para', $more='...') {\n $sep = ($strtype == \"html\" ? array(\"</p>\", \"</div>\") : array(\"\\r\\n\", \"\\n\", \"\\r\"));\n $origstring = $string;", " switch ($type) {\n case \"para\":\n foreach ($sep as $s) {\n $para = explode($s, $string);\n $string = $para[0];\n }\n if (strlen($string) < strlen($origstring)) {\n $string .= \" \" . $more;\n }\n //\t\t\treturn str_replace(\"&amp;#160;\",\" \",htmlentities(expString::convertSmartQuotes(strip_tags($string)),ENT_QUOTES));\n return expString::convertSmartQuotes(strip_tags($string));\n break;\n case \"paralinks\":\n foreach ($sep as $s) {\n $para = explode($s, $string);\n $string = $para[0];\n }\n if (strlen($string) < strlen($origstring)) {\n $string .= \" \" . $more;\n }\n //\t\t\treturn str_replace(\"&#160;\",\" \",htmlspecialchars_decode(htmlentities(expString::convertSmartQuotes(strip_tags($string,'<a>')),ENT_QUOTES)));\n return expString::convertSmartQuotes(strip_tags($string, '<a>'));\n break;\n case \"parapaged\":\n// $s = '<div style=\"page-break-after: always;\"><span style=\"display: none;\">&nbsp;</span></div>';\n $s = '<div style=\"page-break-after: always';\n $para = explode($s, $string);\n $string = $para[0];\n return expString::convertSmartQuotes($string);\n break;\n case \"parahtml\":\n foreach ($sep as $s) {\n $para = explode($s, $string);\n $string = $para[0];\n }\n if (strlen($string) < strlen($origstring)) {\n $string .= \" \" . $more;\n }\n if (!empty($string)) {\n $isText = true;\n $ret = \"\";\n $i = 0;\n // $currentChar = \"\";\n // $lastSpacePosition = -1;\n // $lastChar = \"\";\n $tagsArray = array();\n $currentTag = \"\";\n // $tagLevel = 0;\n // $noTagLength = strlen(strip_tags($string));", " // Parser loop\n for ($j = 0, $jMax = strlen($string); $j < $jMax; $j++) {", " $currentChar = substr($string, $j, 1);\n $ret .= $currentChar;", " // Lesser than event\n if ($currentChar == \"<\") $isText = false;", " // Character handler\n if ($isText) {", " // Memorize last space position\n if ($currentChar == \" \") {\n $lastSpacePosition = $j;\n } else {\n $lastChar = $currentChar;\n }", " $i++;\n } else {\n $currentTag .= $currentChar;\n }", " // Greater than event\n if ($currentChar == \">\") {\n $isText = true;", " // Opening tag handler\n if ((strpos($currentTag, \"<\") !== FALSE) &&\n (strpos($currentTag, \"/>\") === FALSE) &&\n (strpos($currentTag, \"</\") === FALSE)\n ) {", " // Tag has attribute(s)\n if (strpos($currentTag, \" \") !== FALSE) {\n $currentTag = substr($currentTag, 1, strpos($currentTag, \" \") - 1);\n } else {\n // Tag doesn't have attribute(s)\n $currentTag = substr($currentTag, 1, -1);\n }", " array_push($tagsArray, $currentTag);", " } else if (strpos($currentTag, \"</\") !== FALSE) {\n array_pop($tagsArray);\n }", " $currentTag = \"\";\n }\n }\n // Cut HTML string at last space position\n // if ($length < $noTagLength) {\n // if ($lastSpacePosition != -1) {\n // $ret = substr($string, 0, $lastSpacePosition);\n // } else {\n // $ret = substr($string, $j);\n // }\n // }\n if (sizeof($tagsArray) != 0) {\n // Close broken XHTML elements\n while (sizeof($tagsArray) != 0) {\n if (sizeof($tagsArray) > 1) {\n $aTag = array_pop($tagsArray);\n $string .= \"</\" . $aTag . \">\";\n } // You may add more tags here to put the link and added text before the closing tag\n elseif ($aTag == 'p' || 'div') {\n $aTag = array_pop($tagsArray);\n $string .= \"</\" . $aTag . \">\";\n } else {\n $aTag = array_pop($tagsArray);\n $string .= \"</\" . $aTag . \">\";\n }\n }\n }\n }\n return expString::convertSmartQuotes($string);\n break;\n default:\n $words = explode(\" \", strip_tags($string));\n $string = implode(\" \", array_slice($words, 0, $type + 0));\n if (strlen($string) < strlen($origstring)) {\n $string .= \" \" . $more;\n }\n //\t\t\treturn str_replace(\"&amp;#160;\",\" \",htmlentities(expString::convertSmartQuotes($string),ENT_QUOTES));\n return expString::convertSmartQuotes($string);\n break;\n }\n }", " public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? �\n //echo \"1<br>\"; eDebug($str);", " $str = str_replace(\"�\", \"&rsquo;\", $str);\n $str = str_replace(\"�\", \"&lsquo;\", $str);\n $str = str_replace(\"�\", \"&#174;\", $str);\n $str = str_replace(\"�\", \"-\", $str);\n $str = str_replace(\"�\", \"&#151;\", $str);\n $str = str_replace(\"�\", \"&rdquo;\", $str);\n $str = str_replace(\"�\", \"&ldquo;\", $str);\n $str = str_replace(\"\\r\\n\", \" \", $str);\n $str = str_replace(\"\\t\", \" \", $str);\n $str = str_replace(\",\", \"\\,\", $str);\n $str = str_replace(\"�\", \"&#188;\", $str);\n $str = str_replace(\"�\", \"&#189;\", $str);\n $str = str_replace(\"�\", \"&#190;\", $str);", " if (!$isHTML) {\n $str = str_replace('\\\"', \"&quot;\", $str);\n $str = str_replace('\"', \"&quot;\", $str);\n } else {\n $str = str_replace('\"', '\"\"', $str);\n }", " //$str = htmlspecialchars($str);\n //$str = utf8_encode($str);\n $str = trim(str_replace(\"�\", \"&trade;\", $str));\n //echo \"2<br>\"; eDebug($str,die);\n return $str;\n }", " public static function parseAndTrimImport($str, $isHTML = false) { //�Death from above�? �\n //echo \"1<br>\"; eDebug($str);", "// global $db;", "\n $str = str_replace(\"�\", \"&rsquo;\", $str);\n $str = str_replace(\"�\", \"&lsquo;\", $str);\n $str = str_replace(\"�\", \"&#174;\", $str);\n $str = str_replace(\"�\", \"-\", $str);\n $str = str_replace(\"�\", \"&#151;\", $str);\n $str = str_replace(\"�\", \"&rdquo;\", $str);\n $str = str_replace(\"�\", \"&ldquo;\", $str);\n $str = str_replace(\"\\r\\n\", \" \", $str);\n $str = str_replace(\"\\,\", \",\", $str);\n $str = str_replace('\"\"', '\"', $str); //do this no matter what...in case someone added a quote in a non HTML field\n if (!$isHTML) {\n //if HTML, then leave the single quotes alone, otheriwse replace w/ special Char\n $str = str_replace('\"', \"&quot;\", $str);\n }\n $str = str_replace(\"�\", \"&#188;\", $str);\n $str = str_replace(\"�\", \"&#189;\", $str);\n $str = str_replace(\"�\", \"&#190;\", $str);\n //$str = htmlspecialchars($str);\n //$str = utf8_encode($str);\n// if (DB_ENGINE=='mysqli') {", "//\t $str = self::escape(trim(str_replace(\"�\", \"&trade;\", $str)));", "// } elseif(DB_ENGINE=='mysql') {", "// $str = self::escape(trim(str_replace(\"�\", \"&trade;\", $str)));", "// } else {\n//\t $str = trim(str_replace(\"�\", \"&trade;\", $str));\n// }", " $str = self::escape(trim(str_replace(\"�\", \"&trade;\", $str)));", " //echo \"2<br>\"; eDebug($str,die);\n return $str;\n }", " public static function outputField($val, $eof = ',', $isHTML = false) {\n $newVal = self::parseAndTrimExport($val, $isHTML);\n if ($newVal != '') return '\"' . $newVal . '\"' . $eof;\n else return $eof;\n }", " public static function stripLineEndings($val) {\n return preg_replace('/\\r\\n/', ' ', trim($val));\n }", " /**\n * Scrub input string for possible security issues.\n *\n * @static\n * @param $data string\n * @return string\n */\n public static function sanitize(&$data) {\n// return $data;", " if (is_array($data)) {\n $saved_params = array();\n if (!empty($data['controller']) && $data['controller'] == 'snippet') {\n $saved_params['body'] = $data['body']; // store snippet body\n }\n foreach ($data as $var=>$val) {\n// $data[$var] = self::sanitize($val);\n $data[$var] = self::xss_clean($val);\n }\n if (!empty($saved_params)) {\n $data = array_merge($data, $saved_params); // add stored snippet body\n }\n } else {\n if (empty($data)) {\n return $data;\n }", " $data = self::xss_clean($data);", " //fixme orig exp method\n// if(0) {\n// // remove whitespaces and tags\n//// $data = strip_tags(trim($data));\n// // remove whitespaces and script tags\n// $data = self::strip_tags_content(trim($data), '<script>', true);\n//// $data = self::strip_tags_content(trim($data), '<iframe>', true);\n//\n// // apply stripslashes if magic_quotes_gpc is enabled\n// if (get_magic_quotes_gpc()) {\n// $data = stripslashes($data);\n// }\n//\n// $data = self::escape($data);\n//\n// // re-escape newlines\n// $data = str_replace(array('\\r', '\\n'), array(\"\\r\", \"\\n\"), $data);\n// }\n }\n return $data;\n }", " // xss_clean //", " /**\n \t * Character set\n \t *\n \t * Will be overridden by the constructor.\n \t *\n \t * @var\tstring\n \t */\n \tpublic static $charset = 'UTF-8';", " /**\n \t * XSS Hash\n \t *\n \t * Random Hash for protecting URLs.\n \t *\n \t * @var\tstring\n \t */\n \tprotected static $_xss_hash;", " /**\n \t * List of never allowed strings\n \t *\n \t * @var\tarray\n \t */\n protected static $_never_allowed_str =\tarray(\n \t\t'document.cookie'\t=> '[removed]',\n \t\t'document.write'\t=> '[removed]',\n \t\t'.parentNode'\t\t=> '[removed]',\n \t\t'.innerHTML'\t\t=> '[removed]',\n \t\t'-moz-binding'\t\t=> '[removed]',\n \t\t'<!--'\t\t\t\t=> '&lt;!--',\n \t\t'-->'\t\t\t\t=> '--&gt;',\n \t\t'<![CDATA['\t\t\t=> '&lt;![CDATA[',\n \t\t'<comment>'\t\t\t=> '&lt;comment&gt;'\n \t);", " \t/**\n \t * List of never allowed regex replacements\n \t *\n \t * @var\tarray\n \t */\n protected static $_never_allowed_regex = array(\n \t\t'javascript\\s*:',\n \t\t'(document|(document\\.)?window)\\.(location|on\\w*)',\n \t\t'expression\\s*(\\(|&\\#40;)', // CSS and IE\n \t\t'vbscript\\s*:', // IE, surprise!\n \t\t'wscript\\s*:', // IE\n \t\t'jscript\\s*:', // IE\n \t\t'vbs\\s*:', // IE\n \t\t'Redirect\\s+30\\d',\n \t\t\"([\\\"'])?data\\s*:[^\\\\1]*?base64[^\\\\1]*?,[^\\\\1]*?\\\\1?\"\n \t);", " /**\n \t * XSS Clean\n \t *\n \t * Sanitizes data so that Cross Site Scripting Hacks can be\n \t * prevented. This method does a fair amount of work but\n \t * it is extremely thorough, designed to prevent even the\n \t * most obscure XSS attempts. Nothing is ever 100% foolproof,\n \t * of course, but I haven't been able to get anything passed\n \t * the filter.\n \t *\n \t * Note: Should only be used to deal with data upon submission.\n \t *\t It's not something that should be used for general\n \t *\t runtime processing.\n \t *\n \t * @link\thttp://channel.bitflux.ch/wiki/XSS_Prevention\n \t * \t\tBased in part on some code and ideas from Bitflux.\n \t *\n \t * @link\thttp://ha.ckers.org/xss.html\n \t * \t\tTo help develop this script I used this great list of\n \t *\t\tvulnerabilities along with a few other hacks I've\n \t *\t\tharvested from examining vulnerabilities in other programs.\n \t *\n \t * @param\tstring|string[]\t$str\t\tInput data\n \t * @param \tbool\t\t$is_image\tWhether the input is an image\n \t * @return\tstring\n \t */\n \tpublic static function xss_clean($str, $is_image = FALSE)\n \t{\n \t\t// Is the string an array?\n \t\tif (is_array($str))\n \t\t{\n \t\t\twhile (list($key) = each($str))\n \t\t\t{\n if (preg_match('/^[a-zA-Z0-9_\\x7f-\\xff]*$/', $key)) { // check for valid array name\n $str[$key] = self::xss_clean($str[$key]);\n } else {\n return null;\n }\n \t\t\t}", " \t\t\treturn $str;\n \t\t}", " \t\t// Remove Invisible Characters\n \t\t$str = self::remove_invisible_characters($str);", " \t\t/*\n \t\t * URL Decode\n \t\t *\n \t\t * Just in case stuff like this is submitted:\n \t\t *\n \t\t * <a href=\"http://%77%77%77%2E%67%6F%6F%67%6C%65%2E%63%6F%6D\">Google</a>\n \t\t *\n \t\t * Note: Use rawurldecode() so it does not remove plus signs\n \t\t */\n \t\tdo\n \t\t{\n \t\t\t$str = rawurldecode($str);\n \t\t}\n \t\twhile (preg_match('/%[0-9a-f]{2,}/i', $str));", " \t\t/*\n \t\t * Convert character entities to ASCII\n \t\t *\n \t\t * This permits our tests below to work reliably.\n \t\t * We only convert entities that are within tags since\n \t\t * these are the ones that will pose security problems.\n \t\t */\n \t\t$str = preg_replace_callback(\"/[^a-z0-9>]+[a-z0-9]+=([\\'\\\"]).*?\\\\1/si\", array('self', '_convert_attribute'), $str);\n \t\t$str = preg_replace_callback('/<\\w+.*/si', array('self', '_decode_entity'), $str);", " \t\t// Remove Invisible Characters Again!\n \t\t$str = self::remove_invisible_characters($str);", " \t\t/*\n \t\t * Convert all tabs to spaces\n \t\t *\n \t\t * This prevents strings like this: ja\tvascript\n \t\t * NOTE: we deal with spaces between characters later.\n \t\t * NOTE: preg_replace was found to be amazingly slow here on\n \t\t * large blocks of data, so we use str_replace.\n \t\t */\n \t\t$str = str_replace(\"\\t\", ' ', $str);", " \t\t// Capture converted string for later comparison\n \t\t$converted_string = $str;", " \t\t// Remove Strings that are never allowed\n \t\t$str = self::_do_never_allowed($str);", " \t\t/*\n \t\t * Makes PHP tags safe\n \t\t *\n \t\t * Note: XML tags are inadvertently replaced too:\n \t\t *\n \t\t * <?xml\n \t\t *\n \t\t * But it doesn't seem to pose a problem.\n \t\t */\n \t\tif ($is_image === TRUE)\n \t\t{\n \t\t\t// Images have a tendency to have the PHP short opening and\n \t\t\t// closing tags every so often so we skip those and only\n \t\t\t// do the long opening tags.\n \t\t\t$str = preg_replace('/<\\?(php)/i', '&lt;?\\\\1', $str);\n \t\t}\n \t\telse\n \t\t{\n \t\t\t$str = str_replace(array('<?', '?'.'>'), array('&lt;?', '?&gt;'), $str);\n \t\t}", " \t\t/*\n \t\t * Compact any exploded words\n \t\t *\n \t\t * This corrects words like: j a v a s c r i p t\n \t\t * These words are compacted back to their correct state.\n \t\t */\n \t\t$words = array(\n \t\t\t'javascript', 'expression', 'vbscript', 'jscript', 'wscript',\n \t\t\t'vbs', 'script', 'base64', 'applet', 'alert', 'document',\n \t\t\t'write', 'cookie', 'window', 'confirm', 'prompt', 'eval'\n \t\t);", " \t\tforeach ($words as $word)\n \t\t{\n \t\t\t$word = implode('\\s*', str_split($word)).'\\s*';", " \t\t\t// We only want to do this when it is followed by a non-word character\n \t\t\t// That way valid stuff like \"dealer to\" does not become \"dealerto\"\n \t\t\t$str = preg_replace_callback('#('.substr($word, 0, -3).')(\\W)#is', array('self', '_compact_exploded_words'), $str);\n \t\t}", " \t\t/*\n \t\t * Remove disallowed Javascript in links or img tags\n \t\t * We used to do some version comparisons and use of stripos(),\n \t\t * but it is dog slow compared to these simplified non-capturing\n \t\t * preg_match(), especially if the pattern exists in the string\n \t\t *\n \t\t * Note: It was reported that not only space characters, but all in\n \t\t * the following pattern can be parsed as separators between a tag name\n \t\t * and its attributes: [\\d\\s\"\\'`;,\\/\\=\\(\\x00\\x0B\\x09\\x0C]\n \t\t * ... however, remove_invisible_characters() above already strips the\n \t\t * hex-encoded ones, so we'll skip them below.\n \t\t */\n \t\tdo\n \t\t{\n \t\t\t$original = $str;", " \t\t\tif (preg_match('/<a/i', $str))\n \t\t\t{\n \t\t\t\t$str = preg_replace_callback('#<a[^a-z0-9>]+([^>]*?)(?:>|$)#si', array('self', '_js_link_removal'), $str);\n \t\t\t}", " \t\t\tif (preg_match('/<img/i', $str))\n \t\t\t{\n \t\t\t\t$str = preg_replace_callback('#<img[^a-z0-9]+([^>]*?)(?:\\s?/?>|$)#si', array('self', '_js_img_removal'), $str);\n \t\t\t}", " \t\t\tif (preg_match('/script|xss/i', $str))\n \t\t\t{\n \t\t\t\t$str = preg_replace('#</*(?:script|xss).*?>#si', '[removed]', $str);\n \t\t\t}\n \t\t}\n \t\twhile ($original !== $str);\n \t\tunset($original);", " \t\t/*\n \t\t * Sanitize naughty HTML elements\n \t\t *\n \t\t * If a tag containing any of the words in the list\n \t\t * below is found, the tag gets converted to entities.\n \t\t *\n \t\t * So this: <blink>\n \t\t * Becomes: &lt;blink&gt;\n \t\t */\n \t\t$pattern = '#'\n \t\t\t.'<((?<slash>/*\\s*)(?<tagName>[a-z0-9]+)(?=[^a-z0-9]|$)' // tag start and name, followed by a non-tag character\n \t\t\t.'[^\\s\\042\\047a-z0-9>/=]*' // a valid attribute character immediately after the tag would count as a separator\n \t\t\t// optional attributes\n \t\t\t.'(?<attributes>(?:[\\s\\042\\047/=]*' // non-attribute characters, excluding > (tag close) for obvious reasons\n \t\t\t.'[^\\s\\042\\047>/=]+' // attribute characters\n \t\t\t// optional attribute-value\n \t\t\t\t.'(?:\\s*=' // attribute-value separator\n \t\t\t\t\t.'(?:[^\\s\\042\\047=><`]+|\\s*\\042[^\\042]*\\042|\\s*\\047[^\\047]*\\047|\\s*(?U:[^\\s\\042\\047=><`]*))' // single, double or non-quoted value\n \t\t\t\t.')?' // end optional attribute-value group\n \t\t\t.')*)' // end optional attributes group\n \t\t\t.'[^>]*)(?<closeTag>\\>)?#isS';", " \t\t// Note: It would be nice to optimize this for speed, BUT\n \t\t// only matching the naughty elements here results in\n \t\t// false positives and in turn - vulnerabilities!\n \t\tdo\n \t\t{\n \t\t\t$old_str = $str;\n \t\t\t$str = preg_replace_callback($pattern, array('self', '_sanitize_naughty_html'), $str);\n \t\t}\n \t\twhile ($old_str !== $str);\n \t\tunset($old_str);", " \t\t/*\n \t\t * Sanitize naughty scripting elements\n \t\t *\n \t\t * Similar to above, only instead of looking for\n \t\t * tags it looks for PHP and JavaScript commands\n \t\t * that are disallowed. Rather than removing the\n \t\t * code, it simply converts the parenthesis to entities\n \t\t * rendering the code un-executable.\n \t\t *\n \t\t * For example:\teval('some code')\n \t\t * Becomes:\teval&#40;'some code'&#41;\n \t\t */\n \t\t$str = preg_replace(\n \t\t\t'#(alert|prompt|confirm|cmd|passthru|eval|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\\s*)\\((.*?)\\)#si',\n \t\t\t'\\\\1\\\\2&#40;\\\\3&#41;',\n \t\t\t$str\n \t\t);", " \t\t// Final clean up\n \t\t// This adds a bit of extra precaution in case\n \t\t// something got through the above filters\n \t\t$str = self::_do_never_allowed($str);", " \t\t/*\n \t\t * Images are Handled in a Special Way\n \t\t * - Essentially, we want to know that after all of the character\n \t\t * conversion is done whether any unwanted, likely XSS, code was found.\n \t\t * If not, we return TRUE, as the image is clean.\n \t\t * However, if the string post-conversion does not matched the\n \t\t * string post-removal of XSS, then it fails, as there was unwanted XSS\n \t\t * code found and removed/changed during processing.\n \t\t */\n \t\tif ($is_image === TRUE)\n \t\t{\n \t\t\treturn ($str === $converted_string);\n \t\t}", " \t\treturn $str;\n \t}", " /**\n \t * Do Never Allowed\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param \tstring\n \t * @return \tstring\n \t */\n \tprotected static function _do_never_allowed($str)\n \t{\n \t\t$str = str_replace(array_keys(self::$_never_allowed_str), self::$_never_allowed_str, $str);", " \t\tforeach (self::$_never_allowed_regex as $regex)\n \t\t{\n \t\t\t$str = preg_replace('#'.$regex.'#is', '[removed]', $str);\n \t\t}", " \t\treturn $str;\n \t}", "\t/**\n\t * Remove Invisible Characters\n\t *\n\t * This prevents sandwiching null characters\n\t * between ascii characters, like Java\\0script.\n\t *\n\t * @param\tstring\n\t * @param\tbool\n\t * @return\tstring\n\t */\n\tpublic static function remove_invisible_characters($str, $url_encoded = TRUE)\n\t{\n\t\t$non_displayables = array();", "\t\t// every control character except newline (dec 10),\n\t\t// carriage return (dec 13) and horizontal tab (dec 09)\n\t\tif ($url_encoded)\n\t\t{\n\t\t\t$non_displayables[] = '/%0[0-8bcef]/';\t// url encoded 00-08, 11, 12, 14, 15\n\t\t\t$non_displayables[] = '/%1[0-9a-f]/';\t// url encoded 16-31\n\t\t}", "\t\t$non_displayables[] = '/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]+/S';\t// 00-08, 11, 12, 14-31, 127", "\t\tdo\n\t\t{\n\t\t\t$str = preg_replace($non_displayables, '', $str, -1, $count);\n\t\t}\n\t\twhile ($count);", "\t\treturn $str;\n\t}", " /**\n \t * HTML Entity Decode Callback\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$match\n \t * @return\tstring\n \t */\n \tprotected static function _decode_entity($match)\n \t{\n \t\t// Protect GET variables in URLs\n \t\t// 901119URL5918AMP18930PROTECT8198\n \t\t$match = preg_replace('|\\&([a-z\\_0-9\\-]+)\\=([a-z\\_0-9\\-/]+)|i', self::xss_hash().'\\\\1=\\\\2', $match[0]);", " \t\t// Decode, then un-protect URL GET vars\n \t\treturn str_replace(\n self::xss_hash(),\n \t\t\t'&',\n self::entity_decode($match, self::$charset)\n \t\t);\n \t}", " /**\n \t * XSS Hash\n \t *\n \t * Generates the XSS hash if needed and returns it.\n \t *\n \t * @see\t\tCI_Security::$_xss_hash\n \t * @return\tstring\tXSS hash\n \t */\n \tpublic static function xss_hash()\n \t{\n \t\tif (self::$_xss_hash === NULL)\n \t\t{\n \t\t\t$rand = self::get_random_bytes(16);\n self::$_xss_hash = ($rand === FALSE)\n \t\t\t\t? md5(uniqid(mt_rand(), TRUE))\n \t\t\t\t: bin2hex($rand);\n \t\t}", " \t\treturn self::$_xss_hash;\n \t}", " /**\n \t * HTML Entities Decode\n \t *\n \t * A replacement for html_entity_decode()\n \t *\n \t * The reason we are not using html_entity_decode() by itself is because\n \t * while it is not technically correct to leave out the semicolon\n \t * at the end of an entity most browsers will still interpret the entity\n \t * correctly. html_entity_decode() does not convert entities without\n \t * semicolons, so we are left with our own little solution here. Bummer.\n \t *\n \t * @link\thttp://php.net/html-entity-decode\n \t *\n \t * @param\tstring\t$str\t\tInput\n \t * @param\tstring\t$charset\tCharacter set\n \t * @return\tstring\n \t */\n \tpublic static function entity_decode($str, $charset = NULL)\n \t{\n \t\tif (strpos($str, '&') === FALSE)\n \t\t{\n \t\t\treturn $str;\n \t\t}", " \t\tstatic $_entities;", " \t\tisset($charset) OR $charset = self::$charset;\n \t\t$flag = expCore::is_php('5.4')\n \t\t\t? ENT_COMPAT | ENT_HTML5\n \t\t\t: ENT_COMPAT;", " \t\tdo\n \t\t{\n \t\t\t$str_compare = $str;", " \t\t\t// Decode standard entities, avoiding false positives\n \t\t\tif (preg_match_all('/&[a-z]{2,}(?![a-z;])/i', $str, $matches))\n \t\t\t{\n \t\t\t\tif ( ! isset($_entities))\n \t\t\t\t{\n \t\t\t\t\t$_entities = array_map(\n \t\t\t\t\t\t'strtolower',\n expCore::is_php('5.3.4')\n \t\t\t\t\t\t\t? get_html_translation_table(HTML_ENTITIES, $flag, $charset)\n \t\t\t\t\t\t\t: get_html_translation_table(HTML_ENTITIES, $flag)\n \t\t\t\t\t);", " \t\t\t\t\t// If we're not on PHP 5.4+, add the possibly dangerous HTML 5\n \t\t\t\t\t// entities to the array manually\n \t\t\t\t\tif ($flag === ENT_COMPAT)\n \t\t\t\t\t{\n \t\t\t\t\t\t$_entities[':'] = '&colon;';\n \t\t\t\t\t\t$_entities['('] = '&lpar;';\n \t\t\t\t\t\t$_entities[')'] = '&rpar;';\n \t\t\t\t\t\t$_entities[\"\\n\"] = '&newline;';\n \t\t\t\t\t\t$_entities[\"\\t\"] = '&tab;';\n \t\t\t\t\t}\n \t\t\t\t}", " \t\t\t\t$replace = array();\n \t\t\t\t$matches = array_unique(array_map('strtolower', $matches[0]));\n \t\t\t\tforeach ($matches as &$match)\n \t\t\t\t{\n \t\t\t\t\tif (($char = array_search($match.';', $_entities, TRUE)) !== FALSE)\n \t\t\t\t\t{\n \t\t\t\t\t\t$replace[$match] = $char;\n \t\t\t\t\t}\n \t\t\t\t}", " \t\t\t\t$str = str_ireplace(array_keys($replace), array_values($replace), $str);\n \t\t\t}", " \t\t\t// Decode numeric & UTF16 two byte entities\n \t\t\t$str = html_entity_decode(\n \t\t\t\tpreg_replace('/(&#(?:x0*[0-9a-f]{2,5}(?![0-9a-f;])|(?:0*\\d{2,4}(?![0-9;]))))/iS', '$1;', $str),\n \t\t\t\t$flag,\n \t\t\t\t$charset\n \t\t\t);\n \t\t}\n \t\twhile ($str_compare !== $str);\n \t\treturn $str;\n \t}", " /**\n \t * Get random bytes\n \t *\n \t * @param\tint\t$length\tOutput length\n \t * @return\tstring\n \t */\n \tpublic static function get_random_bytes($length)\n \t{\n \t\tif (empty($length) OR ! ctype_digit((string) $length))\n \t\t{\n \t\t\treturn FALSE;\n \t\t}", " if (function_exists('random_bytes'))\n {\n try\n {\n // The cast is required to avoid TypeError\n return random_bytes((int) $length);\n }\n catch (Exception $e)\n {\n // If random_bytes() can't do the job, we can't either ...\n // There's no point in using fallbacks.\n log_message('error', $e->getMessage());\n return FALSE;\n }\n }", " \t\t// Unfortunately, none of the following PRNGs is guaranteed to exist ...\n \t\tif (defined('MCRYPT_DEV_URANDOM') && ($output = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM)) !== FALSE)\n \t\t{\n \t\t\treturn $output;\n \t\t}", "\n \t\tif (is_readable('/dev/urandom') && ($fp = fopen('/dev/urandom', 'rb')) !== FALSE)\n \t\t{\n \t\t\t// Try not to waste entropy ...\n expCore::is_php('5.4') && stream_set_chunk_size($fp, $length);\n \t\t\t$output = fread($fp, $length);\n \t\t\tfclose($fp);\n \t\t\tif ($output !== FALSE)\n \t\t\t{\n \t\t\t\treturn $output;\n \t\t\t}\n \t\t}", " \t\tif (function_exists('openssl_random_pseudo_bytes'))\n \t\t{\n \t\t\treturn openssl_random_pseudo_bytes($length);\n \t\t}", " \t\treturn FALSE;\n \t}", " /**\n \t * Attribute Conversion\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$match\n \t * @return\tstring\n \t */\n \tprotected static function _convert_attribute($match)\n \t{\n \t\treturn str_replace(array('>', '<', '\\\\'), array('&gt;', '&lt;', '\\\\\\\\'), $match[0]);\n \t}", " /**\n \t * Compact Exploded Words\n \t *\n \t * Callback method for xss_clean() to remove whitespace from\n \t * things like 'j a v a s c r i p t'.\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$matches\n \t * @return\tstring\n \t */\n \tprotected static function _compact_exploded_words($matches)\n \t{\n \t\treturn preg_replace('/\\s+/s', '', $matches[1]).$matches[2];\n \t}", " /**\n \t * JS Link Removal\n \t *\n \t * Callback method for xss_clean() to sanitize links.\n \t *\n \t * This limits the PCRE backtracks, making it more performance friendly\n \t * and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in\n \t * PHP 5.2+ on link-heavy strings.\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$match\n \t * @return\tstring\n \t */\n \tprotected static function _js_link_removal($match)\n \t{\n \t\treturn str_replace(\n \t\t\t$match[1],\n \t\t\tpreg_replace(\n \t\t\t\t'#href=.*?(?:(?:alert|prompt|confirm)(?:\\(|&\\#40;)|javascript:|livescript:|mocha:|charset=|window\\.|document\\.|\\.cookie|<script|<xss|data\\s*:)#si',\n \t\t\t\t'',\n \t\t\t\tself::_filter_attributes($match[1])\n \t\t\t),\n \t\t\t$match[0]\n \t\t);\n \t}", " /**\n \t * JS Image Removal\n \t *\n \t * Callback method for xss_clean() to sanitize image tags.\n \t *\n \t * This limits the PCRE backtracks, making it more performance friendly\n \t * and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in\n \t * PHP 5.2+ on image tag heavy strings.\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$match\n \t * @return\tstring\n \t */\n \tprotected static function _js_img_removal($match)\n \t{\n \t\treturn str_replace(\n \t\t\t$match[1],\n \t\t\tpreg_replace(\n \t\t\t\t'#src=.*?(?:(?:alert|prompt|confirm|eval)(?:\\(|&\\#40;)|javascript:|livescript:|mocha:|charset=|window\\.|document\\.|\\.cookie|<script|<xss|base64\\s*,)#si',\n \t\t\t\t'',\n \t\t\t\tself::_filter_attributes($match[1])\n \t\t\t),\n \t\t\t$match[0]\n \t\t);\n \t}", " /**\n \t * Filter Attributes\n \t *\n \t * Filters tag attributes for consistency and safety.\n \t *\n \t * @used-by\tCI_Security::_js_img_removal()\n \t * @used-by\tCI_Security::_js_link_removal()\n \t * @param\tstring\t$str\n \t * @return\tstring\n \t */\n \tprotected static function _filter_attributes($str)\n \t{\n \t\t$out = '';\n \t\tif (preg_match_all('#\\s*[a-z\\-]+\\s*=\\s*(\\042|\\047)([^\\\\1]*?)\\\\1#is', $str, $matches))\n \t\t{\n \t\t\tforeach ($matches[0] as $match)\n \t\t\t{\n \t\t\t\t$out .= preg_replace('#/\\*.*?\\*/#s', '', $match);\n \t\t\t}\n \t\t}", " \t\treturn $out;\n \t}", " /**\n \t * Sanitize Naughty HTML\n \t *\n \t * Callback method for xss_clean() to remove naughty HTML elements.\n \t *\n \t * @used-by\tCI_Security::xss_clean()\n \t * @param\tarray\t$matches\n \t * @return\tstring\n \t */\n \tprotected static function _sanitize_naughty_html($matches)\n \t{\n \t\tstatic $naughty_tags = array(\n \t\t\t'alert', 'prompt', 'confirm', 'applet', 'audio', 'basefont', 'base', 'behavior', 'bgsound',\n \t\t\t'blink', 'body', 'embed', 'expression', 'form', 'frameset', 'frame', 'head', 'html', 'ilayer',\n \t\t\t'input', 'button', 'select', 'isindex', 'layer', 'link', 'meta', 'keygen', 'object',\n \t\t\t'plaintext', 'script', 'textarea', 'title', 'math', 'video', 'svg', 'xml', 'xss'\n //,'style', 'iframe'\n \t\t);", " \t\tstatic $evil_attributes = array(\n \t\t\t'on\\w+', 'xmlns', 'formaction', 'form', 'xlink:href', 'FSCommand', 'seekSegmentTime'\n //, 'style'\n \t\t);", " \t\t// First, escape unclosed tags\n \t\tif (empty($matches['closeTag']))\n \t\t{\n \t\t\treturn '&lt;'.$matches[1];\n \t\t}\n \t\t// Is the element that we caught naughty? If so, escape it\n \t\telseif (in_array(strtolower($matches['tagName']), $naughty_tags, TRUE))\n \t\t{\n \t\t\treturn '&lt;'.$matches[1].'&gt;';\n \t\t}\n \t\t// For other tags, see if their attributes are \"evil\" and strip those\n \t\telseif (isset($matches['attributes']))\n \t\t{\n \t\t\t// We'll store the already fitlered attributes here\n \t\t\t$attributes = array();", " \t\t\t// Attribute-catching pattern\n \t\t\t$attributes_pattern = '#'\n \t\t\t\t.'(?<name>[^\\s\\042\\047>/=]+)' // attribute characters\n \t\t\t\t// optional attribute-value\n \t\t\t\t.'(?:\\s*=(?<value>[^\\s\\042\\047=><`]+|\\s*\\042[^\\042]*\\042|\\s*\\047[^\\047]*\\047|\\s*(?U:[^\\s\\042\\047=><`]*)))' // attribute-value separator\n \t\t\t\t.'#i';", " \t\t\t// Blacklist pattern for evil attribute names\n \t\t\t$is_evil_pattern = '#^('.implode('|', $evil_attributes).')$#i';", " \t\t\t// Each iteration filters a single attribute\n \t\t\tdo\n \t\t\t{\n \t\t\t\t// Strip any non-alpha characters that may preceed an attribute.\n \t\t\t\t// Browsers often parse these incorrectly and that has been a\n \t\t\t\t// of numerous XSS issues we've had.\n \t\t\t\t$matches['attributes'] = preg_replace('#^[^a-z]+#i', '', $matches['attributes']);", " \t\t\t\tif ( ! preg_match($attributes_pattern, $matches['attributes'], $attribute, PREG_OFFSET_CAPTURE))\n \t\t\t\t{\n \t\t\t\t\t// No (valid) attribute found? Discard everything else inside the tag\n \t\t\t\t\tbreak;\n \t\t\t\t}", " \t\t\t\tif (\n \t\t\t\t\t// Is it indeed an \"evil\" attribute?\n \t\t\t\t\tpreg_match($is_evil_pattern, $attribute['name'][0])\n \t\t\t\t\t// Or does it have an equals sign, but no value and not quoted? Strip that too!\n \t\t\t\t\tOR (trim($attribute['value'][0]) === '')\n \t\t\t\t)\n \t\t\t\t{\n \t\t\t\t\t$attributes[] = 'xss=removed';\n \t\t\t\t}\n \t\t\t\telse\n \t\t\t\t{\n \t\t\t\t\t$attributes[] = $attribute[0][0];\n \t\t\t\t}", " \t\t\t\t$matches['attributes'] = substr($matches['attributes'], $attribute[0][1] + strlen($attribute[0][0]));\n \t\t\t}\n \t\t\twhile ($matches['attributes'] !== '');", " \t\t\t$attributes = empty($attributes)\n \t\t\t\t? ''\n \t\t\t\t: ' '.implode(' ', $attributes);\n \t\t\treturn '<'.$matches['slash'].$matches['tagName'].$attributes.'>';\n \t\t}", " \t\treturn $matches[0];\n \t}", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expTheme\n *\n * @package Subsystems\n * @subpackage Subsystems\n */", "/** @define \"BASE\" \"../../..\" */\nclass expTheme\n{", " public static function initialize()\n {\n global $auto_dirs2;", " // Initialize the theme subsystem 1.0 compatibility layer if requested\n\t\tif (defined('OLD_THEME_COMPATIBLE') && OLD_THEME_COMPATIBLE)\n require_once(BASE.'framework/core/compat/theme.php');", " if (!defined('DISPLAY_THEME')) {\n /* exdoc\n * The directory and class name of the current active theme. This may be different\n * than the configured theme (DISPLAY_THEME_REAL) due to previewing.\n */\n define('DISPLAY_THEME', DISPLAY_THEME_REAL);\n }", " if (!defined('THEME_ABSOLUTE')) {\n /* exdoc\n * The absolute path to the current active theme's files. This is similar to the BASE constant\n */\n define('THEME_ABSOLUTE', BASE . 'themes/' . DISPLAY_THEME . '/'); // This is the recommended way\n }", " if (!defined('THEME_RELATIVE')) {\n /* exdoc\n * The relative web path to the current active theme. This is similar to the PATH_RELATIVE constant.\n */\n define('THEME_RELATIVE', PATH_RELATIVE . 'themes/' . DISPLAY_THEME . '/');\n }\n if (!defined('THEME_STYLE')) {\n /* exdoc\n * The name of the current active theme style.\n */\n define('THEME_STYLE', THEME_STYLE_REAL);\n }\n if (THEME_STYLE != '' && file_exists(BASE . 'themes/' . DISPLAY_THEME . '/config_' . THEME_STYLE . '.php')) {\n @include_once(BASE . 'themes/' . DISPLAY_THEME . '/config_' . THEME_STYLE . '.php');\n } elseif (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/config.php')) {\n @include_once(BASE . 'themes/' . DISPLAY_THEME . '/config.php');\n }\n if (!defined('BTN_SIZE')) {\n define('BTN_SIZE', 'medium');\n } // Awesome Button theme\n if (!defined('BTN_COLOR')) {\n define('BTN_COLOR', 'black');\n } // Awesome Button theme\n if (!defined('SWATCH')) {\n define('SWATCH', \"''\");\n } // Twitter Bootstrap theme", " // add our theme folder into autoload to prioritize custom (theme) modules\n array_unshift($auto_dirs2, BASE . 'themes/' . DISPLAY_THEME . '/modules');\n }", " public static function head($config = array())\n {\n echo self::headerInfo($config);\n self::advertiseRSS();\n }", " public static function headerInfo($config)\n {\n global $sectionObj, $validateTheme, $head_config, $auto_dirs, $less_vars, $framework;", " $validateTheme['headerinfo'] = true;\n // end checking for headerInfo", " // globalize header configuration\n $head_config = $config;", " // set theme framework type\n $framework = !empty($head_config['framework']) ? $head_config['framework'] : '';\n if (empty($framework)) {\n if (NEWUI) {\n $framework = 'newui';\n } else {\n $framework = 'yui'; // yui is the 2.x default framework\n }\n }\n expSession::set('framework', $framework);", " // set the global less variables from the head config\n if (!empty($config['lessvars'])) {\n $less_vars = $config['lessvars'];\n } else {\n $less_vars = array();\n }", " // check to see if we're in XHTML or HTML mode\n if (isset($config['xhtml']) && $config['xhtml'] == true) {\n define('XHTML', 1);\n define('XHTML_CLOSING', \"/\"); //default\n } else {\n define('XHTML', 0);\n define('XHTML_CLOSING', \"\");\n }", " // load primer, lessprimer, link (css) and lesscss & normalize CSS files\n if (!empty($config['css_primer']) || !empty($config['lessprimer']) || !empty($config['link']) || !empty($config['lesscss']) || !empty($config['normalize'])) {\n expCSS::pushToHead($config);\n };", " // default loading of primer CSS files to true if not set\n if (empty($config['css_primer']) && empty($config['lessprimer'])) {\n $head_config = array('css_primer' => true) + $head_config;\n }", " // parse & load core css files\n if (isset($config['css_core'])) {\n if (is_array($config['css_core'])) {\n $corecss = implode(\",\", $config['css_core']);\n expCSS::pushToHead(\n array(\n \"corecss\" => $corecss\n )\n );\n }\n } else {\n $head_config['css_core'] = false;\n };", " // default loading of view based CSS inclusion is true if not set\n if (!empty($config['css_links']) || !isset($config['css_links'])) {\n $head_config['css_links'] = true;\n }", " // default theme css collecting is true if not set\n if (!empty($config['css_theme']) || !isset($config['css_theme'])) {\n $head_config['css_theme'] = true;\n }", " if (empty($sectionObj)) {\n return false;\n }", " // set up controls search order based on framework\n if (empty($head_config['framework'])) {\n $head_config['framework'] = '';\n }\n if (bs() || $framework == 'jquery') {\n array_unshift(\n $auto_dirs,\n BASE . 'framework/core/forms/controls/jquery'\n );\n }\n if (bs(true)) {\n array_unshift(\n $auto_dirs,\n BASE . 'framework/core/forms/controls/bootstrap'\n );\n }\n if (bs3(true)) {\n array_unshift(\n $auto_dirs,\n BASE . 'framework/core/forms/controls/bootstrap3'\n );\n }\n if (newui()) {\n expCSS::pushToHead(array(\n \"lessprimer\"=>\"external/bootstrap3/less/newui.less\",\n// \"lessvars\"=>array(\n// 'swatch'=>'cerulean', // newui uses this swatch\n// 'themepath'=>'cerulean', // hack to prevent crash\n// ),\n ));\n if (!defined(\"BTN_SIZE\")) define(\"BTN_SIZE\", 'small');\n array_unshift($auto_dirs, BASE . 'framework/core/forms/controls/newui');\n }\n array_unshift($auto_dirs, BASE . 'themes/' . DISPLAY_THEME . '/controls');", "// if (!expSession::is_set('framework') || expSession::get(\n// 'framework'\n// ) != $head_config['framework']\n// ) {\n// expSession::set('framework', $head_config['framework']);\n// }\n // mark the theme framework", " $metainfo = self::pageMetaInfo();", " // default to showing all meta tags unless specifically set to false\n if (!isset($config['meta']['content_type'])) {\n $config['meta']['content_type'] = true;\n }\n if (!isset($config['meta']['content_language'])) {\n $config['meta']['content_language'] = true;\n }\n if (!isset($config['meta']['generator'])) {\n $config['meta']['generator'] = true;\n }\n if (!isset($config['meta']['keywords'])) {\n $config['meta']['keywords'] = true;\n }\n if (!isset($config['meta']['description'])) {\n $config['meta']['description'] = true;\n }\n if (!isset($config['meta']['canonical'])) {\n $config['meta']['canonical'] = true;\n }\n if (!isset($config['meta']['rich'])) {\n $config['meta']['rich'] = true;\n }\n if (!isset($config['meta']['fb'])) {\n $config['meta']['fb'] = true;\n }\n if (!isset($config['meta']['tw'])) {\n $config['meta']['tw'] = true;\n }\n if (!isset($config['meta']['viewport'])) {\n $config['meta']['viewport'] = true;\n }\n if (!isset($config['meta']['ie_compat'])) {\n $config['meta']['ie_compat'] = true;\n }\n", " $str = '<title>' . $metainfo['title'] . \"</title>\\n\";", " if ($config['meta']['content_type']) {", " $str .= \"\\t\" . '<meta http-equiv=\"Content-Type\" content=\"text/html; charset=' . LANG_CHARSET . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }", " $locale = strtolower(str_replace('_', '-', LOCALE));\n if ($config['meta']['content_language']) {", " $str .= \"\\t\" . '<meta content=\"' . $locale . '\" http-equiv=\"Content-Language\" ' . XHTML_CLOSING . '>' . \"\\n\";", " }\n if ($config['meta']['generator']) {\n $str .= \"\\t\" . '<meta name=\"Generator\" content=\"Exponent Content Management System - v' . expVersion::getVersion(\n true\n ) . self::getThemeDetails() . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if ($config['meta']['keywords']) {\n $str .= \"\\t\" . '<meta name=\"Keywords\" content=\"' . $metainfo['keywords'] . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if ($config['meta']['description']) {\n $str .= \"\\t\" . '<meta name=\"Description\" content=\"' . $metainfo['description'] . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if ($config['meta']['canonical'] && !empty($metainfo['canonical'])) {\n $str .= \"\\t\" . '<link rel=\"canonical\" href=\"' . $metainfo['canonical'] . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if ($config['meta']['rich'] && !empty($metainfo['rich'])) {\n $str .= \"\\t\" . $metainfo['rich'] . \"\\n\";\n }\n if ($config['meta']['fb'] && !empty($metainfo['fb'])) {\n foreach ($metainfo['fb'] as $key => $value) {\n if (!empty($value)) {\n $str .= \"\\t\" . '<meta property=\"og:' . $key . '\" content=\"' . $value . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n }\n }\n if ($config['meta']['tw'] && !empty($metainfo['tw'])) {\n foreach ($metainfo['tw'] as $key => $value) {\n if (!empty($value)) {\n $str .= \"\\t\" . '<meta name=\"twitter:' . $key . '\" content=\"' . $value . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n }\n }", " if ($metainfo['noindex'] || $metainfo['nofollow']) {\n $str .= \"\\t\" . '<meta name=\"robots\" content=\"' . (!empty($metainfo['noindex']) ? 'noindex' : '') . ' ' . ($metainfo['nofollow'] ? 'nofollow' : '') . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }", " if (empty($config['viewport'])) {\n $viewport = 'width=device-width, user-scalable=yes';\n } else {\n if (!empty($config['viewport']['width'])) {\n $viewport = 'width=' . $config['viewport']['width'];\n } else {\n $viewport = 'width=device-width';\n }\n if (!empty($config['viewport']['height'])) {\n $viewport .= ', height=' . $config['viewport']['height'];\n }\n if (!empty($config['viewport']['initial_scale'])) {\n $viewport .= ' initial-scale=' . $config['viewport']['initial_scale'];\n// } else {\n// $viewport .= ', initial-scale=1.0';\n }\n if (!empty($config['viewport']['minimum_scale'])) {\n $viewport .= ', minimum-scale=' . $config['viewport']['minimum_scale'];\n }\n if (!empty($config['viewport']['maximum_scale'])) {\n $viewport .= ', maximum-scale=' . $config['viewport']['maximum_scale'];\n }\n if (!empty($config['viewport']['user_scalable'])) {\n $viewport .= ', user-scalable=' . ($config['viewport']['user_scalable'] ? \"yes\" : \"no\");\n } else {\n $viewport .= ', user-scalable=yes';\n }\n }\n if ($config['meta']['viewport']) {\n $str .= \"\\t\" . '<meta name=\"viewport\" content=\"' . $viewport . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }", " // favicon\n if (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/favicon.png')) {\n $str .= \"\\t\" . '<link rel=\"icon\" href=\"' . URL_FULL . 'themes/' . DISPLAY_THEME . '/favicon.png\" type=\"image/png\" ' . XHTML_CLOSING . '>' . \"\\n\";\n } elseif (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/favicon.ico')) {\n $str .= \"\\t\" . '<link rel=\"icon\" href=\"' . URL_FULL . 'themes/' . DISPLAY_THEME . '/favicon.ico\" type=\"image/x-icon\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n // touch icons\n if (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/apple-touch-icon.png')) {\n $str .= \"\\t\" . '<link rel=\"apple-touch-icon\" href=\"' . URL_FULL . 'themes/' . DISPLAY_THEME . '/apple-touch-icon.png\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/apple-touch-icon-precomposed.png')) {\n $str .= \"\\t\" . '<link rel=\"apple-touch-icon-precomposed\" href=\"' . URL_FULL . 'themes/' . DISPLAY_THEME . '/apple-touch-icon-precomposed.png\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }", " // support for xmlrpc blog editors like Windows Live Writer, etc...\n if (USE_XMLRPC) {\n if (file_exists(BASE . 'rsd.xml')) {\n $str .= \"\\t\" . '<link rel=\"EditURI\" href=\"' . URL_FULL . 'rsd.xml\" type=\"application/rsd+xml\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n $str .= \"\\t\" . '<link rel=\"wlwmanifest\" href=\"' . URL_FULL . 'wlwmanifest.xml\" type=\"application/wlwmanifest+xml\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }", " // when minification is used, the comment below gets replaced when the buffer is dumped\n $str .= '<!-- MINIFY REPLACE -->';", " if ($config['meta']['ie_compat']) {\n // some IE 6 support\n $str .= \"\\t\" . '<!--[if IE 6]><style type=\"text/css\"> body { behavior: url(' . PATH_RELATIVE . 'external/csshover.htc); }</style><![endif]-->' . \"\\n\";", " // css3 transform support for IE 6-8\n// $str .= \"\\t\" . '<!--[if lt IE 9]><style type=\"text/css\"> body { behavior: url(' . PATH_RELATIVE . 'external/ms-transform.htc); }</style><![endif]-->' . \"\\n\";", " // html5 support for IE 6-8\n $str .= \"\\t\" . '<!--[if lt IE 9]><script src=\"' . PATH_RELATIVE . 'external/html5shiv/html5shiv-shiv.js\"></script><![endif]-->' . \"\\n\";", " // media css support for IE 6-8\n $str .= \"\\t\" . '<!--[if lt IE 9]><script src=\"' . PATH_RELATIVE . 'external/Respond-1.4.2/dest/respond.min.js\"></script><![endif]-->' . \"\\n\";", " // canvas support for IE 6-8 - now done by webshims\n// $str .= \"\\t\" . '<!--[if lt IE 9]><script src=\"' . PATH_RELATIVE . 'external/excanvas.js\"></script><![endif]-->' . \"\\n\";", " //Win 8/IE 10 work around\n $str .= \"\\t\" . '<!--[if IE 10]><link rel=\"stylesheet\" href=\"' . PATH_RELATIVE . 'external/ie10-viewport-bug-workaround.css\" type=\"text/css\"' . XHTML_CLOSING . '><![endif]-->' . \"\\n\";\n $str .= \"\\t\" . '<!--[if IE 10]><script src=\"' . PATH_RELATIVE . 'external/ie10-viewport-bug-workaround.js\"></script><![endif]-->' . \"\\n\";", "\n // turn off ie compatibility mode which will break the display\n $str .= \"\\t\" . '<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"' . XHTML_CLOSING . '>' . \"\\n\";", " }", " return $str;\n }", " public static function foot($params = array())\n {\n self::footerInfo($params);\n }", " public static function footerInfo($params = array())\n {\n // checks to see if the theme is calling footerInfo.\n global $validateTheme, $user, $jsForHead;", " $validateTheme['footerinfo'] = true;", " if (!empty($user->getsToolbar) && PRINTER_FRIENDLY != 1 && EXPORT_AS_PDF != 1 && !defined(\n 'SOURCE_SELECTOR'\n ) && empty($params['hide-slingbar'])\n ) {\n self::module(array(\"controller\" => \"administration\", \"action\" => \"toolbar\", \"source\" => \"admin\"));\n }", " if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php')) {\n echo '<div style=\"text-align:center\"><a href=\"', makeLink(\n array('module' => 'administration', 'action' => 'togglemobile')\n ), '\">', gt('View site in'), ' ', (MOBILE ? \"Classic\" : \"Mobile\"), ' ', gt('mode'), '</a></div>';\n }\n // load primer, lessprimer, & normalize CSS files", " if (!empty($params['src']) || !empty($params['content']) || !empty($params['yui3mods']) || !empty($params['jquery']) || !empty($params['bootstrap'])) {\n expJavascript::pushToFoot($params);\n }\n self::processCSSandJS();\n echo expJavascript::footJavascriptOutput();", " expSession::deleteVar(\n \"last_POST\"\n ); //ADK - putting this here so one form doesn't unset it before another form needs it.\n expSession::deleteVar(\n 'last_post_errors'\n );\n }", " public static function pageMetaInfo()\n {\n global $sectionObj, $router;", " $metainfo = array();\n if (self::inAction() && (!empty($router->url_parts[0]) && expModules::controllerExists(\n $router->url_parts[0]\n ))\n ) {\n// $classname = expModules::getControllerClassName($router->url_parts[0]);\n// $controller = new $classname();\n $controller = expModules::getController($router->url_parts[0]);\n $metainfo = $controller->metainfo();\n }\n if (empty($metainfo)) {\n $metainfo['title'] = empty($sectionObj->page_title) ? SITE_TITLE : $sectionObj->page_title;\n $metainfo['keywords'] = empty($sectionObj->keywords) ? SITE_KEYWORDS : $sectionObj->keywords;\n $metainfo['description'] = empty($sectionObj->description) ? SITE_DESCRIPTION : $sectionObj->description;\n $metainfo['canonical'] = empty($sectionObj->canonical) ? URL_FULL . $sectionObj->sef_name : $sectionObj->canonical;\n $metainfo['noindex'] = empty($sectionObj->noindex) ? false : $sectionObj->noindex;\n $metainfo['nofollow'] = empty($sectionObj->nofollow) ? false : $sectionObj->nofollow;\n }", " // clean up meta tag output\n foreach ($metainfo as $key=>$value) {\n $metainfo[$key] = expString::parseAndTrim($value, true);\n }\n return $metainfo;\n }", " public static function grabView($path, $filename)\n { //FIXME Not used\n $dirs = array(\n BASE . 'themes/' . DISPLAY_THEME . '/' . $path,\n BASE . 'framework/' . $path,\n );", " foreach ($dirs as $dir) {\n if (file_exists($dir . $filename . '.tpl')) {\n return $dir . $form . '.tpl';\n } //FIXME $form is not set??\n }", " return false;\n }", " public static function grabViews($path, $filter = '')\n { //FIXME Not used\n $dirs = array(\n BASE . 'framework/' . $path,\n BASE . 'themes/' . DISPLAY_THEME . '/' . $path,\n );", " $files = array();\n foreach ($dirs as $dir) {\n if (is_dir($dir) && is_readable($dir)) {\n $dh = opendir($dir);\n while (($filename = readdir($dh)) !== false) {\n $file = $dir . $filename;\n if (is_file($file)) { //FIXME this should be $file instead of $filename?\n $files[$filename] = $file;\n }\n }\n }\n }", " return $files;\n }", " public static function processCSSandJS()\n {\n global $jsForHead, $cssForHead;", " // returns string, either minified combo url or multiple link and script tags\n $jsForHead = expJavascript::parseJSFiles();\n $cssForHead = expCSS::parseCSSFiles();\n }", " public static function removeCss()\n {\n expFile::removeFilesInDirectory(BASE . 'tmp/minify'); // also clear the minify engine's cache\n return expFile::removeFilesInDirectory(BASE . 'tmp/css');\n }", " public static function clearSmartyCache()\n {\n self::removeSmartyCache();\n flash('message', gt(\"Smarty Cache has been cleared\"));\n expHistory::back();\n }", " public static function removeSmartyCache()\n {\n expFile::removeFilesInDirectory(BASE . 'tmp/cache'); // alt location for cache\n return expFile::removeFilesInDirectory(BASE . 'tmp/views_c');\n }", " /** exdoc\n * Output <link /> elements for each RSS feed on the site\n *\n * @node Subsystems:Theme\n */\n public static function advertiseRSS()\n {\n if (defined('ADVERTISE_RSS') && ADVERTISE_RSS == 1) {\n echo \"\\t<!-- RSS Feeds -->\\r\\n\";\n $rss = new expRss();\n $feeds = $rss->getFeeds('advertise=1');\n foreach ($feeds as $feed) {\n if ($feed->enable_rss) {\n//\t\t\t\t\t$title = empty($feed->feed_title) ? 'RSS' : htmlspecialchars($feed->feed_title, ENT_QUOTES);\n $title = empty($feed->title) ? 'RSS - ' . ORGANIZATION_NAME : htmlspecialchars(\n $feed->title,\n ENT_QUOTES\n );\n $params['module'] = $feed->module;\n $params['src'] = $feed->src;\n//\t\t\t\t\techo \"\\t\".'<link rel=\"alternate\" type=\"application/rss+xml\" title=\"' . $title . '\" href=\"' . expCore::makeRSSLink($params) . \"\\\" />\\n\";\n //FIXME need to use $feed instead of $params\n echo \"\\t\" . '<link rel=\"alternate\" type=\"application/rss+xml\" title=\"', $title, '\" href=\"', expCore::makeLink(\n array('controller' => 'rss', 'action' => 'feed', 'title' => $feed->sef_url)\n ), \"\\\" />\\r\\n\";\n }\n }\n }\n }", " public static function loadActionMaps()\n {\n if (is_readable(BASE . 'themes/' . DISPLAY_THEME . '/action_maps.php')) {\n return include(BASE . 'themes/' . DISPLAY_THEME . '/action_maps.php');\n } else {\n return array();\n }\n }", " public static function satisfyThemeRequirements()\n {\n global $validateTheme;", " if ($validateTheme['headerinfo'] == false) {\n echo \"<h1 style='padding:10px;border:5px solid #992222;color:red;background:white;position:absolute;top:100px;left:300px;width:400px;z-index:999'>expTheme::head() is a required function in your theme. Please refer to the Exponent documentation for details:<br />\n\t\t\t<a href=\\\"http://docs.exponentcms.org/docs/current/header-info\\\" target=\\\"_blank\\\">http://docs.exponentcms.org/</a>\n\t\t\t</h1>\";\n die();\n }", " if ($validateTheme['footerinfo'] == false) {\n echo \"<h1 style='padding:10px;border:5px solid #992222;color:red;background:white;position:absolute;top:100px;left:300px;width:400px;z-index:999'>expTheme::foot() is a required function in your theme. Please refer to the Exponent documentation for details:<br />\n\t\t\t<a href=\\\"http://docs.exponentcms.org/docs/current/footer-info\\\" target=\\\"_blank\\\">http://docs.exponentcms.org/</a>\n\t\t\t</h1>\";\n die();\n }\n }", " public static function getTheme()\n {\n global $sectionObj, $router;", " // Grabs the action maps files for theme overrides\n $action_maps = self::loadActionMaps();", "//\t\t$mobile = self::is_mobile();", " // if we are in an action, get the particulars for the module\n if (self::inAction()) {\n// $module = isset($_REQUEST['module']) ? expString::sanitize(\n// $_REQUEST['module']\n// ) : expString::sanitize($_REQUEST['controller']);\n $module = isset($_REQUEST['module']) ? $_REQUEST['module'] : $_REQUEST['controller'];\n }", " // if we are in an action and have action maps to work with...\n if (self::inAction() && (!empty($action_maps[$module]) && (array_key_exists(\n $_REQUEST['action'],\n $action_maps[$module]\n ) || array_key_exists('*', $action_maps[$module])))\n ) {\n $actionname = array_key_exists($_REQUEST['action'], $action_maps[$module]) ? $_REQUEST['action'] : '*';\n $actiontheme = explode(\":\", $action_maps[$module][$actionname]);", " // this resets the section object. we're suppressing notices with @ because getSectionObj sets constants, which cannot be changed\n // since this will be the second time Exponent calls this function on the page load.\n if (!empty($actiontheme[1])) {\n $sectionObj = @$router->getSectionObj($actiontheme[1]);\n }", " if ($actiontheme[0] == \"default\" || $actiontheme[0] == \"Default\" || $actiontheme[0] == \"index\") {\n if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php';\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/index.php';\n }\n } elseif (is_readable(BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $actiontheme[0] . '.php')) {\n if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/' . $actiontheme[0] . '.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/' . $actiontheme[0] . '.php';\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $actiontheme[0] . '.php';\n }\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/index.php';\n }\n } elseif ($sectionObj->subtheme != '' && is_readable(\n BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $sectionObj->subtheme . '.php'\n )\n ) {\n if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/' . $sectionObj->subtheme . '.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/' . $sectionObj->subtheme . '.php';\n } elseif (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php';\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $sectionObj->subtheme . '.php';\n }\n } else {\n if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php';\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/index.php';\n }\n }\n if (!is_readable($theme)) {\n if (is_readable(BASE . 'framework/core/index.php')) {\n $theme = BASE . 'framework/core/index.php'; // use the fallback bare essentials theme\n }\n }\n return $theme;\n }", " /** exdoc\n * @state <b>UNDOCUMENTED</b>\n *\n * @node Undocumented\n *\n * @param bool $include_default\n * @param string $theme\n *\n * @return array\n */\n public static function getSubthemes($include_default = true, $theme = DISPLAY_THEME)\n {\n $base = BASE . \"themes/$theme/subthemes\";\n // The array of subthemes. If the theme has no subthemes directory,\n // or the directory is not readable by the web server, this empty array\n // will be returned (Unless the caller wanted us to include the default layout)\n $subs = array();\n if ($include_default == true) {\n // Caller wants us to include the default layout.\n $subs[''] = DEFAULT_VIEW; // Not really its intended use, but it works.\n }", " if (is_readable($base)) {\n // subthemes directory exists and is readable by the web server. Continue on.\n $dh = opendir($base);\n // Read out all entries in the THEMEDIR/subthemes directory\n while (($s = readdir($dh)) !== false) {\n if (substr($s, -4, 4) == '.php' && substr($s, 0, 1) != '_' && is_file($base . \"/$s\") && is_readable(\n $base . \"/$s\"\n )\n ) {\n // Only readable .php files are allowed to be subtheme files.\n $subs[substr($s, 0, -4)] = substr($s, 0, -4);\n }\n }\n // Sort the subthemes by their keys (which are the same as the values)\n // using a natural string comparison function (PHP built-in)\n uksort($subs, 'strnatcmp');\n }\n return $subs;\n }", " public static function getPrinterFriendlyTheme()\n {\n global $framework;", " $common = 'framework/core/printer-friendly.php';\n $theme = 'themes/' . DISPLAY_THEME . '/printer-friendly.php';\n if (empty($framework)) {\n $fw = expSession::get('framework');\n $fwprint = 'framework/core/printer-friendly.' . $fw . '.php';\n } else {\n $fwprint = 'framework/core/printer-friendly.' . $framework . '.php';\n }", " if (is_readable($theme)) {\n return $theme;\n } elseif (is_readable($fwprint)) {\n return $fwprint;\n } elseif (is_readable($common)) {\n return $common;\n } else {\n return null;\n }\n }", " /** exdoc\n * Checks to see if the page is currently in an action. Useful only if the theme does not use the self::main() function\n * Returns whether or not an action should be run.\n *\n * @node Subsystems:Theme\n * @return boolean\n */\n public static function inPreview()\n {\n $level = 99;\n if (expSession::is_set('uilevel')) {\n $level = expSession::get('uilevel');\n }\n return ($level == UILEVEL_PREVIEW);\n }", " public static function inAction($action=null)\n {\n return (isset($_REQUEST['action']) && (isset($_REQUEST['module']) || isset($_REQUEST['controller'])) && (!isset($action) || ($action == $_REQUEST['action'])));\n }", " public static function reRoutActionTo($theme = \"\")\n {\n if (empty($theme)) {\n return false;\n }\n if (self::inAction()) {\n include_once(BASE . \"themes/\" . DISPLAY_THEME . \"/\" . $theme);\n exit;\n }\n return false;\n }", " /** exdoc\n * Runs the appropriate action, by looking at the $_REQUEST variable.\n *\n * @node Subsystems:Theme\n * @return bool\n */\n public static function runAction()\n {\n global $user;", " if (self::inAction()) {\n if (!AUTHORIZED_SECTION && !expJavascript::inAjaxAction())\n notfoundController::handle_not_authorized();\n//\t\t\tif (expSession::is_set(\"themeopt_override\")) {\n//\t\t\t\t$config = expSession::get(\"themeopt_override\");\n//\t\t\t\techo \"<a href='\".$config['mainpage'].\"'>\".$config['backlinktext'].\"</a><br /><br />\";\n//\t\t\t}", " //FIXME clean our passed parameters\n// foreach ($_REQUEST as $key=>$param) { //FIXME need array sanitizer\n// $_REQUEST[$key] = expString::sanitize($param);\n// }\n// if (empty($_REQUEST['route_sanitized'])) {\n if (!$user->isAdmin())\n expString::sanitize($_REQUEST);\n// } elseif (empty($_REQUEST['array_sanitized'])) {\n// $tmp =1; //FIXME we've already sanitized at this point\n// } else {\n// $tmp =1; //FIXME we've already sanitized at this point\n// }", " //FIXME: module/controller glue code..remove ASAP\n $module = empty($_REQUEST['controller']) ? $_REQUEST['module'] : $_REQUEST['controller'];\n//\t\t\t$isController = expModules::controllerExists($module);", "//\t\t\tif ($isController && !isset($_REQUEST['_common'])) {\n if (expModules::controllerExists($module)) {\n // this is being set just in case the url said module=modname instead of controller=modname\n // with SEF URls turned on its not really an issue, but with them off some of the links\n // aren't being made correctly...depending on how the {link} plugin was used in the view.\n $_REQUEST['controller'] = $module;", "// if (!isset($_REQUEST['action'])) $_REQUEST['action'] = 'showall';\n// if (isset($_REQUEST['view']) && $_REQUEST['view'] != $_REQUEST['action']) {\n// $test = explode('_',$_REQUEST['view']);\n// if ($test[0] != $_REQUEST['action']) {\n// $_REQUEST['view'] = $_REQUEST['action'].'_'.$_REQUEST['view'];\n// }\n// } elseif (!empty($_REQUEST['action'])) {\n// $_REQUEST['view'] = $_REQUEST['action'];\n// } else {\n// $_REQUEST['view'] = 'showall';\n// }", " echo renderAction($_REQUEST);\n//\t\t\t} else {\n//\t\t\t\tif ($_REQUEST['action'] == 'index') {\n//\t\t\t\t\t$view = empty($_REQUEST['view']) ? 'Default' : $_REQUEST['view'];\n//\t\t\t\t\t$title = empty($_REQUEST['title']) ? '' : expString::sanitize($_REQUEST['title']);\n//\t\t\t\t\t$src = empty($_REQUEST['src']) ? null : expString::sanitize($_REQUEST['src']);\n//\t\t\t\t\tself::showModule($module, $view, $title, $src);\n//\t\t\t\t\treturn true;\n//\t\t\t\t}\n//\n//\t\t\t\tglobal $db, $user; // these globals are needed for the old school actions which are loaded\n//\n//\t\t\t\t// the only reason we should have a controller down in this section is if we are hitting a common action like\n//\t\t\t\t// userperms or groupperms...deal with it.\n////\t\t\t\t$loc = new stdClass();\n////\t\t\t\t$loc->mod = $module;\n////\t\t\t\t$loc->src = (isset($_REQUEST['src']) ? expString::sanitize($_REQUEST['src']) : \"\");\n////\t\t\t\t$loc->int = (!empty($_REQUEST['int']) ? strval(intval($_REQUEST['int'])) : \"\");\n// $loc = expCore::makeLocation($module,(isset($_REQUEST['src']) ? expString::sanitize($_REQUEST['src']) : \"\"),(!empty($_REQUEST['int']) ? strval(intval($_REQUEST['int'])) : \"\"));\n//\t\t\t\t//if (isset($_REQUEST['act'])) $loc->act = $_REQUEST['act'];\n//\n//\t\t\t\tif (isset($_REQUEST['_common'])) {\n//\t\t\t\t\t$actfile = \"/common/actions/\" . $_REQUEST['action'] . \".php\";\n//\t\t\t\t} else {\n//\t\t\t\t\t$actfile = \"/\" . $module . \"/actions/\" . $_REQUEST['action'] . \".php\";\n//\t\t\t\t}\n//\n//\t\t\t\tif (is_readable(BASE.\"themes/\".DISPLAY_THEME.\"/modules\".$actfile)) {\n// include_once(BASE.\"themes/\".DISPLAY_THEME.\"/modules\".$actfile);\n////\t\t\t\t} elseif (is_readable(BASE.'framework/modules-1/'.$actfile)) {\n////\t\t\t\t\tinclude_once(BASE.'framework/modules-1/'.$actfile);\n//\t\t\t\t} else {\n//\t\t\t\t\techo SITE_404_HTML . '<br /><br /><hr size=\"1\" />';\n//\t\t\t\t\techo sprintf(gt('No such module action').' : %1 : %2',strip_tags($module),strip_tags($_REQUEST['action']));\n//\t\t\t\t\techo '<br />';\n//\t\t\t\t}\n }\n }\n return false;\n }", " public static function showAction($module, $action, $src = \"\", $params = array())\n { //FIXME only used by smarty functions, old school?\n global $user;", " $loc = expCore::makeLocation($module, (isset($src) ? $src : \"\"), (isset($int) ? $int : \"\"));", " $actfile = \"/\" . $module . \"/actions/\" . $action . \".php\";\n if (isset($params)) {\n// foreach ($params as $key => $value) { //FIXME need array sanitizer\n//// $_GET[$key] = $value;\n// $_GET[$key] = expString::sanitize($value);\n// }\n if (!$user->isAdmin())\n expString::sanitize($_GET);\n }\n //if (isset($['_common'])) $actfile = \"/common/actions/\" . $_REQUEST['action'] . \".php\";", " if (is_readable(BASE . \"themes/\" . DISPLAY_THEME . \"/modules\" . $actfile)) {\n include(BASE . \"themes/\" . DISPLAY_THEME . \"/modules\" . $actfile);\n// \t\t} elseif (is_readable(BASE.'framework/modules-1/'.$actfile)) {\n// \t\t\tinclude(BASE.'framework/modules-1/'.$actfile);\n } else {\n notfoundController::handle_not_found();\n echo '<br /><hr size=\"1\" />';\n echo sprintf(\n gt('No such module action') . ' : %1 : %2',\n strip_tags($_REQUEST['module']),\n strip_tags($_REQUEST['action'])\n );\n echo '<br />';\n }\n }", " /** exdoc\n * Redirect User to Default Section\n *\n * @node Subsystems:Theme\n */\n public static function goDefaultSection()\n {\n $last_section = expSession::get(\"last_section\");\n if (defined('SITE_DEFAULT_SECTION') && SITE_DEFAULT_SECTION != $last_section) {\n header(\"Location: \" . URL_FULL . \"index.php?section=\" . SITE_DEFAULT_SECTION);\n exit();\n } else {\n global $db;", " $section = $db->selectObject(\"section\", \"public = 1 AND active = 1\"); // grab first section, go there\n if ($section) {\n header(\"Location: \" . URL_FULL . \"index.php?section=\" . $section->id);\n exit();\n } else {\n notfoundController::handle_not_found();\n }\n }\n }", " /** exdoc\n * Takes care of all the specifics of either showing a sectional container or running an action.\n *\n * @node Subsystems:Theme\n */\n public static function main()\n {\n global $db;", " if ((!defined('SOURCE_SELECTOR') || SOURCE_SELECTOR == 1)) {\n $last_section = expSession::get(\"last_section\");\n $section = $db->selectObject(\"section\", \"id=\" . $last_section);\n // View authorization will be taken care of by the runAction and mainContainer functions\n if (self::inAction()) {\n if (!PRINTER_FRIENDLY && !EXPORT_AS_PDF)\n echo show_msg_queue();\n self::runAction();\n } else {\n if ($section == null) {\n self::goDefaultSection();\n } else {\n if (!PRINTER_FRIENDLY && !EXPORT_AS_PDF)\n echo show_msg_queue();\n self::mainContainer();\n }\n }\n// } else {\n// if (isset($_REQUEST['module'])) {\n// include_once(BASE.\"framework/modules/container/orphans_content.php\"); //FIXME not sure how to convert this yet\n// } else {\n// echo gt('Select a module');\n// }\n }\n }", " /** exdoc\n * Useful only if theme does not use self::main\n *\n * @return void\n * @internal param bool $public Whether or not the page is public.\n * @node Subsystems:Theme\n */\n public static function mainContainer()\n {\n global $router;", " if (!AUTHORIZED_SECTION) {\n // Set this so that a login on an Auth Denied page takes them back to the previously Auth-Denied page\n //\t\t\texpHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_SECTIONAL);\n expHistory::set('manageable', $router->params);\n notfoundController::handle_not_authorized();\n return;\n }", " if (PUBLIC_SECTION) {\n //\t\t\texpHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_SECTIONAL);\n expHistory::set('viewable', $router->params);\n } else {\n //\t\t\texpHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_SECTIONAL);\n expHistory::set('manageable', $router->params);\n }", " # if (expSession::is_set(\"themeopt_override\")) {\n # $config = expSession::get(\"themeopt_override\");\n// \t\t\tself::showSectionalModule(\"containermodule\",\"Default\",\"\",\"@section\",false,true); //FIXME change to showModule call\n self::module(\n array(\n \"controller\" => \"container\",\n \"action\" => \"showall\",\n \"view\" => \"showall\",\n \"source\" => \"@section\",\n \"scope\" => \"sectional\"\n )\n );", " # } else {\n # self::showSectionalModule(\"containermodule\",\"Default\",\"\",\"@section\");\n # }\n }", " /** exdoc\n * Calls the necessary methods to show a specific module, in a section-sensitive way.\n *\n * @param string $module The classname of the module to display\n * @param string $view The name of the view to display the module with\n * @param string $title The title of the module (support is view-dependent)\n * @param string $prefix The prefix of the module's source. The current section id will be appended to this\n * @param bool $pickable Whether or not the module is pickable in the Source Picker.\n * @param bool $hide_menu\n *\n * @return void\n * @node Subsystems:Theme\n * @deprecated 2.2.1\n */\n public static function showSectionalModule(\n $module,\n $view,\n $title,\n $prefix = null,\n $pickable = false,\n $hide_menu = false\n ) {\n global $module_scope;", " self::deprecated('expTheme::module()', $module, $view);\n $module = expModules::getModuleName($module); //FIXME patch to cleanup module name\n if ($prefix == null) {\n $prefix = \"@section\";\n }", " $src = $prefix;", "//\t\tif (expSession::is_set(\"themeopt_override\")) {\n//\t\t\t$config = expSession::get(\"themeopt_override\");\n//\t\t\tif (in_array($module,$config['ignore_mods'])) return;\n//\t\t\t$src = $config['src_prefix'].$prefix; //FIXME there is no such config index\n//\t\t\t$section = null;\n//\t\t} else {\n global $sectionObj;", " //$last_section = expSession::get(\"last_section\");\n //$section = $db->selectObject(\"section\",\"id=\".$last_section);\n $src .= $sectionObj->id;\n//\t\t}\n $module_scope[$src][$module] = new stdClass();\n $module_scope[$src][$module]->scope = 'sectional';", " self::showModule($module, $view, $title, $src, false, null, $hide_menu);\n }", " /** exdoc\n * Calls the necessary methods to show a specific module in such a way that the current\n * section displays the same content as its top-level parent and all of the top-level parent's\n * children, grand-children, grand-grand-children, etc.\n *\n * @param string $module The classname of the module to display\n * @param string $view The name of the view to display the module with\n * @param string $title The title of the module (support is view-dependent)\n * @param string $prefix The prefix of the module's source. The current section id will be appended to this\n * @param bool $pickable Whether or not the module is pickable in the Source Picker.\n * @param bool $hide_menu\n *\n * @node Subsystems:Theme\n * @deprecated 2.2.1\n */\n public static function showTopSectionalModule(\n $module,\n $view,\n $title,\n $prefix = null,\n $pickable = false,\n $hide_menu = false\n ) {\n global $db, $module_scope, $sectionObj;", " self::deprecated('expTheme::module()', $module, $view);\n $module = expModules::getModuleName($module); //FIXME patch to cleanup module name\n if ($prefix == null) {\n $prefix = \"@section\";\n }\n//\t\t$last_section = expSession::get(\"last_section\");\n//\t\t$section = $db->selectObject(\"section\",\"id=\".$last_section);\n $section = $sectionObj; //FIXME let's try $sectionObj instead of last_section\n// $module_scope[$prefix.$section->id][$module] = new stdClass();\n $module_scope[$prefix . $section->id][$module]->scope = 'top-sectional';\n // Loop until we find the top level parent.\n while ($section->parent != 0) {\n $section = $db->selectObject(\"section\", \"id=\" . $section->parent);\n }", " self::showModule($module, $view, $title, $prefix . $section->id, false, null, $hide_menu);\n }", " /** exdoc\n * Calls the necessary methods to show a specific controller, in a section-sensitive way.\n *\n * @param array $params\n *\n * @internal param string $module The classname of the module to display\n * @internal param string $view The name of the view to display the module with\n * @internal param string $title The title of the module (support is view-dependent)\n * @internal param string $prefix The prefix of the module's source. The current section id will be appended to this\n * @internal param bool $pickable Whether or not the module is pickable in the Source Picker.\n * @internal param bool $hide_menu\n * @return void\n * @node Subsystems:Theme\n * @deprecated 2.2.1\n */\n public static function showSectionalController($params = array())\n { //FIXME not used in base system (custom themes?)\n global $sectionObj, $module_scope;", " $src = \"@section\" . $sectionObj->id;\n $params['source'] = $src;\n// $module_scope[$params['source']][(isset($params['module'])?$params['module']:$params['controller'])] = new stdClass();\n $module_scope[$params['source']][(isset($params['module']) ? $params['module'] : $params['controller'])]->scope = 'sectional';\n $module = !empty($params['module']) ? $params['module'] : $params['controller'];\n $view = !empty($params['action']) ? $params['action'] : $params['view'];\n self::deprecated('expTheme::module()', $module, $view);\n self::module($params);\n }", " /**\n * @deprecated 2.2.1\n */\n public static function showController($params = array())\n {\n $module = !empty($params['module']) ? $params['module'] : $params['controller'];\n $view = !empty($params['action']) ? $params['action'] : $params['view'];\n self::deprecated('expTheme::module()', $module, $view);\n self::module($params);\n// global $sectionObj, $db, $module_scope;\n// if (empty($params)) {\n//\t return false;\n// } elseif (isset($params['module'])) {\n// self::module($params);\n// } else if (isset($params['controller'])) {\n//\t\t\t$params['view'] = isset($params['view']) ? $params['view'] : $params['action'];\n//\t\t\t$params['title'] = isset($params['moduletitle']) ? $params['moduletitle'] : '';\n//\t\t\t$params['chrome'] = (!isset($params['chrome']) || (isset($params['chrome'])&&empty($params['chrome']))) ? true : false;\n//\t\t\t$params['scope'] = isset($params['scope']) ? $params['scope'] : 'global';\n//\n//\t\t\t// set the controller and action to the one called via the function params\n//\t\t\t$requestvars = isset($params['params']) ? $params['params'] : array();\n//\t\t\t$requestvars['controller'] = $params['controller'];\n//\t\t\t$requestvars['action'] = isset($params['action']) ? $params['action'] : null;\n//\t\t\t$requestvars['view'] = isset($params['view']) ? $params['view'] : null;\n//\n//\t\t\t// figure out the scope of the module and set the source accordingly\n//\t\t\tif ($params['scope'] == 'global') {\n//\t\t\t\t$params['source'] = isset($params['source']) ? $params['source'] : null;\n//\t\t\t} elseif ($params['scope'] == 'sectional') {\n//\t\t\t\t$params['source'] = isset($params['source']) ? $params['source'] : '@section';\n//\t\t\t\t$params['source'] .= $sectionObj->id;\n//\t\t\t} elseif ($params['scope'] == 'top-sectional') {\n//\t\t\t\t$params['source'] = isset($params['source']) ? $params['source'] : '@section';\n//\t\t\t\t$section = $sectionObj;\n//\t\t\t\twhile ($section->parent > 0) $section = $db->selectObject(\"section\",\"id=\".$section->parent);\n//\t\t\t\t$params['source'] .= $section->id;\n//\t\t\t}\n//// $module_scope[$params['source']][(isset($params['module'])?$params['module']:$params['controller'])] = new stdClass();\n// $module_scope[$params['source']][(isset($params['module'])?$params['module']:$params['controller'])]->scope = $params['scope'];\n//\t\t\tself::showModule(expModules::getControllerClassName($params['controller']),$params['view'],$params['title'],$params['source'],false,null,$params['chrome'],$requestvars);\n// }\n// return false;\n }", " /**\n * Entry point for displaying modules\n * Packages $params for calling showModule method\n *\n * @param array $params list of module parameters\n *\n * @return bool\n */\n public static function module($params)\n {\n global $db, $module_scope, $sectionObj;", " if (empty($params)) {\n return false;\n } elseif (isset($params['module']) && expModules::controllerExists($params['module'])) {\n // hack to add compatibility for modules converted to controllers, but still hard-coded the old way\n $params['controller'] = $params['module'];\n unset($params['module']);\n }\n if (!isset($params['action'])) {\n $params['action'] = 'showall';\n }\n if (isset($params['view']) && $params['view'] != $params['action']) {\n $test = explode('_', $params['view']);\n if ($test[0] != $params['action']) {\n $params['view'] = $params['action'] . '_' . $params['view'];\n }\n } elseif (!empty($params['action'])) {\n $params['view'] = $params['action'];\n } else {\n $params['view'] = 'showall';\n }\n//\t if (isset($params['controller'])) {\n $controller = expModules::getModuleName($params['controller']);\n// $params['view'] = isset($params['view']) ? $params['view'] : $params['action'];\n $params['title'] = isset($params['moduletitle']) ? $params['moduletitle'] : '';\n $params['chrome'] = (!isset($params['chrome']) || (isset($params['chrome']) && empty($params['chrome']))) ? true : false;\n $params['scope'] = isset($params['scope']) ? $params['scope'] : 'global';", " // set the controller and action to the one called via the function params\n $requestvars = isset($params['params']) ? $params['params'] : array();\n $requestvars['controller'] = $controller;\n $requestvars['action'] = isset($params['action']) ? $params['action'] : null;\n $requestvars['view'] = isset($params['view']) ? $params['view'] : null;", " // figure out the scope of the module and set the source accordingly\n if ($params['scope'] == 'global') {\n $params['source'] = isset($params['source']) ? $params['source'] : null;\n } elseif ($params['scope'] == 'sectional') {\n $params['source'] = isset($params['source']) ? $params['source'] : '@section';\n $params['source'] .= $sectionObj->id;\n } elseif ($params['scope'] == 'top-sectional') {\n $params['source'] = isset($params['source']) ? $params['source'] : '@section';\n $section = $sectionObj;\n while ($section->parent > 0) {\n $section = $db->selectObject(\"section\", \"id=\" . $section->parent);\n }\n $params['source'] .= $section->id;\n }\n $module_scope[$params['source']][$controller] = new stdClass();\n $module_scope[$params['source']][$controller]->scope = $params['scope'];\n// self::showModule(expModules::getControllerClassName($params['controller']),$params['view'],$params['title'],$params['source'],false,null,$params['chrome'],$requestvars);\n return self::showModule(\n $controller,\n $params['view'],\n $params['title'],\n $params['source'],\n false,\n null,\n $params['chrome'],\n $requestvars\n );\n// } elseif (isset($params['module'])) {\n// $module = expModules::getModuleClassName($params['module']);\n// $moduletitle = (isset($params['moduletitle'])) ? $params['moduletitle'] : \"\";\n// $source = (isset($params['source'])) ? $params['source'] : \"\";\n// $chrome = (isset($params['chrome'])) ? $params['chrome'] : false;\n// $scope = (isset($params['scope'])) ? $params['scope'] : \"global\";\n//\n// if ($scope==\"global\") {\n// self::showModule($module,$params['view'],$moduletitle,$source,false,null,$chrome);\n// }\n// if ($scope==\"top-sectional\") {\n//// self::showTopSectionalModule($params['module'].\"module\", //module\n//// $params['view'], //view\n//// $moduletitle, // Title\n//// $source, // source\n//// false, // used to apply to source picker. does nothing now.\n//// $chrome // Show chrome\n//// );\n// if ($source == null) $source = \"@section\";\n// //FIXME - $section might be empty! We're getting it from last_section instead of sectionObj??\n//// $last_section = expSession::get(\"last_section\");\n//// $section = $db->selectObject(\"section\",\"id=\".$last_section);\n// $section = $sectionObj; //FIXME let's try $sectionObj instead of last_section\n// // Loop until we find the top level parent.\n// while ($section->parent != 0) $section = $db->selectObject(\"section\",\"id=\".$section->parent);\n// $module_scope[$source.$section->id][$module]= new stdClass();\n// $module_scope[$source.$section->id][$module]->scope = 'top-sectional';\n// self::showModule($module,$params['view'],$moduletitle,$source.$section->id,false,null,$chrome);\n// }\n// if ($scope==\"sectional\") {\n//// self::showSectionalModule($params['module'].\"module\", //module\n//// $params['view'], //view\n//// $moduletitle, // title\n//// $source, // source/prefix\n//// false, // used to apply to source picker. does nothing now.\n//// $chrome // Show chrome\n//// );\n// if ($source == null) $source = \"@section\";\n// $src = $source;\n// $src .= $sectionObj->id;\n// $module_scope[$src][$module] = new stdClass();\n// $module_scope[$src][$module]->scope = 'sectional';\n// self::showModule($module,$params['view'],$moduletitle,$src,false,null,$chrome);\n// }\n// }\n// return false;\n }", " /** exdoc\n * Calls the necessary methods to show a specific module - NOT intended to be called directly from theme\n *\n * @param string $module The classname of the module to display\n * @param string $view The name of the view to display the module with\n * @param string $title The title of the module (support is view-dependent)\n * @param string $source The source of the module.\n * @param bool $pickable Whether or not the module is pickable in the Source Picker.\n * @param null $section\n * @param bool $hide_menu\n * @param array $params\n *\n * @return void\n * @node Subsystems:Theme\n */\n public static function showModule(\n $module,\n $view = \"Default\",\n $title = \"\",\n $source = null,\n $pickable = false,\n $section = null,\n $hide_menu = false,\n $params = array()\n ) {\n $module = expModules::getModuleName($module); //FIXME patch to cleanup module name\n if (!AUTHORIZED_SECTION && $module != 'navigation' && $module != 'login') {\n return;\n }", " global $db, $sectionObj, $module_scope;", " // Ensure that we have a section\n //FJD - changed to $sectionObj\n if ($sectionObj == null) {\n $section_id = expSession::get('last_section');\n if ($section_id == null) {\n $section_id = SITE_DEFAULT_SECTION;\n }\n $sectionObj = $db->selectObject('section', 'id=' . $section_id);\n //$section->id = $section_id;\n }\n if ($module == \"login\" && defined('PREVIEW_READONLY') && PREVIEW_READONLY == 1) {\n return;\n }", "//\t\tif (expSession::is_set(\"themeopt_override\")) {\n//\t\t\t$config = expSession::get(\"themeopt_override\");\n//\t\t\tif (in_array($module,$config['ignore_mods'])) return;\n//\t\t}\n if (empty($params['action'])) {\n $params['action'] = $view;\n }\n $loc = expCore::makeLocation($module, $source . \"\");", " if (empty($module_scope[$source][$module]->scope)) {\n $module_scope[$source][$module] = new stdClass();\n $module_scope[$source][$module]->scope = 'global';\n }\n // make sure we've added this module to the sectionref table\n $secref = $db->selectObject(\"sectionref\", \"module='$module' AND source='\" . $loc->src . \"'\");\n if ($secref == null) {\n $secref = new stdClass();\n $secref->module = $module;\n $secref->source = $loc->src;\n $secref->internal = \"\";\n $secref->refcount = 1000; // only hard-coded modules should be missing\n if ($sectionObj != null) {\n $secref->section = $sectionObj->id;\n }\n//\t\t\t $secref->is_original = 1;\n $db->insertObject($secref, 'sectionref');\n// } elseif ($sectionObj != null && $secref->section != $sectionObj->id) {\n// $secref->section = $sectionObj->id;\n// $db->updateObject($secref, 'sectionref');\n }\n // add (hard-coded) modules to the container table, nested containers added in container showall method??\n $container = $db->selectObject('container', \"internal='\" . serialize($loc) . \"'\");\n if (empty($container->id)) {\n //if container isn't here already, then create it...hard-coded from theme template\n $newcontainer = new stdClass();\n $newcontainer->internal = serialize($loc);\n $newcontainer->external = serialize(null);\n $newcontainer->title = $title;\n $newcontainer->view = $view;\n $newcontainer->action = $params['action'];\n $newcontainer->id = $db->insertObject($newcontainer, 'container');\n }\n if (empty($title) && !empty($container->title)) {\n $title = $container->title;\n }\n//\t\t$iscontroller = expModules::controllerExists($module);", " if (defined('SELECTOR') && call_user_func(array(expModules::getModuleClassName($module), \"hasSources\"))) {\n containerController::wrapOutput($module, $view, $loc, $title);\n } else {\n//\t\t\tif (is_callable(array($module,\"show\")) || $iscontroller) {\n if (expModules::controllerExists($module)) {\n // FIXME: we are checking here for a new MVC style controller or an old school module. We only need to perform\n // this check until we get the old modules all gone...until then we have the check and a lot of code duplication\n // in the if blocks below...oh well, that's life.\n//\t\t\t\tif (!$iscontroller) {\n////\t\t\t\t\tif ((!$hide_menu && $loc->mod != \"containermodule\" && (call_user_func(array($module,\"hasSources\")) || $db->tableExists($loc->mod.\"_config\")))) {\n// if ((!$hide_menu && (call_user_func(array($module,\"hasSources\")) || $db->tableExists($loc->mod.\"_config\")))) {\n// $container = new stdClass(); //php 5.4\n//\t\t\t\t\t\t$container->permissions = array(\n//\t\t\t\t\t\t\t'manage'=>(expPermissions::check('manage',$loc) ? 1 : 0),\n//\t\t\t\t\t\t\t'configure'=>(expPermissions::check('configure',$loc) ? 1 : 0)\n//\t\t\t\t\t\t);\n//\n//\t\t\t\t\t\tif ($container->permissions['manage'] || $container->permissions['configure']) {\n//\t\t\t\t\t\t\t$container->randomizer = mt_rand(1,ceil(microtime(1)));\n//\t\t\t\t\t\t\t$container->view = $view;\n//\t\t\t\t\t\t\t$container->info['class'] = expModules::getModuleClassName($loc->mod);\n//\t\t\t\t\t\t\t$container->info['module'] = call_user_func(array($module,\"name\"));\n//\t\t\t\t\t\t\t$container->info['source'] = $loc->src;\n// $container->info['scope'] = $module_scope[$source][$module]->scope;\n//\t\t\t\t\t\t\t$container->info['hasConfig'] = $db->tableExists($loc->mod.\"_config\");\n////\t\t\t\t\t\t\t$template = new template('containermodule','_hardcoded_module_menu',$loc);\n//// $template = new template('containerController','_hardcoded_module_menu',$loc,false,'controllers');\n// $c2 = new containerController();\n// $template = expTemplate::get_template_for_action($c2,'_hardcoded_module_menu');\n//\t\t\t\t\t\t\t$template->assign('container', $container);\n//\t\t\t\t\t\t\t$template->output();\n//\t\t\t\t\t\t}\n//\t\t\t\t\t}\n//\t\t\t\t} else {\n // if we hit here we're dealing with a hard-coded controller...not a module\n if (!$hide_menu && $loc->mod != \"container\") {\n $controller = expModules::getController($module);\n// $controller = expModules::getControllerClassName($module);\n $hccontainer = new stdClass(); //php 5.4\n $hccontainer->permissions = array(\n 'manage' => (expPermissions::check('manage', $loc) ? 1 : 0),\n 'configure' => (expPermissions::check('configure', $loc) ? 1 : 0)\n );", " if ($hccontainer->permissions['manage'] || $hccontainer->permissions['configure']) {\n $hccontainer->randomizer = mt_rand(1, ceil(microtime(1)));\n $hccontainer->view = $view;\n $hccontainer->action = $params['action'];\n $hccontainer->info['class'] = expModules::getModuleClassName($loc->mod);\n $hccontainer->info['module'] = $controller->displayname();\n// $hccontainer->info['module'] = $controller::displayname();\n $hccontainer->info['source'] = $loc->src;\n $hccontainer->info['scope'] = $module_scope[$source][$module]->scope;\n//\t\t\t\t\t\t\t$hccontainer->info['hasConfig'] = true;\n//\t\t\t\t\t\t\t$template = new template('containermodule','_hardcoded_module_menu',$loc);\n//\t\t\t\t\t\t\t$template = new template('containerController','_hardcoded_module_menu',$loc,false,'controllers');\n $c2 = new containerController();\n $template = expTemplate::get_template_for_action($c2, '_hardcoded_module_menu');\n $template->assign('container', $hccontainer);\n $template->output();\n }\n }\n//\t\t\t\t}", "//\t\t\t\tif ($iscontroller) {\n $params['src'] = $loc->src;\n $params['controller'] = $module;\n $params['view'] = $view;\n $params['moduletitle'] = $title;\n return renderAction($params);\n//\t\t\t\t} else {\n//\t\t\t\t\tcall_user_func(array($module,\"show\"),$view,$loc,$title);\n//\t\t\t\t}\n } else {\n echo sprintf(gt('The module \"%s\" was not found in the system.'), $module);\n return false;\n }\n }\n }", " public static function getThemeDetails() {\n $theme_file = DISPLAY_THEME;\n if (is_readable(BASE.'themes/'.$theme_file.'/class.php')) {\n // Need to avoid the duplicate theme problem.\n if (!class_exists($theme_file)) {\n include_once(BASE.'themes/'.$theme_file.'/class.php');\n }", " if (class_exists($theme_file)) {\n // Need to avoid instantiating non-existent classes.\n $theme = new $theme_file();\n return ' ' . gt('using') . ' ' . $theme->name() . ' ' . gt('by') . ' ' . $theme->author();\n }\n }\n return '';\n }", " /**\n * Return the color style for the current framework\n *\n * @param $color\n *\n * @return mixed|string\n */\n public static function buttonColor($color = null)\n {\n $colors = array(\n 'green' => 'btn-success',\n 'blue' => 'btn-primary',\n 'red' => 'btn-danger',\n 'magenta' => 'btn-danger',\n 'orange' => 'btn-warning',\n 'yellow' => 'btn-warning',\n 'grey' => 'btn-default',\n 'purple' => 'btn-info',\n 'black' => 'btn-inverse',\n 'pink' => 'btn-danger',\n );\n if (bs()) {\n if (!empty($colors[$color])) { // awesome to bootstrap button conversion\n $found = $colors[$color];\n } else {\n $found = 'btn-default';\n }\n } else {\n $found = array_search($color, $colors); // bootstrap to awesome button conversion?\n if (empty($found)) {\n $found = $color;\n } else {\n $found = BTN_COLOR;\n }\n }\n return $found;\n }", " /**\n * Return the button size for the current framework\n *\n * @param $size\n *\n * @return mixed|string\n */\n public static function buttonSize($size = null)\n {\n if (bs2()) {\n if (BTN_SIZE == 'large' || (!empty($size) && $size == 'large')) {\n $btn_size = ''; // actually default size, NOT true bootstrap large\n } elseif (BTN_SIZE == 'small' || (!empty($size) && $size == 'small')) {\n $btn_size = 'btn-mini';\n } else { // medium\n $btn_size = 'btn-small';\n }\n return $btn_size;\n } elseif (bs3()) {\n if (BTN_SIZE == 'large' || (!empty($size) && $size == 'large')) {\n $btn_size = 'btn-lg';\n } elseif (BTN_SIZE == 'small' || (!empty($size) && $size == 'small')) {\n $btn_size = 'btn-sm';\n } elseif (BTN_SIZE == 'extrasmall' || (!empty($size) && $size == 'extrasmall')) {\n $btn_size = 'btn-xs';\n } else { // medium\n $btn_size = '';\n }\n return $btn_size;\n } else {\n if (empty($size)) {\n $size = BTN_SIZE;\n }\n return $size;\n }\n }", " /**\n * Return the button color and size style for the current framework\n *\n * @param null $color\n * @param $size\n *\n * @return mixed|string\n */\n public static function buttonStyle($color = null, $size = null)\n {\n if (bs()) {\n $btn_class = 'btn ' . self::buttonColor($color) . ' ' . self::buttonSize($size);\n } else {\n $btn_size = !empty($size) ? $size : BTN_SIZE;\n $btn_color = !empty($color) ? $color : BTN_COLOR;\n $btn_class = \"awesome \" . $btn_size . \" \" . $btn_color;\n }\n return $btn_class;\n }", " /**\n * Return the icon associated for the current frameowrk\n *\n * @param $class\n *\n * @return stdClass|string\n */\n public static function buttonIcon($class, $size=null)\n {\n $btn_type = '';\n if (bs2()) {\n switch ($class) {\n case 'delete' :\n case 'delete-title' :\n $class = \"remove-sign\";\n $btn_type = \"btn-danger\"; // red\n break;\n case 'add' :\n case 'add-title' :\n case 'add-body' :\n case 'switchtheme add' :\n $class = \"plus-sign\";\n $btn_type = \"btn-success\"; // green\n break;\n case 'copy' :\n $class = \"copy\";\n break;\n case 'downloadfile' :\n case 'export' :\n $class = \"download-alt\";\n break;\n case 'uploadfile' :\n case 'import' :\n $class = \"upload-alt\";\n break;\n case 'manage' :\n $class = \"briefcase\";\n break;\n case 'merge' :\n case 'arrow_merge' :\n $class = \"signin\";\n break;\n case 'reranklink' :\n case 'alphasort' :\n $class = \"sort\";\n break;\n case 'configure' :\n $class = \"wrench\";\n break;\n case 'view' :\n $class = \"search\";\n break;\n case 'page_next' :\n $class = 'double-angle-right';\n break;\n case 'page_prev' :\n $class = 'double-angle-left';\n break;\n case 'password' :\n case 'change_password' :\n $class = 'key';\n break;\n case 'clean' :\n $class = 'check';\n break;\n case 'userperms' :\n $class = 'user';\n break;\n case 'groupperms' :\n $class = 'group';\n break;\n case 'monthviewlink' :\n case 'weekviewlink' :\n $class = 'calendar';\n break;\n case 'listviewlink' :\n $class = 'list';\n break;\n case 'adminviewlink' :\n $class = 'cogs';\n break;\n case 'approve' :\n $class = \"check\";\n $btn_type = \"btn-success\"; // green\n break;\n case 'ajax' :\n $class = \"spinner icon-spin\";\n break;\n }\n $found = new stdClass();\n $found->type = $btn_type;\n $found->class = $class;\n $found->size = self::iconSize($size);\n $found->prefix = 'icon-';\n return $found;\n } elseif (bs3()) {\n switch ($class) {\n case 'delete' :\n case 'delete-title' :\n $class = \"times-circle\";\n $btn_type = \"btn-danger\"; // red\n break;\n case 'add' :\n case 'add-title' :\n case 'add-body' :\n case 'switchtheme add' :\n $class = \"plus-circle\";\n $btn_type = \"btn-success\"; // green\n break;\n case 'copy' :\n $class = \"files-o\";\n break;\n case 'downloadfile' :\n case 'export' :\n $class = \"download\";\n break;\n case 'uploadfile' :\n case 'import' :\n $class = \"upload\";\n break;\n case 'manage' :\n $class = \"briefcase\";\n break;\n case 'merge' :\n case 'arrow_merge' :\n $class = \"sign-in\";\n break;\n case 'reranklink' :\n case 'alphasort' :\n $class = \"sort\";\n break;\n case 'configure' :\n $class = \"wrench\";\n break;\n case 'view' :\n $class = \"search\";\n break;\n case 'page_next' :\n $class ='angle-double-right';\n break;\n case 'page_prev' :\n $class = 'angle-double-left';\n break;\n case 'password' :\n case 'change_password' :\n $class = 'key';\n break;\n case 'clean' :\n $class = 'check-square-o';\n break;\n case 'trash' :\n $class = \"trash-o\";\n break;\n case 'userperms' :\n $class = 'user';\n break;\n case 'groupperms' :\n $class = 'group';\n break;\n case 'monthviewlink' :\n case 'weekviewlink' :\n $class = 'calendar';\n break;\n case 'listviewlink' :\n $class = 'list';\n break;\n case 'adminviewlink' :\n $class = 'cogs';\n break;\n case 'approve' :\n $class = \"check\";\n $btn_type = \"btn-success\"; // green\n break;\n case 'ajax' :\n $class = \"spinner fa-spin\";\n break;\n }\n $found = new stdClass();\n $found->type = $btn_type;\n $found->class = $class;\n $found->size = self::iconSize($size);\n $found->prefix = 'fa fa-';\n return $found;\n } else {\n return $class;\n }\n }", " /**\n * Return the full icon style string for the current framework\n *\n * @param $class\n *\n * @return string\n */\n public static function iconStyle($class, $text = null) {\n $style = self::buttonIcon($class);\n if (!empty($style->prefix)) {\n if ($text) {\n return '<i class=\"' .$style->prefix . $style->class . '\"></i> '. $text;\n } else {\n return $style->prefix . $style->class;\n }\n } else {\n return $style;\n }\n }", " /**\n * Return the icon size for the current framework\n *\n * @param $size\n *\n * @return mixed|string\n */\n public static function iconSize($size = null)\n {\n if (bs2()) {\n if (BTN_SIZE == 'large' || (!empty($size) && $size == 'large')) {\n $icon_size = 'icon-large';\n } elseif (BTN_SIZE == 'small' || (!empty($size) && $size == 'small')) {\n $icon_size = '';\n } else { // medium\n $icon_size = 'icon-large';\n }\n return $icon_size;\n } elseif (bs3()) {\n if (BTN_SIZE == 'large' || (!empty($size) && $size == 'large')) {\n $icon_size = 'fa-lg';\n } elseif (BTN_SIZE == 'small' || (!empty($size) && $size == 'small')) {\n $icon_size = '';\n } else { // medium\n $icon_size = 'fa-lg';\n }\n return $icon_size;\n } else {\n return BTN_SIZE;\n }\n }", " public static function is_mobile()\n {\n $tablet_browser = 0;\n $mobile_browser = 0;", " if (preg_match(\n '/(tablet|ipad|playbook)|(android(?!.*(mobi|opera mini)))/i',\n strtolower($_SERVER['HTTP_USER_AGENT'])\n )\n ) {\n $tablet_browser++;\n }", " if (preg_match(\n '/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|android|iemobile)/i',\n strtolower($_SERVER['HTTP_USER_AGENT'])\n )\n ) {\n $mobile_browser++;\n }", " if ((!empty($_SERVER['HTTP_ACCEPT']) && strpos(\n strtolower($_SERVER['HTTP_ACCEPT']),\n 'application/vnd.wap.xhtml+xml'\n ) > 0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))\n ) {\n $mobile_browser++;\n }", " $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4));\n $mobile_agents = array(\n 'w3c ',\n 'acs-',\n 'alav',\n 'alca',\n 'amoi',\n 'audi',\n 'avan',\n 'benq',\n 'bird',\n 'blac',\n 'blaz',\n 'brew',\n 'cell',\n 'cldc',\n 'cmd-',\n 'dang',\n 'doco',\n 'eric',\n 'hipt',\n 'inno',\n 'ipaq',\n 'java',\n 'jigs',\n 'kddi',\n 'keji',\n 'leno',\n 'lg-c',\n 'lg-d',\n 'lg-g',\n 'lge-',\n 'maui',\n 'maxo',\n 'midp',\n 'mits',\n 'mmef',\n 'mobi',\n 'mot-',\n 'moto',\n 'mwbp',\n 'nec-',\n 'newt',\n 'noki',\n 'palm',\n 'pana',\n 'pant',\n 'phil',\n 'play',\n 'port',\n 'prox',\n 'qwap',\n 'sage',\n 'sams',\n 'sany',\n 'sch-',\n 'sec-',\n 'send',\n 'seri',\n 'sgh-',\n 'shar',\n 'sie-',\n 'siem',\n 'smal',\n 'smar',\n 'sony',\n 'sph-',\n 'symb',\n 't-mo',\n 'teli',\n 'tim-',\n 'tosh',\n 'tsm-',\n 'upg1',\n 'upsi',\n 'vk-v',\n 'voda',\n 'wap-',\n 'wapa',\n 'wapi',\n 'wapp',\n 'wapr',\n 'webc',\n 'winw',\n 'winw',\n 'xda ',\n 'xda-'\n );", " if (in_array($mobile_ua, $mobile_agents)) {\n $mobile_browser++;\n }", " if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'opera mini') > 0) {\n $mobile_browser++;\n //Check for tablets on opera mini alternative headers\n $stock_ua = strtolower(\n isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']) ? $_SERVER['HTTP_X_OPERAMINI_PHONE_UA'] : (isset($_SERVER['HTTP_DEVICE_STOCK_UA']) ? $_SERVER['HTTP_DEVICE_STOCK_UA'] : '')\n );\n if (preg_match('/(tablet|ipad|playbook)|(android(?!.*mobile))/i', $stock_ua)) {\n $tablet_browser++;\n }\n }", " if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'windows') > 0) {\n $mobile_browser = 0;\n }", " if ($tablet_browser > 0) {\n // do something for tablet devices\n// print 'is tablet';\n } elseif ($mobile_browser > 0) {\n // do something for mobile devices\n// print 'is mobile';\n } else {\n // do something for everything else\n// print 'is desktop';\n }", " return $mobile_browser;\n }", " /**\n * Warn admin of obsolete theme methods\n *\n * @param string $newcall\n * @param null $controller\n * @param null $actionview\n */\n public static function deprecated($newcall = \"expTheme::module()\", $controller = null, $actionview = null)\n {\n global $user;", " if ($user->isAdmin() && DEVELOPMENT) {\n $trace = debug_backtrace();\n $caller = $trace[1];\n if (substr($caller['file'], -16, 6) == 'compat') {\n $caller = $trace[2];\n }\n $oldcall = $caller['function'];\n if ($caller['class'] == 'expTheme') {\n $oldcall = $caller['class'] . '::' . $oldcall;\n }\n $message = '<strong>' . $oldcall . '</strong> ' . gt(\n 'is deprecated and should be replaced by'\n ) . ' <strong>' . $newcall . '</strong>';\n if (!empty($controller)) {\n $message .= '<br>' . gt(\n 'for hard coded module'\n ) . ' - <strong>' . $controller . ' / ' . $actionview . '</strong>';\n }\n $message .= '<br>' . gt('line') . ' #' . $caller['line'] . ' ' . gt('of') . $caller['file'];\n $message .= ' <a class=\"helplink\" title=\"' . gt('Get Theme Update Help') . '\" href=\"' . help::makeHelpLink(\n 'theme_update'\n ) . '\" target=\"_blank\">' . gt('Help') . '</a>';\n flash('notice', $message);\n }\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expTheme\n *\n * @package Subsystems\n * @subpackage Subsystems\n */", "/** @define \"BASE\" \"../../..\" */\nclass expTheme\n{", " public static function initialize()\n {\n global $auto_dirs2;", " // Initialize the theme subsystem 1.0 compatibility layer if requested\n\t\tif (defined('OLD_THEME_COMPATIBLE') && OLD_THEME_COMPATIBLE)\n require_once(BASE.'framework/core/compat/theme.php');", " if (!defined('DISPLAY_THEME')) {\n /* exdoc\n * The directory and class name of the current active theme. This may be different\n * than the configured theme (DISPLAY_THEME_REAL) due to previewing.\n */\n define('DISPLAY_THEME', DISPLAY_THEME_REAL);\n }", " if (!defined('THEME_ABSOLUTE')) {\n /* exdoc\n * The absolute path to the current active theme's files. This is similar to the BASE constant\n */\n define('THEME_ABSOLUTE', BASE . 'themes/' . DISPLAY_THEME . '/'); // This is the recommended way\n }", " if (!defined('THEME_RELATIVE')) {\n /* exdoc\n * The relative web path to the current active theme. This is similar to the PATH_RELATIVE constant.\n */\n define('THEME_RELATIVE', PATH_RELATIVE . 'themes/' . DISPLAY_THEME . '/');\n }\n if (!defined('THEME_STYLE')) {\n /* exdoc\n * The name of the current active theme style.\n */\n define('THEME_STYLE', THEME_STYLE_REAL);\n }\n if (THEME_STYLE != '' && file_exists(BASE . 'themes/' . DISPLAY_THEME . '/config_' . THEME_STYLE . '.php')) {\n @include_once(BASE . 'themes/' . DISPLAY_THEME . '/config_' . THEME_STYLE . '.php');\n } elseif (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/config.php')) {\n @include_once(BASE . 'themes/' . DISPLAY_THEME . '/config.php');\n }\n if (!defined('BTN_SIZE')) {\n define('BTN_SIZE', 'medium');\n } // Awesome Button theme\n if (!defined('BTN_COLOR')) {\n define('BTN_COLOR', 'black');\n } // Awesome Button theme\n if (!defined('SWATCH')) {\n define('SWATCH', \"''\");\n } // Twitter Bootstrap theme", " // add our theme folder into autoload to prioritize custom (theme) modules\n array_unshift($auto_dirs2, BASE . 'themes/' . DISPLAY_THEME . '/modules');\n }", " public static function head($config = array())\n {\n echo self::headerInfo($config);\n self::advertiseRSS();\n }", " public static function headerInfo($config)\n {\n global $sectionObj, $validateTheme, $head_config, $auto_dirs, $less_vars, $framework;", " $validateTheme['headerinfo'] = true;\n // end checking for headerInfo", " // globalize header configuration\n $head_config = $config;", " // set theme framework type\n $framework = !empty($head_config['framework']) ? $head_config['framework'] : '';\n if (empty($framework)) {\n if (NEWUI) {\n $framework = 'newui';\n } else {\n $framework = 'yui'; // yui is the 2.x default framework\n }\n }\n expSession::set('framework', $framework);", " // set the global less variables from the head config\n if (!empty($config['lessvars'])) {\n $less_vars = $config['lessvars'];\n } else {\n $less_vars = array();\n }", " // check to see if we're in XHTML or HTML mode\n if (isset($config['xhtml']) && $config['xhtml'] == true) {\n define('XHTML', 1);\n define('XHTML_CLOSING', \"/\"); //default\n } else {\n define('XHTML', 0);\n define('XHTML_CLOSING', \"\");\n }", " // load primer, lessprimer, link (css) and lesscss & normalize CSS files\n if (!empty($config['css_primer']) || !empty($config['lessprimer']) || !empty($config['link']) || !empty($config['lesscss']) || !empty($config['normalize'])) {\n expCSS::pushToHead($config);\n };", " // default loading of primer CSS files to true if not set\n if (empty($config['css_primer']) && empty($config['lessprimer'])) {\n $head_config = array('css_primer' => true) + $head_config;\n }", " // parse & load core css files\n if (isset($config['css_core'])) {\n if (is_array($config['css_core'])) {\n $corecss = implode(\",\", $config['css_core']);\n expCSS::pushToHead(\n array(\n \"corecss\" => $corecss\n )\n );\n }\n } else {\n $head_config['css_core'] = false;\n };", " // default loading of view based CSS inclusion is true if not set\n if (!empty($config['css_links']) || !isset($config['css_links'])) {\n $head_config['css_links'] = true;\n }", " // default theme css collecting is true if not set\n if (!empty($config['css_theme']) || !isset($config['css_theme'])) {\n $head_config['css_theme'] = true;\n }", " if (empty($sectionObj)) {\n return false;\n }", " // set up controls search order based on framework\n if (empty($head_config['framework'])) {\n $head_config['framework'] = '';\n }\n if (bs() || $framework == 'jquery') {\n array_unshift(\n $auto_dirs,\n BASE . 'framework/core/forms/controls/jquery'\n );\n }\n if (bs(true)) {\n array_unshift(\n $auto_dirs,\n BASE . 'framework/core/forms/controls/bootstrap'\n );\n }\n if (bs3(true)) {\n array_unshift(\n $auto_dirs,\n BASE . 'framework/core/forms/controls/bootstrap3'\n );\n }\n if (newui()) {\n expCSS::pushToHead(array(\n \"lessprimer\"=>\"external/bootstrap3/less/newui.less\",\n// \"lessvars\"=>array(\n// 'swatch'=>'cerulean', // newui uses this swatch\n// 'themepath'=>'cerulean', // hack to prevent crash\n// ),\n ));\n if (!defined(\"BTN_SIZE\")) define(\"BTN_SIZE\", 'small');\n array_unshift($auto_dirs, BASE . 'framework/core/forms/controls/newui');\n }\n array_unshift($auto_dirs, BASE . 'themes/' . DISPLAY_THEME . '/controls');", "// if (!expSession::is_set('framework') || expSession::get(\n// 'framework'\n// ) != $head_config['framework']\n// ) {\n// expSession::set('framework', $head_config['framework']);\n// }\n // mark the theme framework", " $metainfo = self::pageMetaInfo();", " // default to showing all meta tags unless specifically set to false\n if (!isset($config['meta']['content_type'])) {\n $config['meta']['content_type'] = true;\n }\n if (!isset($config['meta']['content_language'])) {\n $config['meta']['content_language'] = true;\n }\n if (!isset($config['meta']['generator'])) {\n $config['meta']['generator'] = true;\n }\n if (!isset($config['meta']['keywords'])) {\n $config['meta']['keywords'] = true;\n }\n if (!isset($config['meta']['description'])) {\n $config['meta']['description'] = true;\n }\n if (!isset($config['meta']['canonical'])) {\n $config['meta']['canonical'] = true;\n }\n if (!isset($config['meta']['rich'])) {\n $config['meta']['rich'] = true;\n }\n if (!isset($config['meta']['fb'])) {\n $config['meta']['fb'] = true;\n }\n if (!isset($config['meta']['tw'])) {\n $config['meta']['tw'] = true;\n }\n if (!isset($config['meta']['viewport'])) {\n $config['meta']['viewport'] = true;\n }\n if (!isset($config['meta']['ie_compat'])) {\n $config['meta']['ie_compat'] = true;\n }\n", " $str = '';", " if ($config['meta']['content_type']) {", " $str .= '<meta charset=\"' . LANG_CHARSET . XHTML_CLOSING . '>' . \"\\n\"; // html5\n $str .= \"\\t\" . '<meta http-equiv=\"Content-Type\" content=\"text/html; charset=' . LANG_CHARSET . '\" ' . XHTML_CLOSING . '>' . \"\\n\"; // html4 or xhtml?\n }\n if ($config['meta']['ie_compat']) {\n // turn off ie compatibility mode which will break the display\n $str .= \"\\t\" . '<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"' . XHTML_CLOSING . '>' . \"\\n\";\n }\n $str .= \"\\t\" . '<title>' . $metainfo['title'] . \"</title>\\n\";", " $locale = strtolower(str_replace('_', '-', LOCALE));\n if ($config['meta']['content_language']) {", " $str .= \"\\t\" . '<meta http-equiv=\"Content-Language\" content=\"' . $locale . '\" ' . XHTML_CLOSING . '>' . \"\\n\";", " }\n if ($config['meta']['generator']) {\n $str .= \"\\t\" . '<meta name=\"Generator\" content=\"Exponent Content Management System - v' . expVersion::getVersion(\n true\n ) . self::getThemeDetails() . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if ($config['meta']['keywords']) {\n $str .= \"\\t\" . '<meta name=\"Keywords\" content=\"' . $metainfo['keywords'] . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if ($config['meta']['description']) {\n $str .= \"\\t\" . '<meta name=\"Description\" content=\"' . $metainfo['description'] . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if ($config['meta']['canonical'] && !empty($metainfo['canonical'])) {\n $str .= \"\\t\" . '<link rel=\"canonical\" href=\"' . $metainfo['canonical'] . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if ($config['meta']['rich'] && !empty($metainfo['rich'])) {\n $str .= \"\\t\" . $metainfo['rich'] . \"\\n\";\n }\n if ($config['meta']['fb'] && !empty($metainfo['fb'])) {\n foreach ($metainfo['fb'] as $key => $value) {\n if (!empty($value)) {\n $str .= \"\\t\" . '<meta property=\"og:' . $key . '\" content=\"' . $value . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n }\n }\n if ($config['meta']['tw'] && !empty($metainfo['tw'])) {\n foreach ($metainfo['tw'] as $key => $value) {\n if (!empty($value)) {\n $str .= \"\\t\" . '<meta name=\"twitter:' . $key . '\" content=\"' . $value . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n }\n }", " if ($metainfo['noindex'] || $metainfo['nofollow']) {\n $str .= \"\\t\" . '<meta name=\"robots\" content=\"' . (!empty($metainfo['noindex']) ? 'noindex' : '') . ' ' . ($metainfo['nofollow'] ? 'nofollow' : '') . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }", " if (empty($config['viewport'])) {\n $viewport = 'width=device-width, user-scalable=yes';\n } else {\n if (!empty($config['viewport']['width'])) {\n $viewport = 'width=' . $config['viewport']['width'];\n } else {\n $viewport = 'width=device-width';\n }\n if (!empty($config['viewport']['height'])) {\n $viewport .= ', height=' . $config['viewport']['height'];\n }\n if (!empty($config['viewport']['initial_scale'])) {\n $viewport .= ' initial-scale=' . $config['viewport']['initial_scale'];\n// } else {\n// $viewport .= ', initial-scale=1.0';\n }\n if (!empty($config['viewport']['minimum_scale'])) {\n $viewport .= ', minimum-scale=' . $config['viewport']['minimum_scale'];\n }\n if (!empty($config['viewport']['maximum_scale'])) {\n $viewport .= ', maximum-scale=' . $config['viewport']['maximum_scale'];\n }\n if (!empty($config['viewport']['user_scalable'])) {\n $viewport .= ', user-scalable=' . ($config['viewport']['user_scalable'] ? \"yes\" : \"no\");\n } else {\n $viewport .= ', user-scalable=yes';\n }\n }\n if ($config['meta']['viewport']) {\n $str .= \"\\t\" . '<meta name=\"viewport\" content=\"' . $viewport . '\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }", " // favicon\n if (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/favicon.png')) {\n $str .= \"\\t\" . '<link rel=\"icon\" href=\"' . URL_FULL . 'themes/' . DISPLAY_THEME . '/favicon.png\" type=\"image/png\" ' . XHTML_CLOSING . '>' . \"\\n\";\n } elseif (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/favicon.ico')) {\n $str .= \"\\t\" . '<link rel=\"icon\" href=\"' . URL_FULL . 'themes/' . DISPLAY_THEME . '/favicon.ico\" type=\"image/x-icon\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n // touch icons\n if (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/apple-touch-icon.png')) {\n $str .= \"\\t\" . '<link rel=\"apple-touch-icon\" href=\"' . URL_FULL . 'themes/' . DISPLAY_THEME . '/apple-touch-icon.png\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n if (file_exists(BASE . 'themes/' . DISPLAY_THEME . '/apple-touch-icon-precomposed.png')) {\n $str .= \"\\t\" . '<link rel=\"apple-touch-icon-precomposed\" href=\"' . URL_FULL . 'themes/' . DISPLAY_THEME . '/apple-touch-icon-precomposed.png\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }", " // support for xmlrpc blog editors like Windows Live Writer, etc...\n if (USE_XMLRPC) {\n if (file_exists(BASE . 'rsd.xml')) {\n $str .= \"\\t\" . '<link rel=\"EditURI\" href=\"' . URL_FULL . 'rsd.xml\" type=\"application/rsd+xml\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }\n $str .= \"\\t\" . '<link rel=\"wlwmanifest\" href=\"' . URL_FULL . 'wlwmanifest.xml\" type=\"application/wlwmanifest+xml\" ' . XHTML_CLOSING . '>' . \"\\n\";\n }", " // when minification is used, the comment below gets replaced when the buffer is dumped\n $str .= '<!-- MINIFY REPLACE -->';", " if ($config['meta']['ie_compat']) {\n // some IE 6 support\n $str .= \"\\t\" . '<!--[if IE 6]><style type=\"text/css\"> body { behavior: url(' . PATH_RELATIVE . 'external/csshover.htc); }</style><![endif]-->' . \"\\n\";", " // css3 transform support for IE 6-8\n// $str .= \"\\t\" . '<!--[if lt IE 9]><style type=\"text/css\"> body { behavior: url(' . PATH_RELATIVE . 'external/ms-transform.htc); }</style><![endif]-->' . \"\\n\";", " // html5 support for IE 6-8\n $str .= \"\\t\" . '<!--[if lt IE 9]><script src=\"' . PATH_RELATIVE . 'external/html5shiv/html5shiv-shiv.js\"></script><![endif]-->' . \"\\n\";", " // media css support for IE 6-8\n $str .= \"\\t\" . '<!--[if lt IE 9]><script src=\"' . PATH_RELATIVE . 'external/Respond-1.4.2/dest/respond.min.js\"></script><![endif]-->' . \"\\n\";", " // canvas support for IE 6-8 - now done by webshims\n// $str .= \"\\t\" . '<!--[if lt IE 9]><script src=\"' . PATH_RELATIVE . 'external/excanvas.js\"></script><![endif]-->' . \"\\n\";", " //Win 8/IE 10 work around\n $str .= \"\\t\" . '<!--[if IE 10]><link rel=\"stylesheet\" href=\"' . PATH_RELATIVE . 'external/ie10-viewport-bug-workaround.css\" type=\"text/css\"' . XHTML_CLOSING . '><![endif]-->' . \"\\n\";\n $str .= \"\\t\" . '<!--[if IE 10]><script src=\"' . PATH_RELATIVE . 'external/ie10-viewport-bug-workaround.js\"></script><![endif]-->' . \"\\n\";", "", " }", " return $str;\n }", " public static function foot($params = array())\n {\n self::footerInfo($params);\n }", " public static function footerInfo($params = array())\n {\n // checks to see if the theme is calling footerInfo.\n global $validateTheme, $user, $jsForHead;", " $validateTheme['footerinfo'] = true;", " if (!empty($user->getsToolbar) && PRINTER_FRIENDLY != 1 && EXPORT_AS_PDF != 1 && !defined(\n 'SOURCE_SELECTOR'\n ) && empty($params['hide-slingbar'])\n ) {\n self::module(array(\"controller\" => \"administration\", \"action\" => \"toolbar\", \"source\" => \"admin\"));\n }", " if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php')) {\n echo '<div style=\"text-align:center\"><a href=\"', makeLink(\n array('module' => 'administration', 'action' => 'togglemobile')\n ), '\">', gt('View site in'), ' ', (MOBILE ? \"Classic\" : \"Mobile\"), ' ', gt('mode'), '</a></div>';\n }\n // load primer, lessprimer, & normalize CSS files", " if (!empty($params['src']) || !empty($params['content']) || !empty($params['yui3mods']) || !empty($params['jquery']) || !empty($params['bootstrap'])) {\n expJavascript::pushToFoot($params);\n }\n self::processCSSandJS();\n echo expJavascript::footJavascriptOutput();", " expSession::deleteVar(\n \"last_POST\"\n ); //ADK - putting this here so one form doesn't unset it before another form needs it.\n expSession::deleteVar(\n 'last_post_errors'\n );\n }", " public static function pageMetaInfo()\n {\n global $sectionObj, $router;", " $metainfo = array();\n if (self::inAction() && (!empty($router->url_parts[0]) && expModules::controllerExists(\n $router->url_parts[0]\n ))\n ) {\n// $classname = expModules::getControllerClassName($router->url_parts[0]);\n// $controller = new $classname();\n $controller = expModules::getController($router->url_parts[0]);\n $metainfo = $controller->metainfo();\n }\n if (empty($metainfo)) {\n $metainfo['title'] = empty($sectionObj->page_title) ? SITE_TITLE : $sectionObj->page_title;\n $metainfo['keywords'] = empty($sectionObj->keywords) ? SITE_KEYWORDS : $sectionObj->keywords;\n $metainfo['description'] = empty($sectionObj->description) ? SITE_DESCRIPTION : $sectionObj->description;\n $metainfo['canonical'] = empty($sectionObj->canonical) ? URL_FULL . $sectionObj->sef_name : $sectionObj->canonical;\n $metainfo['noindex'] = empty($sectionObj->noindex) ? false : $sectionObj->noindex;\n $metainfo['nofollow'] = empty($sectionObj->nofollow) ? false : $sectionObj->nofollow;\n }", " // clean up meta tag output\n foreach ($metainfo as $key=>$value) {\n $metainfo[$key] = expString::parseAndTrim($value, true);\n }\n return $metainfo;\n }", " public static function grabView($path, $filename)\n { //FIXME Not used\n $dirs = array(\n BASE . 'themes/' . DISPLAY_THEME . '/' . $path,\n BASE . 'framework/' . $path,\n );", " foreach ($dirs as $dir) {\n if (file_exists($dir . $filename . '.tpl')) {\n return $dir . $form . '.tpl';\n } //FIXME $form is not set??\n }", " return false;\n }", " public static function grabViews($path, $filter = '')\n { //FIXME Not used\n $dirs = array(\n BASE . 'framework/' . $path,\n BASE . 'themes/' . DISPLAY_THEME . '/' . $path,\n );", " $files = array();\n foreach ($dirs as $dir) {\n if (is_dir($dir) && is_readable($dir)) {\n $dh = opendir($dir);\n while (($filename = readdir($dh)) !== false) {\n $file = $dir . $filename;\n if (is_file($file)) { //FIXME this should be $file instead of $filename?\n $files[$filename] = $file;\n }\n }\n }\n }", " return $files;\n }", " public static function processCSSandJS()\n {\n global $jsForHead, $cssForHead;", " // returns string, either minified combo url or multiple link and script tags\n $jsForHead = expJavascript::parseJSFiles();\n $cssForHead = expCSS::parseCSSFiles();\n }", " public static function removeCss()\n {\n expFile::removeFilesInDirectory(BASE . 'tmp/minify'); // also clear the minify engine's cache\n return expFile::removeFilesInDirectory(BASE . 'tmp/css');\n }", " public static function clearSmartyCache()\n {\n self::removeSmartyCache();\n flash('message', gt(\"Smarty Cache has been cleared\"));\n expHistory::back();\n }", " public static function removeSmartyCache()\n {\n expFile::removeFilesInDirectory(BASE . 'tmp/cache'); // alt location for cache\n return expFile::removeFilesInDirectory(BASE . 'tmp/views_c');\n }", " /** exdoc\n * Output <link /> elements for each RSS feed on the site\n *\n * @node Subsystems:Theme\n */\n public static function advertiseRSS()\n {\n if (defined('ADVERTISE_RSS') && ADVERTISE_RSS == 1) {\n echo \"\\t<!-- RSS Feeds -->\\r\\n\";\n $rss = new expRss();\n $feeds = $rss->getFeeds('advertise=1');\n foreach ($feeds as $feed) {\n if ($feed->enable_rss) {\n//\t\t\t\t\t$title = empty($feed->feed_title) ? 'RSS' : htmlspecialchars($feed->feed_title, ENT_QUOTES);\n $title = empty($feed->title) ? 'RSS - ' . ORGANIZATION_NAME : htmlspecialchars(\n $feed->title,\n ENT_QUOTES\n );\n $params['module'] = $feed->module;\n $params['src'] = $feed->src;\n//\t\t\t\t\techo \"\\t\".'<link rel=\"alternate\" type=\"application/rss+xml\" title=\"' . $title . '\" href=\"' . expCore::makeRSSLink($params) . \"\\\" />\\n\";\n //FIXME need to use $feed instead of $params\n echo \"\\t\" . '<link rel=\"alternate\" type=\"application/rss+xml\" title=\"', $title, '\" href=\"', expCore::makeLink(\n array('controller' => 'rss', 'action' => 'feed', 'title' => $feed->sef_url)\n ), \"\\\" />\\r\\n\";\n }\n }\n }\n }", " public static function loadActionMaps()\n {\n if (is_readable(BASE . 'themes/' . DISPLAY_THEME . '/action_maps.php')) {\n return include(BASE . 'themes/' . DISPLAY_THEME . '/action_maps.php');\n } else {\n return array();\n }\n }", " public static function satisfyThemeRequirements()\n {\n global $validateTheme;", " if ($validateTheme['headerinfo'] == false) {\n echo \"<h1 style='padding:10px;border:5px solid #992222;color:red;background:white;position:absolute;top:100px;left:300px;width:400px;z-index:999'>expTheme::head() is a required function in your theme. Please refer to the Exponent documentation for details:<br />\n\t\t\t<a href=\\\"http://docs.exponentcms.org/docs/current/header-info\\\" target=\\\"_blank\\\">http://docs.exponentcms.org/</a>\n\t\t\t</h1>\";\n die();\n }", " if ($validateTheme['footerinfo'] == false) {\n echo \"<h1 style='padding:10px;border:5px solid #992222;color:red;background:white;position:absolute;top:100px;left:300px;width:400px;z-index:999'>expTheme::foot() is a required function in your theme. Please refer to the Exponent documentation for details:<br />\n\t\t\t<a href=\\\"http://docs.exponentcms.org/docs/current/footer-info\\\" target=\\\"_blank\\\">http://docs.exponentcms.org/</a>\n\t\t\t</h1>\";\n die();\n }\n }", " public static function getTheme()\n {\n global $sectionObj, $router;", " // Grabs the action maps files for theme overrides\n $action_maps = self::loadActionMaps();", "//\t\t$mobile = self::is_mobile();", " // if we are in an action, get the particulars for the module\n if (self::inAction()) {\n// $module = isset($_REQUEST['module']) ? expString::sanitize(\n// $_REQUEST['module']\n// ) : expString::sanitize($_REQUEST['controller']);\n $module = isset($_REQUEST['module']) ? $_REQUEST['module'] : $_REQUEST['controller'];\n }", " // if we are in an action and have action maps to work with...\n if (self::inAction() && (!empty($action_maps[$module]) && (array_key_exists(\n $_REQUEST['action'],\n $action_maps[$module]\n ) || array_key_exists('*', $action_maps[$module])))\n ) {\n $actionname = array_key_exists($_REQUEST['action'], $action_maps[$module]) ? $_REQUEST['action'] : '*';\n $actiontheme = explode(\":\", $action_maps[$module][$actionname]);", " // this resets the section object. we're suppressing notices with @ because getSectionObj sets constants, which cannot be changed\n // since this will be the second time Exponent calls this function on the page load.\n if (!empty($actiontheme[1])) {\n $sectionObj = @$router->getSectionObj($actiontheme[1]);\n }", " if ($actiontheme[0] == \"default\" || $actiontheme[0] == \"Default\" || $actiontheme[0] == \"index\") {\n if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php';\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/index.php';\n }\n } elseif (is_readable(BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $actiontheme[0] . '.php')) {\n if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/' . $actiontheme[0] . '.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/' . $actiontheme[0] . '.php';\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $actiontheme[0] . '.php';\n }\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/index.php';\n }\n } elseif ($sectionObj->subtheme != '' && is_readable(\n BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $sectionObj->subtheme . '.php'\n )\n ) {\n if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/' . $sectionObj->subtheme . '.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/' . $sectionObj->subtheme . '.php';\n } elseif (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php';\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/subthemes/' . $sectionObj->subtheme . '.php';\n }\n } else {\n if (MOBILE && is_readable(BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php')) {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/mobile/index.php';\n } else {\n $theme = BASE . 'themes/' . DISPLAY_THEME . '/index.php';\n }\n }\n if (!is_readable($theme)) {\n if (is_readable(BASE . 'framework/core/index.php')) {\n $theme = BASE . 'framework/core/index.php'; // use the fallback bare essentials theme\n }\n }\n return $theme;\n }", " /** exdoc\n * @state <b>UNDOCUMENTED</b>\n *\n * @node Undocumented\n *\n * @param bool $include_default\n * @param string $theme\n *\n * @return array\n */\n public static function getSubthemes($include_default = true, $theme = DISPLAY_THEME)\n {\n $base = BASE . \"themes/$theme/subthemes\";\n // The array of subthemes. If the theme has no subthemes directory,\n // or the directory is not readable by the web server, this empty array\n // will be returned (Unless the caller wanted us to include the default layout)\n $subs = array();\n if ($include_default == true) {\n // Caller wants us to include the default layout.\n $subs[''] = DEFAULT_VIEW; // Not really its intended use, but it works.\n }", " if (is_readable($base)) {\n // subthemes directory exists and is readable by the web server. Continue on.\n $dh = opendir($base);\n // Read out all entries in the THEMEDIR/subthemes directory\n while (($s = readdir($dh)) !== false) {\n if (substr($s, -4, 4) == '.php' && substr($s, 0, 1) != '_' && is_file($base . \"/$s\") && is_readable(\n $base . \"/$s\"\n )\n ) {\n // Only readable .php files are allowed to be subtheme files.\n $subs[substr($s, 0, -4)] = substr($s, 0, -4);\n }\n }\n // Sort the subthemes by their keys (which are the same as the values)\n // using a natural string comparison function (PHP built-in)\n uksort($subs, 'strnatcmp');\n }\n return $subs;\n }", " public static function getPrinterFriendlyTheme()\n {\n global $framework;", " $common = 'framework/core/printer-friendly.php';\n $theme = 'themes/' . DISPLAY_THEME . '/printer-friendly.php';\n if (empty($framework)) {\n $fw = expSession::get('framework');\n $fwprint = 'framework/core/printer-friendly.' . $fw . '.php';\n } else {\n $fwprint = 'framework/core/printer-friendly.' . $framework . '.php';\n }", " if (is_readable($theme)) {\n return $theme;\n } elseif (is_readable($fwprint)) {\n return $fwprint;\n } elseif (is_readable($common)) {\n return $common;\n } else {\n return null;\n }\n }", " /** exdoc\n * Checks to see if the page is currently in an action. Useful only if the theme does not use the self::main() function\n * Returns whether or not an action should be run.\n *\n * @node Subsystems:Theme\n * @return boolean\n */\n public static function inPreview()\n {\n $level = 99;\n if (expSession::is_set('uilevel')) {\n $level = expSession::get('uilevel');\n }\n return ($level == UILEVEL_PREVIEW);\n }", " public static function inAction($action=null)\n {\n return (isset($_REQUEST['action']) && (isset($_REQUEST['module']) || isset($_REQUEST['controller'])) && (!isset($action) || ($action == $_REQUEST['action'])));\n }", " public static function reRoutActionTo($theme = \"\")\n {\n if (empty($theme)) {\n return false;\n }\n if (self::inAction()) {\n include_once(BASE . \"themes/\" . DISPLAY_THEME . \"/\" . $theme);\n exit;\n }\n return false;\n }", " /** exdoc\n * Runs the appropriate action, by looking at the $_REQUEST variable.\n *\n * @node Subsystems:Theme\n * @return bool\n */\n public static function runAction()\n {\n global $user;", " if (self::inAction()) {\n if (!AUTHORIZED_SECTION && !expJavascript::inAjaxAction())\n notfoundController::handle_not_authorized();\n//\t\t\tif (expSession::is_set(\"themeopt_override\")) {\n//\t\t\t\t$config = expSession::get(\"themeopt_override\");\n//\t\t\t\techo \"<a href='\".$config['mainpage'].\"'>\".$config['backlinktext'].\"</a><br /><br />\";\n//\t\t\t}", " //FIXME clean our passed parameters\n// foreach ($_REQUEST as $key=>$param) { //FIXME need array sanitizer\n// $_REQUEST[$key] = expString::sanitize($param);\n// }\n// if (empty($_REQUEST['route_sanitized'])) {\n if (!$user->isAdmin())\n expString::sanitize($_REQUEST);\n// } elseif (empty($_REQUEST['array_sanitized'])) {\n// $tmp =1; //FIXME we've already sanitized at this point\n// } else {\n// $tmp =1; //FIXME we've already sanitized at this point\n// }", " //FIXME: module/controller glue code..remove ASAP\n $module = empty($_REQUEST['controller']) ? $_REQUEST['module'] : $_REQUEST['controller'];\n//\t\t\t$isController = expModules::controllerExists($module);", "//\t\t\tif ($isController && !isset($_REQUEST['_common'])) {\n if (expModules::controllerExists($module)) {\n // this is being set just in case the url said module=modname instead of controller=modname\n // with SEF URls turned on its not really an issue, but with them off some of the links\n // aren't being made correctly...depending on how the {link} plugin was used in the view.\n $_REQUEST['controller'] = $module;", "// if (!isset($_REQUEST['action'])) $_REQUEST['action'] = 'showall';\n// if (isset($_REQUEST['view']) && $_REQUEST['view'] != $_REQUEST['action']) {\n// $test = explode('_',$_REQUEST['view']);\n// if ($test[0] != $_REQUEST['action']) {\n// $_REQUEST['view'] = $_REQUEST['action'].'_'.$_REQUEST['view'];\n// }\n// } elseif (!empty($_REQUEST['action'])) {\n// $_REQUEST['view'] = $_REQUEST['action'];\n// } else {\n// $_REQUEST['view'] = 'showall';\n// }", " echo renderAction($_REQUEST);\n//\t\t\t} else {\n//\t\t\t\tif ($_REQUEST['action'] == 'index') {\n//\t\t\t\t\t$view = empty($_REQUEST['view']) ? 'Default' : $_REQUEST['view'];\n//\t\t\t\t\t$title = empty($_REQUEST['title']) ? '' : expString::sanitize($_REQUEST['title']);\n//\t\t\t\t\t$src = empty($_REQUEST['src']) ? null : expString::sanitize($_REQUEST['src']);\n//\t\t\t\t\tself::showModule($module, $view, $title, $src);\n//\t\t\t\t\treturn true;\n//\t\t\t\t}\n//\n//\t\t\t\tglobal $db, $user; // these globals are needed for the old school actions which are loaded\n//\n//\t\t\t\t// the only reason we should have a controller down in this section is if we are hitting a common action like\n//\t\t\t\t// userperms or groupperms...deal with it.\n////\t\t\t\t$loc = new stdClass();\n////\t\t\t\t$loc->mod = $module;\n////\t\t\t\t$loc->src = (isset($_REQUEST['src']) ? expString::sanitize($_REQUEST['src']) : \"\");\n////\t\t\t\t$loc->int = (!empty($_REQUEST['int']) ? strval(intval($_REQUEST['int'])) : \"\");\n// $loc = expCore::makeLocation($module,(isset($_REQUEST['src']) ? expString::sanitize($_REQUEST['src']) : \"\"),(!empty($_REQUEST['int']) ? strval(intval($_REQUEST['int'])) : \"\"));\n//\t\t\t\t//if (isset($_REQUEST['act'])) $loc->act = $_REQUEST['act'];\n//\n//\t\t\t\tif (isset($_REQUEST['_common'])) {\n//\t\t\t\t\t$actfile = \"/common/actions/\" . $_REQUEST['action'] . \".php\";\n//\t\t\t\t} else {\n//\t\t\t\t\t$actfile = \"/\" . $module . \"/actions/\" . $_REQUEST['action'] . \".php\";\n//\t\t\t\t}\n//\n//\t\t\t\tif (is_readable(BASE.\"themes/\".DISPLAY_THEME.\"/modules\".$actfile)) {\n// include_once(BASE.\"themes/\".DISPLAY_THEME.\"/modules\".$actfile);\n////\t\t\t\t} elseif (is_readable(BASE.'framework/modules-1/'.$actfile)) {\n////\t\t\t\t\tinclude_once(BASE.'framework/modules-1/'.$actfile);\n//\t\t\t\t} else {\n//\t\t\t\t\techo SITE_404_HTML . '<br /><br /><hr size=\"1\" />';\n//\t\t\t\t\techo sprintf(gt('No such module action').' : %1 : %2',strip_tags($module),strip_tags($_REQUEST['action']));\n//\t\t\t\t\techo '<br />';\n//\t\t\t\t}\n }\n }\n return false;\n }", " public static function showAction($module, $action, $src = \"\", $params = array())\n { //FIXME only used by smarty functions, old school?\n global $user;", " $loc = expCore::makeLocation($module, (isset($src) ? $src : \"\"), (isset($int) ? $int : \"\"));", " $actfile = \"/\" . $module . \"/actions/\" . $action . \".php\";\n if (isset($params)) {\n// foreach ($params as $key => $value) { //FIXME need array sanitizer\n//// $_GET[$key] = $value;\n// $_GET[$key] = expString::sanitize($value);\n// }\n if (!$user->isAdmin())\n expString::sanitize($_GET);\n }\n //if (isset($['_common'])) $actfile = \"/common/actions/\" . $_REQUEST['action'] . \".php\";", " if (is_readable(BASE . \"themes/\" . DISPLAY_THEME . \"/modules\" . $actfile)) {\n include(BASE . \"themes/\" . DISPLAY_THEME . \"/modules\" . $actfile);\n// \t\t} elseif (is_readable(BASE.'framework/modules-1/'.$actfile)) {\n// \t\t\tinclude(BASE.'framework/modules-1/'.$actfile);\n } else {\n notfoundController::handle_not_found();\n echo '<br /><hr size=\"1\" />';\n echo sprintf(\n gt('No such module action') . ' : %1 : %2',\n strip_tags($_REQUEST['module']),\n strip_tags($_REQUEST['action'])\n );\n echo '<br />';\n }\n }", " /** exdoc\n * Redirect User to Default Section\n *\n * @node Subsystems:Theme\n */\n public static function goDefaultSection()\n {\n $last_section = expSession::get(\"last_section\");\n if (defined('SITE_DEFAULT_SECTION') && SITE_DEFAULT_SECTION != $last_section) {\n header(\"Location: \" . URL_FULL . \"index.php?section=\" . SITE_DEFAULT_SECTION);\n exit();\n } else {\n global $db;", " $section = $db->selectObject(\"section\", \"public = 1 AND active = 1\"); // grab first section, go there\n if ($section) {\n header(\"Location: \" . URL_FULL . \"index.php?section=\" . $section->id);\n exit();\n } else {\n notfoundController::handle_not_found();\n }\n }\n }", " /** exdoc\n * Takes care of all the specifics of either showing a sectional container or running an action.\n *\n * @node Subsystems:Theme\n */\n public static function main()\n {\n global $db;", " if ((!defined('SOURCE_SELECTOR') || SOURCE_SELECTOR == 1)) {\n $last_section = expSession::get(\"last_section\");\n $section = $db->selectObject(\"section\", \"id=\" . $last_section);\n // View authorization will be taken care of by the runAction and mainContainer functions\n if (self::inAction()) {\n if (!PRINTER_FRIENDLY && !EXPORT_AS_PDF)\n echo show_msg_queue();\n self::runAction();\n } else {\n if ($section == null) {\n self::goDefaultSection();\n } else {\n if (!PRINTER_FRIENDLY && !EXPORT_AS_PDF)\n echo show_msg_queue();\n self::mainContainer();\n }\n }\n// } else {\n// if (isset($_REQUEST['module'])) {\n// include_once(BASE.\"framework/modules/container/orphans_content.php\"); //FIXME not sure how to convert this yet\n// } else {\n// echo gt('Select a module');\n// }\n }\n }", " /** exdoc\n * Useful only if theme does not use self::main\n *\n * @return void\n * @internal param bool $public Whether or not the page is public.\n * @node Subsystems:Theme\n */\n public static function mainContainer()\n {\n global $router;", " if (!AUTHORIZED_SECTION) {\n // Set this so that a login on an Auth Denied page takes them back to the previously Auth-Denied page\n //\t\t\texpHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_SECTIONAL);\n expHistory::set('manageable', $router->params);\n notfoundController::handle_not_authorized();\n return;\n }", " if (PUBLIC_SECTION) {\n //\t\t\texpHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_SECTIONAL);\n expHistory::set('viewable', $router->params);\n } else {\n //\t\t\texpHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_SECTIONAL);\n expHistory::set('manageable', $router->params);\n }", " # if (expSession::is_set(\"themeopt_override\")) {\n # $config = expSession::get(\"themeopt_override\");\n// \t\t\tself::showSectionalModule(\"containermodule\",\"Default\",\"\",\"@section\",false,true); //FIXME change to showModule call\n self::module(\n array(\n \"controller\" => \"container\",\n \"action\" => \"showall\",\n \"view\" => \"showall\",\n \"source\" => \"@section\",\n \"scope\" => \"sectional\"\n )\n );", " # } else {\n # self::showSectionalModule(\"containermodule\",\"Default\",\"\",\"@section\");\n # }\n }", " /** exdoc\n * Calls the necessary methods to show a specific module, in a section-sensitive way.\n *\n * @param string $module The classname of the module to display\n * @param string $view The name of the view to display the module with\n * @param string $title The title of the module (support is view-dependent)\n * @param string $prefix The prefix of the module's source. The current section id will be appended to this\n * @param bool $pickable Whether or not the module is pickable in the Source Picker.\n * @param bool $hide_menu\n *\n * @return void\n * @node Subsystems:Theme\n * @deprecated 2.2.1\n */\n public static function showSectionalModule(\n $module,\n $view,\n $title,\n $prefix = null,\n $pickable = false,\n $hide_menu = false\n ) {\n global $module_scope;", " self::deprecated('expTheme::module()', $module, $view);\n $module = expModules::getModuleName($module); //FIXME patch to cleanup module name\n if ($prefix == null) {\n $prefix = \"@section\";\n }", " $src = $prefix;", "//\t\tif (expSession::is_set(\"themeopt_override\")) {\n//\t\t\t$config = expSession::get(\"themeopt_override\");\n//\t\t\tif (in_array($module,$config['ignore_mods'])) return;\n//\t\t\t$src = $config['src_prefix'].$prefix; //FIXME there is no such config index\n//\t\t\t$section = null;\n//\t\t} else {\n global $sectionObj;", " //$last_section = expSession::get(\"last_section\");\n //$section = $db->selectObject(\"section\",\"id=\".$last_section);\n $src .= $sectionObj->id;\n//\t\t}\n $module_scope[$src][$module] = new stdClass();\n $module_scope[$src][$module]->scope = 'sectional';", " self::showModule($module, $view, $title, $src, false, null, $hide_menu);\n }", " /** exdoc\n * Calls the necessary methods to show a specific module in such a way that the current\n * section displays the same content as its top-level parent and all of the top-level parent's\n * children, grand-children, grand-grand-children, etc.\n *\n * @param string $module The classname of the module to display\n * @param string $view The name of the view to display the module with\n * @param string $title The title of the module (support is view-dependent)\n * @param string $prefix The prefix of the module's source. The current section id will be appended to this\n * @param bool $pickable Whether or not the module is pickable in the Source Picker.\n * @param bool $hide_menu\n *\n * @node Subsystems:Theme\n * @deprecated 2.2.1\n */\n public static function showTopSectionalModule(\n $module,\n $view,\n $title,\n $prefix = null,\n $pickable = false,\n $hide_menu = false\n ) {\n global $db, $module_scope, $sectionObj;", " self::deprecated('expTheme::module()', $module, $view);\n $module = expModules::getModuleName($module); //FIXME patch to cleanup module name\n if ($prefix == null) {\n $prefix = \"@section\";\n }\n//\t\t$last_section = expSession::get(\"last_section\");\n//\t\t$section = $db->selectObject(\"section\",\"id=\".$last_section);\n $section = $sectionObj; //FIXME let's try $sectionObj instead of last_section\n// $module_scope[$prefix.$section->id][$module] = new stdClass();\n $module_scope[$prefix . $section->id][$module]->scope = 'top-sectional';\n // Loop until we find the top level parent.\n while ($section->parent != 0) {\n $section = $db->selectObject(\"section\", \"id=\" . $section->parent);\n }", " self::showModule($module, $view, $title, $prefix . $section->id, false, null, $hide_menu);\n }", " /** exdoc\n * Calls the necessary methods to show a specific controller, in a section-sensitive way.\n *\n * @param array $params\n *\n * @internal param string $module The classname of the module to display\n * @internal param string $view The name of the view to display the module with\n * @internal param string $title The title of the module (support is view-dependent)\n * @internal param string $prefix The prefix of the module's source. The current section id will be appended to this\n * @internal param bool $pickable Whether or not the module is pickable in the Source Picker.\n * @internal param bool $hide_menu\n * @return void\n * @node Subsystems:Theme\n * @deprecated 2.2.1\n */\n public static function showSectionalController($params = array())\n { //FIXME not used in base system (custom themes?)\n global $sectionObj, $module_scope;", " $src = \"@section\" . $sectionObj->id;\n $params['source'] = $src;\n// $module_scope[$params['source']][(isset($params['module'])?$params['module']:$params['controller'])] = new stdClass();\n $module_scope[$params['source']][(isset($params['module']) ? $params['module'] : $params['controller'])]->scope = 'sectional';\n $module = !empty($params['module']) ? $params['module'] : $params['controller'];\n $view = !empty($params['action']) ? $params['action'] : $params['view'];\n self::deprecated('expTheme::module()', $module, $view);\n self::module($params);\n }", " /**\n * @deprecated 2.2.1\n */\n public static function showController($params = array())\n {\n $module = !empty($params['module']) ? $params['module'] : $params['controller'];\n $view = !empty($params['action']) ? $params['action'] : $params['view'];\n self::deprecated('expTheme::module()', $module, $view);\n self::module($params);\n// global $sectionObj, $db, $module_scope;\n// if (empty($params)) {\n//\t return false;\n// } elseif (isset($params['module'])) {\n// self::module($params);\n// } else if (isset($params['controller'])) {\n//\t\t\t$params['view'] = isset($params['view']) ? $params['view'] : $params['action'];\n//\t\t\t$params['title'] = isset($params['moduletitle']) ? $params['moduletitle'] : '';\n//\t\t\t$params['chrome'] = (!isset($params['chrome']) || (isset($params['chrome'])&&empty($params['chrome']))) ? true : false;\n//\t\t\t$params['scope'] = isset($params['scope']) ? $params['scope'] : 'global';\n//\n//\t\t\t// set the controller and action to the one called via the function params\n//\t\t\t$requestvars = isset($params['params']) ? $params['params'] : array();\n//\t\t\t$requestvars['controller'] = $params['controller'];\n//\t\t\t$requestvars['action'] = isset($params['action']) ? $params['action'] : null;\n//\t\t\t$requestvars['view'] = isset($params['view']) ? $params['view'] : null;\n//\n//\t\t\t// figure out the scope of the module and set the source accordingly\n//\t\t\tif ($params['scope'] == 'global') {\n//\t\t\t\t$params['source'] = isset($params['source']) ? $params['source'] : null;\n//\t\t\t} elseif ($params['scope'] == 'sectional') {\n//\t\t\t\t$params['source'] = isset($params['source']) ? $params['source'] : '@section';\n//\t\t\t\t$params['source'] .= $sectionObj->id;\n//\t\t\t} elseif ($params['scope'] == 'top-sectional') {\n//\t\t\t\t$params['source'] = isset($params['source']) ? $params['source'] : '@section';\n//\t\t\t\t$section = $sectionObj;\n//\t\t\t\twhile ($section->parent > 0) $section = $db->selectObject(\"section\",\"id=\".$section->parent);\n//\t\t\t\t$params['source'] .= $section->id;\n//\t\t\t}\n//// $module_scope[$params['source']][(isset($params['module'])?$params['module']:$params['controller'])] = new stdClass();\n// $module_scope[$params['source']][(isset($params['module'])?$params['module']:$params['controller'])]->scope = $params['scope'];\n//\t\t\tself::showModule(expModules::getControllerClassName($params['controller']),$params['view'],$params['title'],$params['source'],false,null,$params['chrome'],$requestvars);\n// }\n// return false;\n }", " /**\n * Entry point for displaying modules\n * Packages $params for calling showModule method\n *\n * @param array $params list of module parameters\n *\n * @return bool\n */\n public static function module($params)\n {\n global $db, $module_scope, $sectionObj;", " if (empty($params)) {\n return false;\n } elseif (isset($params['module']) && expModules::controllerExists($params['module'])) {\n // hack to add compatibility for modules converted to controllers, but still hard-coded the old way\n $params['controller'] = $params['module'];\n unset($params['module']);\n }\n if (!isset($params['action'])) {\n $params['action'] = 'showall';\n }\n if (isset($params['view']) && $params['view'] != $params['action']) {\n $test = explode('_', $params['view']);\n if ($test[0] != $params['action']) {\n $params['view'] = $params['action'] . '_' . $params['view'];\n }\n } elseif (!empty($params['action'])) {\n $params['view'] = $params['action'];\n } else {\n $params['view'] = 'showall';\n }\n//\t if (isset($params['controller'])) {\n $controller = expModules::getModuleName($params['controller']);\n// $params['view'] = isset($params['view']) ? $params['view'] : $params['action'];\n $params['title'] = isset($params['moduletitle']) ? $params['moduletitle'] : '';\n $params['chrome'] = (!isset($params['chrome']) || (isset($params['chrome']) && empty($params['chrome']))) ? true : false;\n $params['scope'] = isset($params['scope']) ? $params['scope'] : 'global';", " // set the controller and action to the one called via the function params\n $requestvars = isset($params['params']) ? $params['params'] : array();\n $requestvars['controller'] = $controller;\n $requestvars['action'] = isset($params['action']) ? $params['action'] : null;\n $requestvars['view'] = isset($params['view']) ? $params['view'] : null;", " // figure out the scope of the module and set the source accordingly\n if ($params['scope'] == 'global') {\n $params['source'] = isset($params['source']) ? $params['source'] : null;\n } elseif ($params['scope'] == 'sectional') {\n $params['source'] = isset($params['source']) ? $params['source'] : '@section';\n $params['source'] .= $sectionObj->id;\n } elseif ($params['scope'] == 'top-sectional') {\n $params['source'] = isset($params['source']) ? $params['source'] : '@section';\n $section = $sectionObj;\n while ($section->parent > 0) {\n $section = $db->selectObject(\"section\", \"id=\" . $section->parent);\n }\n $params['source'] .= $section->id;\n }\n $module_scope[$params['source']][$controller] = new stdClass();\n $module_scope[$params['source']][$controller]->scope = $params['scope'];\n// self::showModule(expModules::getControllerClassName($params['controller']),$params['view'],$params['title'],$params['source'],false,null,$params['chrome'],$requestvars);\n return self::showModule(\n $controller,\n $params['view'],\n $params['title'],\n $params['source'],\n false,\n null,\n $params['chrome'],\n $requestvars\n );\n// } elseif (isset($params['module'])) {\n// $module = expModules::getModuleClassName($params['module']);\n// $moduletitle = (isset($params['moduletitle'])) ? $params['moduletitle'] : \"\";\n// $source = (isset($params['source'])) ? $params['source'] : \"\";\n// $chrome = (isset($params['chrome'])) ? $params['chrome'] : false;\n// $scope = (isset($params['scope'])) ? $params['scope'] : \"global\";\n//\n// if ($scope==\"global\") {\n// self::showModule($module,$params['view'],$moduletitle,$source,false,null,$chrome);\n// }\n// if ($scope==\"top-sectional\") {\n//// self::showTopSectionalModule($params['module'].\"module\", //module\n//// $params['view'], //view\n//// $moduletitle, // Title\n//// $source, // source\n//// false, // used to apply to source picker. does nothing now.\n//// $chrome // Show chrome\n//// );\n// if ($source == null) $source = \"@section\";\n// //FIXME - $section might be empty! We're getting it from last_section instead of sectionObj??\n//// $last_section = expSession::get(\"last_section\");\n//// $section = $db->selectObject(\"section\",\"id=\".$last_section);\n// $section = $sectionObj; //FIXME let's try $sectionObj instead of last_section\n// // Loop until we find the top level parent.\n// while ($section->parent != 0) $section = $db->selectObject(\"section\",\"id=\".$section->parent);\n// $module_scope[$source.$section->id][$module]= new stdClass();\n// $module_scope[$source.$section->id][$module]->scope = 'top-sectional';\n// self::showModule($module,$params['view'],$moduletitle,$source.$section->id,false,null,$chrome);\n// }\n// if ($scope==\"sectional\") {\n//// self::showSectionalModule($params['module'].\"module\", //module\n//// $params['view'], //view\n//// $moduletitle, // title\n//// $source, // source/prefix\n//// false, // used to apply to source picker. does nothing now.\n//// $chrome // Show chrome\n//// );\n// if ($source == null) $source = \"@section\";\n// $src = $source;\n// $src .= $sectionObj->id;\n// $module_scope[$src][$module] = new stdClass();\n// $module_scope[$src][$module]->scope = 'sectional';\n// self::showModule($module,$params['view'],$moduletitle,$src,false,null,$chrome);\n// }\n// }\n// return false;\n }", " /** exdoc\n * Calls the necessary methods to show a specific module - NOT intended to be called directly from theme\n *\n * @param string $module The classname of the module to display\n * @param string $view The name of the view to display the module with\n * @param string $title The title of the module (support is view-dependent)\n * @param string $source The source of the module.\n * @param bool $pickable Whether or not the module is pickable in the Source Picker.\n * @param null $section\n * @param bool $hide_menu\n * @param array $params\n *\n * @return void\n * @node Subsystems:Theme\n */\n public static function showModule(\n $module,\n $view = \"Default\",\n $title = \"\",\n $source = null,\n $pickable = false,\n $section = null,\n $hide_menu = false,\n $params = array()\n ) {\n $module = expModules::getModuleName($module); //FIXME patch to cleanup module name\n if (!AUTHORIZED_SECTION && $module != 'navigation' && $module != 'login') {\n return;\n }", " global $db, $sectionObj, $module_scope;", " // Ensure that we have a section\n //FJD - changed to $sectionObj\n if ($sectionObj == null) {\n $section_id = expSession::get('last_section');\n if ($section_id == null) {\n $section_id = SITE_DEFAULT_SECTION;\n }\n $sectionObj = $db->selectObject('section', 'id=' . $section_id);\n //$section->id = $section_id;\n }\n if ($module == \"login\" && defined('PREVIEW_READONLY') && PREVIEW_READONLY == 1) {\n return;\n }", "//\t\tif (expSession::is_set(\"themeopt_override\")) {\n//\t\t\t$config = expSession::get(\"themeopt_override\");\n//\t\t\tif (in_array($module,$config['ignore_mods'])) return;\n//\t\t}\n if (empty($params['action'])) {\n $params['action'] = $view;\n }\n $loc = expCore::makeLocation($module, $source . \"\");", " if (empty($module_scope[$source][$module]->scope)) {\n $module_scope[$source][$module] = new stdClass();\n $module_scope[$source][$module]->scope = 'global';\n }\n // make sure we've added this module to the sectionref table\n $secref = $db->selectObject(\"sectionref\", \"module='$module' AND source='\" . $loc->src . \"'\");\n if ($secref == null) {\n $secref = new stdClass();\n $secref->module = $module;\n $secref->source = $loc->src;\n $secref->internal = \"\";\n $secref->refcount = 1000; // only hard-coded modules should be missing\n if ($sectionObj != null) {\n $secref->section = $sectionObj->id;\n }\n//\t\t\t $secref->is_original = 1;\n $db->insertObject($secref, 'sectionref');\n// } elseif ($sectionObj != null && $secref->section != $sectionObj->id) {\n// $secref->section = $sectionObj->id;\n// $db->updateObject($secref, 'sectionref');\n }\n // add (hard-coded) modules to the container table, nested containers added in container showall method??\n $container = $db->selectObject('container', \"internal='\" . serialize($loc) . \"'\");\n if (empty($container->id)) {\n //if container isn't here already, then create it...hard-coded from theme template\n $newcontainer = new stdClass();\n $newcontainer->internal = serialize($loc);\n $newcontainer->external = serialize(null);\n $newcontainer->title = $title;\n $newcontainer->view = $view;\n $newcontainer->action = $params['action'];\n $newcontainer->id = $db->insertObject($newcontainer, 'container');\n }\n if (empty($title) && !empty($container->title)) {\n $title = $container->title;\n }\n//\t\t$iscontroller = expModules::controllerExists($module);", " if (defined('SELECTOR') && call_user_func(array(expModules::getModuleClassName($module), \"hasSources\"))) {\n containerController::wrapOutput($module, $view, $loc, $title);\n } else {\n//\t\t\tif (is_callable(array($module,\"show\")) || $iscontroller) {\n if (expModules::controllerExists($module)) {\n // FIXME: we are checking here for a new MVC style controller or an old school module. We only need to perform\n // this check until we get the old modules all gone...until then we have the check and a lot of code duplication\n // in the if blocks below...oh well, that's life.\n//\t\t\t\tif (!$iscontroller) {\n////\t\t\t\t\tif ((!$hide_menu && $loc->mod != \"containermodule\" && (call_user_func(array($module,\"hasSources\")) || $db->tableExists($loc->mod.\"_config\")))) {\n// if ((!$hide_menu && (call_user_func(array($module,\"hasSources\")) || $db->tableExists($loc->mod.\"_config\")))) {\n// $container = new stdClass(); //php 5.4\n//\t\t\t\t\t\t$container->permissions = array(\n//\t\t\t\t\t\t\t'manage'=>(expPermissions::check('manage',$loc) ? 1 : 0),\n//\t\t\t\t\t\t\t'configure'=>(expPermissions::check('configure',$loc) ? 1 : 0)\n//\t\t\t\t\t\t);\n//\n//\t\t\t\t\t\tif ($container->permissions['manage'] || $container->permissions['configure']) {\n//\t\t\t\t\t\t\t$container->randomizer = mt_rand(1,ceil(microtime(1)));\n//\t\t\t\t\t\t\t$container->view = $view;\n//\t\t\t\t\t\t\t$container->info['class'] = expModules::getModuleClassName($loc->mod);\n//\t\t\t\t\t\t\t$container->info['module'] = call_user_func(array($module,\"name\"));\n//\t\t\t\t\t\t\t$container->info['source'] = $loc->src;\n// $container->info['scope'] = $module_scope[$source][$module]->scope;\n//\t\t\t\t\t\t\t$container->info['hasConfig'] = $db->tableExists($loc->mod.\"_config\");\n////\t\t\t\t\t\t\t$template = new template('containermodule','_hardcoded_module_menu',$loc);\n//// $template = new template('containerController','_hardcoded_module_menu',$loc,false,'controllers');\n// $c2 = new containerController();\n// $template = expTemplate::get_template_for_action($c2,'_hardcoded_module_menu');\n//\t\t\t\t\t\t\t$template->assign('container', $container);\n//\t\t\t\t\t\t\t$template->output();\n//\t\t\t\t\t\t}\n//\t\t\t\t\t}\n//\t\t\t\t} else {\n // if we hit here we're dealing with a hard-coded controller...not a module\n if (!$hide_menu && $loc->mod != \"container\") {\n $controller = expModules::getController($module);\n// $controller = expModules::getControllerClassName($module);\n $hccontainer = new stdClass(); //php 5.4\n $hccontainer->permissions = array(\n 'manage' => (expPermissions::check('manage', $loc) ? 1 : 0),\n 'configure' => (expPermissions::check('configure', $loc) ? 1 : 0)\n );", " if ($hccontainer->permissions['manage'] || $hccontainer->permissions['configure']) {\n $hccontainer->randomizer = mt_rand(1, ceil(microtime(1)));\n $hccontainer->view = $view;\n $hccontainer->action = $params['action'];\n $hccontainer->info['class'] = expModules::getModuleClassName($loc->mod);\n $hccontainer->info['module'] = $controller->displayname();\n// $hccontainer->info['module'] = $controller::displayname();\n $hccontainer->info['source'] = $loc->src;\n $hccontainer->info['scope'] = $module_scope[$source][$module]->scope;\n//\t\t\t\t\t\t\t$hccontainer->info['hasConfig'] = true;\n//\t\t\t\t\t\t\t$template = new template('containermodule','_hardcoded_module_menu',$loc);\n//\t\t\t\t\t\t\t$template = new template('containerController','_hardcoded_module_menu',$loc,false,'controllers');\n $c2 = new containerController();\n $template = expTemplate::get_template_for_action($c2, '_hardcoded_module_menu');\n $template->assign('container', $hccontainer);\n $template->output();\n }\n }\n//\t\t\t\t}", "//\t\t\t\tif ($iscontroller) {\n $params['src'] = $loc->src;\n $params['controller'] = $module;\n $params['view'] = $view;\n $params['moduletitle'] = $title;\n return renderAction($params);\n//\t\t\t\t} else {\n//\t\t\t\t\tcall_user_func(array($module,\"show\"),$view,$loc,$title);\n//\t\t\t\t}\n } else {\n echo sprintf(gt('The module \"%s\" was not found in the system.'), $module);\n return false;\n }\n }\n }", " public static function getThemeDetails() {\n $theme_file = DISPLAY_THEME;\n if (is_readable(BASE.'themes/'.$theme_file.'/class.php')) {\n // Need to avoid the duplicate theme problem.\n if (!class_exists($theme_file)) {\n include_once(BASE.'themes/'.$theme_file.'/class.php');\n }", " if (class_exists($theme_file)) {\n // Need to avoid instantiating non-existent classes.\n $theme = new $theme_file();\n return ' ' . gt('using') . ' ' . $theme->name() . ' ' . gt('by') . ' ' . $theme->author();\n }\n }\n return '';\n }", " /**\n * Return the color style for the current framework\n *\n * @param $color\n *\n * @return mixed|string\n */\n public static function buttonColor($color = null)\n {\n $colors = array(\n 'green' => 'btn-success',\n 'blue' => 'btn-primary',\n 'red' => 'btn-danger',\n 'magenta' => 'btn-danger',\n 'orange' => 'btn-warning',\n 'yellow' => 'btn-warning',\n 'grey' => 'btn-default',\n 'purple' => 'btn-info',\n 'black' => 'btn-inverse',\n 'pink' => 'btn-danger',\n );\n if (bs()) {\n if (!empty($colors[$color])) { // awesome to bootstrap button conversion\n $found = $colors[$color];\n } else {\n $found = 'btn-default';\n }\n } else {\n $found = array_search($color, $colors); // bootstrap to awesome button conversion?\n if (empty($found)) {\n $found = $color;\n } else {\n $found = BTN_COLOR;\n }\n }\n return $found;\n }", " /**\n * Return the button size for the current framework\n *\n * @param $size\n *\n * @return mixed|string\n */\n public static function buttonSize($size = null)\n {\n if (bs2()) {\n if (BTN_SIZE == 'large' || (!empty($size) && $size == 'large')) {\n $btn_size = ''; // actually default size, NOT true bootstrap large\n } elseif (BTN_SIZE == 'small' || (!empty($size) && $size == 'small')) {\n $btn_size = 'btn-mini';\n } else { // medium\n $btn_size = 'btn-small';\n }\n return $btn_size;\n } elseif (bs3()) {\n if (BTN_SIZE == 'large' || (!empty($size) && $size == 'large')) {\n $btn_size = 'btn-lg';\n } elseif (BTN_SIZE == 'small' || (!empty($size) && $size == 'small')) {\n $btn_size = 'btn-sm';\n } elseif (BTN_SIZE == 'extrasmall' || (!empty($size) && $size == 'extrasmall')) {\n $btn_size = 'btn-xs';\n } else { // medium\n $btn_size = '';\n }\n return $btn_size;\n } else {\n if (empty($size)) {\n $size = BTN_SIZE;\n }\n return $size;\n }\n }", " /**\n * Return the button color and size style for the current framework\n *\n * @param null $color\n * @param $size\n *\n * @return mixed|string\n */\n public static function buttonStyle($color = null, $size = null)\n {\n if (bs()) {\n $btn_class = 'btn ' . self::buttonColor($color) . ' ' . self::buttonSize($size);\n } else {\n $btn_size = !empty($size) ? $size : BTN_SIZE;\n $btn_color = !empty($color) ? $color : BTN_COLOR;\n $btn_class = \"awesome \" . $btn_size . \" \" . $btn_color;\n }\n return $btn_class;\n }", " /**\n * Return the icon associated for the current frameowrk\n *\n * @param $class\n *\n * @return stdClass|string\n */\n public static function buttonIcon($class, $size=null)\n {\n $btn_type = '';\n if (bs2()) {\n switch ($class) {\n case 'delete' :\n case 'delete-title' :\n $class = \"remove-sign\";\n $btn_type = \"btn-danger\"; // red\n break;\n case 'add' :\n case 'add-title' :\n case 'add-body' :\n case 'switchtheme add' :\n $class = \"plus-sign\";\n $btn_type = \"btn-success\"; // green\n break;\n case 'copy' :\n $class = \"copy\";\n break;\n case 'downloadfile' :\n case 'export' :\n $class = \"download-alt\";\n break;\n case 'uploadfile' :\n case 'import' :\n $class = \"upload-alt\";\n break;\n case 'manage' :\n $class = \"briefcase\";\n break;\n case 'merge' :\n case 'arrow_merge' :\n $class = \"signin\";\n break;\n case 'reranklink' :\n case 'alphasort' :\n $class = \"sort\";\n break;\n case 'configure' :\n $class = \"wrench\";\n break;\n case 'view' :\n $class = \"search\";\n break;\n case 'page_next' :\n $class = 'double-angle-right';\n break;\n case 'page_prev' :\n $class = 'double-angle-left';\n break;\n case 'password' :\n case 'change_password' :\n $class = 'key';\n break;\n case 'clean' :\n $class = 'check';\n break;\n case 'userperms' :\n $class = 'user';\n break;\n case 'groupperms' :\n $class = 'group';\n break;\n case 'monthviewlink' :\n case 'weekviewlink' :\n $class = 'calendar';\n break;\n case 'listviewlink' :\n $class = 'list';\n break;\n case 'adminviewlink' :\n $class = 'cogs';\n break;\n case 'approve' :\n $class = \"check\";\n $btn_type = \"btn-success\"; // green\n break;\n case 'ajax' :\n $class = \"spinner icon-spin\";\n break;\n }\n $found = new stdClass();\n $found->type = $btn_type;\n $found->class = $class;\n $found->size = self::iconSize($size);\n $found->prefix = 'icon-';\n return $found;\n } elseif (bs3()) {\n switch ($class) {\n case 'delete' :\n case 'delete-title' :\n $class = \"times-circle\";\n $btn_type = \"btn-danger\"; // red\n break;\n case 'add' :\n case 'add-title' :\n case 'add-body' :\n case 'switchtheme add' :\n $class = \"plus-circle\";\n $btn_type = \"btn-success\"; // green\n break;\n case 'copy' :\n $class = \"files-o\";\n break;\n case 'downloadfile' :\n case 'export' :\n $class = \"download\";\n break;\n case 'uploadfile' :\n case 'import' :\n $class = \"upload\";\n break;\n case 'manage' :\n $class = \"briefcase\";\n break;\n case 'merge' :\n case 'arrow_merge' :\n $class = \"sign-in\";\n break;\n case 'reranklink' :\n case 'alphasort' :\n $class = \"sort\";\n break;\n case 'configure' :\n $class = \"wrench\";\n break;\n case 'view' :\n $class = \"search\";\n break;\n case 'page_next' :\n $class ='angle-double-right';\n break;\n case 'page_prev' :\n $class = 'angle-double-left';\n break;\n case 'password' :\n case 'change_password' :\n $class = 'key';\n break;\n case 'clean' :\n $class = 'check-square-o';\n break;\n case 'trash' :\n $class = \"trash-o\";\n break;\n case 'userperms' :\n $class = 'user';\n break;\n case 'groupperms' :\n $class = 'group';\n break;\n case 'monthviewlink' :\n case 'weekviewlink' :\n $class = 'calendar';\n break;\n case 'listviewlink' :\n $class = 'list';\n break;\n case 'adminviewlink' :\n $class = 'cogs';\n break;\n case 'approve' :\n $class = \"check\";\n $btn_type = \"btn-success\"; // green\n break;\n case 'ajax' :\n $class = \"spinner fa-spin\";\n break;\n }\n $found = new stdClass();\n $found->type = $btn_type;\n $found->class = $class;\n $found->size = self::iconSize($size);\n $found->prefix = 'fa fa-';\n return $found;\n } else {\n return $class;\n }\n }", " /**\n * Return the full icon style string for the current framework\n *\n * @param $class\n *\n * @return string\n */\n public static function iconStyle($class, $text = null) {\n $style = self::buttonIcon($class);\n if (!empty($style->prefix)) {\n if ($text) {\n return '<i class=\"' .$style->prefix . $style->class . '\"></i> '. $text;\n } else {\n return $style->prefix . $style->class;\n }\n } else {\n return $style;\n }\n }", " /**\n * Return the icon size for the current framework\n *\n * @param $size\n *\n * @return mixed|string\n */\n public static function iconSize($size = null)\n {\n if (bs2()) {\n if (BTN_SIZE == 'large' || (!empty($size) && $size == 'large')) {\n $icon_size = 'icon-large';\n } elseif (BTN_SIZE == 'small' || (!empty($size) && $size == 'small')) {\n $icon_size = '';\n } else { // medium\n $icon_size = 'icon-large';\n }\n return $icon_size;\n } elseif (bs3()) {\n if (BTN_SIZE == 'large' || (!empty($size) && $size == 'large')) {\n $icon_size = 'fa-lg';\n } elseif (BTN_SIZE == 'small' || (!empty($size) && $size == 'small')) {\n $icon_size = '';\n } else { // medium\n $icon_size = 'fa-lg';\n }\n return $icon_size;\n } else {\n return BTN_SIZE;\n }\n }", " public static function is_mobile()\n {\n $tablet_browser = 0;\n $mobile_browser = 0;", " if (preg_match(\n '/(tablet|ipad|playbook)|(android(?!.*(mobi|opera mini)))/i',\n strtolower($_SERVER['HTTP_USER_AGENT'])\n )\n ) {\n $tablet_browser++;\n }", " if (preg_match(\n '/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|android|iemobile)/i',\n strtolower($_SERVER['HTTP_USER_AGENT'])\n )\n ) {\n $mobile_browser++;\n }", " if ((!empty($_SERVER['HTTP_ACCEPT']) && strpos(\n strtolower($_SERVER['HTTP_ACCEPT']),\n 'application/vnd.wap.xhtml+xml'\n ) > 0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))\n ) {\n $mobile_browser++;\n }", " $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4));\n $mobile_agents = array(\n 'w3c ',\n 'acs-',\n 'alav',\n 'alca',\n 'amoi',\n 'audi',\n 'avan',\n 'benq',\n 'bird',\n 'blac',\n 'blaz',\n 'brew',\n 'cell',\n 'cldc',\n 'cmd-',\n 'dang',\n 'doco',\n 'eric',\n 'hipt',\n 'inno',\n 'ipaq',\n 'java',\n 'jigs',\n 'kddi',\n 'keji',\n 'leno',\n 'lg-c',\n 'lg-d',\n 'lg-g',\n 'lge-',\n 'maui',\n 'maxo',\n 'midp',\n 'mits',\n 'mmef',\n 'mobi',\n 'mot-',\n 'moto',\n 'mwbp',\n 'nec-',\n 'newt',\n 'noki',\n 'palm',\n 'pana',\n 'pant',\n 'phil',\n 'play',\n 'port',\n 'prox',\n 'qwap',\n 'sage',\n 'sams',\n 'sany',\n 'sch-',\n 'sec-',\n 'send',\n 'seri',\n 'sgh-',\n 'shar',\n 'sie-',\n 'siem',\n 'smal',\n 'smar',\n 'sony',\n 'sph-',\n 'symb',\n 't-mo',\n 'teli',\n 'tim-',\n 'tosh',\n 'tsm-',\n 'upg1',\n 'upsi',\n 'vk-v',\n 'voda',\n 'wap-',\n 'wapa',\n 'wapi',\n 'wapp',\n 'wapr',\n 'webc',\n 'winw',\n 'winw',\n 'xda ',\n 'xda-'\n );", " if (in_array($mobile_ua, $mobile_agents)) {\n $mobile_browser++;\n }", " if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'opera mini') > 0) {\n $mobile_browser++;\n //Check for tablets on opera mini alternative headers\n $stock_ua = strtolower(\n isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']) ? $_SERVER['HTTP_X_OPERAMINI_PHONE_UA'] : (isset($_SERVER['HTTP_DEVICE_STOCK_UA']) ? $_SERVER['HTTP_DEVICE_STOCK_UA'] : '')\n );\n if (preg_match('/(tablet|ipad|playbook)|(android(?!.*mobile))/i', $stock_ua)) {\n $tablet_browser++;\n }\n }", " if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'windows') > 0) {\n $mobile_browser = 0;\n }", " if ($tablet_browser > 0) {\n // do something for tablet devices\n// print 'is tablet';\n } elseif ($mobile_browser > 0) {\n // do something for mobile devices\n// print 'is mobile';\n } else {\n // do something for everything else\n// print 'is desktop';\n }", " return $mobile_browser;\n }", " /**\n * Warn admin of obsolete theme methods\n *\n * @param string $newcall\n * @param null $controller\n * @param null $actionview\n */\n public static function deprecated($newcall = \"expTheme::module()\", $controller = null, $actionview = null)\n {\n global $user;", " if ($user->isAdmin() && DEVELOPMENT) {\n $trace = debug_backtrace();\n $caller = $trace[1];\n if (substr($caller['file'], -16, 6) == 'compat') {\n $caller = $trace[2];\n }\n $oldcall = $caller['function'];\n if ($caller['class'] == 'expTheme') {\n $oldcall = $caller['class'] . '::' . $oldcall;\n }\n $message = '<strong>' . $oldcall . '</strong> ' . gt(\n 'is deprecated and should be replaced by'\n ) . ' <strong>' . $newcall . '</strong>';\n if (!empty($controller)) {\n $message .= '<br>' . gt(\n 'for hard coded module'\n ) . ' - <strong>' . $controller . ' / ' . $actionview . '</strong>';\n }\n $message .= '<br>' . gt('line') . ' #' . $caller['line'] . ' ' . gt('of') . $caller['file'];\n $message .= ' <a class=\"helplink\" title=\"' . gt('Get Theme Update Help') . '\" href=\"' . help::makeHelpLink(\n 'theme_update'\n ) . '\" target=\"_blank\">' . gt('Help') . '</a>';\n flash('notice', $message);\n }\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @package Modules\n * @subpackage Controllers\n */", "class addressController extends expController {", "\tpublic $useractions = array(", "// 'myaddressbook'=>'Show my addressbook'", " );", " protected $remove_permissions = array(\n 'create',\n 'edit',\n 'delete'\n );", " protected $add_permissions = array(\n 'import' => 'Import External Addresses',\n// 'export' => 'Export External Addresses'", " );\n\tpublic $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)", " static function displayname() { return gt(\"Addresses\"); }\n static function description() { return gt(\"Display and manage addresses of users on your site.\"); }\n static function canImportData() { return true;}", " static function hasSources() {\n return false;\n }", " function showall() {\n// redirect_to(array(\"controller\"=>'address',\"action\"=>'myaddressbook'));\n $this->myaddressbook();\n\t}", " ", " public function edit()\n {\n if((isset($this->params['id']))) $record = new address(intval($this->params['id']));\n else $record = null;\n $config = ecomconfig::getConfig('address_allow_admins_all');\n assign_to_template(array(\n 'record'=>$record,\n 'admin_config'=>$config\n ));\n if (expSession::get('customer-signup')) {\n assign_to_template(array(\n 'checkout'=>true\n ));\n }\n }", " ", "\tpublic function myaddressbook() {\n\t\tglobal $user;", "\t\t// check if the user is logged in.\n\t\texpQueue::flashIfNotLoggedIn('message',gt('You must be logged in to manage your address book.'));\n\t\texpHistory::set('viewable', $this->params);\n\t\t$userid = (empty($this->params['user_id'])) ? $user->id : $this->params['user_id'];\n\t\tassign_to_template(array(\n 'addresses'=>$this->address->find('all', 'user_id='.$userid)\n ));\n\t}", "\t", "\tfunction show() {\n\t expHistory::set('viewable', $this->params);\n\t\tassign_to_template(array(\n 'address'=>new address($this->params['id'])\n ));\n\t}", "\tpublic function update() {\n global $user;", " if (expSession::get('customer-signup')) expSession::set('customer-signup', false);\n if (isset($this->params['address_country_id'])) {\n $this->params['country'] = $this->params['address_country_id'];\n unset($this->params['address_country_id']);\n }\n if (isset($this->params['address_region_id'])) {\n $this->params['state'] = $this->params['address_region_id'];\n unset($this->params['address_region_id']);\n }\n\t\tif ($user->isLoggedIn()) {\n\t\t\t// check to see how many other addresses this user has already.\n\t\t\t$count = $this->address->find('count', 'user_id='.$user->id);\n\t\t\t// if this is first address save for this user we'll make this the default", "\t\t\tif ($count == 0) ", " {\n $this->params['is_default'] = 1;\n $this->params['is_billing'] = 1;\n $this->params['is_shipping'] = 1;\n }\n\t\t\t// associate this address with the current user.\n\t\t\t$this->params['user_id'] = $user->id;\n\t\t\t// save the object\n\t\t\t$this->address->update($this->params);\n\t\t}\n else { //if (ecomconfig::getConfig('allow_anonymous_checkout')){", " //user is not logged in, but allow anonymous checkout is enabled so we'll check ", " //a few things that we don't check in the parent 'stuff and create a user account.\n $this->params['is_default'] = 1;\n $this->params['is_billing'] = 1;", " $this->params['is_shipping'] = 1; ", " $this->address->update($this->params);\n }", "\t\texpHistory::back(); ", "\t}", "\t", "\tpublic function delete() {\n\t global $user;", " $count = $this->address->find('count', 'user_id=' . $user->id);\n if($count > 1)", " { ", " $address = new address($this->params['id']);\n\t if ($user->isAdmin() || ($user->id == $address->user_id)) {\n if ($address->is_billing)\n {\n $billAddress = $this->address->find('first', 'user_id=' . $user->id . \" AND id != \" . $address->id);\n $billAddress->is_billing = true;\n $billAddress->save();\n }", " if ($address->is_shipping) ", " {\n $shipAddress = $this->address->find('first', 'user_id=' . $user->id . \" AND id != \" . $address->id);\n $shipAddress->is_shipping = true;\n $shipAddress->save();\n }\n\t parent::delete();\n\t }\n }\n else\n {\n flash(\"error\", gt(\"You must have at least one address.\"));\n }\n\t expHistory::back();\n\t}", " ", " public function activate_address()\n {\n global $db, $user;", " $object = new stdClass();\n $object->id = $this->params['id'];", " $db->setUniqueFlag($object, 'addresses', $this->params['is_what'], \"user_id=\" . $user->id);", " flash(\"message\", gt(\"Successfully updated address.\"));", " expHistory::back(); \n }\n ", " public function manage()\n {\n expHistory::set('manageable',$this->params);\n $gc = new geoCountry();\n $countries = $gc->find('all');", " \n $gr = new geoRegion(); ", " $regions = $gr->find('all',null,'rank asc,name asc');", " ", " assign_to_template(array(\n 'countries'=>$countries,\n 'regions'=>$regions\n ));\n }", " ", " public function manage_update()\n {\n global $db;", " //eDebug($this->params,true);\n //countries\n $db->columnUpdate('geo_country','active',0,'active=1');\n foreach($this->params['country'] as $country_id=>$is_active)\n {\n $gc = new geoCountry($country_id);", " $gc->active = true; \n $gc->save(); ", " }\n //country default\n $db->columnUpdate('geo_country','is_default',0,'is_default=1');\n if(isset($this->params['country_default']))\n {", " $gc = new geoCountry($this->params['country_default']); \n $db->setUniqueFlag($gc,'geo_country','is_default','id=' . $gc->id); \n $gc->refresh(); ", " }\n //regions\n $db->columnUpdate('geo_region','active',0,'active=1');\n foreach($this->params['region'] as $region_id=>$is_active)\n {\n $gr = new geoRegion($region_id);\n $gr->active = true;\n if(isset($this->params['region_rank'][$region_id])) $gr->rank = $this->params['region_rank'][$region_id];", " $gr->save(); ", " }\n flash('message',gt('Address configurations successfully updated.'));\n redirect_to(array('controller'=>'address','action'=>'manage'));\n// $this->manage();\n }", " function edit_country() {\n $country_id = !empty($this->params['id']) ? $this->params['id'] : null;\n $country = new geoCountry($country_id);\n assign_to_template(array(\n 'record'=>$country,\n ));\n }", " function update_country() {\n $country_id = !empty($this->params['id']) ? $this->params['id'] : null;\n $country = new geoCountry($country_id);\n $country->update($this->params);\n expHistory::returnTo('manageable');\n }", " function delete_country() {\n if (empty($this->params['id'])) {\n flash('error', gt('Missing id for the country you would like to delete'));\n expHistory::back();\n }\n $country = new geoCountry($this->params['id']);\n $country->delete();\n expHistory::returnTo('manageable');\n }", " function edit_region() {\n $region_id = !empty($this->params['id']) ? $this->params['id'] : null;\n $region = new geoRegion($region_id);\n assign_to_template(array(\n 'record'=>$region,\n ));\n }", " function update_region() {\n $region_id = !empty($this->params['id']) ? $this->params['id'] : null;\n $region = new geoRegion($region_id);\n $region->update($this->params);\n expHistory::returnTo('manageable');\n }", " function delete_region() {\n if (empty($this->params['id'])) {\n flash('error', gt('Missing id for the region you would like to delete'));\n expHistory::back();\n }\n $region = new geoRegion($this->params['id']);\n $region->delete();\n expHistory::returnTo('manageable');\n }", " /**\n * Import external addresses\n */\n function import() {\n $sources = array('mc' => 'MilitaryClothing.com', 'nt' => 'NameTapes.com', 'am' => 'Amazon');\n assign_to_template(array(\n 'sources' => $sources\n ));\n }", " function process_external_addresses() {\n global $db;", " set_time_limit(0);\n //$file = new expFile($this->params['expFile']['batch_process_upload'][0]);\n eDebug($this->params);\n// eDebug($_FILES,true);\n if (!empty($_FILES['address_csv']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n redirect_to(array('controller' => 'store', 'action' => 'import_external_addresses'));\n// $this->import_external_addresses();\n }", " $file = new stdClass();\n $file->path = $_FILES['address_csv']['tmp_name'];\n echo \"Validating file...<br/>\";", " //replace tabs with commas\n /*if($this->params['type_of_address'][0] == 'am')\n {\n $checkhandle = fopen($file->path, \"w\");\n $oldFile = file_get_contents($file->path);\n $newFile = str_ireplace(chr(9),',',$oldFile);\n fwrite($checkhandle,$newFile);\n fclose($checkhandle);\n }*/", " $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n if ($this->params['type_of_address'][0] == 'am') {\n $checkdata = fgetcsv($checkhandle, 10000, \"\\t\");\n $fieldCount = count($checkdata);\n } else {\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);\n }", " $count = 1;\n if ($this->params['type_of_address'][0] == 'am') {\n while (($checkdata = fgetcsv($checkhandle, 10000, \"\\t\")) !== FALSE) {\n $count++;\n //eDebug($checkdata);\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n } else {\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n }", " fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);", " echo \"<br/>CSV File passed validation...<br/><br/>Importing....<br/><br/>\";\n //exit();\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");\n $data = fgetcsv($handle, 10000, \",\");\n //eDebug($data);\n $dataset = array();", " //mc=1, nt=2, amm=3", " if ($this->params['type_of_address'][0] == 'mc') {\n //militaryclothing\n $db->delete('external_addresses', 'source=1');", " } else if ($this->params['type_of_address'][0] == 'nt') {\n //nametapes\n $db->delete('external_addresses', 'source=2');\n } else if ($this->params['type_of_address'][0] == 'am') {\n //amazon\n $db->delete('external_addresses', 'source=3');\n }", " if ($this->params['type_of_address'][0] == 'am') {\n while (($data = fgetcsv($handle, 10000, \"\\t\")) !== FALSE) {\n //eDebug($data,true);\n $extAddy = new external_address();", " //eDebug($data);\n $extAddy->source = 3;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[15]);\n $extAddy->firstname = $name[0];\n if (isset($name[3])) {\n $extAddy->firstname .= ' ' . $name[1];\n $extAddy->middlename = $name[2];\n $extAddy->lastname = $name[3];\n } else if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[15];\n $extAddy->address1 = $data[16];\n $extAddy->address2 = $data[17];\n $extAddy->city = $data[19];\n $state = new geoRegion();\n $state = $state->findBy('code', trim($data[20]));\n if (empty($state->id)) {\n $state = new geoRegion();\n $state = $state->findBy('name', trim($data[20]));\n }\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[21]);\n $extAddy->phone = $data[6];\n $extAddy->email = $data[4];\n //eDebug($extAddy);\n $extAddy->save();\n }\n } else {\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n eDebug($data);\n $extAddy = new external_address();\n if ($this->params['type_of_address'][0] == 'mc') {\n $extAddy->source = 1;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[3]);\n $extAddy->firstname = $name[0];\n if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[4];\n $extAddy->address1 = $data[5];\n $extAddy->address2 = $data[6];\n $extAddy->city = $data[7];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[8]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[9]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];\n //eDebug($extAddy);\n $extAddy->save();", " //Check if the shipping add is same as the billing add\n if ($data[5] != $data[14]) {\n $extAddy = new external_address();\n $extAddy->source = 1;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[12]);\n $extAddy->firstname = $name[0];\n if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[13];\n $extAddy->address1 = $data[14];\n $extAddy->address2 = $data[15];\n $extAddy->city = $data[16];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[17]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[18]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];\n // eDebug($extAddy, true);\n $extAddy->save();\n }\n }\n if ($this->params['type_of_address'][0] == 'nt') {\n //eDebug($data,true);\n $extAddy->source = 2;\n $extAddy->user_id = 0;\n $extAddy->firstname = $data[16];\n $extAddy->lastname = $data[17];\n $extAddy->organization = $data[15];\n $extAddy->address1 = $data[18];\n $extAddy->address2 = $data[19];\n $extAddy->city = $data[20];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[21]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[22]);\n $extAddy->phone = $data[23];\n $extAddy->email = $data[13];\n //eDebug($extAddy);\n $extAddy->save();\n }\n }\n }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);\n echo \"Done!\";\n }", "}", "?>" ]
[ 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @package Modules\n * @subpackage Controllers\n */", "class addressController extends expController {", "//\tpublic $useractions = array(", "// 'myaddressbook'=>'Show my addressbook'", "// );", " protected $remove_permissions = array(\n 'create',\n 'edit',\n 'delete'\n );", " protected $manage_permissions = array(\n// 'import' => 'Import External Addresses',\n 'process' => 'Import External Addresses'", " );\n\tpublic $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)", " static function displayname() { return gt(\"Addresses\"); }\n static function description() { return gt(\"Display and manage addresses of users on your site.\"); }\n static function canImportData() { return true;}", " static function hasSources() {\n return false;\n }", " function showall() {\n// redirect_to(array(\"controller\"=>'address',\"action\"=>'myaddressbook'));\n $this->myaddressbook();\n\t}", "", " public function edit()\n {\n if((isset($this->params['id']))) $record = new address(intval($this->params['id']));\n else $record = null;\n $config = ecomconfig::getConfig('address_allow_admins_all');\n assign_to_template(array(\n 'record'=>$record,\n 'admin_config'=>$config\n ));\n if (expSession::get('customer-signup')) {\n assign_to_template(array(\n 'checkout'=>true\n ));\n }\n }", "", "\tpublic function myaddressbook() {\n\t\tglobal $user;", "\t\t// check if the user is logged in.\n\t\texpQueue::flashIfNotLoggedIn('message',gt('You must be logged in to manage your address book.'));\n\t\texpHistory::set('viewable', $this->params);\n\t\t$userid = (empty($this->params['user_id'])) ? $user->id : $this->params['user_id'];\n\t\tassign_to_template(array(\n 'addresses'=>$this->address->find('all', 'user_id='.$userid)\n ));\n\t}", "", "\tfunction show() {\n\t expHistory::set('viewable', $this->params);\n\t\tassign_to_template(array(\n 'address'=>new address($this->params['id'])\n ));\n\t}", "\tpublic function update() {\n global $user;", " if (expSession::get('customer-signup')) expSession::set('customer-signup', false);\n if (isset($this->params['address_country_id'])) {\n $this->params['country'] = $this->params['address_country_id'];\n unset($this->params['address_country_id']);\n }\n if (isset($this->params['address_region_id'])) {\n $this->params['state'] = $this->params['address_region_id'];\n unset($this->params['address_region_id']);\n }\n\t\tif ($user->isLoggedIn()) {\n\t\t\t// check to see how many other addresses this user has already.\n\t\t\t$count = $this->address->find('count', 'user_id='.$user->id);\n\t\t\t// if this is first address save for this user we'll make this the default", "\t\t\tif ($count == 0)", " {\n $this->params['is_default'] = 1;\n $this->params['is_billing'] = 1;\n $this->params['is_shipping'] = 1;\n }\n\t\t\t// associate this address with the current user.\n\t\t\t$this->params['user_id'] = $user->id;\n\t\t\t// save the object\n\t\t\t$this->address->update($this->params);\n\t\t}\n else { //if (ecomconfig::getConfig('allow_anonymous_checkout')){", " //user is not logged in, but allow anonymous checkout is enabled so we'll check", " //a few things that we don't check in the parent 'stuff and create a user account.\n $this->params['is_default'] = 1;\n $this->params['is_billing'] = 1;", " $this->params['is_shipping'] = 1;", " $this->address->update($this->params);\n }", "\t\texpHistory::back();", "\t}", "", "\tpublic function delete() {\n\t global $user;", " $count = $this->address->find('count', 'user_id=' . $user->id);\n if($count > 1)", " {", " $address = new address($this->params['id']);\n\t if ($user->isAdmin() || ($user->id == $address->user_id)) {\n if ($address->is_billing)\n {\n $billAddress = $this->address->find('first', 'user_id=' . $user->id . \" AND id != \" . $address->id);\n $billAddress->is_billing = true;\n $billAddress->save();\n }", " if ($address->is_shipping)", " {\n $shipAddress = $this->address->find('first', 'user_id=' . $user->id . \" AND id != \" . $address->id);\n $shipAddress->is_shipping = true;\n $shipAddress->save();\n }\n\t parent::delete();\n\t }\n }\n else\n {\n flash(\"error\", gt(\"You must have at least one address.\"));\n }\n\t expHistory::back();\n\t}", "", " public function activate_address()\n {\n global $db, $user;", " $object = new stdClass();\n $object->id = $this->params['id'];", " $db->setUniqueFlag($object, 'addresses', expString::escape($this->params['is_what']), \"user_id=\" . $user->id);", " flash(\"message\", gt(\"Successfully updated address.\"));", " expHistory::back();\n }\n", " public function manage()\n {\n expHistory::set('manageable',$this->params);\n $gc = new geoCountry();\n $countries = $gc->find('all');", "\n $gr = new geoRegion();", " $regions = $gr->find('all',null,'rank asc,name asc');", "", " assign_to_template(array(\n 'countries'=>$countries,\n 'regions'=>$regions\n ));\n }", "", " public function manage_update()\n {\n global $db;", " //eDebug($this->params,true);\n //countries\n $db->columnUpdate('geo_country','active',0,'active=1');\n foreach($this->params['country'] as $country_id=>$is_active)\n {\n $gc = new geoCountry($country_id);", " $gc->active = true;\n $gc->save();", " }\n //country default\n $db->columnUpdate('geo_country','is_default',0,'is_default=1');\n if(isset($this->params['country_default']))\n {", " $gc = new geoCountry(intval($this->params['country_default']));\n $db->setUniqueFlag($gc,'geo_country','is_default','id=' . $gc->id);\n $gc->refresh();", " }\n //regions\n $db->columnUpdate('geo_region','active',0,'active=1');\n foreach($this->params['region'] as $region_id=>$is_active)\n {\n $gr = new geoRegion($region_id);\n $gr->active = true;\n if(isset($this->params['region_rank'][$region_id])) $gr->rank = $this->params['region_rank'][$region_id];", " $gr->save();", " }\n flash('message',gt('Address configurations successfully updated.'));\n redirect_to(array('controller'=>'address','action'=>'manage'));\n// $this->manage();\n }", " function edit_country() {\n $country_id = !empty($this->params['id']) ? $this->params['id'] : null;\n $country = new geoCountry($country_id);\n assign_to_template(array(\n 'record'=>$country,\n ));\n }", " function update_country() {\n $country_id = !empty($this->params['id']) ? $this->params['id'] : null;\n $country = new geoCountry($country_id);\n $country->update($this->params);\n expHistory::returnTo('manageable');\n }", " function delete_country() {\n if (empty($this->params['id'])) {\n flash('error', gt('Missing id for the country you would like to delete'));\n expHistory::back();\n }\n $country = new geoCountry($this->params['id']);\n $country->delete();\n expHistory::returnTo('manageable');\n }", " function edit_region() {\n $region_id = !empty($this->params['id']) ? $this->params['id'] : null;\n $region = new geoRegion($region_id);\n assign_to_template(array(\n 'record'=>$region,\n ));\n }", " function update_region() {\n $region_id = !empty($this->params['id']) ? $this->params['id'] : null;\n $region = new geoRegion($region_id);\n $region->update($this->params);\n expHistory::returnTo('manageable');\n }", " function delete_region() {\n if (empty($this->params['id'])) {\n flash('error', gt('Missing id for the region you would like to delete'));\n expHistory::back();\n }\n $region = new geoRegion($this->params['id']);\n $region->delete();\n expHistory::returnTo('manageable');\n }", " /**\n * Import external addresses\n */\n function import() {\n $sources = array('mc' => 'MilitaryClothing.com', 'nt' => 'NameTapes.com', 'am' => 'Amazon');\n assign_to_template(array(\n 'sources' => $sources\n ));\n }", " function process_external_addresses() {\n global $db;", " set_time_limit(0);\n //$file = new expFile($this->params['expFile']['batch_process_upload'][0]);\n eDebug($this->params);\n// eDebug($_FILES,true);\n if (!empty($_FILES['address_csv']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n redirect_to(array('controller' => 'store', 'action' => 'import_external_addresses'));\n// $this->import_external_addresses();\n }", " $file = new stdClass();\n $file->path = $_FILES['address_csv']['tmp_name'];\n echo \"Validating file...<br/>\";", " //replace tabs with commas\n /*if($this->params['type_of_address'][0] == 'am')\n {\n $checkhandle = fopen($file->path, \"w\");\n $oldFile = file_get_contents($file->path);\n $newFile = str_ireplace(chr(9),',',$oldFile);\n fwrite($checkhandle,$newFile);\n fclose($checkhandle);\n }*/", " $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n if ($this->params['type_of_address'][0] == 'am') {\n $checkdata = fgetcsv($checkhandle, 10000, \"\\t\");\n $fieldCount = count($checkdata);\n } else {\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);\n }", " $count = 1;\n if ($this->params['type_of_address'][0] == 'am') {\n while (($checkdata = fgetcsv($checkhandle, 10000, \"\\t\")) !== FALSE) {\n $count++;\n //eDebug($checkdata);\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n } else {\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n }", " fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);", " echo \"<br/>CSV File passed validation...<br/><br/>Importing....<br/><br/>\";\n //exit();\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");\n $data = fgetcsv($handle, 10000, \",\");\n //eDebug($data);\n $dataset = array();", " //mc=1, nt=2, amm=3", " if ($this->params['type_of_address'][0] == 'mc') {\n //militaryclothing\n $db->delete('external_addresses', 'source=1');", " } else if ($this->params['type_of_address'][0] == 'nt') {\n //nametapes\n $db->delete('external_addresses', 'source=2');\n } else if ($this->params['type_of_address'][0] == 'am') {\n //amazon\n $db->delete('external_addresses', 'source=3');\n }", " if ($this->params['type_of_address'][0] == 'am') {\n while (($data = fgetcsv($handle, 10000, \"\\t\")) !== FALSE) {\n //eDebug($data,true);\n $extAddy = new external_address();", " //eDebug($data);\n $extAddy->source = 3;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[15]);\n $extAddy->firstname = $name[0];\n if (isset($name[3])) {\n $extAddy->firstname .= ' ' . $name[1];\n $extAddy->middlename = $name[2];\n $extAddy->lastname = $name[3];\n } else if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[15];\n $extAddy->address1 = $data[16];\n $extAddy->address2 = $data[17];\n $extAddy->city = $data[19];\n $state = new geoRegion();\n $state = $state->findBy('code', trim($data[20]));\n if (empty($state->id)) {\n $state = new geoRegion();\n $state = $state->findBy('name', trim($data[20]));\n }\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[21]);\n $extAddy->phone = $data[6];\n $extAddy->email = $data[4];\n //eDebug($extAddy);\n $extAddy->save();\n }\n } else {\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n eDebug($data);\n $extAddy = new external_address();\n if ($this->params['type_of_address'][0] == 'mc') {\n $extAddy->source = 1;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[3]);\n $extAddy->firstname = $name[0];\n if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[4];\n $extAddy->address1 = $data[5];\n $extAddy->address2 = $data[6];\n $extAddy->city = $data[7];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[8]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[9]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];\n //eDebug($extAddy);\n $extAddy->save();", " //Check if the shipping add is same as the billing add\n if ($data[5] != $data[14]) {\n $extAddy = new external_address();\n $extAddy->source = 1;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[12]);\n $extAddy->firstname = $name[0];\n if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[13];\n $extAddy->address1 = $data[14];\n $extAddy->address2 = $data[15];\n $extAddy->city = $data[16];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[17]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[18]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];\n // eDebug($extAddy, true);\n $extAddy->save();\n }\n }\n if ($this->params['type_of_address'][0] == 'nt') {\n //eDebug($data,true);\n $extAddy->source = 2;\n $extAddy->user_id = 0;\n $extAddy->firstname = $data[16];\n $extAddy->lastname = $data[17];\n $extAddy->organization = $data[15];\n $extAddy->address1 = $data[18];\n $extAddy->address2 = $data[19];\n $extAddy->city = $data[20];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[21]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[22]);\n $extAddy->phone = $data[23];\n $extAddy->email = $data[13];\n //eDebug($extAddy);\n $extAddy->save();\n }\n }\n }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);\n echo \"Done!\";\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */\n/** @define \"BASE\" \"../../../..\" */", "class administrationController extends expController {\n public $basemodel_name = 'expRecord';", " protected $add_permissions = array(", "\t 'clear'=>'Clear Caches', //FIXME this requires a logged in user to perform?\n\t \"fix\"=>\"Fix Database\",\n\t \"install\"=>\"Installation\",", "", "\t \"theme\"=>\"Manage Themes\",\n\t 'test_smtp'=>'Test SMTP Server Settings',\n\t 'toggle'=>'Toggle Settings',", " 'mass'=>'Mass Mailing',\n 'update'=>'Update Settings',\n 'change'=>'Change Settings',\n 'save'=>'Save Settings',", " );", " static function displayname() { return gt(\"Administration Controls\"); }\n static function description() { return gt(\"This is the Administration Module\"); }", " static function hasSources() {\n return false;\n }", "\tpublic function install_tables() {\n\t\t$tables = expDatabase::install_dbtables();\n\t\tksort($tables);\n assign_to_template(array(\n 'status'=>$tables\n ));\n\t}", " public function delete_unused_columns() {\n \t\t$tables = expDatabase::install_dbtables(true);\n \t\tksort($tables);\n assign_to_template(array(\n 'status'=>$tables\n ));\n \t}", " public function manage_unused_tables() {\n global $db;", " ", " expHistory::set('manageable', $this->params);\n $unused_tables = array();\n $used_tables = array();\n $tables = $db->getTables();\n //eDebug($tables);", "\t\t// first the core and 1.0 definitions\n\t\t$coredefs = BASE.'framework/core/definitions';\n\t\tif (is_readable($coredefs)) {\n\t\t\t$dh = opendir($coredefs);\n\t\t\twhile (($file = readdir($dh)) !== false) {\n\t\t\t\tif (is_readable(\"$coredefs/$file\") && is_file(\"$coredefs/$file\") && substr($file,-4,4) == \".php\" && substr($file,-9,9) != \".info.php\") {\n\t\t\t\t\t$used_tables[]= strtolower(substr($file,0,-4));\n\t\t\t\t}\n\t\t\t}\n\t\t}", "\t // then search for module definitions\n $moddefs = array(\n BASE.'themes/'.DISPLAY_THEME_REAL.'/modules', // we only want to do this for the set theme, NOT the preview theme\n BASE.\"framework/modules\",\n );\n foreach ($moddefs as $moddef) {\n if (is_readable($moddef)) {\n $dh = opendir($moddef);\n while (($file = readdir($dh)) !== false) {\n if (is_dir($moddef.'/'.$file) && ($file != '..' && $file != '.')) {\n $dirpath = $moddef.'/'.$file.'/definitions';\n if (file_exists($dirpath)) {\n $def_dir = opendir($dirpath);\n while (($def = readdir($def_dir)) !== false) {\n if (is_readable(\"$dirpath/$def\") && is_file(\"$dirpath/$def\") && substr($def,-4,4) == \".php\" && substr($def,-9,9) != \".info.php\") {\n if ((!in_array(substr($def,0,-4), $used_tables))) {\n $used_tables[] = strtolower(substr($def,0,-4));\n }\n }\n }\n }\n }\n }\n }\n }", " foreach($tables as $table) {\n $basename = strtolower(str_replace($db->prefix, '', $table));\n if (!in_array($basename, $used_tables) && !stristr($basename, 'forms')) {\n $unused_tables[$basename] = new stdClass();\n $unused_tables[$basename]->name = $table;\n $unused_tables[$basename]->rows = $db->countObjects($basename);\n }\n }", " ", " assign_to_template(array(\n 'unused_tables'=>$unused_tables\n ));\n }", " ", " public function delete_unused_tables() {\n global $db;", " $count = 0;\n foreach($this->params['tables'] as $del=>$table) {\n $basename = str_replace($db->prefix, '', $table);\n $count += $db->dropTable($basename);\n }", " ", " flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.');\n expHistory::back();\n }", "\tpublic function fix_optimize_database() {\n\t global $db;", "\t\t$before = $db->databaseInfo();\n\t\tforeach (array_keys($before) as $table) {\n\t\t\t$db->optimize($table);\n\t\t}\n\t\t$after = $db->databaseInfo();\n\t assign_to_template(array(\n 'before'=>$before,\n 'after'=>$after\n ));\n\t}\n", "\tpublic function fixsessions() {\n\t global $db;", "//\t\t$test = $db->sql('CHECK TABLE '.$db->prefix.'sessionticket');\n\t\t$fix = $db->sql('REPAIR TABLE '.$db->prefix.'sessionticket');\n\t\tflash('message', gt('Sessions Table was Repaired'));\n\t\texpHistory::back();\n\t}", "\n\tpublic function fix_database() {\n\t global $db;", "\t// upgrade sectionref's that have lost their originals\n// $no_origs = array();\n//\t\t$sectionrefs = $db->selectObjects('sectionref',\"is_original=0\");\n//\t\tif (count($sectionrefs)) {\n//\t\t\tprint_r(gt(\"Found\").\": \".count($sectionrefs).\" \".gt(\"copies (not originals)\").\"<br>\");\n// foreach ($sectionrefs as $sectionref) {\n// if ($db->selectObject('sectionref',\"module='\".$sectionref->module.\"' AND source='\".$sectionref->source.\"' AND is_original='1'\") == null) {\n// // There is no original for this sectionref so change it to the original\n// $sectionref->is_original = 1;\n// $db->updateObject($sectionref,\"sectionref\");\n// $no_origs[] = gt(\"Fixed\").\": \".$sectionref->module.\" - \".$sectionref->source;\n// }\n// }\n//\t\t}\n// assign_to_template(array(\n// 'no_origs'=>$no_origs,\n// ));", "\t// upgrade sectionref's that point to missing sections (pages)\n\t\t$sectionrefs = $db->selectObjects('sectionref',\"refcount!=0\");\n\t\t$no_sections = array();\n\t\tforeach ($sectionrefs as $sectionref) {\n\t\t\tif ($db->selectObject('section',\"id='\".$sectionref->section.\"'\") == null) {\n\t\t\t// There is no section/page for sectionref so change the refcount\n\t\t\t\t$sectionref->refcount = 0;\n\t\t\t\t$db->updateObject($sectionref,\"sectionref\");\n $no_sections[] = gt(\"Fixed\").\": \".$sectionref->module.\" - \".$sectionref->source;\n\t\t\t}\n\t\t}\n assign_to_template(array(\n 'no_sections'=>$no_sections,\n ));", "\t // delete sectionref's that have empty sources since they are dead\n\t\t $sectionrefs = $db->selectObjects('sectionref','source=\"\"');\n $no_assigns = array();\n\t\t if ($sectionrefs != null) {\n $no_assigns[] = gt(\"Removing\").\": \".count($sectionrefs).\" \".gt(\"empty sectionrefs (no source)\");\n\t\t\t $db->delete('sectionref','source=\"\"');\n\t\t }\n assign_to_template(array(\n 'no_assigns'=>$no_assigns,\n ));", "\t// add missing sectionrefs based on existing containers (fixes aggregation problem)\n\t\t$containers = $db->selectObjects('container',1);\n $missing_sectionrefs = array();\n\t\tforeach ($containers as $container) {\n\t\t\t$iloc = expUnserialize($container->internal);\n\t\t\tif ($db->selectObject('sectionref',\"module='\".$iloc->mod.\"' AND source='\".$iloc->src.\"'\") == null) {\n\t\t\t// There is no sectionref for this container. Populate sectionref\n if ($container->external != \"N;\") {\n $newSecRef = new stdClass();\n $newSecRef->module = $iloc->mod;\n $newSecRef->source = $iloc->src;\n $newSecRef->internal = '';\n $newSecRef->refcount = 1;\n// $newSecRef->is_original = 1;\n\t\t\t\t\t$eloc = expUnserialize($container->external);", "//\t\t\t\t\t$section = $db->selectObject('sectionref',\"module='containermodule' AND source='\".$eloc->src.\"'\");", " $section = $db->selectObject('sectionref',\"module='container' AND source='\".$eloc->src.\"'\");\n\t\t\t\t\tif (!empty($section)) {\n\t\t\t\t\t\t$newSecRef->section = $section->id;\n\t\t\t\t\t\t$db->insertObject($newSecRef,\"sectionref\");\n\t\t\t\t\t\t$missing_sectionrefs[] = gt(\"Missing sectionref for container replaced\").\": \".$iloc->mod.\" - \".$iloc->src.\" - PageID #\".$section->id;\n\t\t\t\t\t} else {\n $db->delete('container','id=\"'.$container->id.'\"');\n $missing_sectionrefs[] = gt(\"Cant' find the container page for container\").\": \".$iloc->mod.\" - \".$iloc->src.' - '.gt('deleted');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n assign_to_template(array(\n 'missing_sectionrefs'=>$missing_sectionrefs,\n ));\n\t}", " public function fix_tables() {\n $renamed = expDatabase::fix_table_names();\n assign_to_template(array(\n 'tables'=>$renamed,\n ));\n \t}", " public function install_ecommerce_tables() {\n global $db;", " $eql = BASE . \"install/samples/ecommerce.eql\";\n if (file_exists($eql)) {\n $errors = array();\n expFile::restoreDatabase($eql,$errors);\n } else {\n $errors = array(gt('The file does not exist'));\n }\n if (DEVELOPMENT && count($errors)) {\n $msg = gt('Errors were encountered importing the e-Commerce data.').'<ul>';\n foreach ($errors as $e) $msg .= '<li>'.$e.'</li>';\n $msg .= '</ul>';\n flash('error',$msg);\n } else {\n flash('message',gt('e-Commerce data was added to your database.'));\n }\n expHistory::back();\n \t}", " public function toolbar() {\n// global $user;", " $menu = array();\n\t\t$dirs = array(\n\t\t\tBASE.'framework/modules/administration/menus',\n\t\t\tBASE.'themes/'.DISPLAY_THEME.'/modules/administration/menus'\n\t\t);", "\t\tforeach ($dirs as $dir) {\n\t\t if (is_readable($dir)) {\n\t\t\t $dh = opendir($dir);\n\t\t\t while (($file = readdir($dh)) !== false) {\n\t\t\t\t if (substr($file,-4,4) == '.php' && is_readable($dir.'/'.$file) && is_file($dir.'/'.$file)) {\n\t\t\t\t\t $menu[substr($file,0,-4)] = include($dir.'/'.$file);\n if (empty($menu[substr($file,0,-4)])) unset($menu[substr($file,0,-4)]);\n\t\t\t\t }\n\t\t\t }\n\t\t }\n\t\t}", " // sort the top level menus alphabetically by filename", "\t\tksort($menu);\t\t", "\t\t$sorted = array();\n\t\tforeach($menu as $m) $sorted[] = $m;", " ", " // slingbar position\n if (isset($_COOKIE['slingbar-top'])){\n $top = $_COOKIE['slingbar-top'];\n } else {\n $top = SLINGBAR_TOP;\n }", " ", "\t\tassign_to_template(array(\n 'menu'=>(bs3()) ? $sorted : json_encode($sorted),\n \"top\"=>$top\n ));\n }", " ", "// public function index() {\n// redirect_to(array('controller'=>'administration', 'action'=>'toolbar'));\n//// $this->toolbar();\n// }", " ", " public function update_SetSlingbarPosition() {\n setcookie('slingbar-top', $this->params['top']);\n expHistory::back();\n }", " public function manage_lang() {\n global $default_lang, $cur_lang;", " // Available Languages\n\t $langs = expLang::langList();\n $num_missing = 0;\n foreach ($default_lang as $key => $value) {\n if (!array_key_exists($key,$cur_lang)) $num_missing++;\n }\n $num_untrans = 0;\n foreach ($cur_lang as $key => $value) {\n if ($key == $value) $num_untrans++;\n }\n assign_to_template(array(\n 'langs'=>$langs,\n 'missing'=>$num_missing,\n \"count\"=>count($cur_lang),\n 'untrans'=>$num_untrans\n ));\n \t}", " public function update_language() {\n expSettings::change('LANGUAGE', $this->params['newlang']);\n flash('message',gt('Display Language changed to').\": \".$this->params['newlang']);\n redirect_to(array('controller'=>'administration', 'action'=>'manage_lang'));\n// $this->manage_lang();\n \t}", " public function manage_lang_await() {\n global $cur_lang;", " $awaiting_trans = array();\n foreach ($cur_lang as $key => $value) {\n if ($key == $value) {\n $awaiting_trans[$key] = stripslashes($value);\n }\n }\n assign_to_template(array(\n 'await'=>$awaiting_trans\n ));\n \t}", " public function save_newlangfile() {\n\t\t$result = expLang::createNewLangFile($this->params['newlang']);\n flash($result['type'],$result['message']);\n if ($result['type'] != 'error') {\n expSettings::change('LANGUAGE', $this->params['newlang']);\n expLang::createNewLangInfoFile($this->params['newlang'],$this->params['newauthor'],$this->params['newcharset'],$this->params['newlocale']);\n flash('message',gt('Display Language changed to').\": \".$this->params['newlang']);\n }\n redirect_to(array('controller'=>'administration', 'action'=>'manage_lang'));\n// $this->manage_lang();\n \t}", "\tpublic function test_smtp() {\n\t\t$smtp = new expMail();\n\t\t$smtp->test();\n\t}", " public function toggle_minify() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Minification settings.'));\n } else {\n $newvalue = (MINIFY == 1) ? 0 : 1;\n expSettings::change('MINIFY', $newvalue);\n $message = ($newvalue) ? gt(\"Exponent is now minifying Javascript and CSS\") : gt(\n \"Exponent is no longer minifying Javascript and CSS\"\n );\n flash('message', $message);\n }\n \texpHistory::back();\n }", " ", "\tpublic function toggle_dev() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Error Reporting settings.'));\n } else {\n $newvalue = (DEVELOPMENT == 1) ? 0 : 1;\n expSettings::change('DEVELOPMENT', $newvalue);\n// expTheme::removeCss();\n expCSS::updateCoreCss(); // go ahead and rebuild the core .css files\n $message = ($newvalue) ? gt(\"Exponent is now in 'Development' mode\") : gt(\n \"Exponent is no longer in 'Development' mode\"\n );\n flash('message', $message);\n }\n\t\texpHistory::back();\n\t}", " public function toggle_log() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Logging settings.'));\n } else {\n $newvalue = (LOGGER == 1) ? 0 : 1;\n expSettings::change('LOGGER', $newvalue);\n }\n \t\texpHistory::back();\n \t}", "\tpublic function toggle_maintenance() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Maintenance settings.'));\n } else {\n $newvalue = (MAINTENANCE_MODE == 1) ? 0 : 1;\n expSettings::change('MAINTENANCE_MODE', $newvalue);\n MAINTENANCE_MODE == 1 ? flash('message', gt(\"Exponent is no longer in 'Maintenance' mode\")) : \"\";\n }\n\t\texpHistory::back();\n\t}", " public function toggle_workflow() {\n global $db;", " if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Site Configuration settings.'));\n } else {\n $newvalue = (ENABLE_WORKFLOW == 1) ? 0 : 1;\n expSettings::change('ENABLE_WORKFLOW', $newvalue);\n $models = expModules::initializeModels();\n if ($newvalue) {\n // workflow is now turned on, initialize by approving all items\n expDatabase::install_dbtables(true, $newvalue); // force a strict table update to add workflow columns\n foreach ($models as $modelname => $modelpath) {\n $model = new $modelname();\n if ($model->supports_revisions) {\n $db->columnUpdate($model->tablename, 'approved', 1, 'approved=0');\n }\n }\n } else {\n // workflow is now turned off, remove older revisions\n foreach ($models as $modelname => $modelpath) {\n $model = new $modelname();\n if ($model->supports_revisions) {\n $items = $model->find();\n foreach ($items as $item) {\n $db->trim_revisions($model->tablename, $item->id, 1, $newvalue);\n }\n }\n }\n expDatabase::install_dbtables(\n true,\n $newvalue\n ); // force a strict table update to remove workflow columns\n }\n $message = ($newvalue) ? gt(\"Exponent 'Workflow' is now ON\") : gt(\"Exponent 'Workflow' is now OFF\");\n flash('message', $message);\n }\n \t\texpHistory::back();\n \t}", "\tpublic function toggle_preview() {\n\t\t$level = 99;\n\t\tif (expSession::is_set('uilevel')) {\n\t\t\t$level = expSession::get('uilevel');\n\t\t}\n\t\tif ($level == UILEVEL_PREVIEW) {\n\t\t\texpSession::un_set('uilevel');\n\t\t} else { //edit mode\n\t\t\texpSession::set(\"uilevel\",UILEVEL_PREVIEW);\n\t\t}\n\t\t$message = ($level == UILEVEL_PREVIEW) ? gt(\"Exponent is no longer in 'Preview' mode\") : gt(\"Exponent is now in 'Preview' mode\") ;\n\t\tflash('message',$message);\n\t\texpHistory::back();\n\t}", " public function manage_version() {\n expSession::un_set('update-check'); // reset the already checked flag\n if (!expVersion::checkVersion(true)) {\n flash('message', gt('Your version of Exponent CMS is current.'));\n }\n \t\texpHistory::back();\n \t}", "\tpublic function clear_smarty_cache() {\n\t\texpTheme::clearSmartyCache();\n expSession::clearAllUsersSessionCache();\n }", "\tpublic function clear_css_cache() {\n\t\texpTheme::removeCss();\n expSession::set('force_less_compile', 1);\n expCSS::updateCoreCss(); // go ahead and rebuild the core .css files\n\t\tflash('message',gt(\"CSS/Minify Cache has been cleared\"));\n\t\texpHistory::back();\n\t}", "\tpublic function clear_image_cache() {\n\t\texpFile::removeFilesInDirectory(BASE.'tmp/pixidou');\n\t\tif (file_exists(BASE.'tmp/img_cache'))\n expFile::removeFilesInDirectory(BASE.'tmp/img_cache');\n\t\tflash('message',gt(\"Image/Pixidou Cache has been cleared\"));\n\t\texpHistory::back();\n\t}", "\tpublic function clear_rss_cache() {\n\t\texpFile::removeFilesInDirectory(BASE.'tmp/rsscache');\n\t\tflash('message',gt(\"RSS/Podcast/Twitter Cache has been cleared\"));\n\t\texpHistory::back();\n\t}", "\tpublic static function clear_all_caches() {\n\t\texpTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache(); // clear the session cache for true 'clear all'\n expHistory::flush(); // clear the history\n expSession::un_set('framework');\n expSession::un_set('display_theme');\n expSession::un_set('theme_style');\n\t\texpTheme::removeCss();\n expSession::set('force_less_compile', 1);\n expCSS::updateCoreCss(); // go ahead and rebuild the core .css files\n\t\texpFile::removeFilesInDirectory(BASE.'tmp/pixidou');\n\t\tif (file_exists(BASE.'tmp/img_cache'))\n expFile::removeFilesInDirectory(BASE.'tmp/img_cache');\n if (file_exists(BASE.'tmp/elfinder'))\n expFile::removeFilesInDirectory(BASE.'tmp/elfinder');\n\t\tif (file_exists(BASE.'tmp/extensionuploads'))\n expFile::removeFilesInDirectory(BASE.'tmp/extensionuploads');\n\t\texpFile::removeFilesInDirectory(BASE.'tmp/rsscache');\n\t\tflash('message',gt(\"All the System Caches have been cleared\"));\n\t\texpHistory::back();\n\t}", "\tpublic function install_extension() {", "\t\t$modsurl =array(\n\t\t\t'themes'=>'http://www.exponentcms.org/rss/feed/title/exponentcms-themes',\n\t\t\t'fixes'=>'http://www.exponentcms.org/rss/feed/title/exponentcms-fixes',\n\t\t\t'mods'=>'http://www.exponentcms.org/rss/feed/title/exponentcms-mods'\n\t\t);", "\t\t$RSS = new SimplePie();\n\t\t$RSS->set_cache_location(BASE.'tmp/rsscache'); // default is ./cache\n//\t $RSS->set_cache_duration(3600); // default if 3600\n\t\t$RSS->set_timeout(20); // default is 10\n//\t $RSS->set_output_encoding('UTF-8'); // which is the default\n\t\t$items['themes'] = array();\n\t\t$items['fixes'] = array();\n\t\t$items['mods'] = array();\n\t\tforeach($modsurl as $type=>$url) {\n\t\t $RSS->set_feed_url($url);\n\t\t $feed = $RSS->init();\n\t\t if (!$feed) {\n\t\t // an error occurred in the rss.\n\t\t continue;\n\t\t }\n\t\t\t$RSS->handle_content_type();\n\t\t foreach ($RSS->get_items() as $rssItem) {\n\t\t $rssObject = new stdClass();\n\t\t $rssObject->title = $rssItem->get_title();\n\t\t $rssObject->body = $rssItem->get_description();\n\t\t $rssObject->rss_link = $rssItem->get_permalink();\n\t\t $rssObject->publish = $rssItem->get_date('U');\n\t\t $rssObject->publish_date = $rssItem->get_date('U');\n\t\t\t\tforeach ($rssItem->get_enclosures() as $enclosure) {\n\t\t\t\t\t$rssObject->enclosure = $enclosure->get_link();\n $rssObject->length = $enclosure->get_length();\n\t\t\t\t}\n\t\t $items[$type][] = $rssObject;\n\t\t }\n\t\t}", "//\t\t$form = new form();\n// $form->meta('module','administration');\n// $form->meta('action','install_extension_confirm');\n//\t\t$form->register(null,'',new htmlcontrol(expCore::maxUploadSizeMessage()));\n//\t\t$form->register('mod_archive','Extension Archive',new uploadcontrol());\n// $form->register('patch',gt('Patch Exponent CMS or Install Theme?'),new checkboxcontrol(false,false),null,null,gt('All extensions are normally placed within the CURRENT theme (folder)'));\n// $form->register('submit','',new buttongroupcontrol(gt('Upload Extension')));", "\t\tassign_to_template(array(\n 'themes'=>$items['themes'],\n 'fixes'=>$items['fixes'],\n 'mods'=>$items['mods'],\n// 'form_html'=>$form->toHTML()\n ));\n\t}", "\tpublic function install_extension_confirm() {\n if (!empty($this->params['files'])) {\n foreach ($this->params['files'] as $title=>$url) {\n $filename = tempnam(\"tmp/extensionuploads/\",'tmp');\n expCore::saveData($url,$filename);\n $_FILES['mod_archive']['name'] = end(explode(\"/\", $url));\n// $finfo = finfo_open(FILEINFO_MIME);\n// $mimetype = finfo_file($finfo, $filename);\n// finfo_close($finfo);\n// $_FILES['mod_archive']['type'] = $mimetype;\n $_FILES['mod_archive']['tmp_name'] = $filename;\n $_FILES['mod_archive']['error'] = 0;\n $_FILES['mod_archive']['size'] = filesize($filename);\n }\n }\n if ($_FILES['mod_archive']['error'] != UPLOAD_ERR_OK) {\n\t\t\tswitch($_FILES['mod_archive']['error']) {\n\t\t\t\tcase UPLOAD_ERR_INI_SIZE:\n\t\t\t\tcase UPLOAD_ERR_FORM_SIZE:\n\t\t\t\t\tflash('error', gt('The file you uploaded exceeded the size limits for the server.'));\n\t\t\t\t\tbreak;\n\t\t\t\tcase UPLOAD_ERR_PARTIAL:\n\t\t\t\t\tflash('error', gt('The file you uploaded was only partially uploaded.'));\n\t\t\t\t\tbreak;\n\t\t\t\tcase UPLOAD_ERR_NO_FILE:\n\t\t\t\t\tflash('error', gt('No file was uploaded.'));\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\t$basename = basename($_FILES['mod_archive']['name']);\n\t\t\t// Check future radio buttons; for now, try auto-detect\n\t\t\t$compression = null;\n\t\t\t$ext = '';\n\t\t\tif (substr($basename,-4,4) == '.tar') {\n\t\t\t\t$compression = null;\n\t\t\t\t$ext = '.tar';\n\t\t\t} else if (substr($basename,-7,7) == '.tar.gz') {\n\t\t\t\t$compression = 'gz';\n\t\t\t\t$ext = '.tar.gz';\n\t\t\t} else if (substr($basename,-4,4) == '.tgz') {\n\t\t\t\t$compression = 'gz';\n\t\t\t\t$ext = '.tgz';\n\t\t\t} else if (substr($basename,-8,8) == '.tar.bz2') {\n\t\t\t\t$compression = 'bz2';\n\t\t\t\t$ext = '.tar.bz2';\n\t\t\t} else if (substr($basename,-4,4) == '.zip') {\n\t\t\t\t$compression = 'zip';\n\t\t\t\t$ext = '.zip';\n\t\t\t}", "\t\t\tif ($ext == '') {\n\t\t\t\tflash('error', gt('Unknown archive format. Archives must either be regular ZIP files, TAR files, Gzipped Tarballs, or Bzipped Tarballs.'));\n\t\t\t} else {", "\t\t\t\t// Look for stale sessid directories:\n\t\t\t\t$sessid = session_id();\n\t\t\t\tif (file_exists(BASE.\"tmp/extensionuploads/$sessid\") && is_dir(BASE.\"tmp/extensionuploads/$sessid\")) expFile::removeDirectory(\"tmp/extensionuploads/$sessid\");\n\t\t\t\t$return = expFile::makeDirectory(\"tmp/extensionuploads/$sessid\");\n\t\t\t\tif ($return != SYS_FILES_SUCCESS) {\n\t\t\t\t\tswitch ($return) {\n\t\t\t\t\t\tcase SYS_FILES_FOUNDFILE:\n\t\t\t\t\t\tcase SYS_FILES_FOUNDDIR:\n\t\t\t\t\t\t\tflash('error', gt('Found a file in the directory path when creating the directory to store the files in.'));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase SYS_FILES_NOTWRITABLE:\n\t\t\t\t\t\t\tflash('error', gt('Destination parent is not writable.'));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase SYS_FILES_NOTREADABLE:\n\t\t\t\t\t\t\tflash('error', gt('Destination parent is not readable.'));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}", "\t\t\t\t$dest = BASE.\"tmp/extensionuploads/$sessid/archive$ext\";\n if (is_uploaded_file($_FILES['mod_archive']['tmp_name'])) {\n\t\t\t\t move_uploaded_file($_FILES['mod_archive']['tmp_name'],$dest);\n } else {\n rename($_FILES['mod_archive']['tmp_name'],$dest);\n }", "\t\t\t\tif ($compression != 'zip') {// If not zip, must be tar\n\t\t\t\t\tinclude_once(BASE.'external/Tar.php');", "\t\t\t\t\t$tar = new Archive_Tar($dest,$compression);", "\t\t\t\t\tPEAR::setErrorHandling(PEAR_ERROR_PRINT);\n\t\t\t\t\t$return = $tar->extract(dirname($dest));\n\t\t\t\t\tif (!$return) {\n\t\t\t\t\t\tflash('error',gt('Error extracting TAR archive'));\n\t\t\t\t\t} else {\n//\t\t\t\t\t\theader('Location: ' . URL_FULL . 'index.php?module=administrationmodule&action=verify_extension&type=tar');\n//\t\t\t\t\t\tself::verify_extension('tar');\n\t\t\t\t\t}\n\t\t\t\t} else { // must be zip\n\t\t\t\t\tinclude_once(BASE.'external/Zip.php');", "\t\t\t\t\t$zip = new Archive_Zip($dest);", "\t\t\t\t\tPEAR::setErrorHandling(PEAR_ERROR_PRINT);\n\t\t\t\t\tif ($zip->extract(array('add_path'=>dirname($dest))) == 0) {\n\t\t\t\t\t\tflash('error',gt('Error extracting ZIP archive').': '.$zip->_error_code . ' : ' . $zip->_error_string . '<br />');\n\t\t\t\t\t} else {\n//\t\t\t\t\t\theader('Location: ' . URL_FULL . 'index.php?module=administrationmodule&action=verify_extension&type=zip');\n//\t\t\t\t\t\tself::verify_extension('zip');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$sessid = session_id();\n\t\t\t\t$files = array();\n\t\t\t\tforeach (expFile::listFlat(BASE.'tmp/extensionuploads/'.$sessid,true,null,array(),BASE.'tmp/extensionuploads/'.$sessid) as $key=>$f) {\n\t\t\t\t\tif ($key != '/archive.tar' && $key != '/archive.tar.gz' && $key != '/archive.tar.bz2' && $key != '/archive.zip') {\n if (empty($this->params['patch']) || !$this->params['patch']) {\n $key = substr($key,1);\n if (substr($key,0,7)=='themes/') {\n $parts = explode('/',$key);\n $parts[1] = DISPLAY_THEME_REAL;\n $file = implode('/',$parts);\n } else {\n $file = 'themes/'.DISPLAY_THEME_REAL.'/'.str_replace(\"framework/\", \"\", $key);\n }\n $file = str_replace(\"modules-1\", \"modules\", $file);\n } else {\n $file = substr($key,1);\n }\n\t\t\t\t\t\t$files[] = array(\n\t\t\t\t\t\t\t'absolute'=>$file,\n\t\t\t\t\t\t\t'relative'=>$f,\n\t\t\t\t\t\t\t'canCreate'=>expFile::canCreate(BASE.$file,1),\n\t\t\t\t\t\t\t'ext'=>substr($f,-3,3)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tassign_to_template(array(\n 'relative'=>'tmp/extensionuploads/'.$sessid,\n 'files'=>$files,\n 'patch'=>empty($this->params['patch'])?0:$this->params['patch']\n ));\n\t\t\t}\n\t\t}\n\t}", "\tpublic function install_extension_finish() {\n $patch =$this->params['patch']==1;\n\t\t$sessid = session_id();\n\t\tif (!file_exists(BASE.\"tmp/extensionuploads/$sessid\") || !is_dir(BASE.\"tmp/extensionuploads/$sessid\")) {\n\t\t\t$nofiles = 1;\n\t\t} else {\n\t\t\t$success = array();\n\t\t\tforeach (array_keys(expFile::listFlat(BASE.\"tmp/extensionuploads/$sessid\",true,null,array(),BASE.\"tmp/extensionuploads/$sessid\")) as $file) {\n\t\t\t\tif ($file != '/archive.tar' && $file != '/archive.tar.gz' && $file != 'archive.tar.bz2' && $file != '/archive.zip') {\n if ($patch) { // this is a patch/fix extension\n expFile::makeDirectory(dirname($file));\n $success[$file] = copy(BASE.\"tmp/extensionuploads/$sessid\".$file,BASE.substr($file,1));\n if (basename($file) == 'views_c') chmod(BASE.substr($file,1),0777);\n } else {\n $newfile = substr($file,1);\n if (substr($newfile,0,7)=='themes/') { // this is a theme extension\n $parts = explode('/',$newfile);\n $parts[1] = DISPLAY_THEME_REAL;\n $newfile = implode('/',$parts);\n } else { // this is a mod extension\n $newfile = str_replace(\"framework/\", \"\", $newfile);\n $newfile = 'themes/'.DISPLAY_THEME_REAL.'/'.str_replace(\"modules-1\", \"modules\", $newfile);\n }\n expFile::makeDirectory(dirname($newfile));\n $success[$newfile] = copy(BASE.\"tmp/extensionuploads/$sessid\".$file,BASE.$newfile);\n }\n\t\t\t\t}\n\t\t\t}", "\t\t\t$del_return = expFile::removeDirectory(BASE.\"tmp/extensionuploads/$sessid\"); //FIXME shouldn't use echo\n//\t\t\techo $del_return;\n $tables = expDatabase::install_dbtables();\n ksort($tables);\n assign_to_template(array(\n 'tables'=>$tables\n ));\n\t\t\t$nofiles = 0;\n\t\t}", "\t\tassign_to_template(array(\n 'nofiles'=>$nofiles,\n 'success'=>$success,\n 'redirect'=>expHistory::getLastNotEditable()\n ));\n\t}", " public function mass_mail() {\n // nothing we need to do except display view\n }", " public function mass_mail_out() {\n global $user;", " $emaillist = array();\n if (!empty($this->params['allusers'])) {\n foreach (user::getAllUsers() as $u) {\n $emaillist[$u->email] = user::getUserAttribution($u->id);\n }\n } else {\n if(!empty($this->params['group_list'])) {\n foreach (listbuildercontrol::parseData($this->params,'grouplist') as $group_id) {\n $grpusers = group::getUsersInGroup($group_id);\n foreach ($grpusers as $u) {\n $emaillist[$u->email] = user::getUserAttribution($u->id);\n }\n }\n }\n if(!empty($this->params['user_list'])) {\n foreach (listbuildercontrol::parseData($this->params,'user_list') as $user_id) {\n $u = user::getUserById($user_id);\n $emaillist[$u->email] = user::getUserAttribution($u->id);\n }\n }\n if(!empty($this->params['address_list'])) {\n foreach (listbuildercontrol::parseData($this->params,'address_list') as $email) {\n $emaillist[] = $email;\n }\n }\n }", " //This is an easy way to remove duplicates\n $emaillist = array_flip(array_flip($emaillist));\n $emaillist = array_map('trim', $emaillist);", " if (empty($emaillist)) {\n $post = empty($_POST) ? array() : expString::sanitize($_POST);\n expValidator::failAndReturnToForm(gt('No Mailing Recipients Selected!'), $post);\n }\n if (empty($this->params['subject']) && empty($this->params['body']) && empty($_FILES['attach']['size'])) {\n $post = empty($_POST) ? array() : expString::sanitize($_POST);\n expValidator::failAndReturnToForm(gt('Nothing to Send!'), $post);\n }", " $emailText = $this->params['body'];\n\t\t$emailText = trim(strip_tags(str_replace(array(\"<br />\",\"<br>\",\"br/>\"),\"\\n\",$emailText)));\n\t\t$emailHtml = $this->params['body'];", " $from = $user->email;\n\t\tif (empty($from)) {\n\t\t\t$from = trim(SMTP_FROMADDRESS);\n\t\t}\n $from_name = $user->firstname.\" \".$user->lastname.\" (\".$user->username.\")\";\n\t\tif (empty($from_name)) {\n\t\t\t$from_name = trim(ORGANIZATION_NAME);\n\t\t}\n $subject = $this->params['subject'];\n\t\tif (empty($subject)) {\n $subject = gt('Email from') . ' ' . trim(ORGANIZATION_NAME);\n\t\t}\n// $headers = array(\n// \"MIME-Version\" => \"1.0\",\n// \"Content-type\" => \"text/html; charset=\" . LANG_CHARSET\n// );", " if (count($emaillist)) {\n\t\t\t$mail = new expMail();\n if (!empty($_FILES['attach']['size'])) {\n $dir = 'tmp';\n $filename = expFile::fixName(time() . '_' . $_FILES['attach']['name']);\n $dest = $dir . '/' . $filename;\n //Check to see if the directory exists. If not, create the directory structure.\n if (!file_exists(BASE . $dir)) expFile::makeDirectory($dir);\n // Move the temporary uploaded file into the destination directory, and change the name.\n $file = expFile::moveUploadedFile($_FILES['attach']['tmp_name'], BASE . $dest);\n// $finfo = finfo_open(FILEINFO_MIME_TYPE);\n// $relpath = str_replace(PATH_RELATIVE, '', BASE);\n// $ftype = finfo_file($finfo, BASE.$dest);\n// finfo_close($finfo);\n if (!empty($file)) $mail->attach_file_on_disk(BASE . $file, expFile::getMimeType(BASE . $file));\n }\n if ($this->params['batchsend']) {\n $mail->quickBatchSend(array(\n// \t'headers'=>$headers,\n 'html_message'=>$emailHtml,\n \"text_message\"=>$emailText,\n 'to'=>$emaillist,\n 'from'=>array(trim($from) => $from_name),\n 'subject'=>$subject,\n ));\n } else {\n $mail->quickSend(array(\n// \t'headers'=>$headers,\n 'html_message'=>$emailHtml,\n \"text_message\"=>$emailText,\n 'to'=>$emaillist,\n 'from'=>array(trim($from)=>$from_name),\n 'subject'=>$subject,\n ));\n }\n if (!empty($file)) unlink(BASE . $file); // delete temp file attachment\n flash('message',gt('Mass Email was sent'));\n expHistory::back();\n }\n }", " /**\n * feature to run upgrade scripts outside of installation\n *\n */\n public function install_upgrades() {\n //display the upgrade scripts\n if (is_readable(BASE.'install/upgrades')) {\n $i = 0;\n if (is_readable(BASE.'install/include/upgradescript.php')) include(BASE.'install/include/upgradescript.php');", " // first build a list of valid upgrade scripts\n $oldscripts = array(\n 'install_tables.php',\n 'convert_db_trim.php',\n 'remove_exp1_faqmodule.php',\n 'remove_locationref.php',\n 'upgrade_attachableitem_tables.php',\n );\n $ext_dirs = array(\n BASE . 'install/upgrades',\n THEME_ABSOLUTE . 'modules/upgrades'\n );\n foreach ($ext_dirs as $dir) {\n if (is_readable($dir)) {\n $dh = opendir($dir);\n while (($file = readdir($dh)) !== false) {\n if (is_readable($dir . '/' . $file) && is_file($dir . '/' . $file) && substr($file, -4, 4) == '.php' && !in_array($file,$oldscripts)) {\n include_once($dir . '/' . $file);\n $classname = substr($file, 0, -4);\n /**\n * Stores the upgradescript object\n * @var \\upgradescript $upgradescripts\n * @name $upgradescripts\n */\n $upgradescripts[] = new $classname;\n }\n }\n }\n }\n // next sort the list by priority\n usort($upgradescripts, array('upgradescript','prioritize'));", " // next run through the list\n $db_version = expVersion::dbVersion();\n $upgrade_scripts = array();\n foreach ($upgradescripts as $upgradescript) {\n if ($upgradescript->checkVersion($db_version) && $upgradescript->needed()) {\n $upgradescript->classname = get_class($upgradescript);\n $upgrade_scripts[] = $upgradescript;\n $i++;\n }\n }\n }\n assign_to_template(array(\n 'scripts'=>$upgrade_scripts,\n ));\n }", " /**\n * run selected upgrade scripts outside of installation\n *\n */\n public function install_upgrades_run() {", " $tables = expDatabase::install_dbtables();\n ksort($tables);", " // locate the upgrade scripts\n $upgrade_dir = BASE.'install/upgrades';\n if (is_readable($upgrade_dir)) {\n $i = 0;\n if (is_readable(BASE.'install/include/upgradescript.php')) include(BASE.'install/include/upgradescript.php');\n $dh = opendir($upgrade_dir);", " // first build a list of valid upgrade scripts\n $oldscripts = array(\n 'install_tables.php',\n 'convert_db_trim.php',\n 'remove_exp1_faqmodule.php',\n 'remove_locationref.php',\n 'upgrade_attachableitem_tables.php',\n );\n while (($file = readdir($dh)) !== false) {\n if (is_readable($upgrade_dir . '/' . $file) && is_file($upgrade_dir . '/' . $file) && substr($file, -4, 4) == '.php' && !in_array($file,$oldscripts)) {\n include_once($upgrade_dir . '/' . $file);\n $classname = substr($file, 0, -4);\n /**\n * Stores the upgradescript object\n * @var \\upgradescript $upgradescripts\n * @name $upgradescripts\n */\n $upgradescripts[] = new $classname;\n }\n }\n // next sort the list by priority\n usort($upgradescripts, array('upgradescript','prioritize'));", " // next run through the list\n $db_version = expVersion::dbVersion();\n $upgrade_scripts = array();\n foreach ($upgradescripts as $upgradescript) {\n if ($upgradescript->checkVersion($db_version) && $upgradescript->needed()) {\n if (!empty($this->params[get_class($upgradescript)])) {\n $upgradescript->results = $upgradescript->upgrade();\n }\n $upgradescript->classname = get_class($upgradescript);\n $upgrade_scripts[] = $upgradescript;\n $i++;\n }\n }\n }\n assign_to_template(array(\n 'scripts'=>$upgrade_scripts,\n 'tables'=>$tables,\n ));\n }", " public function manage_themes() {\n expHistory::set('manageable', $this->params);", " if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.'));\n }", " \t$themes = array();\n \tif (is_readable(BASE.'themes')) {\n \t\t$dh = opendir(BASE.'themes');\n \t\twhile (($file = readdir($dh)) !== false) {\n \t\t\tif ($file != '.' && $file != '..' && is_dir(BASE.\"themes/$file\") && is_readable(BASE.\"themes/$file/class.php\")) {\n \t\t\t\tinclude_once(BASE.\"themes/$file/class.php\");\n \t\t\t\t$theme = new $file();\n \t\t\t\t$t = new stdClass();\n\t\t\t\t $t->user_configured = isset($theme->user_configured) ? $theme->user_configured : '';\n $t->stock_theme = isset($theme->stock_theme) ? $theme->stock_theme : '';\n \t\t\t\t$t->name = $theme->name();\n \t\t\t\t$t->description = $theme->description();\n \t\t\t\t$t->author = $theme->author();", "\t\t\t\t $t->style_variations = array();\n \t\t$sv = opendir(BASE.'themes/'.$file);\n \t\twhile (($s = readdir($sv)) !== false) {\n if (substr($s,0,4) == \"css_\") {\n $t->style_variations[str_replace(\"css_\",\"\",$s)] = str_replace(\"css_\",\"\",$s);\n } elseif (substr($s,0,5) == \"less_\") {\n $t->style_variations[str_replace(\"less_\",\"\",$s)] = str_replace(\"less_\",\"\",$s);\n }\n }\n if(count($t->style_variations)>0){\n $t->style_variations = array_merge(array('Default'=>'Default'),$t->style_variations);\n }", " \t\t\t\t$t->preview = is_readable(BASE.\"themes/$file/preview.jpg\") ? PATH_RELATIVE . \"themes/$file/preview.jpg\" : YUI2_RELATIVE . \"yui2-skin-sam-editor/assets/skins/sam/blankimage.png\";\n\t\t\t\t $t->mobile = is_readable(BASE.\"themes/$file/mobile/index.php\") ? true : false;\n \t\t\t\t$themes[$file] = $t;\n \t\t\t}\n \t\t}\n \t}", " assign_to_template(array(\n 'themes'=>$themes\n ));\n }", " ", " public function theme_switch() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.'));\n }\n \texpSettings::change('DISPLAY_THEME_REAL', $this->params['theme']);\n\t expSession::set('display_theme',$this->params['theme']);\n\t $sv = isset($this->params['sv'])?$this->params['sv']:'';\n\t if (strtolower($sv)=='default') {\n\t $sv = '';\n\t }\n\t expSettings::change('THEME_STYLE_REAL',$sv);\n\t expSession::set('theme_style',$sv);\n\t expDatabase::install_dbtables(); // update tables to include any custom definitions in the new theme", " // $message = (MINIFY != 1) ? \"Exponent is now minifying Javascript and CSS\" : \"Exponent is no longer minifying Javascript and CSS\" ;\n // flash('message',$message);\n\t $message = gt(\"You have selected the\").\" '\".$this->params['theme'].\"' \".gt(\"theme\");\n\t if ($sv != '') {\n\t\t $message .= ' '.gt('with').' '.$this->params['sv'].' '.gt('style variation');\n\t }\n\t flash('message',$message);\n// expSession::un_set('framework');\n expSession::set('force_less_compile', 1);\n// expTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n \texpHistory::returnTo('manageable');", " }\t\n ", "\tpublic function theme_preview() {\n\t\texpSession::set('display_theme',$this->params['theme']);\n\t\t$sv = isset($this->params['sv'])?$this->params['sv']:'';\n\t\tif (strtolower($sv)=='default') {\n\t\t $sv = '';\n\t\t}\n\t\texpSession::set('theme_style',$sv);\n\t\t$message = gt(\"You are previewing the\").\" '\".$this->params['theme'].\"' \".gt(\"theme\");\n\t\tif ($sv) {\n\t\t\t$message .= ' with '.$sv.' style variation';\n\t\t}\n\t\tif ($this->params['theme'] != DISPLAY_THEME_REAL || $this->params['sv'] != THEME_STYLE_REAL) {\n\t\t\tflash('notice',$message);\n\t\t}\n// expSession::un_set('framework');\n expSession::set('force_less_compile', 1);\n//\t\texpTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n\t\texpHistory::back();\n\t}", "\tpublic function configure_theme() {\n\t\tif (is_readable(BASE.\"themes/\".$this->params['theme'].\"/class.php\")) {\n\t\t\tinclude_once(BASE.\"themes/\".$this->params['theme'].\"/class.php\");\n $themeclass = $this->params['theme'];\n\t\t\t$theme = new $themeclass($this->params);\n\t\t\t$theme->configureTheme();\n\t\t}\n\t}", "\tpublic function update_theme() {\n\t\tif (is_readable(BASE.\"themes/\".$this->params['theme'].\"/class.php\")) {\n\t\t\tinclude_once(BASE.\"themes/\".$this->params['theme'].\"/class.php\");\n $themeclass = $this->params['theme'];\n\t\t\t$theme = new $themeclass();\n\t\t\t$theme->saveThemeConfig($this->params);\n expSession::set('force_less_compile', 1);\n expTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n\t\t}\n\t}", " public function export_theme() {\n include_once(BASE.'external/Tar.php');", " $themeclass = $this->params['theme'];\n $fname = tempnam(BASE.'/tmp','exporter_files_');\n $tar = new Archive_Tar($fname,'gz');\n $tar->createModify(BASE.'themes/'.$themeclass,'themes/',BASE.'themes/');", " $filename = preg_replace('/[^A-Za-z0-9_.-]/','-',$themeclass.'.tar.gz');", " ob_end_clean();\n // This code was lifted from phpMyAdmin, but this is Open Source, right?", " // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';", " header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }", " $fh = fopen($fname,'rb');\n while (!feof($fh)) {\n echo fread($fh,8192);\n }\n fclose($fh);\n unlink($fname);", " exit(''); // Exit, since we are exporting.\n }", "\tpublic function togglemobile() {\n\t\tif (!expSession::is_set('mobile')) { // account for FORCE_MOBILE initial state\n\t\t\texpSession::set('mobile',MOBILE);\n\t\t}\n\t\texpSession::set('mobile',!expSession::get('mobile'));\n expSession::set('force_less_compile', 1);\n\t\texpTheme::removeSmartyCache();\n\t\texpHistory::back();\n\t}", " public function configure_site () {\n\t expHistory::set('manageable',$this->params);", " if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Site Configuration settings.'));\n }", " // TYPES OF ANTISPAM CONTROLS... CURRENTLY ONLY ReCAPTCHA\n $as_types = array(\n '0'=>'-- '.gt('Please Select an Anti-Spam Control').' --',\n \"recaptcha\"=>'reCAPTCHA'\n );", " ", " //THEMES FOR RECAPTCHA\n $as_themes = array(\n \"light\"=>gt('Light (Default)'),\n \t\"dark\"=>gt('Dark'),\n );", " ", " // Available Themes\n $themes = array();\n if (is_readable(BASE.'themes')) {\n \t$theme_dh = opendir(BASE.'themes');\n \twhile (($theme_file = readdir($theme_dh)) !== false) {\n \t\tif (is_readable(BASE.'themes/'.$theme_file.'/class.php')) {\n \t\t\t// Need to avoid the duplicate theme problem.\n \t\t\tif (!class_exists($theme_file)) {\n \t\t\t\tinclude_once(BASE.'themes/'.$theme_file.'/class.php');\n \t\t\t}", " \t\t\tif (class_exists($theme_file)) {\n \t\t\t\t// Need to avoid instantiating non-existent classes.\n \t\t\t\t$t = new $theme_file();\n \t\t\t\t$themes[$theme_file] = $t->name();\n \t\t\t}\n \t\t}\n \t}\n }\n uasort($themes,'strnatcmp');", " // Available elFinder Themes\n $elf_themes = array(''=>gt('Default/OSX'));\n if (is_readable(BASE.'external/elFinder/themes')) {\n \t$theme_dh = opendir(BASE.'external/elFinder/themes');\n \twhile (($theme_file = readdir($theme_dh)) !== false) {\n \t\tif ($theme_file != '..' && is_readable(BASE.'external/elFinder/themes/'.$theme_file.'/css/theme.css')) {\n $elf_themes['/themes/' . $theme_file] = ucwords($theme_file);\n \t\t}\n \t}\n }\n uasort($elf_themes,'strnatcmp');", " // Available Languages\n\t $langs = expLang::langList();\n// ksort($langs);", " // smtp protocol\n $protocol = array(\n 'ssl'=>'SSL',\n 'tls'=>'TLS'\n );", " // Currency Format\n $currency = expSettings::dropdownData('currency');", " // attribution\n// $attribution = array(\n// 'firstlast'=>'John Doe',\n// 'lastfirst'=>'Doe, John',\n// 'first'=>'John',\n// 'last'=>'Doe',\n// 'username'=>'jdoe'\n// );\n $attribution = expSettings::dropdownData('attribution');", " // These funcs need to be moved up in to new subsystems", " ", " // Date/Time Format\n $datetime_format = expSettings::dropdownData('datetime_format');", " // Date Format\n $date_format = expSettings::dropdownData('date_format');", " ", " // Time Format\n $time_format = expSettings::dropdownData('time_format');", " ", " // Start of Week\n// $start_of_week = glist(expSettings::dropdownData('start_of_week'));\n $daysofweek = event::dayNames();\n $start_of_week = $daysofweek['long'];", " // File Permissions\n $file_permisions = glist(expSettings::dropdownData('file_permissions'));", " ", " // File Permissions\n $dir_permissions = glist(expSettings::dropdownData('dir_permissions'));", " // Homepage Dropdown\n $section_dropdown = section::levelDropdownControlArray(0, 0, array(), false, 'view', true);", " // Timezone Dropdown\n $list = DateTimeZone::listAbbreviations();\n $idents = DateTimeZone::listIdentifiers();\n $data = $offset = $added = array();\n foreach ($list as $abbr => $info) {\n foreach ($info as $zone) {\n if (!empty($zone['timezone_id']) AND !in_array($zone['timezone_id'],$added) AND in_array($zone['timezone_id'],$idents)) {\n try{\n $z = new DateTimeZone($zone['timezone_id']);\n $c = new DateTime(null, $z);\n $zone['time'] = $c->format('H:i a');\n $data[] = $zone;\n $offset[] = $z->getOffset($c);\n $added[] = $zone['timezone_id'];\n } catch(Exception $e) {\n flash('error', $e->getMessage());\n }\n }\n }\n }", " array_multisort($offset, SORT_ASC, $data);\n $tzoptions = array();\n foreach ($data as $row) {\n $tzoptions[$row['timezone_id']] = self::formatOffset($row['offset'])\n . ' ' . $row['timezone_id'];\n }", " $expcat = new expCat();\n $cats = $expcat->find('all','module=\"file\"');\n $folders = array();\n $folders[] = 'Root Folder';\n foreach ($cats as $cat) {\n $folders[$cat->id] = $cat->title;\n }", " // profiles\n $profiles = expSettings::profiles();\n if (empty($profiles)) {\n $profiles = array('' => '(default)');\n }", " assign_to_template(array(\n 'as_types'=>$as_types,\n 'as_themes'=>$as_themes,\n 'themes'=>$themes,\n 'elf_themes'=>$elf_themes,\n 'langs'=>$langs,\n 'protocol'=>$protocol,\n 'currency'=>$currency,\n 'attribution'=>$attribution,\n 'datetime_format'=>$datetime_format,\n 'date_format'=>$date_format,\n 'time_format'=>$time_format,\n 'start_of_week'=>$start_of_week,\n 'timezones'=>$tzoptions,\n 'file_permisions'=>$file_permisions,\n 'dir_permissions'=>$dir_permissions,\n 'section_dropdown'=>$section_dropdown,\n 'folders'=>$folders,\n 'profiles'=>$profiles\n ));\n }", "\t// now you can use $options;\n\tprivate function formatOffset($offset) {\n\t\t\t$hours = $offset / 3600;\n\t\t\t$remainder = $offset % 3600;\n\t\t\t$sign = $hours > 0 ? '+' : '-';\n\t\t\t$hour = (int) abs($hours);\n\t\t\t$minutes = (int) abs($remainder / 60);", "\t\t\tif ($hour == 0 AND $minutes == 0) {\n\t\t\t\t$sign = ' ';\n\t\t\t}\n\t\t\treturn 'GMT' . $sign . str_pad($hour, 2, '0', STR_PAD_LEFT)\n\t\t\t\t\t.':'. str_pad($minutes,2, '0');", "\t}", " public function update_siteconfig () {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Site Configuration settings.'));\n } else {\n $this->params['sc']['MAINTENANCE_RETURN_TIME'] = yuicalendarcontrol::parseData('MAINTENANCE_RETURN_TIME', $this->params['sc']);\n foreach ($this->params['sc'] as $key => $value) {\n// expSettings::change($key, addslashes($value));\n expSettings::change($key, $value);\n }", " flash('message', gt(\"Your Website Configuration has been updated\"));\n }\n setcookie('slingbar-top', $this->params['sc']['SLINGBAR_TOP']);\n// expHistory::back();\n\t expHistory::returnTo('viewable');\n }", " public function change_profile() {\n if (empty($this->params['profile'])) return;\n expSession::un_set('display_theme');\n expSession::un_set('theme_style');\n// expSession::un_set('framework');\n expSession::set('force_less_compile', 1);\n expTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n expSettings::activateProfile($this->params['profile']);\n flash('message', gt(\"New Configuration Profile Loaded\") . ' (' . $this->params['profile'] . ')');\n redirect_to(array('controller'=>'administration', 'action'=>'configure_site'));\n }", " public function save_profile() {\n if (empty($this->params['profile'])) return;\n $profile = expSettings::createProfile($this->params['profile']);\n flash('message', gt(\"Configuration Profile Saved\") . ' (' . $this->params['profile'] . ')');\n// redirect_to(array('controller'=>'administration', 'action'=>'configure_site'));\n redirect_to(array('controller'=>'administration', 'action'=>'change_profile', 'profile'=>$profile));\n }", " /**\n \t * Routine to force launching exponent installer\n \t */\n \tpublic static function install_exponent() {\n \t\t// we'll need the not_configured file to exist for install routine to work\n// \t\tif (!@file_exists(BASE.'install/not_configured')) {\n// \t\t\t$nc_file = fopen(BASE.'install/not_configured', \"w\");\n// \t\t\tfclose($nc_file);\n// \t\t}\n// $page = \"\";\n// if (@file_exists(BASE.'framework/conf/config.php')) {\n// $page = \"?page=upgrade-1\";\n// }\n if (@file_exists(BASE.'install/index.php')) {\n header('Location: ' . URL_FULL . 'install/index.php');\n exit('Redirecting to the Exponent Install Wizard');\n } else {\n flash('error', gt(\"Installation files were not found\"));\n }\n \t}", "}", "/**\n * This is the base theme class\n *\n * @subpackage Controllers\n * @package Modules\n */\nclass theme {\n\tpublic $user_configured = false;\n public $stock_theme = false;", "\tfunction name() { return \"theme\"; }\n\tfunction author() { return \"\"; }\n\tfunction description() { return gt(\"The theme shell\"); }", " /**\n * @param array $params\n */\n function __construct($params = array()) {\n $this->params = $params;\n }", "\t/**\n\t * Method to Configure theme settings\n\t * This generic routine parses the theme's config.php file\n\t * and presents the values as text boxes.\n\t */\n\tfunction configureTheme () {\n\t\tif (isset($this->params['sv']) && $this->params['sv'] != '') {\n\t\t\tif (strtolower($this->params['sv'])=='default') {\n $this->params['sv']='';\n\t\t\t}\n\t\t\t$settings = expSettings::parseFile(BASE.\"themes/\".$this->params['theme'].\"/config_\".$this->params['sv'].\".php\");\n\t\t} else {\n\t\t\t$settings = expSettings::parseFile(BASE.\"themes/\".$this->params['theme'].\"/config.php\");\n\t\t}\n\t\t$form = new form();\n\t\t$form->meta('controller','administration');\n\t\t$form->meta('action','update_theme');\n\t\t$form->meta('theme',$this->params['theme']);\n\t\t$form->meta('sv',isset($this->params['sv'])?$this->params['sv']:'');\n\t\tforeach ($settings as $setting=>$key) {\n\t\t\t$form->register($setting,$setting.': ',new textcontrol($key,20));\n\t\t}\n\t\t$form->register(null,'',new htmlcontrol('<br>'));\n\t\t$form->register('submit','',new buttongroupcontrol(gt('Save'),'',gt('Cancel')));\n\t\tassign_to_template(array(\n 'name'=>$this->name().(!empty($this->params['sv'])?' '.$this->params['sv']:''),\n 'form_html'=>$form->toHTML()\n ));\n\t}", "\t/**\n\t * Method to save/update theme settings\n\t * This generic routine parses the passed params\n\t * and saves them to the theme's config.php file\n\t * It attempts to remove non-theme params such as analytics, etc..\n\t *\n\t * @param $params theme configuration parameters\n\t */\n\tfunction saveThemeConfig ($params) {\n\t\t$theme = $params['theme'];\n\t\tunset ($params['theme']);\n\t\t$sv = $params['sv'];\n\t\tif (strtolower($sv)=='default') {\n\t\t $sv='';\n\t\t}\n\t\tunset (\n $params['sv'],\n $params['controller'],\n $params['action'],\n $params['cid'],\n $params['scayt_verLang'],\n $params['slingbar-top'],\n $params['XDEBUG_SESSION']\n );\n\t\tforeach ($params as $key=>$value) {\n\t\t\tif ($key[0] == '_') {\n\t\t\t\tunset ($params[$key]);\n\t\t\t}\n\t\t}\n\t\tif (!empty($sv)) {\n\t\t\texpSettings::saveValues($params, BASE.\"themes/\".$theme.\"/config_\".$sv.\".php\");\n\t\t} else {\n\t\t\texpSettings::saveValues($params, BASE.\"themes/\".$theme.\"/config.php\");\n\t\t}\n\t\texpHistory::back();\n\t}", "}", "?>" ]
[ 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */\n/** @define \"BASE\" \"../../../..\" */", "class administrationController extends expController {\n public $basemodel_name = 'expRecord';", " protected $manage_permissions = array(\n 'change'=>'Change Settings',", "\t 'clear'=>'Clear Caches', //FIXME this requires a logged in user to perform?\n\t \"fix\"=>\"Fix Database\",\n\t \"install\"=>\"Installation\",", " 'mass'=>'Mass Mailing',\n 'save'=>'Save Settings',", "\t \"theme\"=>\"Manage Themes\",\n\t 'test_smtp'=>'Test SMTP Server Settings',\n\t 'toggle'=>'Toggle Settings',", "// 'update'=>'Update Settings',", " );", " static function displayname() { return gt(\"Administration Controls\"); }\n static function description() { return gt(\"This is the Administration Module\"); }", " static function hasSources() {\n return false;\n }", "\tpublic function install_tables() {\n\t\t$tables = expDatabase::install_dbtables();\n\t\tksort($tables);\n assign_to_template(array(\n 'status'=>$tables\n ));\n\t}", " public function delete_unused_columns() {\n \t\t$tables = expDatabase::install_dbtables(true);\n \t\tksort($tables);\n assign_to_template(array(\n 'status'=>$tables\n ));\n \t}", " public function manage_unused_tables() {\n global $db;", "", " expHistory::set('manageable', $this->params);\n $unused_tables = array();\n $used_tables = array();\n $tables = $db->getTables();\n //eDebug($tables);", "\t\t// first the core and 1.0 definitions\n\t\t$coredefs = BASE.'framework/core/definitions';\n\t\tif (is_readable($coredefs)) {\n\t\t\t$dh = opendir($coredefs);\n\t\t\twhile (($file = readdir($dh)) !== false) {\n\t\t\t\tif (is_readable(\"$coredefs/$file\") && is_file(\"$coredefs/$file\") && substr($file,-4,4) == \".php\" && substr($file,-9,9) != \".info.php\") {\n\t\t\t\t\t$used_tables[]= strtolower(substr($file,0,-4));\n\t\t\t\t}\n\t\t\t}\n\t\t}", "\t // then search for module definitions\n $moddefs = array(\n BASE.'themes/'.DISPLAY_THEME_REAL.'/modules', // we only want to do this for the set theme, NOT the preview theme\n BASE.\"framework/modules\",\n );\n foreach ($moddefs as $moddef) {\n if (is_readable($moddef)) {\n $dh = opendir($moddef);\n while (($file = readdir($dh)) !== false) {\n if (is_dir($moddef.'/'.$file) && ($file != '..' && $file != '.')) {\n $dirpath = $moddef.'/'.$file.'/definitions';\n if (file_exists($dirpath)) {\n $def_dir = opendir($dirpath);\n while (($def = readdir($def_dir)) !== false) {\n if (is_readable(\"$dirpath/$def\") && is_file(\"$dirpath/$def\") && substr($def,-4,4) == \".php\" && substr($def,-9,9) != \".info.php\") {\n if ((!in_array(substr($def,0,-4), $used_tables))) {\n $used_tables[] = strtolower(substr($def,0,-4));\n }\n }\n }\n }\n }\n }\n }\n }", " foreach($tables as $table) {\n $basename = strtolower(str_replace($db->prefix, '', $table));\n if (!in_array($basename, $used_tables) && !stristr($basename, 'forms')) {\n $unused_tables[$basename] = new stdClass();\n $unused_tables[$basename]->name = $table;\n $unused_tables[$basename]->rows = $db->countObjects($basename);\n }\n }", "", " assign_to_template(array(\n 'unused_tables'=>$unused_tables\n ));\n }", "", " public function delete_unused_tables() {\n global $db;", " $count = 0;\n foreach($this->params['tables'] as $del=>$table) {\n $basename = str_replace($db->prefix, '', $table);\n $count += $db->dropTable($basename);\n }", "", " flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.');\n expHistory::back();\n }", "\tpublic function fix_optimize_database() {\n\t global $db;", "\t\t$before = $db->databaseInfo();\n\t\tforeach (array_keys($before) as $table) {\n\t\t\t$db->optimize($table);\n\t\t}\n\t\t$after = $db->databaseInfo();\n\t assign_to_template(array(\n 'before'=>$before,\n 'after'=>$after\n ));\n\t}\n", "//\tpublic function fix_sessions() {\n//\t global $db;\n//\n////\t\t$test = $db->sql('CHECK TABLE '.$db->prefix.'sessionticket');\n//\t\t$fix = $db->sql('REPAIR TABLE '.$db->prefix.'sessionticket');\n//\t\tflash('message', gt('Sessions Table was Repaired'));\n//\t\texpHistory::back();\n//\t}", "\n\tpublic function fix_database() {\n\t global $db;", "\t// upgrade sectionref's that have lost their originals\n// $no_origs = array();\n//\t\t$sectionrefs = $db->selectObjects('sectionref',\"is_original=0\");\n//\t\tif (count($sectionrefs)) {\n//\t\t\tprint_r(gt(\"Found\").\": \".count($sectionrefs).\" \".gt(\"copies (not originals)\").\"<br>\");\n// foreach ($sectionrefs as $sectionref) {\n// if ($db->selectObject('sectionref',\"module='\".$sectionref->module.\"' AND source='\".$sectionref->source.\"' AND is_original='1'\") == null) {\n// // There is no original for this sectionref so change it to the original\n// $sectionref->is_original = 1;\n// $db->updateObject($sectionref,\"sectionref\");\n// $no_origs[] = gt(\"Fixed\").\": \".$sectionref->module.\" - \".$sectionref->source;\n// }\n// }\n//\t\t}\n// assign_to_template(array(\n// 'no_origs'=>$no_origs,\n// ));", "\t// upgrade sectionref's that point to missing sections (pages)\n\t\t$sectionrefs = $db->selectObjects('sectionref',\"refcount!=0\");\n\t\t$no_sections = array();\n\t\tforeach ($sectionrefs as $sectionref) {\n\t\t\tif ($db->selectObject('section',\"id='\".$sectionref->section.\"'\") == null) {\n\t\t\t// There is no section/page for sectionref so change the refcount\n\t\t\t\t$sectionref->refcount = 0;\n\t\t\t\t$db->updateObject($sectionref,\"sectionref\");\n $no_sections[] = gt(\"Fixed\").\": \".$sectionref->module.\" - \".$sectionref->source;\n\t\t\t}\n\t\t}\n assign_to_template(array(\n 'no_sections'=>$no_sections,\n ));", "\t // delete sectionref's that have empty sources since they are dead\n\t\t $sectionrefs = $db->selectObjects('sectionref','source=\"\"');\n $no_assigns = array();\n\t\t if ($sectionrefs != null) {\n $no_assigns[] = gt(\"Removing\").\": \".count($sectionrefs).\" \".gt(\"empty sectionrefs (no source)\");\n\t\t\t $db->delete('sectionref','source=\"\"');\n\t\t }\n assign_to_template(array(\n 'no_assigns'=>$no_assigns,\n ));", "\t// add missing sectionrefs based on existing containers (fixes aggregation problem)\n\t\t$containers = $db->selectObjects('container',1);\n $missing_sectionrefs = array();\n\t\tforeach ($containers as $container) {\n\t\t\t$iloc = expUnserialize($container->internal);\n\t\t\tif ($db->selectObject('sectionref',\"module='\".$iloc->mod.\"' AND source='\".$iloc->src.\"'\") == null) {\n\t\t\t// There is no sectionref for this container. Populate sectionref\n if ($container->external != \"N;\") {\n $newSecRef = new stdClass();\n $newSecRef->module = $iloc->mod;\n $newSecRef->source = $iloc->src;\n $newSecRef->internal = '';\n $newSecRef->refcount = 1;\n// $newSecRef->is_original = 1;\n\t\t\t\t\t$eloc = expUnserialize($container->external);", "", " $section = $db->selectObject('sectionref',\"module='container' AND source='\".$eloc->src.\"'\");\n\t\t\t\t\tif (!empty($section)) {\n\t\t\t\t\t\t$newSecRef->section = $section->id;\n\t\t\t\t\t\t$db->insertObject($newSecRef,\"sectionref\");\n\t\t\t\t\t\t$missing_sectionrefs[] = gt(\"Missing sectionref for container replaced\").\": \".$iloc->mod.\" - \".$iloc->src.\" - PageID #\".$section->id;\n\t\t\t\t\t} else {\n $db->delete('container','id=\"'.$container->id.'\"');\n $missing_sectionrefs[] = gt(\"Cant' find the container page for container\").\": \".$iloc->mod.\" - \".$iloc->src.' - '.gt('deleted');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n assign_to_template(array(\n 'missing_sectionrefs'=>$missing_sectionrefs,\n ));\n\t}", " public function fix_tables() {\n $renamed = expDatabase::fix_table_names();\n assign_to_template(array(\n 'tables'=>$renamed,\n ));\n \t}", " public function install_ecommerce_tables() {\n global $db;", " $eql = BASE . \"install/samples/ecommerce.eql\";\n if (file_exists($eql)) {\n $errors = array();\n expFile::restoreDatabase($eql,$errors);\n } else {\n $errors = array(gt('The file does not exist'));\n }\n if (DEVELOPMENT && count($errors)) {\n $msg = gt('Errors were encountered importing the e-Commerce data.').'<ul>';\n foreach ($errors as $e) $msg .= '<li>'.$e.'</li>';\n $msg .= '</ul>';\n flash('error',$msg);\n } else {\n flash('message',gt('e-Commerce data was added to your database.'));\n }\n expHistory::back();\n \t}", " public function toolbar() {\n// global $user;", " $menu = array();\n\t\t$dirs = array(\n\t\t\tBASE.'framework/modules/administration/menus',\n\t\t\tBASE.'themes/'.DISPLAY_THEME.'/modules/administration/menus'\n\t\t);", "\t\tforeach ($dirs as $dir) {\n\t\t if (is_readable($dir)) {\n\t\t\t $dh = opendir($dir);\n\t\t\t while (($file = readdir($dh)) !== false) {\n\t\t\t\t if (substr($file,-4,4) == '.php' && is_readable($dir.'/'.$file) && is_file($dir.'/'.$file)) {\n\t\t\t\t\t $menu[substr($file,0,-4)] = include($dir.'/'.$file);\n if (empty($menu[substr($file,0,-4)])) unset($menu[substr($file,0,-4)]);\n\t\t\t\t }\n\t\t\t }\n\t\t }\n\t\t}", " // sort the top level menus alphabetically by filename", "\t\tksort($menu);", "\t\t$sorted = array();\n\t\tforeach($menu as $m) $sorted[] = $m;", "", " // slingbar position\n if (isset($_COOKIE['slingbar-top'])){\n $top = $_COOKIE['slingbar-top'];\n } else {\n $top = SLINGBAR_TOP;\n }", "", "\t\tassign_to_template(array(\n 'menu'=>(bs3()) ? $sorted : json_encode($sorted),\n \"top\"=>$top\n ));\n }", "", "// public function index() {\n// redirect_to(array('controller'=>'administration', 'action'=>'toolbar'));\n//// $this->toolbar();\n// }", "", " public function update_SetSlingbarPosition() {\n setcookie('slingbar-top', $this->params['top']);\n expHistory::back();\n }", " public function manage_lang() {\n global $default_lang, $cur_lang;", " // Available Languages\n\t $langs = expLang::langList();\n $num_missing = 0;\n foreach ($default_lang as $key => $value) {\n if (!array_key_exists($key,$cur_lang)) $num_missing++;\n }\n $num_untrans = 0;\n foreach ($cur_lang as $key => $value) {\n if ($key == $value) $num_untrans++;\n }\n assign_to_template(array(\n 'langs'=>$langs,\n 'missing'=>$num_missing,\n \"count\"=>count($cur_lang),\n 'untrans'=>$num_untrans\n ));\n \t}", " public function update_language() {\n expSettings::change('LANGUAGE', $this->params['newlang']);\n flash('message',gt('Display Language changed to').\": \".$this->params['newlang']);\n redirect_to(array('controller'=>'administration', 'action'=>'manage_lang'));\n// $this->manage_lang();\n \t}", " public function manage_lang_await() {\n global $cur_lang;", " $awaiting_trans = array();\n foreach ($cur_lang as $key => $value) {\n if ($key == $value) {\n $awaiting_trans[$key] = stripslashes($value);\n }\n }\n assign_to_template(array(\n 'await'=>$awaiting_trans\n ));\n \t}", " public function save_newlangfile() {\n\t\t$result = expLang::createNewLangFile($this->params['newlang']);\n flash($result['type'],$result['message']);\n if ($result['type'] != 'error') {\n expSettings::change('LANGUAGE', $this->params['newlang']);\n expLang::createNewLangInfoFile($this->params['newlang'],$this->params['newauthor'],$this->params['newcharset'],$this->params['newlocale']);\n flash('message',gt('Display Language changed to').\": \".$this->params['newlang']);\n }\n redirect_to(array('controller'=>'administration', 'action'=>'manage_lang'));\n// $this->manage_lang();\n \t}", "\tpublic function test_smtp() {\n\t\t$smtp = new expMail();\n\t\t$smtp->test();\n\t}", " public function toggle_minify() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Minification settings.'));\n } else {\n $newvalue = (MINIFY == 1) ? 0 : 1;\n expSettings::change('MINIFY', $newvalue);\n $message = ($newvalue) ? gt(\"Exponent is now minifying Javascript and CSS\") : gt(\n \"Exponent is no longer minifying Javascript and CSS\"\n );\n flash('message', $message);\n }\n \texpHistory::back();\n }", "", "\tpublic function toggle_dev() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Error Reporting settings.'));\n } else {\n $newvalue = (DEVELOPMENT == 1) ? 0 : 1;\n expSettings::change('DEVELOPMENT', $newvalue);\n// expTheme::removeCss();\n expCSS::updateCoreCss(); // go ahead and rebuild the core .css files\n $message = ($newvalue) ? gt(\"Exponent is now in 'Development' mode\") : gt(\n \"Exponent is no longer in 'Development' mode\"\n );\n flash('message', $message);\n }\n\t\texpHistory::back();\n\t}", " public function toggle_log() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Logging settings.'));\n } else {\n $newvalue = (LOGGER == 1) ? 0 : 1;\n expSettings::change('LOGGER', $newvalue);\n }\n \t\texpHistory::back();\n \t}", "\tpublic function toggle_maintenance() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Maintenance settings.'));\n } else {\n $newvalue = (MAINTENANCE_MODE == 1) ? 0 : 1;\n expSettings::change('MAINTENANCE_MODE', $newvalue);\n MAINTENANCE_MODE == 1 ? flash('message', gt(\"Exponent is no longer in 'Maintenance' mode\")) : \"\";\n }\n\t\texpHistory::back();\n\t}", " public function toggle_workflow() {\n global $db;", " if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Site Configuration settings.'));\n } else {\n $newvalue = (ENABLE_WORKFLOW == 1) ? 0 : 1;\n expSettings::change('ENABLE_WORKFLOW', $newvalue);\n $models = expModules::initializeModels();\n if ($newvalue) {\n // workflow is now turned on, initialize by approving all items\n expDatabase::install_dbtables(true, $newvalue); // force a strict table update to add workflow columns\n foreach ($models as $modelname => $modelpath) {\n $model = new $modelname();\n if ($model->supports_revisions) {\n $db->columnUpdate($model->tablename, 'approved', 1, 'approved=0');\n }\n }\n } else {\n // workflow is now turned off, remove older revisions\n foreach ($models as $modelname => $modelpath) {\n $model = new $modelname();\n if ($model->supports_revisions) {\n $items = $model->find();\n foreach ($items as $item) {\n $db->trim_revisions($model->tablename, $item->id, 1, $newvalue);\n }\n }\n }\n expDatabase::install_dbtables(\n true,\n $newvalue\n ); // force a strict table update to remove workflow columns\n }\n $message = ($newvalue) ? gt(\"Exponent 'Workflow' is now ON\") : gt(\"Exponent 'Workflow' is now OFF\");\n flash('message', $message);\n }\n \t\texpHistory::back();\n \t}", "\tpublic function toggle_preview() {\n\t\t$level = 99;\n\t\tif (expSession::is_set('uilevel')) {\n\t\t\t$level = expSession::get('uilevel');\n\t\t}\n\t\tif ($level == UILEVEL_PREVIEW) {\n\t\t\texpSession::un_set('uilevel');\n\t\t} else { //edit mode\n\t\t\texpSession::set(\"uilevel\",UILEVEL_PREVIEW);\n\t\t}\n\t\t$message = ($level == UILEVEL_PREVIEW) ? gt(\"Exponent is no longer in 'Preview' mode\") : gt(\"Exponent is now in 'Preview' mode\") ;\n\t\tflash('message',$message);\n\t\texpHistory::back();\n\t}", " public function manage_version() {\n expSession::un_set('update-check'); // reset the already checked flag\n if (!expVersion::checkVersion(true)) {\n flash('message', gt('Your version of Exponent CMS is current.'));\n }\n \t\texpHistory::back();\n \t}", "\tpublic function clear_smarty_cache() {\n\t\texpTheme::clearSmartyCache();\n expSession::clearAllUsersSessionCache();\n }", "\tpublic function clear_css_cache() {\n\t\texpTheme::removeCss();\n expSession::set('force_less_compile', 1);\n expCSS::updateCoreCss(); // go ahead and rebuild the core .css files\n\t\tflash('message',gt(\"CSS/Minify Cache has been cleared\"));\n\t\texpHistory::back();\n\t}", "\tpublic function clear_image_cache() {\n\t\texpFile::removeFilesInDirectory(BASE.'tmp/pixidou');\n\t\tif (file_exists(BASE.'tmp/img_cache'))\n expFile::removeFilesInDirectory(BASE.'tmp/img_cache');\n\t\tflash('message',gt(\"Image/Pixidou Cache has been cleared\"));\n\t\texpHistory::back();\n\t}", "\tpublic function clear_rss_cache() {\n\t\texpFile::removeFilesInDirectory(BASE.'tmp/rsscache');\n\t\tflash('message',gt(\"RSS/Podcast/Twitter Cache has been cleared\"));\n\t\texpHistory::back();\n\t}", "\tpublic static function clear_all_caches() {\n\t\texpTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache(); // clear the session cache for true 'clear all'\n expHistory::flush(); // clear the history\n expSession::un_set('framework');\n expSession::un_set('display_theme');\n expSession::un_set('theme_style');\n\t\texpTheme::removeCss();\n expSession::set('force_less_compile', 1);\n expCSS::updateCoreCss(); // go ahead and rebuild the core .css files\n\t\texpFile::removeFilesInDirectory(BASE.'tmp/pixidou');\n\t\tif (file_exists(BASE.'tmp/img_cache'))\n expFile::removeFilesInDirectory(BASE.'tmp/img_cache');\n if (file_exists(BASE.'tmp/elfinder'))\n expFile::removeFilesInDirectory(BASE.'tmp/elfinder');\n\t\tif (file_exists(BASE.'tmp/extensionuploads'))\n expFile::removeFilesInDirectory(BASE.'tmp/extensionuploads');\n\t\texpFile::removeFilesInDirectory(BASE.'tmp/rsscache');\n\t\tflash('message',gt(\"All the System Caches have been cleared\"));\n\t\texpHistory::back();\n\t}", "\tpublic function install_extension() {", "\t\t$modsurl =array(\n\t\t\t'themes'=>'http://www.exponentcms.org/rss/feed/title/exponentcms-themes',\n\t\t\t'fixes'=>'http://www.exponentcms.org/rss/feed/title/exponentcms-fixes',\n\t\t\t'mods'=>'http://www.exponentcms.org/rss/feed/title/exponentcms-mods'\n\t\t);", "\t\t$RSS = new SimplePie();\n\t\t$RSS->set_cache_location(BASE.'tmp/rsscache'); // default is ./cache\n//\t $RSS->set_cache_duration(3600); // default if 3600\n\t\t$RSS->set_timeout(20); // default is 10\n//\t $RSS->set_output_encoding('UTF-8'); // which is the default\n\t\t$items['themes'] = array();\n\t\t$items['fixes'] = array();\n\t\t$items['mods'] = array();\n\t\tforeach($modsurl as $type=>$url) {\n\t\t $RSS->set_feed_url($url);\n\t\t $feed = $RSS->init();\n\t\t if (!$feed) {\n\t\t // an error occurred in the rss.\n\t\t continue;\n\t\t }\n\t\t\t$RSS->handle_content_type();\n\t\t foreach ($RSS->get_items() as $rssItem) {\n\t\t $rssObject = new stdClass();\n\t\t $rssObject->title = $rssItem->get_title();\n\t\t $rssObject->body = $rssItem->get_description();\n\t\t $rssObject->rss_link = $rssItem->get_permalink();\n\t\t $rssObject->publish = $rssItem->get_date('U');\n\t\t $rssObject->publish_date = $rssItem->get_date('U');\n\t\t\t\tforeach ($rssItem->get_enclosures() as $enclosure) {\n\t\t\t\t\t$rssObject->enclosure = $enclosure->get_link();\n $rssObject->length = $enclosure->get_length();\n\t\t\t\t}\n\t\t $items[$type][] = $rssObject;\n\t\t }\n\t\t}", "//\t\t$form = new form();\n// $form->meta('module','administration');\n// $form->meta('action','install_extension_confirm');\n//\t\t$form->register(null,'',new htmlcontrol(expCore::maxUploadSizeMessage()));\n//\t\t$form->register('mod_archive','Extension Archive',new uploadcontrol());\n// $form->register('patch',gt('Patch Exponent CMS or Install Theme?'),new checkboxcontrol(false,false),null,null,gt('All extensions are normally placed within the CURRENT theme (folder)'));\n// $form->register('submit','',new buttongroupcontrol(gt('Upload Extension')));", "\t\tassign_to_template(array(\n 'themes'=>$items['themes'],\n 'fixes'=>$items['fixes'],\n 'mods'=>$items['mods'],\n// 'form_html'=>$form->toHTML()\n ));\n\t}", "\tpublic function install_extension_confirm() {\n if (!empty($this->params['files'])) {\n foreach ($this->params['files'] as $title=>$url) {\n $filename = tempnam(\"tmp/extensionuploads/\",'tmp');\n expCore::saveData($url,$filename);\n $_FILES['mod_archive']['name'] = end(explode(\"/\", $url));\n// $finfo = finfo_open(FILEINFO_MIME);\n// $mimetype = finfo_file($finfo, $filename);\n// finfo_close($finfo);\n// $_FILES['mod_archive']['type'] = $mimetype;\n $_FILES['mod_archive']['tmp_name'] = $filename;\n $_FILES['mod_archive']['error'] = 0;\n $_FILES['mod_archive']['size'] = filesize($filename);\n }\n }\n if ($_FILES['mod_archive']['error'] != UPLOAD_ERR_OK) {\n\t\t\tswitch($_FILES['mod_archive']['error']) {\n\t\t\t\tcase UPLOAD_ERR_INI_SIZE:\n\t\t\t\tcase UPLOAD_ERR_FORM_SIZE:\n\t\t\t\t\tflash('error', gt('The file you uploaded exceeded the size limits for the server.'));\n\t\t\t\t\tbreak;\n\t\t\t\tcase UPLOAD_ERR_PARTIAL:\n\t\t\t\t\tflash('error', gt('The file you uploaded was only partially uploaded.'));\n\t\t\t\t\tbreak;\n\t\t\t\tcase UPLOAD_ERR_NO_FILE:\n\t\t\t\t\tflash('error', gt('No file was uploaded.'));\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\t$basename = basename($_FILES['mod_archive']['name']);\n\t\t\t// Check future radio buttons; for now, try auto-detect\n\t\t\t$compression = null;\n\t\t\t$ext = '';\n\t\t\tif (substr($basename,-4,4) == '.tar') {\n\t\t\t\t$compression = null;\n\t\t\t\t$ext = '.tar';\n\t\t\t} else if (substr($basename,-7,7) == '.tar.gz') {\n\t\t\t\t$compression = 'gz';\n\t\t\t\t$ext = '.tar.gz';\n\t\t\t} else if (substr($basename,-4,4) == '.tgz') {\n\t\t\t\t$compression = 'gz';\n\t\t\t\t$ext = '.tgz';\n\t\t\t} else if (substr($basename,-8,8) == '.tar.bz2') {\n\t\t\t\t$compression = 'bz2';\n\t\t\t\t$ext = '.tar.bz2';\n\t\t\t} else if (substr($basename,-4,4) == '.zip') {\n\t\t\t\t$compression = 'zip';\n\t\t\t\t$ext = '.zip';\n\t\t\t}", "\t\t\tif ($ext == '') {\n\t\t\t\tflash('error', gt('Unknown archive format. Archives must either be regular ZIP files, TAR files, Gzipped Tarballs, or Bzipped Tarballs.'));\n\t\t\t} else {", "\t\t\t\t// Look for stale sessid directories:\n\t\t\t\t$sessid = session_id();\n\t\t\t\tif (file_exists(BASE.\"tmp/extensionuploads/$sessid\") && is_dir(BASE.\"tmp/extensionuploads/$sessid\")) expFile::removeDirectory(\"tmp/extensionuploads/$sessid\");\n\t\t\t\t$return = expFile::makeDirectory(\"tmp/extensionuploads/$sessid\");\n\t\t\t\tif ($return != SYS_FILES_SUCCESS) {\n\t\t\t\t\tswitch ($return) {\n\t\t\t\t\t\tcase SYS_FILES_FOUNDFILE:\n\t\t\t\t\t\tcase SYS_FILES_FOUNDDIR:\n\t\t\t\t\t\t\tflash('error', gt('Found a file in the directory path when creating the directory to store the files in.'));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase SYS_FILES_NOTWRITABLE:\n\t\t\t\t\t\t\tflash('error', gt('Destination parent is not writable.'));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase SYS_FILES_NOTREADABLE:\n\t\t\t\t\t\t\tflash('error', gt('Destination parent is not readable.'));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}", "\t\t\t\t$dest = BASE.\"tmp/extensionuploads/$sessid/archive$ext\";\n if (is_uploaded_file($_FILES['mod_archive']['tmp_name'])) {\n\t\t\t\t move_uploaded_file($_FILES['mod_archive']['tmp_name'],$dest);\n } else {\n rename($_FILES['mod_archive']['tmp_name'],$dest);\n }", "\t\t\t\tif ($compression != 'zip') {// If not zip, must be tar\n\t\t\t\t\tinclude_once(BASE.'external/Tar.php');", "\t\t\t\t\t$tar = new Archive_Tar($dest,$compression);", "\t\t\t\t\tPEAR::setErrorHandling(PEAR_ERROR_PRINT);\n\t\t\t\t\t$return = $tar->extract(dirname($dest));\n\t\t\t\t\tif (!$return) {\n\t\t\t\t\t\tflash('error',gt('Error extracting TAR archive'));\n\t\t\t\t\t} else {\n//\t\t\t\t\t\theader('Location: ' . URL_FULL . 'index.php?module=administrationmodule&action=verify_extension&type=tar');\n//\t\t\t\t\t\tself::verify_extension('tar');\n\t\t\t\t\t}\n\t\t\t\t} else { // must be zip\n\t\t\t\t\tinclude_once(BASE.'external/Zip.php');", "\t\t\t\t\t$zip = new Archive_Zip($dest);", "\t\t\t\t\tPEAR::setErrorHandling(PEAR_ERROR_PRINT);\n\t\t\t\t\tif ($zip->extract(array('add_path'=>dirname($dest))) == 0) {\n\t\t\t\t\t\tflash('error',gt('Error extracting ZIP archive').': '.$zip->_error_code . ' : ' . $zip->_error_string . '<br />');\n\t\t\t\t\t} else {\n//\t\t\t\t\t\theader('Location: ' . URL_FULL . 'index.php?module=administrationmodule&action=verify_extension&type=zip');\n//\t\t\t\t\t\tself::verify_extension('zip');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$sessid = session_id();\n\t\t\t\t$files = array();\n\t\t\t\tforeach (expFile::listFlat(BASE.'tmp/extensionuploads/'.$sessid,true,null,array(),BASE.'tmp/extensionuploads/'.$sessid) as $key=>$f) {\n\t\t\t\t\tif ($key != '/archive.tar' && $key != '/archive.tar.gz' && $key != '/archive.tar.bz2' && $key != '/archive.zip') {\n if (empty($this->params['patch']) || !$this->params['patch']) {\n $key = substr($key,1);\n if (substr($key,0,7)=='themes/') {\n $parts = explode('/',$key);\n $parts[1] = DISPLAY_THEME_REAL;\n $file = implode('/',$parts);\n } else {\n $file = 'themes/'.DISPLAY_THEME_REAL.'/'.str_replace(\"framework/\", \"\", $key);\n }\n $file = str_replace(\"modules-1\", \"modules\", $file);\n } else {\n $file = substr($key,1);\n }\n\t\t\t\t\t\t$files[] = array(\n\t\t\t\t\t\t\t'absolute'=>$file,\n\t\t\t\t\t\t\t'relative'=>$f,\n\t\t\t\t\t\t\t'canCreate'=>expFile::canCreate(BASE.$file,1),\n\t\t\t\t\t\t\t'ext'=>substr($f,-3,3)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tassign_to_template(array(\n 'relative'=>'tmp/extensionuploads/'.$sessid,\n 'files'=>$files,\n 'patch'=>empty($this->params['patch'])?0:$this->params['patch']\n ));\n\t\t\t}\n\t\t}\n\t}", "\tpublic function install_extension_finish() {\n $patch =$this->params['patch']==1;\n\t\t$sessid = session_id();\n\t\tif (!file_exists(BASE.\"tmp/extensionuploads/$sessid\") || !is_dir(BASE.\"tmp/extensionuploads/$sessid\")) {\n\t\t\t$nofiles = 1;\n\t\t} else {\n\t\t\t$success = array();\n\t\t\tforeach (array_keys(expFile::listFlat(BASE.\"tmp/extensionuploads/$sessid\",true,null,array(),BASE.\"tmp/extensionuploads/$sessid\")) as $file) {\n\t\t\t\tif ($file != '/archive.tar' && $file != '/archive.tar.gz' && $file != 'archive.tar.bz2' && $file != '/archive.zip') {\n if ($patch) { // this is a patch/fix extension\n expFile::makeDirectory(dirname($file));\n $success[$file] = copy(BASE.\"tmp/extensionuploads/$sessid\".$file,BASE.substr($file,1));\n if (basename($file) == 'views_c') chmod(BASE.substr($file,1),0777);\n } else {\n $newfile = substr($file,1);\n if (substr($newfile,0,7)=='themes/') { // this is a theme extension\n $parts = explode('/',$newfile);\n $parts[1] = DISPLAY_THEME_REAL;\n $newfile = implode('/',$parts);\n } else { // this is a mod extension\n $newfile = str_replace(\"framework/\", \"\", $newfile);\n $newfile = 'themes/'.DISPLAY_THEME_REAL.'/'.str_replace(\"modules-1\", \"modules\", $newfile);\n }\n expFile::makeDirectory(dirname($newfile));\n $success[$newfile] = copy(BASE.\"tmp/extensionuploads/$sessid\".$file,BASE.$newfile);\n }\n\t\t\t\t}\n\t\t\t}", "\t\t\t$del_return = expFile::removeDirectory(BASE.\"tmp/extensionuploads/$sessid\"); //FIXME shouldn't use echo\n//\t\t\techo $del_return;\n $tables = expDatabase::install_dbtables();\n ksort($tables);\n assign_to_template(array(\n 'tables'=>$tables\n ));\n\t\t\t$nofiles = 0;\n\t\t}", "\t\tassign_to_template(array(\n 'nofiles'=>$nofiles,\n 'success'=>$success,\n 'redirect'=>expHistory::getLastNotEditable()\n ));\n\t}", " public function mass_mail() {\n // nothing we need to do except display view\n }", " public function mass_mail_out() {\n global $user;", " $emaillist = array();\n if (!empty($this->params['allusers'])) {\n foreach (user::getAllUsers() as $u) {\n $emaillist[$u->email] = user::getUserAttribution($u->id);\n }\n } else {\n if(!empty($this->params['group_list'])) {\n foreach (listbuildercontrol::parseData($this->params,'grouplist') as $group_id) {\n $grpusers = group::getUsersInGroup($group_id);\n foreach ($grpusers as $u) {\n $emaillist[$u->email] = user::getUserAttribution($u->id);\n }\n }\n }\n if(!empty($this->params['user_list'])) {\n foreach (listbuildercontrol::parseData($this->params,'user_list') as $user_id) {\n $u = user::getUserById($user_id);\n $emaillist[$u->email] = user::getUserAttribution($u->id);\n }\n }\n if(!empty($this->params['address_list'])) {\n foreach (listbuildercontrol::parseData($this->params,'address_list') as $email) {\n $emaillist[] = $email;\n }\n }\n }", " //This is an easy way to remove duplicates\n $emaillist = array_flip(array_flip($emaillist));\n $emaillist = array_map('trim', $emaillist);", " if (empty($emaillist)) {\n $post = empty($_POST) ? array() : expString::sanitize($_POST);\n expValidator::failAndReturnToForm(gt('No Mailing Recipients Selected!'), $post);\n }\n if (empty($this->params['subject']) && empty($this->params['body']) && empty($_FILES['attach']['size'])) {\n $post = empty($_POST) ? array() : expString::sanitize($_POST);\n expValidator::failAndReturnToForm(gt('Nothing to Send!'), $post);\n }", " $emailText = $this->params['body'];\n\t\t$emailText = trim(strip_tags(str_replace(array(\"<br />\",\"<br>\",\"br/>\"),\"\\n\",$emailText)));\n\t\t$emailHtml = $this->params['body'];", " $from = $user->email;\n\t\tif (empty($from)) {\n\t\t\t$from = trim(SMTP_FROMADDRESS);\n\t\t}\n $from_name = $user->firstname.\" \".$user->lastname.\" (\".$user->username.\")\";\n\t\tif (empty($from_name)) {\n\t\t\t$from_name = trim(ORGANIZATION_NAME);\n\t\t}\n $subject = $this->params['subject'];\n\t\tif (empty($subject)) {\n $subject = gt('Email from') . ' ' . trim(ORGANIZATION_NAME);\n\t\t}\n// $headers = array(\n// \"MIME-Version\" => \"1.0\",\n// \"Content-type\" => \"text/html; charset=\" . LANG_CHARSET\n// );", " if (count($emaillist)) {\n\t\t\t$mail = new expMail();\n if (!empty($_FILES['attach']['size'])) {\n $dir = 'tmp';\n $filename = expFile::fixName(time() . '_' . $_FILES['attach']['name']);\n $dest = $dir . '/' . $filename;\n //Check to see if the directory exists. If not, create the directory structure.\n if (!file_exists(BASE . $dir)) expFile::makeDirectory($dir);\n // Move the temporary uploaded file into the destination directory, and change the name.\n $file = expFile::moveUploadedFile($_FILES['attach']['tmp_name'], BASE . $dest);\n// $finfo = finfo_open(FILEINFO_MIME_TYPE);\n// $relpath = str_replace(PATH_RELATIVE, '', BASE);\n// $ftype = finfo_file($finfo, BASE.$dest);\n// finfo_close($finfo);\n if (!empty($file)) $mail->attach_file_on_disk(BASE . $file, expFile::getMimeType(BASE . $file));\n }\n if ($this->params['batchsend']) {\n $mail->quickBatchSend(array(\n// \t'headers'=>$headers,\n 'html_message'=>$emailHtml,\n \"text_message\"=>$emailText,\n 'to'=>$emaillist,\n 'from'=>array(trim($from) => $from_name),\n 'subject'=>$subject,\n ));\n } else {\n $mail->quickSend(array(\n// \t'headers'=>$headers,\n 'html_message'=>$emailHtml,\n \"text_message\"=>$emailText,\n 'to'=>$emaillist,\n 'from'=>array(trim($from)=>$from_name),\n 'subject'=>$subject,\n ));\n }\n if (!empty($file)) unlink(BASE . $file); // delete temp file attachment\n flash('message',gt('Mass Email was sent'));\n expHistory::back();\n }\n }", " /**\n * feature to run upgrade scripts outside of installation\n *\n */\n public function install_upgrades() {\n //display the upgrade scripts\n if (is_readable(BASE.'install/upgrades')) {\n $i = 0;\n if (is_readable(BASE.'install/include/upgradescript.php')) include(BASE.'install/include/upgradescript.php');", " // first build a list of valid upgrade scripts\n $oldscripts = array(\n 'install_tables.php',\n 'convert_db_trim.php',\n 'remove_exp1_faqmodule.php',\n 'remove_locationref.php',\n 'upgrade_attachableitem_tables.php',\n );\n $ext_dirs = array(\n BASE . 'install/upgrades',\n THEME_ABSOLUTE . 'modules/upgrades'\n );\n foreach ($ext_dirs as $dir) {\n if (is_readable($dir)) {\n $dh = opendir($dir);\n while (($file = readdir($dh)) !== false) {\n if (is_readable($dir . '/' . $file) && is_file($dir . '/' . $file) && substr($file, -4, 4) == '.php' && !in_array($file,$oldscripts)) {\n include_once($dir . '/' . $file);\n $classname = substr($file, 0, -4);\n /**\n * Stores the upgradescript object\n * @var \\upgradescript $upgradescripts\n * @name $upgradescripts\n */\n $upgradescripts[] = new $classname;\n }\n }\n }\n }\n // next sort the list by priority\n usort($upgradescripts, array('upgradescript','prioritize'));", " // next run through the list\n $db_version = expVersion::dbVersion();\n $upgrade_scripts = array();\n foreach ($upgradescripts as $upgradescript) {\n if ($upgradescript->checkVersion($db_version) && $upgradescript->needed()) {\n $upgradescript->classname = get_class($upgradescript);\n $upgrade_scripts[] = $upgradescript;\n $i++;\n }\n }\n }\n assign_to_template(array(\n 'scripts'=>$upgrade_scripts,\n ));\n }", " /**\n * run selected upgrade scripts outside of installation\n *\n */\n public function install_upgrades_run() {", " $tables = expDatabase::install_dbtables();\n ksort($tables);", " // locate the upgrade scripts\n $upgrade_dir = BASE.'install/upgrades';\n if (is_readable($upgrade_dir)) {\n $i = 0;\n if (is_readable(BASE.'install/include/upgradescript.php')) include(BASE.'install/include/upgradescript.php');\n $dh = opendir($upgrade_dir);", " // first build a list of valid upgrade scripts\n $oldscripts = array(\n 'install_tables.php',\n 'convert_db_trim.php',\n 'remove_exp1_faqmodule.php',\n 'remove_locationref.php',\n 'upgrade_attachableitem_tables.php',\n );\n while (($file = readdir($dh)) !== false) {\n if (is_readable($upgrade_dir . '/' . $file) && is_file($upgrade_dir . '/' . $file) && substr($file, -4, 4) == '.php' && !in_array($file,$oldscripts)) {\n include_once($upgrade_dir . '/' . $file);\n $classname = substr($file, 0, -4);\n /**\n * Stores the upgradescript object\n * @var \\upgradescript $upgradescripts\n * @name $upgradescripts\n */\n $upgradescripts[] = new $classname;\n }\n }\n // next sort the list by priority\n usort($upgradescripts, array('upgradescript','prioritize'));", " // next run through the list\n $db_version = expVersion::dbVersion();\n $upgrade_scripts = array();\n foreach ($upgradescripts as $upgradescript) {\n if ($upgradescript->checkVersion($db_version) && $upgradescript->needed()) {\n if (!empty($this->params[get_class($upgradescript)])) {\n $upgradescript->results = $upgradescript->upgrade();\n }\n $upgradescript->classname = get_class($upgradescript);\n $upgrade_scripts[] = $upgradescript;\n $i++;\n }\n }\n }\n assign_to_template(array(\n 'scripts'=>$upgrade_scripts,\n 'tables'=>$tables,\n ));\n }", " public function manage_themes() {\n expHistory::set('manageable', $this->params);", " if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.'));\n }", " \t$themes = array();\n \tif (is_readable(BASE.'themes')) {\n \t\t$dh = opendir(BASE.'themes');\n \t\twhile (($file = readdir($dh)) !== false) {\n \t\t\tif ($file != '.' && $file != '..' && is_dir(BASE.\"themes/$file\") && is_readable(BASE.\"themes/$file/class.php\")) {\n \t\t\t\tinclude_once(BASE.\"themes/$file/class.php\");\n \t\t\t\t$theme = new $file();\n \t\t\t\t$t = new stdClass();\n\t\t\t\t $t->user_configured = isset($theme->user_configured) ? $theme->user_configured : '';\n $t->stock_theme = isset($theme->stock_theme) ? $theme->stock_theme : '';\n \t\t\t\t$t->name = $theme->name();\n \t\t\t\t$t->description = $theme->description();\n \t\t\t\t$t->author = $theme->author();", "\t\t\t\t $t->style_variations = array();\n \t\t$sv = opendir(BASE.'themes/'.$file);\n \t\twhile (($s = readdir($sv)) !== false) {\n if (substr($s,0,4) == \"css_\") {\n $t->style_variations[str_replace(\"css_\",\"\",$s)] = str_replace(\"css_\",\"\",$s);\n } elseif (substr($s,0,5) == \"less_\") {\n $t->style_variations[str_replace(\"less_\",\"\",$s)] = str_replace(\"less_\",\"\",$s);\n }\n }\n if(count($t->style_variations)>0){\n $t->style_variations = array_merge(array('Default'=>'Default'),$t->style_variations);\n }", " \t\t\t\t$t->preview = is_readable(BASE.\"themes/$file/preview.jpg\") ? PATH_RELATIVE . \"themes/$file/preview.jpg\" : YUI2_RELATIVE . \"yui2-skin-sam-editor/assets/skins/sam/blankimage.png\";\n\t\t\t\t $t->mobile = is_readable(BASE.\"themes/$file/mobile/index.php\") ? true : false;\n \t\t\t\t$themes[$file] = $t;\n \t\t\t}\n \t\t}\n \t}", " assign_to_template(array(\n 'themes'=>$themes\n ));\n }", "", " public function theme_switch() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.'));\n }\n \texpSettings::change('DISPLAY_THEME_REAL', $this->params['theme']);\n\t expSession::set('display_theme',$this->params['theme']);\n\t $sv = isset($this->params['sv'])?$this->params['sv']:'';\n\t if (strtolower($sv)=='default') {\n\t $sv = '';\n\t }\n\t expSettings::change('THEME_STYLE_REAL',$sv);\n\t expSession::set('theme_style',$sv);\n\t expDatabase::install_dbtables(); // update tables to include any custom definitions in the new theme", " // $message = (MINIFY != 1) ? \"Exponent is now minifying Javascript and CSS\" : \"Exponent is no longer minifying Javascript and CSS\" ;\n // flash('message',$message);\n\t $message = gt(\"You have selected the\").\" '\".$this->params['theme'].\"' \".gt(\"theme\");\n\t if ($sv != '') {\n\t\t $message .= ' '.gt('with').' '.$this->params['sv'].' '.gt('style variation');\n\t }\n\t flash('message',$message);\n// expSession::un_set('framework');\n expSession::set('force_less_compile', 1);\n// expTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n \texpHistory::returnTo('manageable');", " }\n", "\tpublic function theme_preview() {\n\t\texpSession::set('display_theme',$this->params['theme']);\n\t\t$sv = isset($this->params['sv'])?$this->params['sv']:'';\n\t\tif (strtolower($sv)=='default') {\n\t\t $sv = '';\n\t\t}\n\t\texpSession::set('theme_style',$sv);\n\t\t$message = gt(\"You are previewing the\").\" '\".$this->params['theme'].\"' \".gt(\"theme\");\n\t\tif ($sv) {\n\t\t\t$message .= ' with '.$sv.' style variation';\n\t\t}\n\t\tif ($this->params['theme'] != DISPLAY_THEME_REAL || $this->params['sv'] != THEME_STYLE_REAL) {\n\t\t\tflash('notice',$message);\n\t\t}\n// expSession::un_set('framework');\n expSession::set('force_less_compile', 1);\n//\t\texpTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n\t\texpHistory::back();\n\t}", "\tpublic function configure_theme() {\n\t\tif (is_readable(BASE.\"themes/\".$this->params['theme'].\"/class.php\")) {\n\t\t\tinclude_once(BASE.\"themes/\".$this->params['theme'].\"/class.php\");\n $themeclass = $this->params['theme'];\n\t\t\t$theme = new $themeclass($this->params);\n\t\t\t$theme->configureTheme();\n\t\t}\n\t}", "\tpublic function update_theme() {\n\t\tif (is_readable(BASE.\"themes/\".$this->params['theme'].\"/class.php\")) {\n\t\t\tinclude_once(BASE.\"themes/\".$this->params['theme'].\"/class.php\");\n $themeclass = $this->params['theme'];\n\t\t\t$theme = new $themeclass();\n\t\t\t$theme->saveThemeConfig($this->params);\n expSession::set('force_less_compile', 1);\n expTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n\t\t}\n\t}", " public function export_theme() {\n include_once(BASE.'external/Tar.php');", " $themeclass = $this->params['theme'];\n $fname = tempnam(BASE.'/tmp','exporter_files_');\n $tar = new Archive_Tar($fname,'gz');\n $tar->createModify(BASE.'themes/'.$themeclass,'themes/',BASE.'themes/');", " $filename = preg_replace('/[^A-Za-z0-9_.-]/','-',$themeclass.'.tar.gz');", " ob_end_clean();\n // This code was lifted from phpMyAdmin, but this is Open Source, right?", " // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';", " header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }", " $fh = fopen($fname,'rb');\n while (!feof($fh)) {\n echo fread($fh,8192);\n }\n fclose($fh);\n unlink($fname);", " exit(''); // Exit, since we are exporting.\n }", "\tpublic function togglemobile() {\n\t\tif (!expSession::is_set('mobile')) { // account for FORCE_MOBILE initial state\n\t\t\texpSession::set('mobile',MOBILE);\n\t\t}\n\t\texpSession::set('mobile',!expSession::get('mobile'));\n expSession::set('force_less_compile', 1);\n\t\texpTheme::removeSmartyCache();\n\t\texpHistory::back();\n\t}", " public function configure_site () {\n\t expHistory::set('manageable',$this->params);", " if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Site Configuration settings.'));\n }", " // TYPES OF ANTISPAM CONTROLS... CURRENTLY ONLY ReCAPTCHA\n $as_types = array(\n '0'=>'-- '.gt('Please Select an Anti-Spam Control').' --',\n \"recaptcha\"=>'reCAPTCHA'\n );", "", " //THEMES FOR RECAPTCHA\n $as_themes = array(\n \"light\"=>gt('Light (Default)'),\n \t\"dark\"=>gt('Dark'),\n );", "", " // Available Themes\n $themes = array();\n if (is_readable(BASE.'themes')) {\n \t$theme_dh = opendir(BASE.'themes');\n \twhile (($theme_file = readdir($theme_dh)) !== false) {\n \t\tif (is_readable(BASE.'themes/'.$theme_file.'/class.php')) {\n \t\t\t// Need to avoid the duplicate theme problem.\n \t\t\tif (!class_exists($theme_file)) {\n \t\t\t\tinclude_once(BASE.'themes/'.$theme_file.'/class.php');\n \t\t\t}", " \t\t\tif (class_exists($theme_file)) {\n \t\t\t\t// Need to avoid instantiating non-existent classes.\n \t\t\t\t$t = new $theme_file();\n \t\t\t\t$themes[$theme_file] = $t->name();\n \t\t\t}\n \t\t}\n \t}\n }\n uasort($themes,'strnatcmp');", " // Available elFinder Themes\n $elf_themes = array(''=>gt('Default/OSX'));\n if (is_readable(BASE.'external/elFinder/themes')) {\n \t$theme_dh = opendir(BASE.'external/elFinder/themes');\n \twhile (($theme_file = readdir($theme_dh)) !== false) {\n \t\tif ($theme_file != '..' && is_readable(BASE.'external/elFinder/themes/'.$theme_file.'/css/theme.css')) {\n $elf_themes['/themes/' . $theme_file] = ucwords($theme_file);\n \t\t}\n \t}\n }\n uasort($elf_themes,'strnatcmp');", " // Available Languages\n\t $langs = expLang::langList();\n// ksort($langs);", " // smtp protocol\n $protocol = array(\n 'ssl'=>'SSL',\n 'tls'=>'TLS'\n );", " // Currency Format\n $currency = expSettings::dropdownData('currency');", " // attribution\n// $attribution = array(\n// 'firstlast'=>'John Doe',\n// 'lastfirst'=>'Doe, John',\n// 'first'=>'John',\n// 'last'=>'Doe',\n// 'username'=>'jdoe'\n// );\n $attribution = expSettings::dropdownData('attribution');", " // These funcs need to be moved up in to new subsystems", "", " // Date/Time Format\n $datetime_format = expSettings::dropdownData('datetime_format');", " // Date Format\n $date_format = expSettings::dropdownData('date_format');", "", " // Time Format\n $time_format = expSettings::dropdownData('time_format');", "", " // Start of Week\n// $start_of_week = glist(expSettings::dropdownData('start_of_week'));\n $daysofweek = event::dayNames();\n $start_of_week = $daysofweek['long'];", " // File Permissions\n $file_permisions = glist(expSettings::dropdownData('file_permissions'));", "", " // File Permissions\n $dir_permissions = glist(expSettings::dropdownData('dir_permissions'));", " // Homepage Dropdown\n $section_dropdown = section::levelDropdownControlArray(0, 0, array(), false, 'view', true);", " // Timezone Dropdown\n $list = DateTimeZone::listAbbreviations();\n $idents = DateTimeZone::listIdentifiers();\n $data = $offset = $added = array();\n foreach ($list as $abbr => $info) {\n foreach ($info as $zone) {\n if (!empty($zone['timezone_id']) AND !in_array($zone['timezone_id'],$added) AND in_array($zone['timezone_id'],$idents)) {\n try{\n $z = new DateTimeZone($zone['timezone_id']);\n $c = new DateTime(null, $z);\n $zone['time'] = $c->format('H:i a');\n $data[] = $zone;\n $offset[] = $z->getOffset($c);\n $added[] = $zone['timezone_id'];\n } catch(Exception $e) {\n flash('error', $e->getMessage());\n }\n }\n }\n }", " array_multisort($offset, SORT_ASC, $data);\n $tzoptions = array();\n foreach ($data as $row) {\n $tzoptions[$row['timezone_id']] = self::formatOffset($row['offset'])\n . ' ' . $row['timezone_id'];\n }", " $expcat = new expCat();\n $cats = $expcat->find('all','module=\"file\"');\n $folders = array();\n $folders[] = 'Root Folder';\n foreach ($cats as $cat) {\n $folders[$cat->id] = $cat->title;\n }", " // profiles\n $profiles = expSettings::profiles();\n if (empty($profiles)) {\n $profiles = array('' => '(default)');\n }", " assign_to_template(array(\n 'as_types'=>$as_types,\n 'as_themes'=>$as_themes,\n 'themes'=>$themes,\n 'elf_themes'=>$elf_themes,\n 'langs'=>$langs,\n 'protocol'=>$protocol,\n 'currency'=>$currency,\n 'attribution'=>$attribution,\n 'datetime_format'=>$datetime_format,\n 'date_format'=>$date_format,\n 'time_format'=>$time_format,\n 'start_of_week'=>$start_of_week,\n 'timezones'=>$tzoptions,\n 'file_permisions'=>$file_permisions,\n 'dir_permissions'=>$dir_permissions,\n 'section_dropdown'=>$section_dropdown,\n 'folders'=>$folders,\n 'profiles'=>$profiles\n ));\n }", "\t// now you can use $options;\n\tprivate function formatOffset($offset) {\n\t\t\t$hours = $offset / 3600;\n\t\t\t$remainder = $offset % 3600;\n\t\t\t$sign = $hours > 0 ? '+' : '-';\n\t\t\t$hour = (int) abs($hours);\n\t\t\t$minutes = (int) abs($remainder / 60);", "\t\t\tif ($hour == 0 AND $minutes == 0) {\n\t\t\t\t$sign = ' ';\n\t\t\t}\n\t\t\treturn 'GMT' . $sign . str_pad($hour, 2, '0', STR_PAD_LEFT)\n\t\t\t\t\t.':'. str_pad($minutes,2, '0');", "\t}", " public function update_siteconfig () {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change Site Configuration settings.'));\n } else {\n $this->params['sc']['MAINTENANCE_RETURN_TIME'] = yuicalendarcontrol::parseData('MAINTENANCE_RETURN_TIME', $this->params['sc']);\n foreach ($this->params['sc'] as $key => $value) {\n// expSettings::change($key, addslashes($value));\n expSettings::change($key, $value);\n }", " flash('message', gt(\"Your Website Configuration has been updated\"));\n }\n setcookie('slingbar-top', $this->params['sc']['SLINGBAR_TOP']);\n// expHistory::back();\n\t expHistory::returnTo('viewable');\n }", " public function change_profile() {\n if (empty($this->params['profile'])) return;\n expSession::un_set('display_theme');\n expSession::un_set('theme_style');\n// expSession::un_set('framework');\n expSession::set('force_less_compile', 1);\n expTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n expSettings::activateProfile($this->params['profile']);\n flash('message', gt(\"New Configuration Profile Loaded\") . ' (' . $this->params['profile'] . ')');\n redirect_to(array('controller'=>'administration', 'action'=>'configure_site'));\n }", " public function save_profile() {\n if (empty($this->params['profile'])) return;\n $profile = expSettings::createProfile($this->params['profile']);\n flash('message', gt(\"Configuration Profile Saved\") . ' (' . $this->params['profile'] . ')');\n// redirect_to(array('controller'=>'administration', 'action'=>'configure_site'));\n redirect_to(array('controller'=>'administration', 'action'=>'change_profile', 'profile'=>$profile));\n }", " /**\n \t * Routine to force launching exponent installer\n \t */\n \tpublic static function install_exponent() {\n \t\t// we'll need the not_configured file to exist for install routine to work\n// \t\tif (!@file_exists(BASE.'install/not_configured')) {\n// \t\t\t$nc_file = fopen(BASE.'install/not_configured', \"w\");\n// \t\t\tfclose($nc_file);\n// \t\t}\n// $page = \"\";\n// if (@file_exists(BASE.'framework/conf/config.php')) {\n// $page = \"?page=upgrade-1\";\n// }\n if (@file_exists(BASE.'install/index.php')) {\n header('Location: ' . URL_FULL . 'install/index.php');\n exit('Redirecting to the Exponent Install Wizard');\n } else {\n flash('error', gt(\"Installation files were not found\"));\n }\n \t}", "}", "/**\n * This is the base theme class\n *\n * @subpackage Controllers\n * @package Modules\n */\nclass theme {\n\tpublic $user_configured = false;\n public $stock_theme = false;", "\tfunction name() { return \"theme\"; }\n\tfunction author() { return \"\"; }\n\tfunction description() { return gt(\"The theme shell\"); }", " /**\n * @param array $params\n */\n function __construct($params = array()) {\n $this->params = $params;\n }", "\t/**\n\t * Method to Configure theme settings\n\t * This generic routine parses the theme's config.php file\n\t * and presents the values as text boxes.\n\t */\n\tfunction configureTheme () {\n\t\tif (isset($this->params['sv']) && $this->params['sv'] != '') {\n\t\t\tif (strtolower($this->params['sv'])=='default') {\n $this->params['sv']='';\n\t\t\t}\n\t\t\t$settings = expSettings::parseFile(BASE.\"themes/\".$this->params['theme'].\"/config_\".$this->params['sv'].\".php\");\n\t\t} else {\n\t\t\t$settings = expSettings::parseFile(BASE.\"themes/\".$this->params['theme'].\"/config.php\");\n\t\t}\n\t\t$form = new form();\n\t\t$form->meta('controller','administration');\n\t\t$form->meta('action','update_theme');\n\t\t$form->meta('theme',$this->params['theme']);\n\t\t$form->meta('sv',isset($this->params['sv'])?$this->params['sv']:'');\n\t\tforeach ($settings as $setting=>$key) {\n\t\t\t$form->register($setting,$setting.': ',new textcontrol($key,20));\n\t\t}\n\t\t$form->register(null,'',new htmlcontrol('<br>'));\n\t\t$form->register('submit','',new buttongroupcontrol(gt('Save'),'',gt('Cancel')));\n\t\tassign_to_template(array(\n 'name'=>$this->name().(!empty($this->params['sv'])?' '.$this->params['sv']:''),\n 'form_html'=>$form->toHTML()\n ));\n\t}", "\t/**\n\t * Method to save/update theme settings\n\t * This generic routine parses the passed params\n\t * and saves them to the theme's config.php file\n\t * It attempts to remove non-theme params such as analytics, etc..\n\t *\n\t * @param $params theme configuration parameters\n\t */\n\tfunction saveThemeConfig ($params) {\n\t\t$theme = $params['theme'];\n\t\tunset ($params['theme']);\n\t\t$sv = $params['sv'];\n\t\tif (strtolower($sv)=='default') {\n\t\t $sv='';\n\t\t}\n\t\tunset (\n $params['sv'],\n $params['controller'],\n $params['action'],\n $params['cid'],\n $params['scayt_verLang'],\n $params['slingbar-top'],\n $params['XDEBUG_SESSION']\n );\n\t\tforeach ($params as $key=>$value) {\n\t\t\tif ($key[0] == '_') {\n\t\t\t\tunset ($params[$key]);\n\t\t\t}\n\t\t}\n\t\tif (!empty($sv)) {\n\t\t\texpSettings::saveValues($params, BASE.\"themes/\".$theme.\"/config_\".$sv.\".php\");\n\t\t} else {\n\t\t\texpSettings::saveValues($params, BASE.\"themes/\".$theme.\"/config.php\");\n\t\t}\n\t\texpHistory::back();\n\t}", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class bannerController extends expController {", "", " public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'module_title',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)", " public $useractions = array(\n 'showall'=>'Display Banner(s)'\n );", "\n static function displayname() { return gt(\"Banners\"); }\n static function description() { return gt(\"Display banners on your website and track 'clicks'.\"); }", " ", " public function showall() {\n $banners = array();\n if (!empty($this->config['banners'])) {\n // only show banners that this module is configured to show.\n // do not show banners that have gone over their impression limit\n // do not show banners that have gone over their click limit", " // randomly grab one banner to be displayed ", " // increase the impression count for this banner", " $where = 'id IN ('.implode(',', $this->config['banners']).')'; ", " $where .= ' AND (impression_limit > impressions || impression_limit=0)';\n $where .= ' AND (click_limit > clicks || click_limit=0)';\n $limit = isset($this->config['limit']) ? $this->config['limit'] : 1;\n $banners = $this->banner->find('all', $where , 'RAND()', $limit);", " foreach($banners as $banner) { ", " $banner->increaseImpressions();\n }\n }", " ", " // assign banner to the template and show it!\n assign_to_template(array(\n 'banners'=>$banners\n ));\n }", " ", " public function click() {\n $banner = new banner($this->params['id']);\n $banner->increaseClicks();\n redirect_to($banner->url);\n }", " ", " public function create() {\n// global $db;\n //make sure we have companies.\n// $count = $db->countObjects('companies');\n $comp = new company();\n $count = $comp->find('count');\n if ($count < 1) {\n flash('message', gt('There are no companies created yet. You need to create at least one company first.'));\n redirect_to(array('controller'=>'company', 'action'=>'edit'));\n// $this->edit();\n } else {\n parent::create();\n }\n }", " ", " public function manage() {\n expHistory::set('manageable', $this->params);", " ", " // build out a SQL query that gets all the data we need and is sortable.\n $sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id ';\n $sql .= 'FROM '.DB_TABLE_PREFIX.'_banner b, '.DB_TABLE_PREFIX.'_companies c , '.DB_TABLE_PREFIX.'_content_expFiles f ';\n $sql .= 'WHERE b.companies_id = c.id AND (b.id = f.content_id AND f.content_type=\"banner\")';", "\t\t", "\t\t$page = new expPaginator(array(\n\t\t\t'model'=>'banner',\n\t\t\t'sql'=>$sql,\n\t\t\t'order'=>'title',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n\t\t\t'columns'=>array(\n gt('Title')=>'title',\n gt('Company')=>'companyname',\n gt('Impressions')=>'impressions',\n gt('Clicks')=>'clicks'\n )\n ));", "\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }", " ", " public function configure() {\n $this->config['defaultbanner'] = array();\n if (!empty($this->config['defaultbanner_id'])) {\n $this->config['defaultbanner'][] = new expFile($this->config['defaultbanner_id']);", " } ", "\t parent::configure();\n\t $banners = $this->banner->find('all', null, 'companies_id');\n\t assign_to_template(array(\n 'banners'=>$banners,\n 'title'=>static::displayname()\n ));\n\t}", "\t", "\tpublic function saveconfig() {\n\t $this->params['defaultbanner_id'] = isset($this->params['expFile'][0]) ? $this->params['expFile'][0] : 0;\n \t parent::saveconfig();\n\t}", "\t", "\tpublic function export() {\n // gather all the data\n $banners = $this->banner->find('all');\n $out = '\"Banner ID\",\"Banner Title\",\"Banner URL\",\"Company Name\",\"Impression Limit\",\"Click Limit\",\"Impressions\",\"Clicks\"' . \"\\n\";\n foreach ($banners as $l) {\n $out .='\"'.$l->id.'\",\"'.$l->title.'\",\"'.$l->url.'\",\"'.$l->company->title.'\",\"'.$l->impression_limit.'\",\"'.$l->click_limit.'\",\"'.$l->impressions.'\",\"'.$l->clicks.'\"' . \"\\n\";\n }", " ", " // open the file\n $dir = BASE.'tmp';", " $filename = 'banner_export' . date(\"m-d-Y\") . '.csv'; ", " $fh = fopen ($dir .'/'. $filename, 'w');", " // Put all values from $out to export.csv.\n fputs($fh, $out);", " fclose($fh); ", "\n // push the file to the user\n $export = new expFile(array('directory'=>$dir, 'filename'=>$filename)); //FIXME we are using a full path BASE instead of relative to root\n expFile::download($export);\n }", " function reset_stats() {\n// global $db;", " // reset the counters\n// $db->sql ('UPDATE '.$db->prefix.'banner SET impressions=0 WHERE 1');\n banner::resetImpressions();\n// $db->sql ('UPDATE '.$db->prefix.'banner SET clicks=0 WHERE 1');\n banner::resetClicks();", " \n // let the user know we did stuff. ", " flash('message', gt(\"Banner statistics reset.\"));\n expHistory::back();\n }", "}", "?>" ]
[ 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class bannerController extends expController {", " public $useractions = array(\n 'showall'=>'Display Banner(s)'\n );\n protected $manage_permissions = array(\n 'reset' => 'Reset Stats'\n );", " public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'module_title',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)", "", "\n static function displayname() { return gt(\"Banners\"); }\n static function description() { return gt(\"Display banners on your website and track 'clicks'.\"); }", "", " public function showall() {\n $banners = array();\n if (!empty($this->config['banners'])) {\n // only show banners that this module is configured to show.\n // do not show banners that have gone over their impression limit\n // do not show banners that have gone over their click limit", " // randomly grab one banner to be displayed", " // increase the impression count for this banner", " $where = 'id IN ('.implode(',', $this->config['banners']).')';", " $where .= ' AND (impression_limit > impressions || impression_limit=0)';\n $where .= ' AND (click_limit > clicks || click_limit=0)';\n $limit = isset($this->config['limit']) ? $this->config['limit'] : 1;\n $banners = $this->banner->find('all', $where , 'RAND()', $limit);", " foreach($banners as $banner) {", " $banner->increaseImpressions();\n }\n }", "", " // assign banner to the template and show it!\n assign_to_template(array(\n 'banners'=>$banners\n ));\n }", "", " public function click() {\n $banner = new banner($this->params['id']);\n $banner->increaseClicks();\n redirect_to($banner->url);\n }", "", " public function create() {\n// global $db;\n //make sure we have companies.\n// $count = $db->countObjects('companies');\n $comp = new company();\n $count = $comp->find('count');\n if ($count < 1) {\n flash('message', gt('There are no companies created yet. You need to create at least one company first.'));\n redirect_to(array('controller'=>'company', 'action'=>'edit'));\n// $this->edit();\n } else {\n parent::create();\n }\n }", "", " public function manage() {\n expHistory::set('manageable', $this->params);", "", " // build out a SQL query that gets all the data we need and is sortable.\n $sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id ';\n $sql .= 'FROM '.DB_TABLE_PREFIX.'_banner b, '.DB_TABLE_PREFIX.'_companies c , '.DB_TABLE_PREFIX.'_content_expFiles f ';\n $sql .= 'WHERE b.companies_id = c.id AND (b.id = f.content_id AND f.content_type=\"banner\")';", "", "\t\t$page = new expPaginator(array(\n\t\t\t'model'=>'banner',\n\t\t\t'sql'=>$sql,\n\t\t\t'order'=>'title',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n\t\t\t'columns'=>array(\n gt('Title')=>'title',\n gt('Company')=>'companyname',\n gt('Impressions')=>'impressions',\n gt('Clicks')=>'clicks'\n )\n ));", "\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }", "", " public function configure() {\n $this->config['defaultbanner'] = array();\n if (!empty($this->config['defaultbanner_id'])) {\n $this->config['defaultbanner'][] = new expFile($this->config['defaultbanner_id']);", " }", "\t parent::configure();\n\t $banners = $this->banner->find('all', null, 'companies_id');\n\t assign_to_template(array(\n 'banners'=>$banners,\n 'title'=>static::displayname()\n ));\n\t}", "", "\tpublic function saveconfig() {\n\t $this->params['defaultbanner_id'] = isset($this->params['expFile'][0]) ? $this->params['expFile'][0] : 0;\n \t parent::saveconfig();\n\t}", "", "\tpublic function export() {\n // gather all the data\n $banners = $this->banner->find('all');\n $out = '\"Banner ID\",\"Banner Title\",\"Banner URL\",\"Company Name\",\"Impression Limit\",\"Click Limit\",\"Impressions\",\"Clicks\"' . \"\\n\";\n foreach ($banners as $l) {\n $out .='\"'.$l->id.'\",\"'.$l->title.'\",\"'.$l->url.'\",\"'.$l->company->title.'\",\"'.$l->impression_limit.'\",\"'.$l->click_limit.'\",\"'.$l->impressions.'\",\"'.$l->clicks.'\"' . \"\\n\";\n }", "", " // open the file\n $dir = BASE.'tmp';", " $filename = 'banner_export' . date(\"m-d-Y\") . '.csv';", " $fh = fopen ($dir .'/'. $filename, 'w');", " // Put all values from $out to export.csv.\n fputs($fh, $out);", " fclose($fh);", "\n // push the file to the user\n $export = new expFile(array('directory'=>$dir, 'filename'=>$filename)); //FIXME we are using a full path BASE instead of relative to root\n expFile::download($export);\n }", " function reset_stats() {\n// global $db;", " // reset the counters\n// $db->sql ('UPDATE '.$db->prefix.'banner SET impressions=0 WHERE 1');\n banner::resetImpressions();\n// $db->sql ('UPDATE '.$db->prefix.'banner SET clicks=0 WHERE 1');\n banner::resetClicks();", "\n // let the user know we did stuff.", " flash('message', gt(\"Banner statistics reset.\"));\n expHistory::back();\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class blogController extends expController {\n public $useractions = array(\n 'showall'=>'Show All Posts',\n 'tags'=>\"Show Post Tags\",\n 'authors'=>\"Show Post Authors\",\n 'categories'=>\"Show Post Categories\",\n 'dates'=>\"Show Post Dates\",\n 'comments'=>\"Show Recent Post Comments\",\n );", "", " public $remove_configs = array(\n// 'categories',\n// 'ealerts'\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)", " protected $add_permissions = array(\n 'approve'=>\"Approve Comments\",\n 'import'=>'Import Blog Items',\n 'export'=>'Export Blog Items'\n );", "\n static function displayname() { return gt(\"Blog\"); }\n static function description() { return gt(\"Run a blog on your site.\"); }\n static function author() { return \"Phillip Ball - OIC Group, Inc\"; }\n static function hasSources() { return false; } // must be explicitly added by config['add_source'] or config['aggregate']\n static function isSearchable() { return true; }", " static function canImportData() {\n return true;\n }", " static function canExportData() {\n return true;\n }", " public function showall() {\n\t expHistory::set('viewable', $this->params);\n\t\t$page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>$this->aggregateWhereClause(),\n 'limit'=>(isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] :10,\n 'order'=>'publish',\n 'dir'=>empty($this->config['sort_dir']) ? 'DESC' : $this->config['sort_dir'],\n 'categorize'=> empty($this->config['usecategories']) ? false : $this->config['usecategories'],\n 'groups'=>!isset($this->params['cat']) ? array() : array($this->params['cat']),\n 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));", "\t\tassign_to_template(array(\n 'page'=>$page,\n 'params'=>$this->params,\n ));\n if (isset($this->params['cat'])) assign_to_template(array(\n 'moduletitle' => gt('Posts filed under') . ' ' . (empty($page->records[0]->expCat[0]->title) ? $this->config['uncat'] : $page->records[0]->expCat[0]->title),\n ));", "\t}", "\tpublic function authors() {\n expHistory::set('viewable', $this->params);\n $blogs = $this->blog->find('all');\n $users = array();\n foreach ($blogs as $blog) {\n if (isset($users[$blog->poster])) {\n $users[$blog->poster]->count++;\n } else {\n $users[$blog->poster] = new user($blog->poster);\n $users[$blog->poster]->count = 1;\n }\n }", "\t assign_to_template(array(\n 'authors'=>$users\n ));\n\t}", "\tpublic function dates() {\n\t global $db;", " expHistory::set('viewable', $this->params);\n $where = $this->aggregateWhereClause();\n\t $dates = $db->selectColumn('blog', 'publish', $where, 'publish DESC');\n\t $blog_date = array();\n $count = 0;\n $limit = empty($this->config['limit']) ? count($dates) : $this->config['limit'];\n\t foreach ($dates as $date) {\n\t $year = date('Y',$date);\n\t $month = date('n',$date);\n\t if (isset($blog_date[$year][$month])) {\n\t $blog_date[$year][$month]->count++;\n\t } else {\n $count++;\n if ($count > $limit) break;\n $blog_date[$year][$month] = new stdClass();\n\t $blog_date[$year][$month]->name = date('F',$date);\n\t $blog_date[$year][$month]->count = 1;\n\t }\n\t }\n if (!empty($blog_date)) {\n ksort($blog_date);\n $blog_date = array_reverse($blog_date,1);\n foreach ($blog_date as $key=>$val) {\n ksort($blog_date[$key]);\n $blog_date[$key] = array_reverse($blog_date[$key],1);\n }\n } else {\n $blog_date = array();\n }\n\t //eDebug($blog_date);\n\t assign_to_template(array(\n 'dates'=>$blog_date\n ));\n\t}", " public function showall_by_date() {\n\t expHistory::set('viewable', $this->params);\n\t $start_date = expDateTime::startOfMonthTimestamp(mktime(0, 0, 0, $this->params['month'], 1, $this->params['year']));\n\t $end_date = expDateTime::endOfMonthTimestamp(mktime(0, 0, 0, $this->params['month'], 1, $this->params['year']));", "\t\t$page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>($this->aggregateWhereClause()?$this->aggregateWhereClause().\" AND \":\"\").\"publish >= '\".$start_date.\"' AND publish <= '\".$end_date.\"'\",\n 'limit'=>isset($this->config['limit']) ? $this->config['limit'] : 10,\n 'order'=>'publish',\n 'dir'=>'desc',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));", "\t\tassign_to_template(array(\n 'page'=>$page,\n 'moduletitle'=>gt('Blogs by date').' \"'.expDateTime::format_date($start_date,\"%B %Y\").'\"')\n );\n\t}", "\tpublic function showall_by_author() {\n\t expHistory::set('viewable', $this->params);\n", "", " $user = user::getUserByName($this->params['author']);\n\t\t$page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>($this->aggregateWhereClause()?$this->aggregateWhereClause().\" AND \":\"\").\"poster=\".$user->id,\n 'limit'=>isset($this->config['limit']) ? $this->config['limit'] : 10,\n 'order'=>'publish',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));", "\t\tassign_to_template(array(\n 'page'=>$page,\n 'moduletitle'=>gt('Blogs by author').' \"'.$this->params['author'].'\"'\n ));\n\t}", "\tpublic function show() {\n expHistory::set('viewable', $this->params);\n\t $id = isset($this->params['title']) ? $this->params['title'] : $this->params['id'];\n $record = new blog($id);\n if (empty($record->id))", " redirect_to(array('controller'=>'notfound','action'=>'page_not_found','title'=>$this->params['title']));", "\n\t // since we are probably getting here via a router mapped url\n\t // some of the links (tags in particular) require a source, we will\n\t // populate the location data in the template now.\n $config = expConfig::getConfig($record->location_data);\n if (empty($this->config))\n $this->config = $config;\n if (empty($this->loc->src)) {\n $r_loc = expUnserialize($record->location_data);\n $this->loc->src = $r_loc->src;\n }", " $nextwhere = $this->aggregateWhereClause().' AND publish > '.$record->publish.' ORDER BY publish';\n $record->next = $record->find('first',$nextwhere);\n $prevwhere = $this->aggregateWhereClause().' AND publish < '.$record->publish.' ORDER BY publish DESC';\n $record->prev = $record->find('first',$prevwhere);", "\t assign_to_template(array(\n 'record'=>$record,\n 'config'=>$config,\n 'params'=>$this->params\n ));\n\t}", " /**\n * view items referenced by tags\n * @deprecated 2.0.0\n */\n function showByTags() {\n global $db;", " // set the history point for this action\n expHistory::set('viewable', $this->params);", " // setup some objects\n $tagobj = new expTag();", " $modelname = empty($this->params['model']) ? $this->basemodel_name : $this->params['model'];", " $model = new $modelname();", " // start building the sql query\n $sql = 'SELECT DISTINCT m.id FROM '.$db->prefix.$model->tablename.' m ';\n $sql .= 'JOIN '.$db->prefix.$tagobj->attachable_table.' ct ';\n $sql .= 'ON m.id = ct.content_id WHERE (';\n $first = true;", " if (isset($this->params['tags'])) {\n $tags = is_array($this->params['tags']) ? $this->params['tags'] : array($this->params['tags']);\n } elseif (isset($this->config['expTags'])) {\n $tags = $this->config['expTags'];\n } else {\n $tags = array();\n }", " foreach ($tags as $tagid) {\n $sql .= ($first) ? 'exptags_id='.intval($tagid) : ' OR exptags_id='.intval($tagid);\n $first = false;\n }\n $sql .= \") AND content_type='\".$model->classname.\"'\";\n if (!expPermissions::check('edit',$this->loc)) {\n $sql = \"(publish =0 or publish <= \" . time() . \")) AND \". $sql . ' AND private=0';\n }", " // get the objects and render the template\n $tag_assocs = $db->selectObjectsBySql($sql);\n $records = array();\n foreach ($tag_assocs as $assoc) {\n $records[] = new $modelname($assoc->id);\n }", " assign_to_template(array(\n 'items'=>$records\n ));\n }", " /**\n * get the blog items in an rss feed format\n *\n * @return array\n */\n// function getRSSContent() {\n// $class = new blog();\n// $items = $class->find('all', $this->aggregateWhereClause(), isset($this->config['order']) ? $this->config['order'] : 'publish DESC');\n//\n// //Convert the items to rss items\n// $rssitems = array();\n// foreach ($items as $key => $item) {\n// $rss_item = new FeedItem();\n// $rss_item->title = expString::convertSmartQuotes($item->title);\n// $rss_item->link = $rss_item->guid = makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$item->sef_url));\n// $rss_item->description = expString::convertSmartQuotes($item->body);\n// $rss_item->author = user::getUserById($item->poster)->firstname.' '.user::getUserById($item->poster)->lastname;\n// $rss_item->authorEmail = user::getEmailById($item->poster);\n//// $rss_item->date = isset($item->publish_date) ? date(DATE_RSS,$item->publish_date) : date(DATE_RSS, $item->created_at);\n// $rss_item->date = isset($item->publish_date) ? $item->publish_date : $item->created_at;\n//// $rss_item->guid = expUnserialize($item->location_data)->src.'-id#'.$item->id;\n// if (!empty($item->expCat[0]->title)) $rss_item->category = array($item->expCat[0]->title);\n// $comment_count = expCommentController::countComments(array('content_id'=>$item->id,'content_type'=>$this->basemodel_name));\n// if ($comment_count) {\n// $rss_item->comments = makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$item->sef_url)).'#exp-comments';\n//// $rss_item->commentsRSS = makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$item->sef_url)).'#exp-comments';\n// $rss_item->commentsCount = $comment_count;\n// }\n// $rssitems[$key] = $rss_item;\n// }\n// return $rssitems;\n// }", " /**\n * additional check for display of search hit, only display non-draft\n *\n * @param $record\n *\n * @return bool\n */\n public static function searchHit($record) {\n $blog = new blog($record->original_id);\n if (expPermissions::check('edit', expUnserialize($record->location_data)) || $blog->private == 0 && ($blog->publish === 0 || $blog->publish <= time())) {\n return true;\n } else {\n return false;\n }\n }", " /**\n * The aggregateWhereClause function creates a sql where clause which also includes aggregated module content\n *\n * @param string $type\n *\n * @return string\n */\n \tfunction aggregateWhereClause($type='') {\n $sql = parent::aggregateWhereClause();\n if (!expPermissions::check('edit',$this->loc)) {\n if (!empty($sql)) {\n $sql .= \" AND \";\n }\n $sql .= \"private = 0 AND (publish = 0 OR publish <= \" . time() . \")\";\n }", " return $sql;\n }", " /**\n * delete module's items (all) by instance\n */\n function delete_instance($loc = false) {\n parent::delete_instance(true);\n }", " /**\n * Returns Facebook og: meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_fb($request, $object, $canonical) {\n $metainfo = array();\n $metainfo['type'] = 'article';\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n $metainfo['title'] = substr(empty($object->meta_fb['title']) ? $object->title : $object->meta_fb['title'], 0, 87);\n $metainfo['description'] = substr(empty($object->meta_fb['description']) ? $desc : $object->meta_fb['description'], 0, 199);\n $metainfo['url'] = empty($object->meta_fb['url']) ? $canonical : $object->meta_fb['url'];\n $metainfo['image'] = empty($object->meta_fb['fbimage'][0]) ? '' : $object->meta_fb['fbimage'][0]->url;\n if (empty($metainfo['image'])) {\n if (!empty($object->expFile['files'][0]->is_image)) {\n $metainfo['image'] = $object->expFile['files'][0]->url;\n } else {\n $config = expConfig::getConfig($object->location_data);\n if (!empty($config['expFile']['fbimage'][0]))\n $file = new expFile($config['expFile']['fbimage'][0]);\n if (!empty($file->id))\n $metainfo['image'] = $file->url;\n if (empty($metainfo['image']))\n $metainfo['image'] = URL_BASE . MIMEICON_RELATIVE . 'generic_22x22.png';\n }\n }\n return $metainfo;\n }", " /**\n * Returns Twitter twitter: meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_tw($request, $object, $canonical) {\n $metainfo = array();\n $metainfo['card'] = 'summary';\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n $config = expConfig::getConfig($object->location_data);\n if (!empty($object->meta_tw['twsite'])) {\n $metainfo['site'] = $object->meta_tw['twsite'];\n } elseif (!empty($config['twsite'])) {\n $metainfo['site'] = $config['twsite'];\n }\n $metainfo['title'] = substr(empty($object->meta_tw['title']) ? $object->title : $object->meta_tw['title'], 0, 87);\n $metainfo['description'] = substr(empty($object->meta_tw['description']) ? $desc : $object->meta_tw['description'], 0, 199);\n $metainfo['image'] = empty($object->meta_tw['twimage'][0]) ? '' : $object->meta_tw['twimage'][0]->url;\n if (empty($metainfo['image'])) {\n if (!empty($object->expFile['images'][0]->is_image)) {\n $metainfo['image'] = $object->expFile['images'][0]->url;\n } else {\n if (!empty($config['expFile']['twimage'][0]))\n $file = new expFile($config['expFile']['twimage'][0]);\n if (!empty($file->id))\n $metainfo['image'] = $file->url;\n if (empty($metainfo['image']))\n $metainfo['image'] = URL_BASE . MIMEICON_RELATIVE . 'generic_22x22.png';\n }\n }\n return $metainfo;\n }", " function showall_by_author_meta($request) {\n global $router;", " // look up the record.\n if (isset($request['author'])) {\n // set the meta info\n $u = user::getUserByName(expString::sanitize($request['author']));\n $str = user::getUserAttribution($u->id);\n// switch (DISPLAY_ATTRIBUTION) {\n// case \"firstlast\":\n// $str = $u->firstname . \" \" . $u->lastname;\n// break;\n// case \"lastfirst\":\n// $str = $u->lastname . \", \" . $u->firstname;\n// break;\n// case \"first\":\n// $str = $u->firstname;\n// break;\n// case \"username\":\n// default:\n// $str = $u->username;\n// break;\n// }", " if (!empty($str)) {\n $metainfo = array('title' => '', 'keywords' => '', 'description' => '', 'canonical' => '', 'noindex' => false, 'nofollow' => false);\n $metainfo['title'] = gt('Showing all Blog Posts written by') .\" \\\"\" . $str . \"\\\"\";\n// $metainfo['keywords'] = empty($object->meta_keywords) ? SITE_KEYWORDS : $object->meta_keywords; //FIXME $object not set\n $metainfo['keywords'] = $str;\n// $metainfo['description'] = empty($object->meta_description) ? SITE_DESCRIPTION : $object->meta_description; //FIXME $object not set\n $metainfo['description'] = SITE_DESCRIPTION;\n// $metainfo['canonical'] = empty($object->canonical) ? URL_FULL.substr($router->sefPath, 1) : $object->canonical; //FIXME $object not set\n// $metainfo['canonical'] = URL_FULL.substr($router->sefPath, 1);\n $metainfo['canonical'] = $router->plainPath();", " return $metainfo;\n }\n }\n }", "}", "?>" ]
[ 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class blogController extends expController {\n public $useractions = array(\n 'showall'=>'Show All Posts',\n 'tags'=>\"Show Post Tags\",\n 'authors'=>\"Show Post Authors\",\n 'categories'=>\"Show Post Categories\",\n 'dates'=>\"Show Post Dates\",\n 'comments'=>\"Show Recent Post Comments\",\n );", " protected $manage_permissions = array(\n// 'approve'=>\"Approve Comments\",\n );", " public $remove_configs = array(\n// 'categories',\n// 'ealerts'\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)", "", "\n static function displayname() { return gt(\"Blog\"); }\n static function description() { return gt(\"Run a blog on your site.\"); }\n static function author() { return \"Phillip Ball - OIC Group, Inc\"; }\n static function hasSources() { return false; } // must be explicitly added by config['add_source'] or config['aggregate']\n static function isSearchable() { return true; }", " static function canImportData() {\n return true;\n }", " static function canExportData() {\n return true;\n }", " public function showall() {\n\t expHistory::set('viewable', $this->params);\n\t\t$page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>$this->aggregateWhereClause(),\n 'limit'=>(isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] :10,\n 'order'=>'publish',\n 'dir'=>empty($this->config['sort_dir']) ? 'DESC' : $this->config['sort_dir'],\n 'categorize'=> empty($this->config['usecategories']) ? false : $this->config['usecategories'],\n 'groups'=>!isset($this->params['cat']) ? array() : array($this->params['cat']),\n 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));", "\t\tassign_to_template(array(\n 'page'=>$page,\n 'params'=>$this->params,\n ));\n if (isset($this->params['cat'])) assign_to_template(array(\n 'moduletitle' => gt('Posts filed under') . ' ' . (empty($page->records[0]->expCat[0]->title) ? $this->config['uncat'] : $page->records[0]->expCat[0]->title),\n ));", "\t}", "\tpublic function authors() {\n expHistory::set('viewable', $this->params);\n $blogs = $this->blog->find('all');\n $users = array();\n foreach ($blogs as $blog) {\n if (isset($users[$blog->poster])) {\n $users[$blog->poster]->count++;\n } else {\n $users[$blog->poster] = new user($blog->poster);\n $users[$blog->poster]->count = 1;\n }\n }", "\t assign_to_template(array(\n 'authors'=>$users\n ));\n\t}", "\tpublic function dates() {\n\t global $db;", " expHistory::set('viewable', $this->params);\n $where = $this->aggregateWhereClause();\n\t $dates = $db->selectColumn('blog', 'publish', $where, 'publish DESC');\n\t $blog_date = array();\n $count = 0;\n $limit = empty($this->config['limit']) ? count($dates) : $this->config['limit'];\n\t foreach ($dates as $date) {\n\t $year = date('Y',$date);\n\t $month = date('n',$date);\n\t if (isset($blog_date[$year][$month])) {\n\t $blog_date[$year][$month]->count++;\n\t } else {\n $count++;\n if ($count > $limit) break;\n $blog_date[$year][$month] = new stdClass();\n\t $blog_date[$year][$month]->name = date('F',$date);\n\t $blog_date[$year][$month]->count = 1;\n\t }\n\t }\n if (!empty($blog_date)) {\n ksort($blog_date);\n $blog_date = array_reverse($blog_date,1);\n foreach ($blog_date as $key=>$val) {\n ksort($blog_date[$key]);\n $blog_date[$key] = array_reverse($blog_date[$key],1);\n }\n } else {\n $blog_date = array();\n }\n\t //eDebug($blog_date);\n\t assign_to_template(array(\n 'dates'=>$blog_date\n ));\n\t}", " public function showall_by_date() {\n\t expHistory::set('viewable', $this->params);\n\t $start_date = expDateTime::startOfMonthTimestamp(mktime(0, 0, 0, $this->params['month'], 1, $this->params['year']));\n\t $end_date = expDateTime::endOfMonthTimestamp(mktime(0, 0, 0, $this->params['month'], 1, $this->params['year']));", "\t\t$page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>($this->aggregateWhereClause()?$this->aggregateWhereClause().\" AND \":\"\").\"publish >= '\".$start_date.\"' AND publish <= '\".$end_date.\"'\",\n 'limit'=>isset($this->config['limit']) ? $this->config['limit'] : 10,\n 'order'=>'publish',\n 'dir'=>'desc',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));", "\t\tassign_to_template(array(\n 'page'=>$page,\n 'moduletitle'=>gt('Blogs by date').' \"'.expDateTime::format_date($start_date,\"%B %Y\").'\"')\n );\n\t}", "\tpublic function showall_by_author() {\n\t expHistory::set('viewable', $this->params);\n", " $this->params['author'] = expString::escape($this->params['author']);", " $user = user::getUserByName($this->params['author']);\n\t\t$page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>($this->aggregateWhereClause()?$this->aggregateWhereClause().\" AND \":\"\").\"poster=\".$user->id,\n 'limit'=>isset($this->config['limit']) ? $this->config['limit'] : 10,\n 'order'=>'publish',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'columns'=>array(\n gt('Title')=>'title'\n ),\n ));", "\t\tassign_to_template(array(\n 'page'=>$page,\n 'moduletitle'=>gt('Blogs by author').' \"'.$this->params['author'].'\"'\n ));\n\t}", "\tpublic function show() {\n expHistory::set('viewable', $this->params);\n\t $id = isset($this->params['title']) ? $this->params['title'] : $this->params['id'];\n $record = new blog($id);\n if (empty($record->id))", " redirect_to(array('controller'=>'notfound','action'=>'page_not_found','title'=>expString::escape($this->params['title'])));", "\n\t // since we are probably getting here via a router mapped url\n\t // some of the links (tags in particular) require a source, we will\n\t // populate the location data in the template now.\n $config = expConfig::getConfig($record->location_data);\n if (empty($this->config))\n $this->config = $config;\n if (empty($this->loc->src)) {\n $r_loc = expUnserialize($record->location_data);\n $this->loc->src = $r_loc->src;\n }", " $nextwhere = $this->aggregateWhereClause().' AND publish > '.$record->publish.' ORDER BY publish';\n $record->next = $record->find('first',$nextwhere);\n $prevwhere = $this->aggregateWhereClause().' AND publish < '.$record->publish.' ORDER BY publish DESC';\n $record->prev = $record->find('first',$prevwhere);", "\t assign_to_template(array(\n 'record'=>$record,\n 'config'=>$config,\n 'params'=>$this->params\n ));\n\t}", " /**\n * view items referenced by tags\n * @deprecated 2.0.0\n */\n function showByTags() {\n global $db;", " // set the history point for this action\n expHistory::set('viewable', $this->params);", " // setup some objects\n $tagobj = new expTag();", " $modelname = empty($this->params['model']) ? $this->basemodel_name : expString::escape($this->params['model']);", " $model = new $modelname();", " // start building the sql query\n $sql = 'SELECT DISTINCT m.id FROM '.$db->prefix.$model->tablename.' m ';\n $sql .= 'JOIN '.$db->prefix.$tagobj->attachable_table.' ct ';\n $sql .= 'ON m.id = ct.content_id WHERE (';\n $first = true;", " if (isset($this->params['tags'])) {\n $tags = is_array($this->params['tags']) ? $this->params['tags'] : array($this->params['tags']);\n } elseif (isset($this->config['expTags'])) {\n $tags = $this->config['expTags'];\n } else {\n $tags = array();\n }", " foreach ($tags as $tagid) {\n $sql .= ($first) ? 'exptags_id='.intval($tagid) : ' OR exptags_id='.intval($tagid);\n $first = false;\n }\n $sql .= \") AND content_type='\".$model->classname.\"'\";\n if (!expPermissions::check('edit',$this->loc)) {\n $sql = \"(publish =0 or publish <= \" . time() . \")) AND \". $sql . ' AND private=0';\n }", " // get the objects and render the template\n $tag_assocs = $db->selectObjectsBySql($sql);\n $records = array();\n foreach ($tag_assocs as $assoc) {\n $records[] = new $modelname($assoc->id);\n }", " assign_to_template(array(\n 'items'=>$records\n ));\n }", " /**\n * get the blog items in an rss feed format\n *\n * @return array\n */\n// function getRSSContent() {\n// $class = new blog();\n// $items = $class->find('all', $this->aggregateWhereClause(), isset($this->config['order']) ? $this->config['order'] : 'publish DESC');\n//\n// //Convert the items to rss items\n// $rssitems = array();\n// foreach ($items as $key => $item) {\n// $rss_item = new FeedItem();\n// $rss_item->title = expString::convertSmartQuotes($item->title);\n// $rss_item->link = $rss_item->guid = makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$item->sef_url));\n// $rss_item->description = expString::convertSmartQuotes($item->body);\n// $rss_item->author = user::getUserById($item->poster)->firstname.' '.user::getUserById($item->poster)->lastname;\n// $rss_item->authorEmail = user::getEmailById($item->poster);\n//// $rss_item->date = isset($item->publish_date) ? date(DATE_RSS,$item->publish_date) : date(DATE_RSS, $item->created_at);\n// $rss_item->date = isset($item->publish_date) ? $item->publish_date : $item->created_at;\n//// $rss_item->guid = expUnserialize($item->location_data)->src.'-id#'.$item->id;\n// if (!empty($item->expCat[0]->title)) $rss_item->category = array($item->expCat[0]->title);\n// $comment_count = expCommentController::countComments(array('content_id'=>$item->id,'content_type'=>$this->basemodel_name));\n// if ($comment_count) {\n// $rss_item->comments = makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$item->sef_url)).'#exp-comments';\n//// $rss_item->commentsRSS = makeLink(array('controller'=>$this->baseclassname, 'action'=>'show', 'title'=>$item->sef_url)).'#exp-comments';\n// $rss_item->commentsCount = $comment_count;\n// }\n// $rssitems[$key] = $rss_item;\n// }\n// return $rssitems;\n// }", " /**\n * additional check for display of search hit, only display non-draft\n *\n * @param $record\n *\n * @return bool\n */\n public static function searchHit($record) {\n $blog = new blog($record->original_id);\n if (expPermissions::check('edit', expUnserialize($record->location_data)) || $blog->private == 0 && ($blog->publish === 0 || $blog->publish <= time())) {\n return true;\n } else {\n return false;\n }\n }", " /**\n * The aggregateWhereClause function creates a sql where clause which also includes aggregated module content\n *\n * @param string $type\n *\n * @return string\n */\n \tfunction aggregateWhereClause($type='') {\n $sql = parent::aggregateWhereClause();\n if (!expPermissions::check('edit',$this->loc)) {\n if (!empty($sql)) {\n $sql .= \" AND \";\n }\n $sql .= \"private = 0 AND (publish = 0 OR publish <= \" . time() . \")\";\n }", " return $sql;\n }", " /**\n * delete module's items (all) by instance\n */\n function delete_instance($loc = false) {\n parent::delete_instance(true);\n }", " /**\n * Returns Facebook og: meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_fb($request, $object, $canonical) {\n $metainfo = array();\n $metainfo['type'] = 'article';\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n $metainfo['title'] = substr(empty($object->meta_fb['title']) ? $object->title : $object->meta_fb['title'], 0, 87);\n $metainfo['description'] = substr(empty($object->meta_fb['description']) ? $desc : $object->meta_fb['description'], 0, 199);\n $metainfo['url'] = empty($object->meta_fb['url']) ? $canonical : $object->meta_fb['url'];\n $metainfo['image'] = empty($object->meta_fb['fbimage'][0]) ? '' : $object->meta_fb['fbimage'][0]->url;\n if (empty($metainfo['image'])) {\n if (!empty($object->expFile['files'][0]->is_image)) {\n $metainfo['image'] = $object->expFile['files'][0]->url;\n } else {\n $config = expConfig::getConfig($object->location_data);\n if (!empty($config['expFile']['fbimage'][0]))\n $file = new expFile($config['expFile']['fbimage'][0]);\n if (!empty($file->id))\n $metainfo['image'] = $file->url;\n if (empty($metainfo['image']))\n $metainfo['image'] = URL_BASE . MIMEICON_RELATIVE . 'generic_22x22.png';\n }\n }\n return $metainfo;\n }", " /**\n * Returns Twitter twitter: meta data\n *\n * @param $request\n * @param $object\n *\n * @return null\n */\n public function meta_tw($request, $object, $canonical) {\n $metainfo = array();\n $metainfo['card'] = 'summary';\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n $config = expConfig::getConfig($object->location_data);\n if (!empty($object->meta_tw['twsite'])) {\n $metainfo['site'] = $object->meta_tw['twsite'];\n } elseif (!empty($config['twsite'])) {\n $metainfo['site'] = $config['twsite'];\n }\n $metainfo['title'] = substr(empty($object->meta_tw['title']) ? $object->title : $object->meta_tw['title'], 0, 87);\n $metainfo['description'] = substr(empty($object->meta_tw['description']) ? $desc : $object->meta_tw['description'], 0, 199);\n $metainfo['image'] = empty($object->meta_tw['twimage'][0]) ? '' : $object->meta_tw['twimage'][0]->url;\n if (empty($metainfo['image'])) {\n if (!empty($object->expFile['images'][0]->is_image)) {\n $metainfo['image'] = $object->expFile['images'][0]->url;\n } else {\n if (!empty($config['expFile']['twimage'][0]))\n $file = new expFile($config['expFile']['twimage'][0]);\n if (!empty($file->id))\n $metainfo['image'] = $file->url;\n if (empty($metainfo['image']))\n $metainfo['image'] = URL_BASE . MIMEICON_RELATIVE . 'generic_22x22.png';\n }\n }\n return $metainfo;\n }", " function showall_by_author_meta($request) {\n global $router;", " // look up the record.\n if (isset($request['author'])) {\n // set the meta info\n $u = user::getUserByName(expString::sanitize($request['author']));\n $str = user::getUserAttribution($u->id);\n// switch (DISPLAY_ATTRIBUTION) {\n// case \"firstlast\":\n// $str = $u->firstname . \" \" . $u->lastname;\n// break;\n// case \"lastfirst\":\n// $str = $u->lastname . \", \" . $u->firstname;\n// break;\n// case \"first\":\n// $str = $u->firstname;\n// break;\n// case \"username\":\n// default:\n// $str = $u->username;\n// break;\n// }", " if (!empty($str)) {\n $metainfo = array('title' => '', 'keywords' => '', 'description' => '', 'canonical' => '', 'noindex' => false, 'nofollow' => false);\n $metainfo['title'] = gt('Showing all Blog Posts written by') .\" \\\"\" . $str . \"\\\"\";\n// $metainfo['keywords'] = empty($object->meta_keywords) ? SITE_KEYWORDS : $object->meta_keywords; //FIXME $object not set\n $metainfo['keywords'] = $str;\n// $metainfo['description'] = empty($object->meta_description) ? SITE_DESCRIPTION : $object->meta_description; //FIXME $object not set\n $metainfo['description'] = SITE_DESCRIPTION;\n// $metainfo['canonical'] = empty($object->canonical) ? URL_FULL.substr($router->sefPath, 1) : $object->canonical; //FIXME $object not set\n// $metainfo['canonical'] = URL_FULL.substr($router->sefPath, 1);\n $metainfo['canonical'] = $router->plainPath();", " return $metainfo;\n }\n }\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expCatController\n *\n * @package Core\n * @subpackage Controllers\n */", "class expCatController extends expController {", "", "\n\t/**\n\t * name of module\n\t * @return string\n\t */\n static function displayname() { return gt(\"Category Manager\"); }", "\t/**\n\t * description of module\n\t * @return string\n\t */\n static function description() { return gt(\"This module is used to manage categories\"); }", " /**\n \t * author of module\n \t * @return string\n \t */\n static function author() { return \"Dave Leffler\"; }", "\t/**\n\t * does module have sources available?\n\t * @return bool\n\t */\n\tstatic function hasSources() { return false; }", "\t/**\n\t * manage categories\n\t */\n\tfunction manage() {\n// global $db;", " expHistory::set('manageable', $this->params);\n if (!empty($this->params['model'])) {\n// $modulename = expModules::getControllerClassName($this->params['model']);\n// $module = new $modulename(empty($this->params['src'])?null:$this->params['src']);\n $module = expModules::getController($this->params['model'], empty($this->params['src']) ? null : $this->params['src']);\n $where = $module->aggregateWhereClause();\n if ($this->params['model'] == 'file') $where = 1;\n $page = new expPaginator(array(\n 'model'=>($this->params['model'] == 'file') ? 'expFile' : $this->params['model'],\n// 'where'=>\"location_data='\".serialize(expCore::makeLocation($this->params['model'],$this->loc->src,'')).\"'\",\n 'where'=>$where,\n// 'order'=>'module,rank',\n 'categorize'=>true,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['model'],\n// 'action'=>$this->params['action'],\n// 'src'=>static::hasSources() == true ? $this->loc->src : null,\n// 'columns'=>array(gt('ID#')=>'id',gt('Title')=>'title',gt('Body')=>'body'),\n ));\n if ($this->params['model'] == 'faq') {\n foreach ($page->records as $record) {\n $record->title = $record->question;\n }\n } elseif ($this->params['model'] == 'file') {\n foreach ($page->records as $record) {\n $record->title = $record->filename;\n }\n }\n } else $page = '';\n $cats = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>empty($this->params['model']) ? null : \"module='\".$this->params['model'].\"'\",\n// 'limit'=>50,\n 'order'=>'module,rank',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>static::hasSources() == true ? $this->loc->src : null,\n 'columns'=>array(\n gt('ID#')=>'id',\n gt('Title')=>'title',\n// gt('Body')=>'body'\n ),\n ));", "// foreach ($db->selectColumn('content_expCats','content_type',null,null,true) as $contenttype) {\n foreach (expCat::selectAllCatContentType() as $contenttype) {\n foreach ($cats->records as $key => $value) {\n $attatchedat = $cats->records[$key]->findWhereAttachedTo($contenttype);\n if (!empty($attatchedat)) {\n $cats->records[$key]->attachedcount = @$cats->records[$key]->attachedcount + count($attatchedat);\n $cats->records[$key]->attached[$contenttype] = $attatchedat;\n //FIXME here is a hack to get the faq to be listed\n if ($contenttype == 'faq' && !empty($cats->records[$key]->attached[$contenttype][0]->question)) {\n $cats->records[$key]->attached[$contenttype][0]->title = $cats->records[$key]->attached[$contenttype][0]->question;\n }\n }\n }\n }\n foreach ($cats->records as $record) {\n $cats->modules[$record->module][] = $record;\n }\n if (SITE_FILE_MANAGER == 'elfinder') {\n unset($cats->modules['file']); // we're not using the traditional file manager\n }\n if (!empty($this->params['model']) && $this->params['model'] == 'file') {\n $catlist[0] = gt('Root Folder');\n } else {\n $catlist[0] = gt('Uncategorized');\n }\n if (!empty($cats->modules)) foreach ($cats->modules as $key=>$module) {\n foreach ($module as $listing) {\n $catlist[$listing->id] = $listing->title;\n }\n }\n assign_to_template(array(\n 'catlist'=>$catlist,\n 'cats'=>$cats,\n 'page'=>$page,\n 'model'=>empty($this->params['model']) ? null : $this->params['model']\n ));\n }", " function edit() {\n $mod = array();\n// $modules = expModules::listControllers();\n// foreach ($modules as $modname=>$mods) {\n// if (!strstr($mods,'Controller')) {\n// $mod[$modname] = ucfirst($modname);\n// }\n// }\n $modules = expModules::listUserRunnableControllers();\n foreach ($modules as $modname) {\n// $modname = expModules::getControllerName($modname);\n $mod[expModules::getControllerName($modname)] = ucfirst(expModules::getControllerDisplayName($modname));\n }\n $mod['expFile'] = 'File';\n asort($mod);\n assign_to_template(array(\n 'mods'=>$mod\n ));\n if (!empty($this->params['model'])) {\n assign_to_template(array(\n 'model'=>$this->params['model'],\n ));\n }\n parent::edit();\n }", " function update() {\n if ($this->params['module'] == 'expFile') $this->params['module'] = 'file';\n parent::update();\n }", " /**\n * this method changes the category of the selected items to the chosen category\n */\n function change_cats() {\n if (!empty($this->params['change_cat'])) {\n foreach ($this->params['change_cat'] as $item) {\n $classname = $this->params['mod'];\n $object = new $classname($item);\n $params['expCat'][0] = $this->params['newcat'];\n $object->update($params);\n }\n }\n expHistory::returnTo('viewable');\n }", " /**\n * this method adds cats properties to object and then sorts by category\n * it is assumed the records have expCats attachments, even if they are empty\n *\n * @static\n * @param array $records\n * @param string $order sort order/dir for items\n * @param string $uncattitle name to use for uncategorized group\n * @param array $groups limit set to these groups only if set\n * @param bool $dontsort\n *\n * @return void\n */\n public static function addCats(&$records,$order,$uncattitle,$groups=array(),$dontsort=false) {\n if (empty($uncattitle)) $uncattitle = gt('Not Categorized');\n foreach ($records as $key=>$record) {\n foreach ($record->expCat as $cat) {\n $records[$key]->catid = $cat->id;\n $records[$key]->catrank = $cat->rank;\n $records[$key]->cat = $cat->title;\n $catcolor = empty($cat->color) ? null : trim($cat->color);\n if (substr($catcolor,0,1)=='#') $catcolor = '\" style=\"color:'.$catcolor.';';\n $records[$key]->color = $catcolor;\n $records[$key]->module = empty($cat->module) ? null : $cat->module;\n break;\n }\n if (empty($records[$key]->catid)) {\n $records[$key]->catid = 0;\n $records[$key]->expCat[0] = new stdClass();\n $records[$key]->expCat[0]->id = 0;\n $records[$key]->catrank = 9999;\n $records[$key]->cat = $uncattitle;\n $records[$key]->color = null;\n }\n if (!empty($groups) && !in_array($records[$key]->catid,$groups)) {\n unset ($records[$key]);\n }\n }\n // we don't always want to sort by cat first\n if (!$dontsort) {\n $orderby = explode(\" \",$order);\n $order = $orderby[0];\n $order_direction = !empty($orderby[1]) && $orderby[1] == 'DESC' ? SORT_DESC : SORT_ASC;\n expSorter::osort($records, array('catrank',$order => $order_direction));\n }\n }", " /**\n * this method fills a multidimensional array from a sorted records object\n * it is assumed the records object is already processed by expCatController::addCats\n *\n * @static\n * @param array $records\n * @param array $cats array of site category objects\n * @param array $groups limit set to these groups only if set\n * @param null $grouplimit\n * @return void\n */\n public static function sortedByCats($records,&$cats,$groups=array(),$grouplimit=null) {\n foreach ($records as $record) {\n if (empty($groups) || in_array($record->catid,$groups)) {\n if (empty($record->catid)) $record->catid = 0;\n if (empty($cats[$record->catid])) {\n $cats[$record->catid] = new stdClass();\n $cats[$record->catid]->count = 1;\n $cats[$record->catid]->name = $record->cat;\n $cats[$record->catid]->color = $record->color;\n } else {\n $cats[$record->catid]->count++;\n }\n if (empty($grouplimit)) {\n $cats[$record->catid]->records[] = $record;\n } else {\n if (empty($cats[$record->catid]->records[0])) $cats[$record->catid]->records[0] = $record;\n }\n }\n }\n }", "}", "?>" ]
[ 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expCatController\n *\n * @package Core\n * @subpackage Controllers\n */", "class expCatController extends expController {", " protected $manage_permissions = array(\n 'change' => 'Change Cats'\n );", "\n\t/**\n\t * name of module\n\t * @return string\n\t */\n static function displayname() { return gt(\"Category Manager\"); }", "\t/**\n\t * description of module\n\t * @return string\n\t */\n static function description() { return gt(\"This module is used to manage categories\"); }", " /**\n \t * author of module\n \t * @return string\n \t */\n static function author() { return \"Dave Leffler\"; }", "\t/**\n\t * does module have sources available?\n\t * @return bool\n\t */\n\tstatic function hasSources() { return false; }", "\t/**\n\t * manage categories\n\t */\n\tfunction manage() {\n// global $db;", " expHistory::set('manageable', $this->params);\n if (!empty($this->params['model'])) {\n// $modulename = expModules::getControllerClassName($this->params['model']);\n// $module = new $modulename(empty($this->params['src'])?null:$this->params['src']);\n $module = expModules::getController($this->params['model'], empty($this->params['src']) ? null : $this->params['src']);\n $where = $module->aggregateWhereClause();\n if ($this->params['model'] == 'file') $where = 1;\n $page = new expPaginator(array(\n 'model'=>($this->params['model'] == 'file') ? 'expFile' : $this->params['model'],\n// 'where'=>\"location_data='\".serialize(expCore::makeLocation($this->params['model'],$this->loc->src,'')).\"'\",\n 'where'=>$where,\n// 'order'=>'module,rank',\n 'categorize'=>true,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['model'],\n// 'action'=>$this->params['action'],\n// 'src'=>static::hasSources() == true ? $this->loc->src : null,\n// 'columns'=>array(gt('ID#')=>'id',gt('Title')=>'title',gt('Body')=>'body'),\n ));\n if ($this->params['model'] == 'faq') {\n foreach ($page->records as $record) {\n $record->title = $record->question;\n }\n } elseif ($this->params['model'] == 'file') {\n foreach ($page->records as $record) {\n $record->title = $record->filename;\n }\n }\n } else $page = '';\n $cats = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>empty($this->params['model']) ? null : \"module='\".$this->params['model'].\"'\",\n// 'limit'=>50,\n 'order'=>'module,rank',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>static::hasSources() == true ? $this->loc->src : null,\n 'columns'=>array(\n gt('ID#')=>'id',\n gt('Title')=>'title',\n// gt('Body')=>'body'\n ),\n ));", "// foreach ($db->selectColumn('content_expCats','content_type',null,null,true) as $contenttype) {\n foreach (expCat::selectAllCatContentType() as $contenttype) {\n foreach ($cats->records as $key => $value) {\n $attatchedat = $cats->records[$key]->findWhereAttachedTo($contenttype);\n if (!empty($attatchedat)) {\n $cats->records[$key]->attachedcount = @$cats->records[$key]->attachedcount + count($attatchedat);\n $cats->records[$key]->attached[$contenttype] = $attatchedat;\n //FIXME here is a hack to get the faq to be listed\n if ($contenttype == 'faq' && !empty($cats->records[$key]->attached[$contenttype][0]->question)) {\n $cats->records[$key]->attached[$contenttype][0]->title = $cats->records[$key]->attached[$contenttype][0]->question;\n }\n }\n }\n }\n foreach ($cats->records as $record) {\n $cats->modules[$record->module][] = $record;\n }\n if (SITE_FILE_MANAGER == 'elfinder') {\n unset($cats->modules['file']); // we're not using the traditional file manager\n }\n if (!empty($this->params['model']) && $this->params['model'] == 'file') {\n $catlist[0] = gt('Root Folder');\n } else {\n $catlist[0] = gt('Uncategorized');\n }\n if (!empty($cats->modules)) foreach ($cats->modules as $key=>$module) {\n foreach ($module as $listing) {\n $catlist[$listing->id] = $listing->title;\n }\n }\n assign_to_template(array(\n 'catlist'=>$catlist,\n 'cats'=>$cats,\n 'page'=>$page,\n 'model'=>empty($this->params['model']) ? null : $this->params['model']\n ));\n }", " function edit() {\n $mod = array();\n// $modules = expModules::listControllers();\n// foreach ($modules as $modname=>$mods) {\n// if (!strstr($mods,'Controller')) {\n// $mod[$modname] = ucfirst($modname);\n// }\n// }\n $modules = expModules::listUserRunnableControllers();\n foreach ($modules as $modname) {\n// $modname = expModules::getControllerName($modname);\n $mod[expModules::getControllerName($modname)] = ucfirst(expModules::getControllerDisplayName($modname));\n }\n $mod['expFile'] = 'File';\n asort($mod);\n assign_to_template(array(\n 'mods'=>$mod\n ));\n if (!empty($this->params['model'])) {\n assign_to_template(array(\n 'model'=>$this->params['model'],\n ));\n }\n parent::edit();\n }", " function update() {\n if ($this->params['module'] == 'expFile') $this->params['module'] = 'file';\n parent::update();\n }", " /**\n * this method changes the category of the selected items to the chosen category\n */\n function change_cats() {\n if (!empty($this->params['change_cat'])) {\n foreach ($this->params['change_cat'] as $item) {\n $classname = $this->params['mod'];\n $object = new $classname($item);\n $params['expCat'][0] = $this->params['newcat'];\n $object->update($params);\n }\n }\n expHistory::returnTo('viewable');\n }", " /**\n * this method adds cats properties to object and then sorts by category\n * it is assumed the records have expCats attachments, even if they are empty\n *\n * @static\n * @param array $records\n * @param string $order sort order/dir for items\n * @param string $uncattitle name to use for uncategorized group\n * @param array $groups limit set to these groups only if set\n * @param bool $dontsort\n *\n * @return void\n */\n public static function addCats(&$records,$order,$uncattitle,$groups=array(),$dontsort=false) {\n if (empty($uncattitle)) $uncattitle = gt('Not Categorized');\n foreach ($records as $key=>$record) {\n foreach ($record->expCat as $cat) {\n $records[$key]->catid = $cat->id;\n $records[$key]->catrank = $cat->rank;\n $records[$key]->cat = $cat->title;\n $catcolor = empty($cat->color) ? null : trim($cat->color);\n if (substr($catcolor,0,1)=='#') $catcolor = '\" style=\"color:'.$catcolor.';';\n $records[$key]->color = $catcolor;\n $records[$key]->module = empty($cat->module) ? null : $cat->module;\n break;\n }\n if (empty($records[$key]->catid)) {\n $records[$key]->catid = 0;\n $records[$key]->expCat[0] = new stdClass();\n $records[$key]->expCat[0]->id = 0;\n $records[$key]->catrank = 9999;\n $records[$key]->cat = $uncattitle;\n $records[$key]->color = null;\n }\n if (!empty($groups) && !in_array($records[$key]->catid,$groups)) {\n unset ($records[$key]);\n }\n }\n // we don't always want to sort by cat first\n if (!$dontsort) {\n $orderby = explode(\" \",$order);\n $order = $orderby[0];\n $order_direction = !empty($orderby[1]) && $orderby[1] == 'DESC' ? SORT_DESC : SORT_ASC;\n expSorter::osort($records, array('catrank',$order => $order_direction));\n }\n }", " /**\n * this method fills a multidimensional array from a sorted records object\n * it is assumed the records object is already processed by expCatController::addCats\n *\n * @static\n * @param array $records\n * @param array $cats array of site category objects\n * @param array $groups limit set to these groups only if set\n * @param null $grouplimit\n * @return void\n */\n public static function sortedByCats($records,&$cats,$groups=array(),$grouplimit=null) {\n foreach ($records as $record) {\n if (empty($groups) || in_array($record->catid,$groups)) {\n if (empty($record->catid)) $record->catid = 0;\n if (empty($cats[$record->catid])) {\n $cats[$record->catid] = new stdClass();\n $cats[$record->catid]->count = 1;\n $cats[$record->catid]->name = $record->cat;\n $cats[$record->catid]->color = $record->color;\n } else {\n $cats[$record->catid]->count++;\n }\n if (empty($grouplimit)) {\n $cats[$record->catid]->records[] = $record;\n } else {\n if (empty($cats[$record->catid]->records[0])) $cats[$record->catid]->records[0] = $record;\n }\n }\n }\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expCommentController\n *\n * @package Core\n * @subpackage Controllers\n */", "class expCommentController extends expController {\n public $base_class = 'expComment';", " protected $add_permissions = array(\n 'approve'=>\"Approve Comments\"\n );\n \tprotected $remove_permissions = array(", " 'create'\n );", "", "\n static function displayname() { return gt(\"Comments\"); }\n static function description() { return gt(\"Use this module to add comments to a page.\"); }", " ", "\tfunction edit() {\n\t if (empty($this->params['content_id'])) {\n\t flash('message',gt('An error occurred: No content id set.'));", " expHistory::back(); \n\t } ", " /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", " \n ", "\t $id = empty($this->params['id']) ? null : $this->params['id'];\n\t $comment = new expComment($id);\n //FIXME here is where we might sanitize the comment before displaying/editing it\n\t\tassign_to_template(array(\n\t\t 'content_id'=>$this->params['content_id'],\n 'content_type'=>$this->params['content_type'],\n\t\t 'comment'=>$comment\n\t\t));", "\t}\t\n\t", "\tfunction manage() {\n\t expHistory::set('manageable', $this->params);", " $order = 'approved';\n $dir = 'ASC';\n /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", "\t ", "\t $sql = 'SELECT c.*, cnt.* FROM '.DB_TABLE_PREFIX.'_expComments c ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_content_expComments cnt ON c.id=cnt.expcomments_id ';\n if (!empty($this->params['content_id']) && !empty($this->params['content_type'])) {\n $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";\n $order = 'created_at';\n $dir = 'DESC';\n }\n //$sql .= 'AND c.approved=0';", " $page = new expPaginator(array(\n// 'model'=>'expComment',", " 'sql'=>$sql, ", " 'limit'=>10,\n 'order'=>$order,\n 'dir'=>$dir,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Approved')=>'approved',\n gt('Poster')=>'name',\n gt('Comment')=>'body',\n gt('Type')=>'content_type'\n ),\n ));", " $refs[][] = array();\n foreach ($page->records as $record) {\n //FIXME here is where we might sanitize the comments before displaying them\n $item = new $record->content_type($record->content_id);\n $refs[$record->content_type][$record->content_id] = $item->title;\n }\n assign_to_template(array(\n 'page'=>$page,\n 'refs'=>$refs,\n ));\n\t}", " /**\n * Displays comments attached to specified item\n */\n\tfunction showComments() {\n\t\tglobal $user, $db;", " /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet", " $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", "\n// $sql = 'SELECT c.*, ua.image, u.username FROM '.$db->prefix.'expComments c ';\n// $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON c.id=cnt.expcomments_id ';\n// $sql .= 'JOIN '.$db->prefix.'user_avatar ua ON c.poster=ua.user_id ';\n// $sql .= 'JOIN '.$db->prefix.'user u ON c.poster=u.id ';\n// $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";", " $sql = 'SELECT c.* FROM '.$db->prefix.'expComments c ';\n $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON c.id=cnt.expcomments_id ';", " $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";", " if (!$user->isAdmin()) {\n $sql .= 'AND c.approved=1';\n }", " $comments = new expPaginator(array(\n //'model'=>'expComment',", " 'sql'=>$sql, ", "// 'limit'=>999,\n 'order'=>'created_at',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Readable Column Name')=>'Column Name'\n ),\n ));", " // add username and avatar\n foreach ($comments->records as $key=>$record) {\n $commentor = new user($record->poster);\n //FIXME here is where we might sanitize the comments before displaying them\n// $comments->records[$key]->username = $commentor->username; //FIXME this should follow the site attribution setting\n $comments->records[$key]->username = user::getUserAttribution($commentor->id); // follow the site attribution setting\n $comments->records[$key]->avatar = $db->selectObject('user_avatar',\"user_id='\".$record->poster.\"'\");\n }", " if (empty($this->params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records);\n // eDebug($sql, true);", " ", " // count the unapproved comments\n if ($require_approval == 1 && $user->isAdmin()) {\n $sql = 'SELECT count(com.id) as c FROM '.$db->prefix.'expComments com ';\n $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON com.id=cnt.expcomments_id ';", " $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";", " $sql .= 'AND com.approved=0';\n $unapproved = $db->countObjectsBySql($sql);\n } else {\n $unapproved = 0;", " } \n ", " $this->config = $this->params['config'];\n $type = !empty($this->params['type']) ? $this->params['type'] : gt('Comment');\n $ratings = !empty($this->params['ratings']) ? true : false;", " assign_to_template(array(\n 'comments'=>$comments,\n 'config'=>$this->params['config'],\n 'unapproved'=>$unapproved,", "\t\t\t'content_id'=>$this->params['content_id'], ", "\t\t\t'content_type'=>$this->params['content_type'],\n\t\t\t'user'=>$user,\n\t\t\t'hideform'=>$this->params['hideform'],\n\t\t\t'hidecomments'=>$this->params['hidecomments'],\n\t\t\t'title'=>$this->params['title'],\n\t\t\t'formtitle'=>$this->params['formtitle'],\n 'type'=>$type,\n 'ratings'=>$ratings,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n\t\t));\n\t}", " /**\n * function to arrange comments in hierarchy of parent_id's as children properties\n *\n * @param array $comments\n *\n * @return array\n */\n function arrangecomments($comments) {", " $tree = array();", " /* We get all the parent into the tree array */\n foreach ($comments as &$node) {\n /* Note: I've used 0 for top level parent, you can change this to == 'NULL' */\n if($node->parent_id=='0'){\n $tree[] = $node;\n unset($node);\n }\n }", " /* This is the recursive function that does the magic */\n /* $k is the position in the array */\n if (!function_exists('findchildren')) {\n function findchildren(&$parent, &$comments, $k = 0)\n {\n if (isset($comments[$k])) {\n if ($comments[$k]->parent_id == $parent->id) {\n $com = $comments[$k];\n findchildren($com, $comments); // We try to find children's children\n $parent->children[] = $com;\n }\n findchildren($parent, $comments, $k + 1); // And move to the next sibling\n }\n }\n }", " /* looping through the parent array, we try to find the children */\n foreach ($tree as &$parent) {\n findchildren($parent, $comments);\n }", " return $tree;\n }", " /**\n * Returns count of comments attached to specified item\n *\n * @static\n * @param $params\n * @return int\n */\n public static function countComments($params) {\n// global $user, $db;\n global $user;", " $sql = 'SELECT c.* FROM '.DB_TABLE_PREFIX.'_expComments c ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_content_expComments cnt ON c.id=cnt.expcomments_id ';\n $sql .= 'WHERE cnt.content_id='.$params['content_id'].\" AND cnt.content_type='\".$params['content_type'].\"' \";\n if (!$user->isAdmin()) {\n $sql .= 'AND c.approved=1';\n }", " $comments = new expPaginator(array(\n 'sql'=>$sql,\n ));\n return count($comments->records);\n// return $count = $db->countObjectsBySql($sql);", " }", " /**\n * Returns comments attached to specified item\n *\n * @static\n * @param $params\n * @return array\n */\n public static function getComments($params) {\n global $user, $db;", " $sql = 'SELECT c.* FROM '.$db->prefix.'expComments c ';\n $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON c.id=cnt.expcomments_id ';\n $sql .= 'WHERE cnt.content_id='.$params['content_id'].\" AND cnt.content_type='\".$params['content_type'].\"' \";\n if (!$user->isAdmin()) {\n $sql .= 'AND c.approved=1';\n }", " $comments = new expPaginator(array(\n //'model'=>'expComment',\n 'sql'=>$sql,\n // 'limit'=>999,\n 'order'=>'created_at',\n// 'page'=>(isset($params['page']) ? $params['page'] : 1),\n 'controller'=>'expComment',\n// 'action'=>$params['action'],\n// 'columns'=>array(\n// gt('Readable Column Name')=>'Column Name'\n// ),\n ));", " // add username and avatar\n foreach ($comments->records as $key=>$record) {\n $commentor = new user($record->poster);\n //FIXME here is where we might sanitize the comments before displaying them\n// $comments->records[$key]->username = $commentor->username; //FIXME this should follow the site attribution setting\n $comments->records[$key]->username = user::getUserAttribution($commentor->id); // follow the site attribution setting\n $comments->records[$key]->avatar = $db->selectObject('user_avatar',\"user_id='\".$record->poster.\"'\");\n }\n// if (empty($params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records);\n // eDebug($sql, true);", " // count the unapproved comments\n $unapproved = 0;", "// assign_to_template(array(\n// 'comments'=>$comments,\n// 'config'=>$params['config'],\n// 'unapproved'=>$unapproved,\n// 'content_id'=>$params['content_id'],\n// 'content_type'=>$params['content_type'],\n// 'user'=>$user,\n// 'hideform'=>$params['hideform'],\n// 'hidecomments'=>$params['hidecomments'],\n// 'title'=>$params['title'],\n// 'formtitle'=>$params['formtitle'],\n// ));\n return $comments->records;\n }", " function update() {\n global $user;", " ", " /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", " if (COMMENTS_REQUIRE_LOGIN && !$user->isLoggedIn()) {\n expValidator::failAndReturnToForm('You must be logged on to post a comment!', $this->params);\n }\n // check the anti-spam control\n if (!(ANTI_SPAM_USERS_SKIP && $user->isLoggedIn())) {\n expValidator::check_antispam($this->params, gt('Your comment was not posted.') . ' ' . gt(\"Anti-spam verification failed. Please try again. Please try again.\"));\n }", " ", " // figure out the name and email address\n if (!empty($user->id) && empty($this->params['id'])) {\n $this->params['name'] = $user->firstname.\" \".$user->lastname;\n $this->params['email'] = $user->email;\n }", " ", " // save the comment\n if (empty($require_approval)) {\n $this->expComment->approved=1;\n }\n $this->expComment->update($this->params);", " ", " // attach the comment to the datatype it belongs to (blog, news, etc..);\n// $obj = new stdClass();\n//\t\t$obj->content_type = $this->params['content_type'];\n//\t\t$obj->content_id = $this->params['content_id'];\n//\t\t$obj->expcomments_id = $this->expComment->id;\n//\t\tif(isset($this->params['subtype'])) $obj->subtype = $this->params['subtype'];\n//\t\t$db->insertObject($obj, $this->expComment->attachable_table);\n $this->expComment->attachComment($this->params['content_type'], $this->params['content_id'], $this->params['subtype']);", "\t\t$msg = 'Thank you for posting a comment.';\n\t\tif ($require_approval == 1 && !$user->isAdmin()) {\n\t\t $msg .= ' '.gt('Your comment is now pending approval. You will receive an email to').' ';\n\t\t $msg .= $this->expComment->email.' '.gt('letting you know when it has been approved.');\n\t\t}", "\t\t", "\t\tif ($require_notification && !$user->isAdmin()) {\n\t\t $this->sendNotification($this->expComment,$this->params);\n\t\t}\n if ($require_approval==1 && $this->params['approved']==1 && $this->expComment->poster != $user->id) {\n\t\t $this->sendApprovalNotification($this->expComment,$this->params);\n }", "\t\tflash('message', $msg);", "\t\t", "\t\texpHistory::back();\n\t}", "\t", "\tpublic function approve() {\n\t expHistory::set('editable', $this->params);", " \n /* The global constants can be overriden by passing appropriate params */ ", " //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", "\t ", "\t if (empty($this->params['id'])) {\n\t flash('error', gt('No ID supplied for comment to approve'));\n\t expHistory::back();\n\t }", "\t ", "\t $comment = new expComment($this->params['id']);\n\t assign_to_template(array(\n 'comment'=>$comment\n ));\n\t}", "\t", "\tpublic function approve_submit() {\n\t if (empty($this->params['id'])) {\n\t flash('error', gt('No ID supplied for comment to approve'));\n\t expHistory::back();\n\t }", " \n /* The global constants can be overriden by passing appropriate params */ ", " //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", "\t ", "\t $comment = new expComment($this->params['id']);\n\t $comment->body = $this->params['body'];\n\t $comment->approved = $this->params['approved'];\n\t $comment->save();\n\t expHistory::back();\n\t}", "\t", "\tpublic function approve_toggle() {\n\t if (empty($this->params['id'])) return;", " \n /* The global constants can be overriden by passing appropriate params */ ", " //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", "\t $comment = new expComment($this->params['id']);\n\t $comment->approved = $comment->approved == 1 ? 0 : 1;\n\t if ($comment->approved) {\n\t\t $this->sendApprovalNotification($comment,$this->params);\n\t }\n\t $comment->save();\n\t expHistory::back();\n\t}", " /**\n * this method bulk processes the selected comments\n */\n function bulk_process() {\n global $db;", " if (!empty($this->params['bulk_select']) && !empty($this->params['command'])) {\n foreach ($this->params['bulk_select'] as $item) {\n switch ($this->params['command']) {\n case 1: // approve\n $comment = new expComment($item);\n if (!$comment->approved) {\n $comment->approved = 1;\n //FIXME here is where we might sanitize the comments before approving them\n $attached = $db->selectObject('content_expComments','expcomments_id='.$item);\n $params['content_type'] = $attached->content_type;\n $params['content_id'] = $attached->content_id;\n $this->sendApprovalNotification($comment,$params);\n $comment->save();\n }\n break;\n case 2: // disable\n $comment = new expComment($item);\n \t $comment->approved = 0;\n \t $comment->save();\n break;\n case 3: //delete\n // delete the comment\n $comment = new expComment($item);\n $comment->delete();\n // delete the association too\n $db->delete($comment->attachable_table, 'expcomments_id='.$item);\n }\n }\n }\n expHistory::returnTo('manageable');\n }", "\tpublic function delete() {\n\t global $db;", " \n /* The global constants can be overriden by passing appropriate params */ ", " //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", "\t ", "\t if (empty($this->params['id'])) {\n\t flash('error', gt('Missing id for the comment you would like to delete'));\n\t expHistory::back();\n\t }", "\t ", "\t // delete the comment\n $comment = new expComment($this->params['id']);\n $comment->delete();", " ", " // delete the association too", " $db->delete($comment->attachable_table, 'expcomments_id='.$this->params['id']); \n ", " // send the user back where they came from.\n expHistory::back();\n\t}", "\t", "\tprivate function sendNotification($comment,$params) {\n//\t global $db;\n\t if (empty($comment)) return false;", " ", " //eDebug($comment,1);", " /* The global constants can be overriden by passing appropriate params */ ", " //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", "\t ", "\t // setup some email variables.\n\t $subject = gt('Notification of a New Comment Posted to').' '.URL_BASE;\n $tos = explode(',', str_replace(' ', '', $notification_email));\n $tos = array_filter($tos);\n if (empty($tos)) return false;", " $model = new $params['content_type']($params['content_id']);\n//\t $loc = expUnserialize($model->location_data);", " $posting = makelink(array('controller'=>$params['content_type'], 'action'=>'show', 'title'=>$model->sef_url));\n $editlink = makelink(array('controller'=>'expComment', 'action'=>'edit', 'content_id'=>$params['content_id'], 'content_type'=>$params['content_type'], 'id'=>$comment->id));", " ", " // make the email body\n $body = '<h1>'.gt('New Comment Posted').'</h1>';\n $body .= '<h2>'.gt('Posted By').'</h2>';\n $body .= '<p>'.$comment->name.\"</p>\";\n $body .= '<h2>'.gt('Poster\\'s Email').'</h2>';\n $body .= '<p>'.$comment->email.\"</p>\";\n $body .= '<h2>'.gt('Comment').'</h2>';\n $body .= '<p>'.$comment->body.'</p>';\n $body .= '<h3>'.gt('View posting').'</h3>';\n $body .= '<a href=\"'.$posting.'\">'.$posting.'</a>';\n //1$body .= \"<br><br>\";\n $body .= '<h3>'.gt('Edit / Approve comment').'</h3>';\n $body .= '<a href=\"'.$editlink.'\">'.$editlink.'</a>';", " ", " // create the mail message", " $mail = new expMail(); ", " $mail->quickSend(array(\n 'html_message'=>$body,\n\t\t\t 'to'=>$tos,\n\t\t\t\t'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n\t\t\t 'subject'=>$subject,\n ));", " ", " return true;\n\t}", "\tprivate function sendApprovalNotification($comment,$params) {\n\t if (empty($comment)) return false;", " \n /* The global constants can be overriden by passing appropriate params */ ", " //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", "\t ", "\t // setup some email variables.\n\t $subject = gt('Notification of Comment Approval on').' '.URL_BASE;\n $tos = explode(',', str_replace(' ', '', $notification_email));\n $tos[] = $comment->email;\n\t\t$tos = array_filter($tos);\n\t\tif (empty($tos)) return false;", " $model = new $params['content_type']($params['content_id']);\n//\t $loc = expUnserialize($model->location_data);", " $posting = makelink(array('controller'=>$params['content_type'], 'action'=>'show', 'title'=>$model->sef_url));", " // make the email body\n $body = '<h1>'.gt('Comment Approved').'</h1>';\n $body .= '<h2>'.gt('Posted By').'</h2>';\n $body .= '<p>'.$comment->name.\"</p>\";\n $body .= '<h2>'.gt('Poster\\'s Email').'</h2>';\n $body .= '<p>'.$comment->email.'</p>';\n $body .= '<h2>'.gt('Comment').'</h2>';\n $body .= '<p>'.$comment->body.\"</p>\";\n $body .= '<h3>'.gt('View posting').'</h3>';\n $body .= '<a href=\"'.$posting.'\">'.$posting.'</a>';", " // create the mail message", " $mail = new expMail(); ", " $mail->quickSend(array(\n 'html_message'=>$body,\n\t\t\t 'to'=>$tos,\n\t\t\t 'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n\t\t\t 'subject'=>$subject,\n ));", " ", " return true;\n\t}", "}", "?>" ]
[ 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expCommentController\n *\n * @package Core\n * @subpackage Controllers\n */", "class expCommentController extends expController {\n public $base_class = 'expComment';", " protected $remove_permissions = array(", " 'create'\n );", " protected $add_permissions = array(\n 'approve'=>\"Approve Comments\",\n 'bulk'=>\"Bulk Actions\"\n );", "\n static function displayname() { return gt(\"Comments\"); }\n static function description() { return gt(\"Use this module to add comments to a page.\"); }", "", "\tfunction edit() {\n\t if (empty($this->params['content_id'])) {\n\t flash('message',gt('An error occurred: No content id set.'));", " expHistory::back();\n\t }", " /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", "\n", "\t $id = empty($this->params['id']) ? null : $this->params['id'];\n\t $comment = new expComment($id);\n //FIXME here is where we might sanitize the comment before displaying/editing it\n\t\tassign_to_template(array(\n\t\t 'content_id'=>$this->params['content_id'],\n 'content_type'=>$this->params['content_type'],\n\t\t 'comment'=>$comment\n\t\t));", "\t}\n", "\tfunction manage() {\n\t expHistory::set('manageable', $this->params);", " $order = 'approved';\n $dir = 'ASC';\n /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", "", "\t $sql = 'SELECT c.*, cnt.* FROM '.DB_TABLE_PREFIX.'_expComments c ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_content_expComments cnt ON c.id=cnt.expcomments_id ';\n if (!empty($this->params['content_id']) && !empty($this->params['content_type'])) {\n $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";\n $order = 'created_at';\n $dir = 'DESC';\n }\n //$sql .= 'AND c.approved=0';", " $page = new expPaginator(array(\n// 'model'=>'expComment',", " 'sql'=>$sql,", " 'limit'=>10,\n 'order'=>$order,\n 'dir'=>$dir,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Approved')=>'approved',\n gt('Poster')=>'name',\n gt('Comment')=>'body',\n gt('Type')=>'content_type'\n ),\n ));", " $refs[][] = array();\n foreach ($page->records as $record) {\n //FIXME here is where we might sanitize the comments before displaying them\n $item = new $record->content_type($record->content_id);\n $refs[$record->content_type][$record->content_id] = $item->title;\n }\n assign_to_template(array(\n 'page'=>$page,\n 'refs'=>$refs,\n ));\n\t}", " /**\n * Displays comments attached to specified item\n */\n\tfunction showComments() {\n\t\tglobal $user, $db;", " /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet", " $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : intval($this->params['require_login']);\n $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : intval($this->params['require_approval']);\n $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : intval($this->params['require_notification']);\n $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : expString::escape($this->params['notification_email']);", "\n// $sql = 'SELECT c.*, ua.image, u.username FROM '.$db->prefix.'expComments c ';\n// $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON c.id=cnt.expcomments_id ';\n// $sql .= 'JOIN '.$db->prefix.'user_avatar ua ON c.poster=ua.user_id ';\n// $sql .= 'JOIN '.$db->prefix.'user u ON c.poster=u.id ';\n// $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";", " $sql = 'SELECT c.* FROM '.$db->prefix.'expComments c ';\n $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON c.id=cnt.expcomments_id ';", " $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".expString::escape($this->params['content_type']).\"' \";", " if (!$user->isAdmin()) {\n $sql .= 'AND c.approved=1';\n }", " $comments = new expPaginator(array(\n //'model'=>'expComment',", " 'sql'=>$sql,", "// 'limit'=>999,\n 'order'=>'created_at',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Readable Column Name')=>'Column Name'\n ),\n ));", " // add username and avatar\n foreach ($comments->records as $key=>$record) {\n $commentor = new user($record->poster);\n //FIXME here is where we might sanitize the comments before displaying them\n// $comments->records[$key]->username = $commentor->username; //FIXME this should follow the site attribution setting\n $comments->records[$key]->username = user::getUserAttribution($commentor->id); // follow the site attribution setting\n $comments->records[$key]->avatar = $db->selectObject('user_avatar',\"user_id='\".$record->poster.\"'\");\n }", " if (empty($this->params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records);\n // eDebug($sql, true);", "", " // count the unapproved comments\n if ($require_approval == 1 && $user->isAdmin()) {\n $sql = 'SELECT count(com.id) as c FROM '.$db->prefix.'expComments com ';\n $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON com.id=cnt.expcomments_id ';", " $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".expString::escape($this->params['content_type']).\"' \";", " $sql .= 'AND com.approved=0';\n $unapproved = $db->countObjectsBySql($sql);\n } else {\n $unapproved = 0;", " }\n", " $this->config = $this->params['config'];\n $type = !empty($this->params['type']) ? $this->params['type'] : gt('Comment');\n $ratings = !empty($this->params['ratings']) ? true : false;", " assign_to_template(array(\n 'comments'=>$comments,\n 'config'=>$this->params['config'],\n 'unapproved'=>$unapproved,", "\t\t\t'content_id'=>$this->params['content_id'],", "\t\t\t'content_type'=>$this->params['content_type'],\n\t\t\t'user'=>$user,\n\t\t\t'hideform'=>$this->params['hideform'],\n\t\t\t'hidecomments'=>$this->params['hidecomments'],\n\t\t\t'title'=>$this->params['title'],\n\t\t\t'formtitle'=>$this->params['formtitle'],\n 'type'=>$type,\n 'ratings'=>$ratings,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n\t\t));\n\t}", " /**\n * function to arrange comments in hierarchy of parent_id's as children properties\n *\n * @param array $comments\n *\n * @return array\n */\n function arrangecomments($comments) {", " $tree = array();", " /* We get all the parent into the tree array */\n foreach ($comments as &$node) {\n /* Note: I've used 0 for top level parent, you can change this to == 'NULL' */\n if($node->parent_id=='0'){\n $tree[] = $node;\n unset($node);\n }\n }", " /* This is the recursive function that does the magic */\n /* $k is the position in the array */\n if (!function_exists('findchildren')) {\n function findchildren(&$parent, &$comments, $k = 0)\n {\n if (isset($comments[$k])) {\n if ($comments[$k]->parent_id == $parent->id) {\n $com = $comments[$k];\n findchildren($com, $comments); // We try to find children's children\n $parent->children[] = $com;\n }\n findchildren($parent, $comments, $k + 1); // And move to the next sibling\n }\n }\n }", " /* looping through the parent array, we try to find the children */\n foreach ($tree as &$parent) {\n findchildren($parent, $comments);\n }", " return $tree;\n }", " /**\n * Returns count of comments attached to specified item\n *\n * @static\n * @param $params\n * @return int\n */\n public static function countComments($params) {\n// global $user, $db;\n global $user;", " $sql = 'SELECT c.* FROM '.DB_TABLE_PREFIX.'_expComments c ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_content_expComments cnt ON c.id=cnt.expcomments_id ';\n $sql .= 'WHERE cnt.content_id='.$params['content_id'].\" AND cnt.content_type='\".$params['content_type'].\"' \";\n if (!$user->isAdmin()) {\n $sql .= 'AND c.approved=1';\n }", " $comments = new expPaginator(array(\n 'sql'=>$sql,\n ));\n return count($comments->records);\n// return $count = $db->countObjectsBySql($sql);", " }", " /**\n * Returns comments attached to specified item\n *\n * @static\n * @param $params\n * @return array\n */\n public static function getComments($params) {\n global $user, $db;", " $sql = 'SELECT c.* FROM '.$db->prefix.'expComments c ';\n $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON c.id=cnt.expcomments_id ';\n $sql .= 'WHERE cnt.content_id='.$params['content_id'].\" AND cnt.content_type='\".$params['content_type'].\"' \";\n if (!$user->isAdmin()) {\n $sql .= 'AND c.approved=1';\n }", " $comments = new expPaginator(array(\n //'model'=>'expComment',\n 'sql'=>$sql,\n // 'limit'=>999,\n 'order'=>'created_at',\n// 'page'=>(isset($params['page']) ? $params['page'] : 1),\n 'controller'=>'expComment',\n// 'action'=>$params['action'],\n// 'columns'=>array(\n// gt('Readable Column Name')=>'Column Name'\n// ),\n ));", " // add username and avatar\n foreach ($comments->records as $key=>$record) {\n $commentor = new user($record->poster);\n //FIXME here is where we might sanitize the comments before displaying them\n// $comments->records[$key]->username = $commentor->username; //FIXME this should follow the site attribution setting\n $comments->records[$key]->username = user::getUserAttribution($commentor->id); // follow the site attribution setting\n $comments->records[$key]->avatar = $db->selectObject('user_avatar',\"user_id='\".$record->poster.\"'\");\n }\n// if (empty($params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records);\n // eDebug($sql, true);", " // count the unapproved comments\n $unapproved = 0;", "// assign_to_template(array(\n// 'comments'=>$comments,\n// 'config'=>$params['config'],\n// 'unapproved'=>$unapproved,\n// 'content_id'=>$params['content_id'],\n// 'content_type'=>$params['content_type'],\n// 'user'=>$user,\n// 'hideform'=>$params['hideform'],\n// 'hidecomments'=>$params['hidecomments'],\n// 'title'=>$params['title'],\n// 'formtitle'=>$params['formtitle'],\n// ));\n return $comments->records;\n }", " function update() {\n global $user;", "", " /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", " if (COMMENTS_REQUIRE_LOGIN && !$user->isLoggedIn()) {\n expValidator::failAndReturnToForm('You must be logged on to post a comment!', $this->params);\n }\n // check the anti-spam control\n if (!(ANTI_SPAM_USERS_SKIP && $user->isLoggedIn())) {\n expValidator::check_antispam($this->params, gt('Your comment was not posted.') . ' ' . gt(\"Anti-spam verification failed. Please try again. Please try again.\"));\n }", "", " // figure out the name and email address\n if (!empty($user->id) && empty($this->params['id'])) {\n $this->params['name'] = $user->firstname.\" \".$user->lastname;\n $this->params['email'] = $user->email;\n }", "", " // save the comment\n if (empty($require_approval)) {\n $this->expComment->approved=1;\n }\n $this->expComment->update($this->params);", "", " // attach the comment to the datatype it belongs to (blog, news, etc..);\n// $obj = new stdClass();\n//\t\t$obj->content_type = $this->params['content_type'];\n//\t\t$obj->content_id = $this->params['content_id'];\n//\t\t$obj->expcomments_id = $this->expComment->id;\n//\t\tif(isset($this->params['subtype'])) $obj->subtype = $this->params['subtype'];\n//\t\t$db->insertObject($obj, $this->expComment->attachable_table);\n $this->expComment->attachComment($this->params['content_type'], $this->params['content_id'], $this->params['subtype']);", "\t\t$msg = 'Thank you for posting a comment.';\n\t\tif ($require_approval == 1 && !$user->isAdmin()) {\n\t\t $msg .= ' '.gt('Your comment is now pending approval. You will receive an email to').' ';\n\t\t $msg .= $this->expComment->email.' '.gt('letting you know when it has been approved.');\n\t\t}", "", "\t\tif ($require_notification && !$user->isAdmin()) {\n\t\t $this->sendNotification($this->expComment,$this->params);\n\t\t}\n if ($require_approval==1 && $this->params['approved']==1 && $this->expComment->poster != $user->id) {\n\t\t $this->sendApprovalNotification($this->expComment,$this->params);\n }", "\t\tflash('message', $msg);", "", "\t\texpHistory::back();\n\t}", "", "\tpublic function approve() {\n\t expHistory::set('editable', $this->params);", "\n /* The global constants can be overriden by passing appropriate params */", " //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", "", "\t if (empty($this->params['id'])) {\n\t flash('error', gt('No ID supplied for comment to approve'));\n\t expHistory::back();\n\t }", "", "\t $comment = new expComment($this->params['id']);\n\t assign_to_template(array(\n 'comment'=>$comment\n ));\n\t}", "", "\tpublic function approve_submit() {\n\t if (empty($this->params['id'])) {\n\t flash('error', gt('No ID supplied for comment to approve'));\n\t expHistory::back();\n\t }", "\n /* The global constants can be overriden by passing appropriate params */", " //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", "", "\t $comment = new expComment($this->params['id']);\n\t $comment->body = $this->params['body'];\n\t $comment->approved = $this->params['approved'];\n\t $comment->save();\n\t expHistory::back();\n\t}", "", "\tpublic function approve_toggle() {\n\t if (empty($this->params['id'])) return;", "\n /* The global constants can be overriden by passing appropriate params */", " //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", "\t $comment = new expComment($this->params['id']);\n\t $comment->approved = $comment->approved == 1 ? 0 : 1;\n\t if ($comment->approved) {\n\t\t $this->sendApprovalNotification($comment,$this->params);\n\t }\n\t $comment->save();\n\t expHistory::back();\n\t}", " /**\n * this method bulk processes the selected comments\n */\n function bulk_process() {\n global $db;", " if (!empty($this->params['bulk_select']) && !empty($this->params['command'])) {\n foreach ($this->params['bulk_select'] as $item) {\n switch ($this->params['command']) {\n case 1: // approve\n $comment = new expComment($item);\n if (!$comment->approved) {\n $comment->approved = 1;\n //FIXME here is where we might sanitize the comments before approving them\n $attached = $db->selectObject('content_expComments','expcomments_id='.$item);\n $params['content_type'] = $attached->content_type;\n $params['content_id'] = $attached->content_id;\n $this->sendApprovalNotification($comment,$params);\n $comment->save();\n }\n break;\n case 2: // disable\n $comment = new expComment($item);\n \t $comment->approved = 0;\n \t $comment->save();\n break;\n case 3: //delete\n // delete the comment\n $comment = new expComment($item);\n $comment->delete();\n // delete the association too\n $db->delete($comment->attachable_table, 'expcomments_id='.$item);\n }\n }\n }\n expHistory::returnTo('manageable');\n }", "\tpublic function delete() {\n\t global $db;", "\n /* The global constants can be overriden by passing appropriate params */", " //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", "", "\t if (empty($this->params['id'])) {\n\t flash('error', gt('Missing id for the comment you would like to delete'));\n\t expHistory::back();\n\t }", "", "\t // delete the comment\n $comment = new expComment($this->params['id']);\n $comment->delete();", "", " // delete the association too", " $db->delete($comment->attachable_table, 'expcomments_id='.$this->params['id']);\n", " // send the user back where they came from.\n expHistory::back();\n\t}", "", "\tprivate function sendNotification($comment,$params) {\n//\t global $db;\n\t if (empty($comment)) return false;", "", " //eDebug($comment,1);", " /* The global constants can be overriden by passing appropriate params */", " //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", "", "\t // setup some email variables.\n\t $subject = gt('Notification of a New Comment Posted to').' '.URL_BASE;\n $tos = explode(',', str_replace(' ', '', $notification_email));\n $tos = array_filter($tos);\n if (empty($tos)) return false;", " $model = new $params['content_type']($params['content_id']);\n//\t $loc = expUnserialize($model->location_data);", " $posting = makelink(array('controller'=>$params['content_type'], 'action'=>'show', 'title'=>$model->sef_url));\n $editlink = makelink(array('controller'=>'expComment', 'action'=>'edit', 'content_id'=>$params['content_id'], 'content_type'=>$params['content_type'], 'id'=>$comment->id));", "", " // make the email body\n $body = '<h1>'.gt('New Comment Posted').'</h1>';\n $body .= '<h2>'.gt('Posted By').'</h2>';\n $body .= '<p>'.$comment->name.\"</p>\";\n $body .= '<h2>'.gt('Poster\\'s Email').'</h2>';\n $body .= '<p>'.$comment->email.\"</p>\";\n $body .= '<h2>'.gt('Comment').'</h2>';\n $body .= '<p>'.$comment->body.'</p>';\n $body .= '<h3>'.gt('View posting').'</h3>';\n $body .= '<a href=\"'.$posting.'\">'.$posting.'</a>';\n //1$body .= \"<br><br>\";\n $body .= '<h3>'.gt('Edit / Approve comment').'</h3>';\n $body .= '<a href=\"'.$editlink.'\">'.$editlink.'</a>';", "", " // create the mail message", " $mail = new expMail();", " $mail->quickSend(array(\n 'html_message'=>$body,\n\t\t\t 'to'=>$tos,\n\t\t\t\t'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n\t\t\t 'subject'=>$subject,\n ));", "", " return true;\n\t}", "\tprivate function sendApprovalNotification($comment,$params) {\n\t if (empty($comment)) return false;", "\n /* The global constants can be overriden by passing appropriate params */", " //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];", "", "\t // setup some email variables.\n\t $subject = gt('Notification of Comment Approval on').' '.URL_BASE;\n $tos = explode(',', str_replace(' ', '', $notification_email));\n $tos[] = $comment->email;\n\t\t$tos = array_filter($tos);\n\t\tif (empty($tos)) return false;", " $model = new $params['content_type']($params['content_id']);\n//\t $loc = expUnserialize($model->location_data);", " $posting = makelink(array('controller'=>$params['content_type'], 'action'=>'show', 'title'=>$model->sef_url));", " // make the email body\n $body = '<h1>'.gt('Comment Approved').'</h1>';\n $body .= '<h2>'.gt('Posted By').'</h2>';\n $body .= '<p>'.$comment->name.\"</p>\";\n $body .= '<h2>'.gt('Poster\\'s Email').'</h2>';\n $body .= '<p>'.$comment->email.'</p>';\n $body .= '<h2>'.gt('Comment').'</h2>';\n $body .= '<p>'.$comment->body.\"</p>\";\n $body .= '<h3>'.gt('View posting').'</h3>';\n $body .= '<a href=\"'.$posting.'\">'.$posting.'</a>';", " // create the mail message", " $mail = new expMail();", " $mail->quickSend(array(\n 'html_message'=>$body,\n\t\t\t 'to'=>$tos,\n\t\t\t 'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n\t\t\t 'subject'=>$subject,\n ));", "", " return true;\n\t}", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expDefinableFieldController\n *\n * @package Core\n * @subpackage Controllers\n */", "class expDefinableFieldController extends expController {\n\tpublic $basemodel_name = 'expDefinableField';", "\t/**\n\t * name of module\n\t * @return string\n\t */\n static function displayname() { return gt(\"Definable Field\"); }", "\t/**\n\t * description of module\n\t * @return string\n\t */\n static function description() { return gt(\"This module is for managing definable fields\"); }", "\t/**\n\t * does module have sources available?\n\t * @return bool\n\t */\n\tstatic function hasSources() { return false; }", " /**\n \t * default view for individual field\n \t */\n \tfunction show() {", " assign_to_template(array('record'=>$record,'tag'=>$tag)); //FIXME $record & $tag are undefined", " }", "\t/**\n\t * manage definable field\n\t */\n\tfunction manage() {\n global $db;", "\t\t", " expHistory::set('manageable', $this->params);\n\t\t$fields = $db->selectObjects(\"expDefinableFields\",'1','rank');\n\t\t$types = expTemplate::listControlTypes();\n uasort($types, \"strnatcmp\");\n\t\tarray_unshift($types,'['.gt('Please Select'.']'));\n assign_to_template(array('fields'=>$fields, 'types'=>$types));\n }", "\t", "\tfunction edit() {\n\t\tglobal $db;", "\t\t ", "\t\t$control_type = \"\";\n\t\t$ctl = null;\n\t\tif (isset($this->params['id'])) {\n\t\t\t$control = $db->selectObject(\"expDefinableFields\",\"id=\".$this->params['id']);\n\t\t\tif ($control) {\n\t\t\t\t$ctl = unserialize($control->data);\n\t\t\t\t$ctl->identifier = $control->name;\n\t\t\t\t$ctl->id = $control->id;\n\t\t\t\t$control_type = get_class($ctl);\n\t\t\t}\n\t\t}\n\t\tif ($control_type == \"\") $control_type = $this->params['control_type'];\n\t\t$form = call_user_func(array($control_type,\"form\"),$ctl);", "\t\tif ($ctl) { ", "\t\t\t$form->controls['identifier']->disabled = true;\n\t\t\t$form->meta(\"id\",$ctl->id);\n\t\t\t$form->meta(\"identifier\",$ctl->identifier);\n\t\t}\n\t\t$form->meta(\"action\",\"save\");\n\t\t$form->meta('module',\"expDefinableField\");\n\t\t$form->meta('control_type',$control_type);\n\t\t$form->meta(\"type\", $control_type);\n\t\t$types = expTemplate::listControlTypes();\n", "\t\tassign_to_template(array('form_html'=>$form->toHTML(), 'types'=>$types[$control_type]));\t\t\t", "\t}", "\t\n\tfunction save() {\t", "\t\tglobal $db;\n\t\t$ctl = null;\n\t\t$control = null;\n\t\tif (isset($this->params['id'])) {\n\t\t\t$control = $db->selectObject('expDefinableFields','id='.$this->params['id']);\n\t\t\tif ($control) {\n\t\t\t\t$ctl = unserialize($control->data);\n\t\t\t\t$ctl->name = $ctl->identifier;\n\t\t\t}\n\t\t}\n", "\t\tif (call_user_func(array($_POST['control_type'],'useGeneric')) == true) { \t", "\t\t\t$ctl = call_user_func(array('genericcontrol','update'),expString::sanitize($_POST),$ctl);\n\t\t} else {\n\t\t\t$ctl = call_user_func(array($_POST['control_type'],'update'),expString::sanitize($_POST),$ctl);\n\t\t}", "\t\t", "\t\tif ($ctl != null) {\n\t\t\t$name = substr(preg_replace('/[^A-Za-z0-9]/','_',$ctl->identifier),0,20);", "\t", "\t\t\tif (!isset($this->params['id'])) {\n\t\t\t\t$control->name = $name;\n\t\t\t}", "\t", " if (!empty($ctl->pattern)) $ctl->pattern = addslashes($ctl->pattern);\n\t\t\t$control->data = serialize($ctl);\n\t\t\t$control->type = $this->params['type'];", "\t\t\t", "\t\t\tif (isset($control->id)) {\n\t\t\t\t$db->updateObject($control,'expDefinableFields');\n\t\t\t} else {\n\t\t\t\t$db->insertObject($control,'expDefinableFields');\n\t\t\t}\n\t\t}", "\t\t", "\t\tredirect_to(array('controller'=>'expDefinableField','action'=>'manage'));\n\t}", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expDefinableFieldController\n *\n * @package Core\n * @subpackage Controllers\n */", "class expDefinableFieldController extends expController {\n\tpublic $basemodel_name = 'expDefinableField';", "\t/**\n\t * name of module\n\t * @return string\n\t */\n static function displayname() { return gt(\"Definable Field\"); }", "\t/**\n\t * description of module\n\t * @return string\n\t */\n static function description() { return gt(\"This module is for managing definable fields\"); }", "\t/**\n\t * does module have sources available?\n\t * @return bool\n\t */\n\tstatic function hasSources() { return false; }", " /**\n \t * default view for individual field\n \t */\n \tfunction show() {", "// assign_to_template(array('record'=>$record,'tag'=>$tag)); //FIXME $record & $tag are undefined", " }", "\t/**\n\t * manage definable field\n\t */\n\tfunction manage() {\n global $db;", "", " expHistory::set('manageable', $this->params);\n\t\t$fields = $db->selectObjects(\"expDefinableFields\",'1','rank');\n\t\t$types = expTemplate::listControlTypes();\n uasort($types, \"strnatcmp\");\n\t\tarray_unshift($types,'['.gt('Please Select'.']'));\n assign_to_template(array('fields'=>$fields, 'types'=>$types));\n }", "", "\tfunction edit() {\n\t\tglobal $db;", "", "\t\t$control_type = \"\";\n\t\t$ctl = null;\n\t\tif (isset($this->params['id'])) {\n\t\t\t$control = $db->selectObject(\"expDefinableFields\",\"id=\".$this->params['id']);\n\t\t\tif ($control) {\n\t\t\t\t$ctl = unserialize($control->data);\n\t\t\t\t$ctl->identifier = $control->name;\n\t\t\t\t$ctl->id = $control->id;\n\t\t\t\t$control_type = get_class($ctl);\n\t\t\t}\n\t\t}\n\t\tif ($control_type == \"\") $control_type = $this->params['control_type'];\n\t\t$form = call_user_func(array($control_type,\"form\"),$ctl);", "\t\tif ($ctl) {", "\t\t\t$form->controls['identifier']->disabled = true;\n\t\t\t$form->meta(\"id\",$ctl->id);\n\t\t\t$form->meta(\"identifier\",$ctl->identifier);\n\t\t}\n\t\t$form->meta(\"action\",\"save\");\n\t\t$form->meta('module',\"expDefinableField\");\n\t\t$form->meta('control_type',$control_type);\n\t\t$form->meta(\"type\", $control_type);\n\t\t$types = expTemplate::listControlTypes();\n", "\t\tassign_to_template(array('form_html'=>$form->toHTML(), 'types'=>$types[$control_type]));", "\t}", "\n\tfunction save() {", "\t\tglobal $db;\n\t\t$ctl = null;\n\t\t$control = null;\n\t\tif (isset($this->params['id'])) {\n\t\t\t$control = $db->selectObject('expDefinableFields','id='.$this->params['id']);\n\t\t\tif ($control) {\n\t\t\t\t$ctl = unserialize($control->data);\n\t\t\t\t$ctl->name = $ctl->identifier;\n\t\t\t}\n\t\t}\n", "\t\tif (call_user_func(array($_POST['control_type'],'useGeneric')) == true) {", "\t\t\t$ctl = call_user_func(array('genericcontrol','update'),expString::sanitize($_POST),$ctl);\n\t\t} else {\n\t\t\t$ctl = call_user_func(array($_POST['control_type'],'update'),expString::sanitize($_POST),$ctl);\n\t\t}", "", "\t\tif ($ctl != null) {\n\t\t\t$name = substr(preg_replace('/[^A-Za-z0-9]/','_',$ctl->identifier),0,20);", "", "\t\t\tif (!isset($this->params['id'])) {\n\t\t\t\t$control->name = $name;\n\t\t\t}", "", " if (!empty($ctl->pattern)) $ctl->pattern = addslashes($ctl->pattern);\n\t\t\t$control->data = serialize($ctl);\n\t\t\t$control->type = $this->params['type'];", "", "\t\t\tif (isset($control->id)) {\n\t\t\t\t$db->updateObject($control,'expDefinableFields');\n\t\t\t} else {\n\t\t\t\t$db->insertObject($control,'expDefinableFields');\n\t\t\t}\n\t\t}", "", "\t\tredirect_to(array('controller'=>'expDefinableField','action'=>'manage'));\n\t}", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expHTMLEditorController\n *\n * @package Core\n * @subpackage Controllers\n */", "class expHTMLEditorController extends expController\n{", " static function displayname()\n {\n return gt(\"Editors\");\n }", " static function description()\n {\n return gt(\"Mostly for CKEditor\");\n }", " static function author()\n {\n return \"Phillip Ball\";\n }", " static function hasSources()\n {\n return false;\n }", " static function hasContent()\n {\n return false;\n }", " protected $add_permissions = array(", " 'activate' => \"Activate\",\n 'preview' => \"Preview Editor Toolbars\"\n );", "", "\n function __construct($src = null, $params = array())\n {\n parent:: __construct($src, $params);\n if (empty($this->params['editor'])) {\n $this->params['editor'] = SITE_WYSIWYG_EDITOR;\n }\n }", " function manage()\n {\n global $db;", " expHistory::set('manageable', $this->params);\n if (SITE_WYSIWYG_EDITOR == \"FCKeditor\") {\n flash('error', gt('FCKeditor is deprecated!'));\n redirect_to(array(\"module\" => \"administration\", \"action\" => \"configure_site\"));\n }", " // otherwise, on to the show\n $configs = $db->selectObjects('htmleditor_' . $this->params['editor'], 1);", " assign_to_template(\n array(\n 'configs' => $configs,\n 'editor' => $this->params['editor']\n )\n );\n }", " function update()\n {\n global $db;", " $obj = self::getEditorSettings($this->params['id'], $this->params['editor']);\n $obj->name = $this->params['name'];\n $obj->data = stripSlashes($this->params['data']);\n $obj->skin = $this->params['skin'];\n $obj->scayt_on = $this->params['scayt_on'];\n $obj->paste_word = $this->params['paste_word'];\n $obj->plugins = stripSlashes($this->params['plugins']);\n $obj->stylesset = stripSlashes($this->params['stylesset']);\n $obj->formattags = stripSlashes($this->params['formattags']);\n $obj->fontnames = stripSlashes($this->params['fontnames']);\n if (empty($this->params['id'])) {\n $this->params['id'] = $db->insertObject($obj, 'htmleditor_' . $this->params['editor']);\n } else {\n $db->updateObject($obj, 'htmleditor_' . $this->params['editor'], null, 'id');\n }\n if ($this->params['active']) {\n $this->activate();\n }\n expHistory::returnTo('manageable');\n }", " function edit()\n {\n expHistory::set('editable', $this->params);\n $tool = self::getEditorSettings(!empty($this->params['id'])?$this->params['id']:null, $this->params['editor']);\n if ($tool == null) $tool = new stdClass();\n $tool->data = !empty($tool->data) ? @stripSlashes($tool->data) : '';\n $tool->plugins = !empty($tool->plugins) ? @stripSlashes($tool->plugins) : '';\n $tool->stylesset = !empty($tool->stylesset) ? @stripSlashes($tool->stylesset) : '';\n $tool->formattags = !empty($tool->formattags) ? @stripSlashes($tool->formattags) : '';\n $tool->fontnames = !empty($tool->fontnames) ? @stripSlashes($tool->fontnames) : '';\n $skins_dir = opendir(BASE . 'external/editors/' . $this->params['editor'] . '/skins');\n $skins = array();\n while (($skin = readdir($skins_dir)) !== false) {\n if ($skin != '.' && $skin != '..') {\n $skins[] = $skin;\n }\n }\n assign_to_template(\n array(\n 'record' => $tool,\n 'skins' => $skins,\n 'editor' => $this->params['editor']\n )\n );\n }", " function delete()\n {\n global $db;", " expHistory::set('editable', $this->params);\n @$db->delete('htmleditor_' . $this->params['editor'], \"id=\" . $this->params['id']);\n expHistory::returnTo('manageable');\n }", " function activate()\n {\n global $db;", " $db->toggle('htmleditor_' . $this->params['editor'], \"active\", 'active=1');\n if ($this->params['id'] != \"default\") {\n $active = self::getEditorSettings($this->params['id'], $this->params['editor']);\n $active->active = 1;\n $db->updateObject($active, 'htmleditor_' . $this->params['editor'], null, 'id');\n }\n expHistory::returnTo('manageable');\n }", " function preview()\n {\n if ($this->params['id'] == 0) { // we want the default editor\n $demo = new stdClass();\n $demo->id = 0;\n $demo->name = \"Default\";\n if ($this->params['editor'] == 'ckeditor') {\n $demo->skin = 'kama';\n } elseif ($this->params['editor'] == 'tinymce') {\n $demo->skin = 'lightgray';\n }\n } else {\n $demo = self::getEditorSettings($this->params['id'], $this->params['editor']);\n }\n assign_to_template(\n array(\n 'demo' => $demo,\n 'editor' => $this->params['editor']\n )\n );\n }", " public static function getEditorSettings($settings_id, $editor)\n {\n global $db;", " return @$db->selectObject('htmleditor_' . $editor, \"id=\" . $settings_id);\n }", " public static function getActiveEditorSettings($editor)\n {\n global $db;", " return $db->selectObject('htmleditor_' . $editor, 'active=1');\n }", "}", "?>" ]
[ 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expHTMLEditorController\n *\n * @package Core\n * @subpackage Controllers\n */", "class expHTMLEditorController extends expController\n{", " protected $manage_permissions = array(", " 'activate' => \"Activate\",\n 'preview' => \"Preview Editor Toolbars\"\n );", " public $requires_login = array(\n 'preview'=>'Preview Editor',\n );", " static function displayname()\n {\n return gt(\"Editors\");\n }", " static function description()\n {\n return gt(\"Mostly for CKEditor\");\n }", " static function author()\n {\n return \"Phillip Ball\";\n }", " static function hasSources()\n {\n return false;\n }", " static function hasContent()\n {\n return false;\n }", "\n function __construct($src = null, $params = array())\n {\n parent:: __construct($src, $params);\n if (empty($this->params['editor'])) {\n $this->params['editor'] = SITE_WYSIWYG_EDITOR;\n }\n }", " function manage()\n {\n global $db;", " expHistory::set('manageable', $this->params);\n if (SITE_WYSIWYG_EDITOR == \"FCKeditor\") {\n flash('error', gt('FCKeditor is deprecated!'));\n redirect_to(array(\"module\" => \"administration\", \"action\" => \"configure_site\"));\n }", " // otherwise, on to the show\n $configs = $db->selectObjects('htmleditor_' . $this->params['editor'], 1);", " assign_to_template(\n array(\n 'configs' => $configs,\n 'editor' => $this->params['editor']\n )\n );\n }", " function update()\n {\n global $db;", " $obj = self::getEditorSettings($this->params['id'], $this->params['editor']);\n $obj->name = $this->params['name'];\n $obj->data = stripSlashes($this->params['data']);\n $obj->skin = $this->params['skin'];\n $obj->scayt_on = $this->params['scayt_on'];\n $obj->paste_word = $this->params['paste_word'];\n $obj->plugins = stripSlashes($this->params['plugins']);\n $obj->stylesset = stripSlashes($this->params['stylesset']);\n $obj->formattags = stripSlashes($this->params['formattags']);\n $obj->fontnames = stripSlashes($this->params['fontnames']);\n if (empty($this->params['id'])) {\n $this->params['id'] = $db->insertObject($obj, 'htmleditor_' . $this->params['editor']);\n } else {\n $db->updateObject($obj, 'htmleditor_' . $this->params['editor'], null, 'id');\n }\n if ($this->params['active']) {\n $this->activate();\n }\n expHistory::returnTo('manageable');\n }", " function edit()\n {\n expHistory::set('editable', $this->params);\n $tool = self::getEditorSettings(!empty($this->params['id'])?$this->params['id']:null, $this->params['editor']);\n if ($tool == null) $tool = new stdClass();\n $tool->data = !empty($tool->data) ? @stripSlashes($tool->data) : '';\n $tool->plugins = !empty($tool->plugins) ? @stripSlashes($tool->plugins) : '';\n $tool->stylesset = !empty($tool->stylesset) ? @stripSlashes($tool->stylesset) : '';\n $tool->formattags = !empty($tool->formattags) ? @stripSlashes($tool->formattags) : '';\n $tool->fontnames = !empty($tool->fontnames) ? @stripSlashes($tool->fontnames) : '';\n $skins_dir = opendir(BASE . 'external/editors/' . $this->params['editor'] . '/skins');\n $skins = array();\n while (($skin = readdir($skins_dir)) !== false) {\n if ($skin != '.' && $skin != '..') {\n $skins[] = $skin;\n }\n }\n assign_to_template(\n array(\n 'record' => $tool,\n 'skins' => $skins,\n 'editor' => $this->params['editor']\n )\n );\n }", " function delete()\n {\n global $db;", " expHistory::set('editable', $this->params);\n @$db->delete('htmleditor_' . $this->params['editor'], \"id=\" . $this->params['id']);\n expHistory::returnTo('manageable');\n }", " function activate()\n {\n global $db;", " $db->toggle('htmleditor_' . $this->params['editor'], \"active\", 'active=1');\n if ($this->params['id'] != \"default\") {\n $active = self::getEditorSettings($this->params['id'], $this->params['editor']);\n $active->active = 1;\n $db->updateObject($active, 'htmleditor_' . $this->params['editor'], null, 'id');\n }\n expHistory::returnTo('manageable');\n }", " function preview()\n {\n if ($this->params['id'] == 0) { // we want the default editor\n $demo = new stdClass();\n $demo->id = 0;\n $demo->name = \"Default\";\n if ($this->params['editor'] == 'ckeditor') {\n $demo->skin = 'kama';\n } elseif ($this->params['editor'] == 'tinymce') {\n $demo->skin = 'lightgray';\n }\n } else {\n $demo = self::getEditorSettings($this->params['id'], $this->params['editor']);\n }\n assign_to_template(\n array(\n 'demo' => $demo,\n 'editor' => $this->params['editor']\n )\n );\n }", " public static function getEditorSettings($settings_id, $editor)\n {\n global $db;", " return @$db->selectObject('htmleditor_' . $editor, \"id=\" . $settings_id);\n }", " public static function getActiveEditorSettings($editor)\n {\n global $db;", " return $db->selectObject('htmleditor_' . $editor, 'active=1');\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expSimpleNoteController\n *\n * @package Core\n * @subpackage Controllers\n */", "class expSimpleNoteController extends expController {\n public $base_class = 'expSimpleNote';", " protected $add_permissions = array(\n 'approve'=>\"Approve Comments\"", " );\n// protected $remove_permissions = array(\n// 'edit',\n// 'create'\n// );", " static function displayname() { return gt(\"Simple Notes\"); }\n static function description() { return gt(\"Use this module to add Simple Notes attached to something (product, order, etc)\"); }\n static function author() { return \"Jonathan Worent @ OIC Group, Inc\"; }", " ", " function edit() {\n global $user;", " \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n \n if (empty($this->params['formtitle'])) ", " {\n if (empty($this->params['id']))\n {\n $formtitle = gt(\"Add New Note\");\n }\n else\n {\n $formtitle = gt(\"Edit Note\");\n }\n }\n else\n {\n $formtitle = $this->params['formtitle'];\n }", " ", " $id = empty($this->params['id']) ? null : $this->params['id'];\n $simpleNote = new expSimpleNote($id);\n //FIXME here is where we might sanitize the note before displaying/editing it", " assign_to_template(array(\n 'simplenote'=>$simpleNote,\n 'user'=>$user,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'formtitle'=>$formtitle,\n 'content_type'=>$this->params['content_type'],\n 'content_id'=>$this->params['content_id'],\n 'tab'=>empty($this->params['tab'])?0:$this->params['tab']\n ));", " } \n ", " function manage() {\n expHistory::set('manageable', $this->params);", " \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n ", " $sql = 'SELECT n.* FROM '.DB_TABLE_PREFIX.'_expSimpleNote n ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_content_expSimpleNote cnt ON n.id=cnt.expsimplenote_id ';\n $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";\n $sql .= 'AND n.approved=0';", " ", " $page = new expPaginator(array(\n// 'model'=>'expSimpleNote', // brings in all of model", " 'sql'=>$sql, ", " 'limit'=>10,\n 'order'=>'created_at',\n 'dir'=>'DESC',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Approved')=>'approved',\n gt('Poster')=>'name',\n gt('Comment')=>'body'\n ),\n ));", " ", " //FIXME here is where we might sanitize the notes before displaying them", " assign_to_template(array(\n 'page'=>$page,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'tab'=>$this->params['tab']\n ));\n }", " ", " function getNotes() {\n global $user, $db;", " \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n \n ", " $sql = 'SELECT n.* FROM '.$db->prefix.'expSimpleNote n ';\n $sql .= 'JOIN '.$db->prefix.'content_expSimpleNote cnt ON n.id=cnt.expsimplenote_id ';", " $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";", " $sql .= 'AND n.approved=1';", " ", " $simplenotes = new expPaginator(array(\n //'model'=>'expSimpleNote',", " 'sql'=>$sql, ", " 'limit'=>10,\n 'order'=>'created_at',\n 'dir'=>'DESC',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Readable Column Name')=>'Column Name'\n ),\n ));", " \n // count the unapproved comments", " if ($require_approval == 1 && $user->isAdmin()) {\n $sql = 'SELECT count(com.id) as c FROM '.$db->prefix.'expSimpleNote com ';\n $sql .= 'JOIN '.$db->prefix.'content_expSimpleNote cnt ON com.id=cnt.expsimplenote_id ';", " $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";", " $sql .= 'AND com.approved=0';\n $unapproved = $db->countObjectsBySql($sql);\n } else {\n $unapproved = 0;", " } \n ", " //FIXME here is where we might sanitize the notes before displaying them", " assign_to_template(array(\n 'simplenotes'=>$simplenotes,", " 'unapproved'=>$unapproved, \n 'content_id'=>$this->params['content_id'], ", " 'content_type'=>$this->params['content_type'],\n 'user'=>$user,\n 'hideform'=>$this->params['hideform'],\n 'hidenotes'=>$this->params['hidenotes'],\n 'title'=>$this->params['title'],\n 'formtitle'=>$this->params['formtitle'],\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'tab'=>$this->params['tab']\n ));\n }", " function update() {\n global $db, $user, $history;", " \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n ", " // figure out the name and email address\n if (!empty($user->id)) {\n $this->params['name'] = $user->firstname.\" \".$user->lastname;\n $this->params['email'] = $user->email;\n }", " \n // if simplenotes are configed to require approvals set this to 0 otherwise we ", " // will just go ahead and turn the approval on for this comment.\n $this->expSimpleNote->approved = ($require_approval == 1 && !$user->isAdmin()) ? 0 : 1;", " ", " // save the note\n //FIXME here is where we might sanitize the note before saving it\n $this->expSimpleNote->update($this->params);", " ", " // attach the note to the datatype it belongs to (product, order, etc..);\n// $obj = new stdClass();\n// $obj->content_type = $this->params['content_type'];\n// $obj->content_id = $this->params['content_id'];\n// $obj->expsimplenote_id = $this->expSimpleNote->id;\n// if(isset($this->params['subtype'])) $obj->subtype = $this->params['subtype'];\n// $db->insertObject($obj, $this->expSimpleNote->attachable_table);\n $this->expSimpleNote->attachNote($this->params['content_type'], $this->params['content_id'], $this->params['subtype']);", " $msg = gt('Your note has been added.');\n if ($require_approval == 1 && !$user->isAdmin()) {\n $msg .= ' '.gt('Your note is now pending approval. You will receive an email to').' ';\n $msg .= $this->expSimpleNote->email.' '.gt('letting you know when it has been approved.');\n }", " ", " if ($require_notification && !$user->isAdmin()) {\n $this->sendNotification($this->expComment);\n }", " ", " flash('message', $msg);", " \n ", " $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']);\n if (!empty($this->params['tab']))\n {\n $lastUrl .= \"#\".$this->params['tab'];\n }\n redirect_to($lastUrl);\n }", " ", " public function approve() {\n expHistory::set('editable', $this->params);", " \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n ", " if (empty($this->params['id'])) {\n flash('error', gt('No ID supplied for note to approve'));\n $lastUrl = expHistory::getLast('editable');\n }", " ", " $simplenote = new expSimpleNote($this->params['id']);\n assign_to_template(array(\n 'simplenote'=>$simplenote,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'tab'=>$this->params['tab']\n ));\n }", " ", " public function approve_submit() {\n global $history;", " ", " if (empty($this->params['id'])) {\n flash('error', gt('No ID supplied for comment to approve'));\n $lastUrl = expHistory::getLast('editable');\n }", " \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n ", " $simplenote = new expSimpleNote($this->params['id']);\n //FIXME here is where we might sanitize the note before approving it\n $simplenote->body = $this->params['body'];\n $simplenote->approved = $this->params['approved'];\n $simplenote->save();", " ", " $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']);\n if (!empty($this->params['tab']))\n {\n $lastUrl .= \"#\".$this->params['tab'];\n }\n redirect_to($lastUrl);\n }", " ", " public function approve_toggle() {\n global $history;", " ", " if (empty($this->params['id'])) return;", " \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n \n ", " $simplenote = new expSimpleNote($this->params['id']);\n $simplenote->approved = $simplenote->approved == 1 ? 0 : 1;\n $simplenote->save();", " ", " $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']);\n if (!empty($this->params['tab']))\n {\n $lastUrl .= \"#\".$this->params['tab'];\n }\n redirect_to($lastUrl);\n }", " ", " public function delete() {\n global $db, $history;", " \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n ", " if (empty($this->params['id'])) {\n flash('error', gt('Missing id for the comment you would like to delete'));\n $lastUrl = expHistory::getLast('editable');\n }", " ", " // delete the note\n $simplenote = new expSimpleNote($this->params['id']);\n $rows = $simplenote->delete();", " ", " // delete the assocication too", " $db->delete($simplenote->attachable_table, 'expsimplenote_id='.$this->params['id']); \n ", " // send the user back where they came from.\n $lastUrl = expHistory::getLast('editable');\n if (!empty($this->params['tab']))\n {\n $lastUrl .= \"#\".$this->params['tab'];\n }\n redirect_to($lastUrl);\n }", " ", " private function sendNotification($simplenote) {\n if (empty($simplenote)) return false;", " \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n ", " // setup some email variables.\n $subject = 'Notification of a New Note Posted to '.URL_BASE;\n $tos = explode(',', str_replace(' ', '', $notification_email));\n $editlink = makelink(array('controller'=>'expSimpleNote', 'action'=>'edit', 'id'=>$simplenote->id));", " ", " // make the email body\n $body = gt('Posted By').':&#160;'.$simplenote->name.\"<br>\";\n $body .= gt('Posters Email').':&#160;'.$simplenote->email.\"<br><br>\";\n $body .= $simplenote->body.\"<br><br>\";\n $body .= gt('You can view, edit and optionally approved this comment by going to').' ';\n $body .= '<a href=\"'.$editlink.'\">'.$editlink.'</a>';", " ", " // create the mail message", " $mail = new expMail(); ", " $mail->quickSend(array(\n 'html_message'=>$body,\n 'to'=>$tos,\n 'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n 'subject'=>$subject,\n ));", " ", " return true;\n }", "}", "?>" ]
[ 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expSimpleNoteController\n *\n * @package Core\n * @subpackage Controllers\n */", "class expSimpleNoteController extends expController {\n public $base_class = 'expSimpleNote';", " protected $manage_permissions = array(\n 'approve'=>\"Approve Notes\"", " );\n// protected $remove_permissions = array(\n// 'edit',\n// 'create'\n// );", " static function displayname() { return gt(\"Simple Notes\"); }\n static function description() { return gt(\"Use this module to add Simple Notes attached to something (product, order, etc)\"); }\n static function author() { return \"Jonathan Worent @ OIC Group, Inc\"; }", "", " function edit() {\n global $user;", "\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];", " if (empty($this->params['formtitle']))", " {\n if (empty($this->params['id']))\n {\n $formtitle = gt(\"Add New Note\");\n }\n else\n {\n $formtitle = gt(\"Edit Note\");\n }\n }\n else\n {\n $formtitle = $this->params['formtitle'];\n }", "", " $id = empty($this->params['id']) ? null : $this->params['id'];\n $simpleNote = new expSimpleNote($id);\n //FIXME here is where we might sanitize the note before displaying/editing it", " assign_to_template(array(\n 'simplenote'=>$simpleNote,\n 'user'=>$user,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'formtitle'=>$formtitle,\n 'content_type'=>$this->params['content_type'],\n 'content_id'=>$this->params['content_id'],\n 'tab'=>empty($this->params['tab'])?0:$this->params['tab']\n ));", " }\n", " function manage() {\n expHistory::set('manageable', $this->params);", "\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n", " $sql = 'SELECT n.* FROM '.DB_TABLE_PREFIX.'_expSimpleNote n ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_content_expSimpleNote cnt ON n.id=cnt.expsimplenote_id ';\n $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";\n $sql .= 'AND n.approved=0';", "", " $page = new expPaginator(array(\n// 'model'=>'expSimpleNote', // brings in all of model", " 'sql'=>$sql,", " 'limit'=>10,\n 'order'=>'created_at',\n 'dir'=>'DESC',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Approved')=>'approved',\n gt('Poster')=>'name',\n gt('Comment')=>'body'\n ),\n ));", "", " //FIXME here is where we might sanitize the notes before displaying them", " assign_to_template(array(\n 'page'=>$page,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'tab'=>$this->params['tab']\n ));\n }", "", " function getNotes() {\n global $user, $db;", "\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : intval($this->params['require_login']);\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : intval($this->params['require_approval']);\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : intval($this->params['require_notification']);\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : expString::escape($this->params['notification_email']);", "", " $sql = 'SELECT n.* FROM '.$db->prefix.'expSimpleNote n ';\n $sql .= 'JOIN '.$db->prefix.'content_expSimpleNote cnt ON n.id=cnt.expsimplenote_id ';", " $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".expString::escape($this->params['content_type']).\"' \";", " $sql .= 'AND n.approved=1';", "", " $simplenotes = new expPaginator(array(\n //'model'=>'expSimpleNote',", " 'sql'=>$sql,", " 'limit'=>10,\n 'order'=>'created_at',\n 'dir'=>'DESC',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Readable Column Name')=>'Column Name'\n ),\n ));", "\n // count the unapproved notes", " if ($require_approval == 1 && $user->isAdmin()) {\n $sql = 'SELECT count(com.id) as c FROM '.$db->prefix.'expSimpleNote com ';\n $sql .= 'JOIN '.$db->prefix.'content_expSimpleNote cnt ON com.id=cnt.expsimplenote_id ';", " $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".expString::escape($this->params['content_type']).\"' \";", " $sql .= 'AND com.approved=0';\n $unapproved = $db->countObjectsBySql($sql);\n } else {\n $unapproved = 0;", " }\n", " //FIXME here is where we might sanitize the notes before displaying them", " assign_to_template(array(\n 'simplenotes'=>$simplenotes,", " 'unapproved'=>$unapproved,\n 'content_id'=>$this->params['content_id'],", " 'content_type'=>$this->params['content_type'],\n 'user'=>$user,\n 'hideform'=>$this->params['hideform'],\n 'hidenotes'=>$this->params['hidenotes'],\n 'title'=>$this->params['title'],\n 'formtitle'=>$this->params['formtitle'],\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'tab'=>$this->params['tab']\n ));\n }", " function update() {\n global $db, $user, $history;", "\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n", " // figure out the name and email address\n if (!empty($user->id)) {\n $this->params['name'] = $user->firstname.\" \".$user->lastname;\n $this->params['email'] = $user->email;\n }", "\n // if simplenotes are configed to require approvals set this to 0 otherwise we", " // will just go ahead and turn the approval on for this comment.\n $this->expSimpleNote->approved = ($require_approval == 1 && !$user->isAdmin()) ? 0 : 1;", "", " // save the note\n //FIXME here is where we might sanitize the note before saving it\n $this->expSimpleNote->update($this->params);", "", " // attach the note to the datatype it belongs to (product, order, etc..);\n// $obj = new stdClass();\n// $obj->content_type = $this->params['content_type'];\n// $obj->content_id = $this->params['content_id'];\n// $obj->expsimplenote_id = $this->expSimpleNote->id;\n// if(isset($this->params['subtype'])) $obj->subtype = $this->params['subtype'];\n// $db->insertObject($obj, $this->expSimpleNote->attachable_table);\n $this->expSimpleNote->attachNote($this->params['content_type'], $this->params['content_id'], $this->params['subtype']);", " $msg = gt('Your note has been added.');\n if ($require_approval == 1 && !$user->isAdmin()) {\n $msg .= ' '.gt('Your note is now pending approval. You will receive an email to').' ';\n $msg .= $this->expSimpleNote->email.' '.gt('letting you know when it has been approved.');\n }", "", " if ($require_notification && !$user->isAdmin()) {\n $this->sendNotification($this->expComment);\n }", "", " flash('message', $msg);", "\n", " $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']);\n if (!empty($this->params['tab']))\n {\n $lastUrl .= \"#\".$this->params['tab'];\n }\n redirect_to($lastUrl);\n }", "", " public function approve() {\n expHistory::set('editable', $this->params);", "\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n", " if (empty($this->params['id'])) {\n flash('error', gt('No ID supplied for note to approve'));\n $lastUrl = expHistory::getLast('editable');\n }", "", " $simplenote = new expSimpleNote($this->params['id']);\n assign_to_template(array(\n 'simplenote'=>$simplenote,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'tab'=>$this->params['tab']\n ));\n }", "", " public function approve_submit() {\n global $history;", "", " if (empty($this->params['id'])) {\n flash('error', gt('No ID supplied for comment to approve'));\n $lastUrl = expHistory::getLast('editable');\n }", "\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n", " $simplenote = new expSimpleNote($this->params['id']);\n //FIXME here is where we might sanitize the note before approving it\n $simplenote->body = $this->params['body'];\n $simplenote->approved = $this->params['approved'];\n $simplenote->save();", "", " $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']);\n if (!empty($this->params['tab']))\n {\n $lastUrl .= \"#\".$this->params['tab'];\n }\n redirect_to($lastUrl);\n }", "", " public function approve_toggle() {\n global $history;", "", " if (empty($this->params['id'])) return;", "\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];", "", " $simplenote = new expSimpleNote($this->params['id']);\n $simplenote->approved = $simplenote->approved == 1 ? 0 : 1;\n $simplenote->save();", "", " $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']);\n if (!empty($this->params['tab']))\n {\n $lastUrl .= \"#\".$this->params['tab'];\n }\n redirect_to($lastUrl);\n }", "", " public function delete() {\n global $db, $history;", "\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n", " if (empty($this->params['id'])) {\n flash('error', gt('Missing id for the comment you would like to delete'));\n $lastUrl = expHistory::getLast('editable');\n }", "", " // delete the note\n $simplenote = new expSimpleNote($this->params['id']);\n $rows = $simplenote->delete();", "", " // delete the assocication too", " $db->delete($simplenote->attachable_table, 'expsimplenote_id='.$this->params['id']);\n", " // send the user back where they came from.\n $lastUrl = expHistory::getLast('editable');\n if (!empty($this->params['tab']))\n {\n $lastUrl .= \"#\".$this->params['tab'];\n }\n redirect_to($lastUrl);\n }", "", " private function sendNotification($simplenote) {\n if (empty($simplenote)) return false;", "\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : intval($this->params['require_login']);\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : intval($this->params['require_approval']);\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : intval($this->params['require_notification']);\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : expString::escape($this->params['notification_email']);\n", " // setup some email variables.\n $subject = 'Notification of a New Note Posted to '.URL_BASE;\n $tos = explode(',', str_replace(' ', '', $notification_email));\n $editlink = makelink(array('controller'=>'expSimpleNote', 'action'=>'edit', 'id'=>$simplenote->id));", "", " // make the email body\n $body = gt('Posted By').':&#160;'.$simplenote->name.\"<br>\";\n $body .= gt('Posters Email').':&#160;'.$simplenote->email.\"<br><br>\";\n $body .= $simplenote->body.\"<br><br>\";\n $body .= gt('You can view, edit and optionally approved this comment by going to').' ';\n $body .= '<a href=\"'.$editlink.'\">'.$editlink.'</a>';", "", " // create the mail message", " $mail = new expMail();", " $mail->quickSend(array(\n 'html_message'=>$body,\n 'to'=>$tos,\n 'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n 'subject'=>$subject,\n ));", "", " return true;\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expTagController\n *\n * @package Core\n * @subpackage Controllers\n */", "class expTagController extends expController {", "", "\t/**\n\t * name of module\n\t * @return string\n\t */\n static function displayname() { return gt(\"Tag Manager\"); }", "\t/**\n\t * description of module\n\t * @return string\n\t */\n static function description() { return gt(\"This module is used to manage tags\"); }", " static function canImportData() { return true;}\n static function canExportData() { return true;}", "\t/**\n\t * does module have sources available?\n\t * @return bool\n\t */\n\tstatic function hasSources() { return false; }", " /**\n \t * default view for individual item\n \t */\n \tfunction show() {\n// global $db;", " expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;", " // figure out if we're looking this up by id or title\n $id = null;\n $tag = '';\n if (isset($this->params['id'])) {\n $id = $this->params['id'];\n } elseif (isset($this->params['title'])) {", " $id = $this->params['title'];", " $tag = $id;\n }", " $record = new $modelname($id);\n if (empty($tag) && !empty($record->title)) {\n $tag = $record->title;\n }", "// foreach ($db->selectColumn('content_expTags','content_type',null,null,true) as $contenttype) {\n foreach (expTag::selectAllTagContentType() as $contenttype) {\n $attatchedat = $record->findWhereAttachedTo($contenttype);\n if (!empty($attatchedat)) {\n $record->attachedcount = @$record->attachedcount + count($attatchedat);\n $record->attached[$contenttype] = $attatchedat;\n }\n }", " assign_to_template(array(\n 'record'=>$record,\n 'tag'=>$tag\n ));\n }", "\t/**\n\t * manage tags\n\t */\n\tfunction manage() {\n// global $db;", " expHistory::set('manageable', $this->params);\n $page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>static::hasSources() ? $this->aggregateWhereClause() : null,\n 'limit'=>10,\n 'order'=>\"title\",\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>static::hasSources() == true ? $this->loc->src : null,\n 'columns'=>array(\n gt('ID#')=>'id',\n gt('Title')=>'title',\n// gt('Body')=>'body'\n ),\n ));", "// foreach ($db->selectColumn('content_expTags','content_type',null,null,true) as $contenttype) {\n foreach (expTag::selectAllTagContentType() as $contenttype) {\n foreach ($page->records as $key => $value) {\n $attatchedat = $page->records[$key]->findWhereAttachedTo($contenttype);\n if (!empty($attatchedat)) {\n $page->records[$key]->attachedcount = @$page->records[$key]->attachedcount + count($attatchedat);\n $page->records[$key]->attached[$contenttype] = $attatchedat;\n //FIXME here is a hack to get the faq to be listed\n if ($contenttype == 'faq' && !empty($page->records[$key]->attached[$contenttype][0]->question)) {\n $page->records[$key]->attached[$contenttype][0]->title = $page->records[$key]->attached[$contenttype][0]->question;\n }\n }\n }\n }", " assign_to_template(array(\n 'page'=>$page\n ));\n }", " /**\n \t * manage tags\n \t */\n \tfunction manage_module() {\n expHistory::set('manageable', $this->params);\n// $modulename = expModules::getControllerClassName($this->params['model']);\n// $module = new $modulename($this->params['src']);\n $module = expModules::getController($this->params['model'], $this->params['src']);\n $where = $module->aggregateWhereClause();\n if ($this->params['model'] == 'sermonseries') {\n $model = 'sermons';\n } else {\n $model = $this->params['model'];\n }\n $page = new expPaginator(array(\n 'model'=>$model,\n 'where'=>$where,\n// 'order'=>'module,rank',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['model'],\n// 'action'=>$this->params['action'],\n// 'src'=>static::hasSources() == true ? $this->loc->src : null,\n// 'columns'=>array(gt('ID#')=>'id',gt('Title')=>'title',gt('Body')=>'body'),\n ));\n if ($this->params['model'] == 'faq') {\n foreach ($page->records as $record) {\n $record->title = $record->question;\n }\n }", "// $page = new expPaginator(array(\n// 'model'=>$this->basemodel_name,\n// 'where'=>static::hasSources() ? $this->aggregateWhereClause() : null,\n// 'limit'=>50,\n// 'order'=>\"title\",\n// 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n// 'controller'=>$this->baseclassname,\n// 'action'=>$this->params['action'],\n// 'src'=>static::hasSources() == true ? $this->loc->src : null,\n// 'columns'=>array(gt('ID#')=>'id',gt('Title')=>'title',gt('Body')=>'body'),\n// ));\n//\n// foreach ($db->selectColumn('content_expTags','content_type',\"content_type='\".$this->params['model'].\"'\",null,true) as $contenttype) {\n// foreach ($page->records as $key => $value) {\n// $attatchedat = $page->records[$key]->findWhereAttachedTo($contenttype);\n// if (!empty($attatchedat)) {\n// $page->records[$key]->attachedcount = @$page->records[$key]->attachedcount + count($attatchedat);\n// $page->records[$key]->attached[$contenttype] = $attatchedat;\n// //FIXME here is a hack to get the faq to be listed\n// if ($contenttype == 'faq' && !empty($page->records[$key]->attached[$contenttype][0]->question)) {\n// $page->records[$key]->attached[$contenttype][0]->title = $page->records[$key]->attached[$contenttype][0]->question;\n// }\n// }\n// }\n// }\n// $tags = $db->selectObjects('expTags','1','title ASC');\n// $taglist = '';\n// foreach ($tags as $tag) {\n// $taglist .= \"'\".$tag->title.\"',\";\n// }\n $taglist = expTag::getAllTags();", " assign_to_template(array(\n 'page'=>$page,\n 'taglist'=>$taglist\n ));\n }", " /**\n * this method changes the tags of the selected items as requested\n */\n function change_tags() {\n// global $db;", " if (!empty($this->params['change_tag'])) {\n // build array of tags to add\n $addtags = explode(\",\", trim($this->params['addTag']));\n \t foreach($addtags as $key=>$tag) {\n if (!empty($tag)) {\n $tag = strtolower(trim($tag));\n $tag = str_replace(array('\"', \"'\"), \"\", $tag); // strip double and single quotes\n if (!empty($tag)) {\n $addtags[$key] = $tag;\n $expTag = new expTag($tag);\n if (empty($expTag->id)) // create the new tag\n $expTag->update(array('title' => $tag));\n }\n }\n \t }\n // build array of tags to remove\n $removetags = explode(\",\", trim($this->params['removeTag']));\n \t foreach($removetags as $key=>$tag) {\n if (!empty($tag)) {\n $tag = strtolower(trim($tag));\n $tag = str_replace(array('\"', \"'\"), \"\", $tag); // strip double and single quotes\n if (!empty($tag))\n $removetags[$key] = $tag;\n }\n \t }\n foreach ($this->params['change_tag'] as $item) {\n $params['expTag'] = array();\n $classname = $this->params['mod'];\n $object = new $classname($item);\n expTag::deleteTag($this->params['mod'], $object->id);\n $tags = $object->expTag;\n $object->expTag = array();\n foreach ($tags as $tag) {\n if (!in_array($tag->title, $removetags)) {\n $params['expTag'][] = $tag->id; // add back any tags not being removed\n }\n }\n foreach ($addtags as $tag) {\n $expTag = new expTag($tag);\n $params['expTag'][] = $expTag->id; // add new tags\n }\n $object->update($params);\n }\n }\n expHistory::returnTo('viewable');\n }", " function import() {\n assign_to_template(array(\n 'type' => $this\n ));\n }", " function importTags($file=null) {\n if (empty($file->path)) {\n $file = new stdClass();\n $file->path = $_FILES['import_file']['tmp_name'];\n }\n if (empty($file->path)) {\n echo gt('Not a Tag Import CSV File');\n return;\n }\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");", " // read in the header line\n $header = fgetcsv($handle, 10000, \",\");\n $count = 0;\n if (stripos($header[0], 'tag') === false) {\n rewind($handle);\n } else {\n $count++;\n }", " $errorSet = array();", " // read in the data lines\n echo \"<h1>\", gt(\"Importing Tags\"), \"</h1>\";\n while (($row = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;", " $row[0] = strtolower(trim($row['0']));\n if (empty($row['0'])) {\n $errorSet[$count] = gt(\"Is empty.\");\n continue;\n } else {\n $newtag = new expTag($row[0]);\n if ($newtag->id) {\n echo gt(\"Tag already existed\"), \": \", $row[0], \"<br/>\";\n } else {\n $newtag->update(array('title'=>$row[0]));\n echo gt(\"Tag successfully added\"), \": <strong>\", $row[0], \"</strong><br/>\";\n }\n }\n }", " fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);", " if (count($errorSet)) {\n echo \"<br/><hr><br/><div style='color:red'><strong>\".gt('The following records were NOT imported').\":</strong><br/>\";\n foreach ($errorSet as $rownum => $err) {\n echo \"Row: \", $rownum, \" -- \", $err, \"<br/>\";\n }\n echo \"</div>\";\n }\n echo \"<br>\";\n }", " function export() {\n $out = gt('Tag Name (lower case)') . chr(13) . chr(10);\n $tg = new expTag();\n $tags = $tg->find('all');\n set_time_limit(0);\n foreach ($tags as $tag) {\n $out .= $tag->title . chr(13) . chr(10);\n }", " $filename = 'tags_export_' . time() . '.csv';", " ob_end_clean();\n ob_start(\"ob_gzhandler\");", " // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';", " header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }\n echo $out;\n exit; // Exit, since we are exporting\n }", "}", "?>" ]
[ 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * This is the class expTagController\n *\n * @package Core\n * @subpackage Controllers\n */", "class expTagController extends expController {", " protected $manage_permissions = array(\n// 'import' => 'Import Tags',\n// 'importTags' => 'Import Tags',\n// 'export' => 'Export Tags',\n 'change' => 'Change Tags',\n );", "\t/**\n\t * name of module\n\t * @return string\n\t */\n static function displayname() { return gt(\"Tag Manager\"); }", "\t/**\n\t * description of module\n\t * @return string\n\t */\n static function description() { return gt(\"This module is used to manage tags\"); }", " static function canImportData() { return true;}\n static function canExportData() { return true;}", "\t/**\n\t * does module have sources available?\n\t * @return bool\n\t */\n\tstatic function hasSources() { return false; }", " /**\n \t * default view for individual item\n \t */\n \tfunction show() {\n// global $db;", " expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;", " // figure out if we're looking this up by id or title\n $id = null;\n $tag = '';\n if (isset($this->params['id'])) {\n $id = $this->params['id'];\n } elseif (isset($this->params['title'])) {", " $id = expString::escape($this->params['title']);", " $tag = $id;\n }", " $record = new $modelname($id);\n if (empty($tag) && !empty($record->title)) {\n $tag = $record->title;\n }", "// foreach ($db->selectColumn('content_expTags','content_type',null,null,true) as $contenttype) {\n foreach (expTag::selectAllTagContentType() as $contenttype) {\n $attatchedat = $record->findWhereAttachedTo($contenttype);\n if (!empty($attatchedat)) {\n $record->attachedcount = @$record->attachedcount + count($attatchedat);\n $record->attached[$contenttype] = $attatchedat;\n }\n }", " assign_to_template(array(\n 'record'=>$record,\n 'tag'=>$tag\n ));\n }", "\t/**\n\t * manage tags\n\t */\n\tfunction manage() {\n// global $db;", " expHistory::set('manageable', $this->params);\n $page = new expPaginator(array(\n 'model'=>$this->basemodel_name,\n 'where'=>static::hasSources() ? $this->aggregateWhereClause() : null,\n 'limit'=>10,\n 'order'=>\"title\",\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'src'=>static::hasSources() == true ? $this->loc->src : null,\n 'columns'=>array(\n gt('ID#')=>'id',\n gt('Title')=>'title',\n// gt('Body')=>'body'\n ),\n ));", "// foreach ($db->selectColumn('content_expTags','content_type',null,null,true) as $contenttype) {\n foreach (expTag::selectAllTagContentType() as $contenttype) {\n foreach ($page->records as $key => $value) {\n $attatchedat = $page->records[$key]->findWhereAttachedTo($contenttype);\n if (!empty($attatchedat)) {\n $page->records[$key]->attachedcount = @$page->records[$key]->attachedcount + count($attatchedat);\n $page->records[$key]->attached[$contenttype] = $attatchedat;\n //FIXME here is a hack to get the faq to be listed\n if ($contenttype == 'faq' && !empty($page->records[$key]->attached[$contenttype][0]->question)) {\n $page->records[$key]->attached[$contenttype][0]->title = $page->records[$key]->attached[$contenttype][0]->question;\n }\n }\n }\n }", " assign_to_template(array(\n 'page'=>$page\n ));\n }", " /**\n \t * manage tags\n \t */\n \tfunction manage_module() {\n expHistory::set('manageable', $this->params);\n// $modulename = expModules::getControllerClassName($this->params['model']);\n// $module = new $modulename($this->params['src']);\n $module = expModules::getController($this->params['model'], $this->params['src']);\n $where = $module->aggregateWhereClause();\n if ($this->params['model'] == 'sermonseries') {\n $model = 'sermons';\n } else {\n $model = $this->params['model'];\n }\n $page = new expPaginator(array(\n 'model'=>$model,\n 'where'=>$where,\n// 'order'=>'module,rank',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['model'],\n// 'action'=>$this->params['action'],\n// 'src'=>static::hasSources() == true ? $this->loc->src : null,\n// 'columns'=>array(gt('ID#')=>'id',gt('Title')=>'title',gt('Body')=>'body'),\n ));\n if ($this->params['model'] == 'faq') {\n foreach ($page->records as $record) {\n $record->title = $record->question;\n }\n }", "// $page = new expPaginator(array(\n// 'model'=>$this->basemodel_name,\n// 'where'=>static::hasSources() ? $this->aggregateWhereClause() : null,\n// 'limit'=>50,\n// 'order'=>\"title\",\n// 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n// 'controller'=>$this->baseclassname,\n// 'action'=>$this->params['action'],\n// 'src'=>static::hasSources() == true ? $this->loc->src : null,\n// 'columns'=>array(gt('ID#')=>'id',gt('Title')=>'title',gt('Body')=>'body'),\n// ));\n//\n// foreach ($db->selectColumn('content_expTags','content_type',\"content_type='\".$this->params['model'].\"'\",null,true) as $contenttype) {\n// foreach ($page->records as $key => $value) {\n// $attatchedat = $page->records[$key]->findWhereAttachedTo($contenttype);\n// if (!empty($attatchedat)) {\n// $page->records[$key]->attachedcount = @$page->records[$key]->attachedcount + count($attatchedat);\n// $page->records[$key]->attached[$contenttype] = $attatchedat;\n// //FIXME here is a hack to get the faq to be listed\n// if ($contenttype == 'faq' && !empty($page->records[$key]->attached[$contenttype][0]->question)) {\n// $page->records[$key]->attached[$contenttype][0]->title = $page->records[$key]->attached[$contenttype][0]->question;\n// }\n// }\n// }\n// }\n// $tags = $db->selectObjects('expTags','1','title ASC');\n// $taglist = '';\n// foreach ($tags as $tag) {\n// $taglist .= \"'\".$tag->title.\"',\";\n// }\n $taglist = expTag::getAllTags();", " assign_to_template(array(\n 'page'=>$page,\n 'taglist'=>$taglist\n ));\n }", " /**\n * this method changes the tags of the selected items as requested\n */\n function change_tags() {\n// global $db;", " if (!empty($this->params['change_tag'])) {\n // build array of tags to add\n $addtags = explode(\",\", trim($this->params['addTag']));\n \t foreach($addtags as $key=>$tag) {\n if (!empty($tag)) {\n $tag = strtolower(trim($tag));\n $tag = str_replace(array('\"', \"'\"), \"\", $tag); // strip double and single quotes\n if (!empty($tag)) {\n $addtags[$key] = $tag;\n $expTag = new expTag($tag);\n if (empty($expTag->id)) // create the new tag\n $expTag->update(array('title' => $tag));\n }\n }\n \t }\n // build array of tags to remove\n $removetags = explode(\",\", trim($this->params['removeTag']));\n \t foreach($removetags as $key=>$tag) {\n if (!empty($tag)) {\n $tag = strtolower(trim($tag));\n $tag = str_replace(array('\"', \"'\"), \"\", $tag); // strip double and single quotes\n if (!empty($tag))\n $removetags[$key] = $tag;\n }\n \t }\n foreach ($this->params['change_tag'] as $item) {\n $params['expTag'] = array();\n $classname = $this->params['mod'];\n $object = new $classname($item);\n expTag::deleteTag($this->params['mod'], $object->id);\n $tags = $object->expTag;\n $object->expTag = array();\n foreach ($tags as $tag) {\n if (!in_array($tag->title, $removetags)) {\n $params['expTag'][] = $tag->id; // add back any tags not being removed\n }\n }\n foreach ($addtags as $tag) {\n $expTag = new expTag($tag);\n $params['expTag'][] = $expTag->id; // add new tags\n }\n $object->update($params);\n }\n }\n expHistory::returnTo('viewable');\n }", " function import() {\n assign_to_template(array(\n 'type' => $this\n ));\n }", " function importTags($file=null) {\n if (empty($file->path)) {\n $file = new stdClass();\n $file->path = $_FILES['import_file']['tmp_name'];\n }\n if (empty($file->path)) {\n echo gt('Not a Tag Import CSV File');\n return;\n }\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");", " // read in the header line\n $header = fgetcsv($handle, 10000, \",\");\n $count = 0;\n if (stripos($header[0], 'tag') === false) {\n rewind($handle);\n } else {\n $count++;\n }", " $errorSet = array();", " // read in the data lines\n echo \"<h1>\", gt(\"Importing Tags\"), \"</h1>\";\n while (($row = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;", " $row[0] = strtolower(trim($row['0']));\n if (empty($row['0'])) {\n $errorSet[$count] = gt(\"Is empty.\");\n continue;\n } else {\n $newtag = new expTag($row[0]);\n if ($newtag->id) {\n echo gt(\"Tag already existed\"), \": \", $row[0], \"<br/>\";\n } else {\n $newtag->update(array('title'=>$row[0]));\n echo gt(\"Tag successfully added\"), \": <strong>\", $row[0], \"</strong><br/>\";\n }\n }\n }", " fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);", " if (count($errorSet)) {\n echo \"<br/><hr><br/><div style='color:red'><strong>\".gt('The following records were NOT imported').\":</strong><br/>\";\n foreach ($errorSet as $rownum => $err) {\n echo \"Row: \", $rownum, \" -- \", $err, \"<br/>\";\n }\n echo \"</div>\";\n }\n echo \"<br>\";\n }", " function export() {\n $out = gt('Tag Name (lower case)') . chr(13) . chr(10);\n $tg = new expTag();\n $tags = $tg->find('all');\n set_time_limit(0);\n foreach ($tags as $tag) {\n $out .= $tag->title . chr(13) . chr(10);\n }", " $filename = 'tags_export_' . time() . '.csv';", " ob_end_clean();\n ob_start(\"ob_gzhandler\");", " // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';", " header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }\n echo $out;\n exit; // Exit, since we are exporting\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class eaasController extends expController {\n //public $basemodel_name = '';\n public $useractions = array(\n 'showall'=>'Install Service API'\n // 'tags'=>\"Tags\",\n // 'authors'=>\"Authors\",\n // 'dates'=>\"Dates\",\n );\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n// 'module',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)", " protected $add_permissions = array(\n // 'approve'=>\"Approve Comments\"\n );\n", " public $tabs = array(\n 'aboutus'=>'About Us', \n 'blog'=>'Blog', \n 'photo'=>'Photos', \n 'media'=>'Media',\n 'event'=>'Events',\n 'filedownload'=>'File Downloads', \n 'news'=>'News'\n );", "", " protected $data = array();\n \n static function displayname() { return gt(\"Exponent as a Service\"); }", " static function description() { return gt(\"This module allows you make service calls and return JSON for parts of Exponent\"); }\n static function author() { return \"Phillip Ball - OIC Group, Inc\"; }\n static function hasSources() { return false; } // must be explicitly added by config['add_source'] or config['aggregate']\n// static function isSearchable() { return true; }", " static function requiresConfiguration()\n {\n return true;\n }", " public function showall() {\n expHistory::set('viewable', $this->params);\n $info = array();\n $info['config'] = $this->config;\n $info['apikey'] = base64_encode(serialize($this->loc));", " assign_to_template(array('info'=>$info));\n }", " public function api() {\n if (empty($this->params['apikey'])) {\n $_REQUEST['apikey'] = true; // set this to force an ajax reply\n $ar = new expAjaxReply(550, 'Permission Denied', 'You need an API key in order to access Exponent as a Service', null);\n $ar->send(); //FIXME this doesn't seem to work correctly in this scenario\n } else {\n $key = expUnserialize(base64_decode(urldecode($this->params['apikey'])));\n $cfg = new expConfig($key);\n $this->config = $cfg->config;\n if(empty($cfg->id)) {\n $ar = new expAjaxReply(550, 'Permission Denied', 'Incorrect API key or Exponent as a Service module configuration missing', null);\n $ar->send();\n } else {\n if (!empty($this->params['get'])) {\n $this->handleRequest();\n } else {\n $ar = new expAjaxReply(200, 'ok', 'Your API key is working, no data requested', null);\n $ar->send();\n }\n }\n }\n }", " private function handleRequest() {\n if (!array_key_exists($this->params['get'], $this->tabs)) {\n $ar = new expAjaxReply(400, 'Bad Request', 'No service available for your request', null);\n $ar->send();\n }\n if ($this->params['get'] != 'aboutus' && empty($this->config[$this->params['get'].'_aggregate'])) {\n $ar = new expAjaxReply(400, 'Bad Request', 'No modules assigned to requested service', null);\n $ar->send();\n }\n switch ($this->params['get']) {\n case 'aboutus':\n $ar = new expAjaxReply(200, 'ok', $this->aboutUs(), null);\n $ar->send();\n break;\n case 'news':\n $ar = new expAjaxReply(200, 'ok', $this->news(), null);\n $ar->send();\n break;\n case 'photo':\n case 'photos':\n $ar = new expAjaxReply(200, 'ok', $this->photo(), null);\n $ar->send();\n break;\n case 'media':\n $ar = new expAjaxReply(200, 'ok', $this->media(), null);\n $ar->send();\n break;\n case 'filedownload':\n case 'filedownloads':\n $ar = new expAjaxReply(200, 'ok', $this->filedownload(), null);\n $ar->send();\n break;\n case 'blog':\n case 'blogs':\n $ar = new expAjaxReply(200, 'ok', $this->blog(), null);\n $ar->send();\n break;\n case 'event':\n case 'events':\n $ar = new expAjaxReply(200, 'ok', $this->event(), null);\n $ar->send();\n break;\n default: // probably shouldn't evet get to this point\n $ar = new expAjaxReply(400, 'Bad Request', 'No service available for your request', null);\n $ar->send();\n break;\n }\n }", " /**\n * Return the About Us data along with a quick item count by module\n * @return array\n */\n private function aboutUs() {\n $counts = array();\n foreach ($this->tabs as $key=>$name) {\n if ($key != 'aboutus') {\n $data = $this->$key();\n $counts[$key] = count($data['records']);\n }\n }\n $this->data = array(); // initialize\n $this->data = $counts;\n $this->data['records'] = array();\n $this->getImageBody($this->params['get']);\n return $this->data;\n }", " private function news() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $news = new news($this->params['id']);\n $this->data['records'] = $news;\n } else {\n $news = new news();", " // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } \n \n $order = isset($this->params['order']) ? $this->params['order'] : 'publish DESC';\n $items = $news->find('all', $this->aggregateWhereClause('news'), $order, $limit);\n $this->data['records'] = $items;\n }", " $this->getImageBody($this->params['get']);\n return $this->data;\n }", "// private function youtube() { //FIXME must replace with media player and then removed\n// $this->data = array(); // initialize\n// if (!empty($this->params['id'])) {\n// $youtube = new youtube($this->params['id']);\n// $this->data['records'] = $youtube;\n// } else {\n// $youtube = new youtube();\n//\n// // figure out if should limit the results\n// if (isset($this->params['limit'])) {\n// $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n// } else {\n// $limit = '';\n// }\n//\n// $order = isset($this->params['order']) ? $this->params['order'] : 'created_at ASC';\n//\n// $items = $youtube->find('all', $this->aggregateWhereClause('youtube'), $order, $limit);\n// $this->data['records'] = $items;\n// }\n//\n// $this->getImageBody($this->params['get']);\n// return $this->data;\n// }", " private function media() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $media = new media($this->params['id']);\n $this->data['records'] = $media;\n } else {\n $media = new media();", " // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n }", " $order = isset($this->params['order']) ? $this->params['order'] : 'created_at ASC';", " $items = $media->find('all', $this->aggregateWhereClause('media'), $order, $limit);\n $this->data['records'] = $items;\n }", " $this->getImageBody($this->params['get']);\n return $this->data;\n }", " private function filedownload() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $filedownload = new filedownload($this->params['id']);\n $this->data['records'] = $filedownload;\n } else {\n $filedownload = new filedownload();", " // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } ", " $order = isset($this->params['order']) ? $this->params['order'] : 'created_at ASC';", " $items = $filedownload->find('all', $this->aggregateWhereClause('filedownload'), $order, $limit);\n $this->data['records'] = $items;\n }", " $this->getImageBody($this->params['get']);\n return $this->data;\n }", " private function photo() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $photo = new photo($this->params['id']);\n $this->data['records'] = $photo;\n } else {\n $photo = new photo();", " // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } \n \n $order = isset($this->params['order']) ? $this->params['order'] : 'rank';\n $items = $photo->find('all', $this->aggregateWhereClause('photo'), $order, $limit);\n $this->data['records'] = $items;\n }", " $this->getImageBody($this->params['get']);\n return $this->data;\n }", " private function blog() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $blog = new blog($this->params['id']);\n $this->data['records'] = $blog;\n } else {\n $blog = new blog();", " // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } \n \n $order = isset($this->params['order']) ? $this->params['order'] : 'publish DESC';\n $items = $blog->find('all', $this->aggregateWhereClause('blog'), $order, $limit);\n $this->data['records'] = $items;\n }", " $this->getImageBody($this->params['get']);\n return $this->data;\n }", " private function event() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $event = new event($this->params['id']);\n $this->data['records'] = $event;\n } else {\n $event = new event();", " // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } \n \n// $order = isset($this->params['order']) ? $this->params['order'] : 'created_at'; //FIXME we shoud be getting upcoming events\n// $items = $event->find('all', $this->aggregateWhereClause('event'), $order, $limit); //FIXME needs 'upcoming' type of find\n $items = $event->find('upcoming', $this->aggregateWhereClause('event'), false, $limit); //new 'upcoming' type of find\n $this->data['records'] = $items;\n }", " if (!empty($this->params['groupbydate'])&&!empty($items)) { // aggregate by day like with regular calendar\n $this->data['records'] = array();\n foreach ($items as $value) {\n $this->data['records'][date('r',$value->eventdate[0]->date)][] = $value;\n // edebug($value);\n }\n }", " $this->getImageBody($this->params['get']);\n return $this->data;\n }", " function configure() {\n expHistory::set('editable', $this->params);\n parent::configure();\n $order = isset($this->params['order']) ? $this->params['order'] : 'section';\n $dir = isset($this->params['dir']) ? $this->params['dir'] : '';\n \n $views = expTemplate::get_config_templates($this, $this->loc);\n $pullable = array();\n $page = array();", " foreach ($this->tabs as $tab => $name) {\n // news tab\n if ($tab!='aboutus') {\n $pullable[$tab] = expModules::listInstalledControllers($tab);\n $page[$tab] = new expPaginator(array(\n 'controller'=>$tab.'Controller',\n 'action' => $this->params['action'],\n 'records'=>$pullable[$tab],\n 'limit'=>count($pullable[$tab]),\n 'order'=>$order,\n 'dir'=>$dir,\n 'columns'=>array(gt('Title')=>'title',gt('Page')=>'section'),\n ));\n }", " $this->configImage($tab); // fix attached files for proper display of file manager control\n }\n // edebug($this->config['expFile']);", " assign_to_template(array(\n 'config'=>$this->config, // though already assigned in controllertemplate, we need to update expFiles\n 'pullable'=>$pullable,\n 'page'=>$page,\n// 'views'=>$views\n ));\n }", " private function configImage($tab) {\n if (count(@$this->config['expFile'][$tab.'_image'])>1) {\n $ftmp[] = new expFile($this->config['expFile'][$tab.'_image'][0]);\n $this->config['expFile'][$tab.'_image'] = $ftmp;\n } else {\n $this->config['expFile'][$tab.'_image'] = array();\n }\n }", " private function getImageBody($tab) {\n // create an empty 'banner' object to prevent errors in caller\n $this->data['banner']['obj'] = null;\n $this->data['banner']['obj']->url = null;\n $this->data['banner']['md5'] = null;", " if (count(@$this->config['expFile'][$tab.'_image'])>1) {\n $img = new expFile($this->config['expFile'][$tab.'_image'][0]);\n if ($img) {\n $this->data['banner']['obj'] = $img;\n $this->data['banner']['md5'] = md5_file($img->path);\n }\n }\n $this->data['html'] = $this->config[$tab.'_body'];\n }", " /**\n * Only return selected modules\n *\n * @param string $type\n * @return string\n */\n function aggregateWhereClause($type='') {\n $sql = '(0'; // simply to offset the 'OR' added in loop\n if (!empty($this->config[$type.'_aggregate'])) {\n foreach ($this->config[$type.'_aggregate'] as $src) {\n $loc = expCore::makeLocation($type, $src);\n $sql .= \" OR location_data ='\".serialize($loc).\"'\";\n }\n \n }\n $sql .= ')';\n $model = $this->basemodel_name;\n if ($this->$model->needs_approval && ENABLE_WORKFLOW) {\n $sql .= ' AND approved=1';\n }", " return $sql;\n }", "}", "?>" ]
[ 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php\n##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class eaasController extends expController {\n //public $basemodel_name = '';\n public $useractions = array(\n 'showall'=>'Install Service API'\n // 'tags'=>\"Tags\",\n // 'authors'=>\"Authors\",\n // 'dates'=>\"Dates\",\n );\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n// 'module',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','pagination','rss','tags','twitter',)", "", " public $tabs = array(\n 'aboutus'=>'About Us', \n 'blog'=>'Blog', \n 'photo'=>'Photos', \n 'media'=>'Media',\n 'event'=>'Events',\n 'filedownload'=>'File Downloads', \n 'news'=>'News'\n );", "", " protected $data = array();\n \n static function displayname() { return gt(\"Exponent as a Service\"); }", " static function description() { return gt(\"This module allows you make service calls and return JSON for parts of Exponent\"); }\n static function author() { return \"Phillip Ball - OIC Group, Inc\"; }\n static function hasSources() { return false; } // must be explicitly added by config['add_source'] or config['aggregate']\n// static function isSearchable() { return true; }", " static function requiresConfiguration()\n {\n return true;\n }", " public function showall() {\n expHistory::set('viewable', $this->params);\n $info = array();\n $info['config'] = $this->config;\n $info['apikey'] = base64_encode(serialize($this->loc));", " assign_to_template(array('info'=>$info));\n }", " public function api() {\n if (empty($this->params['apikey'])) {\n $_REQUEST['apikey'] = true; // set this to force an ajax reply\n $ar = new expAjaxReply(550, 'Permission Denied', 'You need an API key in order to access Exponent as a Service', null);\n $ar->send(); //FIXME this doesn't seem to work correctly in this scenario\n } else {\n $key = expUnserialize(base64_decode(urldecode($this->params['apikey'])));\n $cfg = new expConfig($key);\n $this->config = $cfg->config;\n if(empty($cfg->id)) {\n $ar = new expAjaxReply(550, 'Permission Denied', 'Incorrect API key or Exponent as a Service module configuration missing', null);\n $ar->send();\n } else {\n if (!empty($this->params['get'])) {\n $this->handleRequest();\n } else {\n $ar = new expAjaxReply(200, 'ok', 'Your API key is working, no data requested', null);\n $ar->send();\n }\n }\n }\n }", " private function handleRequest() {\n if (!array_key_exists($this->params['get'], $this->tabs)) {\n $ar = new expAjaxReply(400, 'Bad Request', 'No service available for your request', null);\n $ar->send();\n }\n if ($this->params['get'] != 'aboutus' && empty($this->config[$this->params['get'].'_aggregate'])) {\n $ar = new expAjaxReply(400, 'Bad Request', 'No modules assigned to requested service', null);\n $ar->send();\n }\n switch ($this->params['get']) {\n case 'aboutus':\n $ar = new expAjaxReply(200, 'ok', $this->aboutUs(), null);\n $ar->send();\n break;\n case 'news':\n $ar = new expAjaxReply(200, 'ok', $this->news(), null);\n $ar->send();\n break;\n case 'photo':\n case 'photos':\n $ar = new expAjaxReply(200, 'ok', $this->photo(), null);\n $ar->send();\n break;\n case 'media':\n $ar = new expAjaxReply(200, 'ok', $this->media(), null);\n $ar->send();\n break;\n case 'filedownload':\n case 'filedownloads':\n $ar = new expAjaxReply(200, 'ok', $this->filedownload(), null);\n $ar->send();\n break;\n case 'blog':\n case 'blogs':\n $ar = new expAjaxReply(200, 'ok', $this->blog(), null);\n $ar->send();\n break;\n case 'event':\n case 'events':\n $ar = new expAjaxReply(200, 'ok', $this->event(), null);\n $ar->send();\n break;\n default: // probably shouldn't evet get to this point\n $ar = new expAjaxReply(400, 'Bad Request', 'No service available for your request', null);\n $ar->send();\n break;\n }\n }", " /**\n * Return the About Us data along with a quick item count by module\n * @return array\n */\n private function aboutUs() {\n $counts = array();\n foreach ($this->tabs as $key=>$name) {\n if ($key != 'aboutus') {\n $data = $this->$key();\n $counts[$key] = count($data['records']);\n }\n }\n $this->data = array(); // initialize\n $this->data = $counts;\n $this->data['records'] = array();\n $this->getImageBody($this->params['get']);\n return $this->data;\n }", " private function news() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $news = new news($this->params['id']);\n $this->data['records'] = $news;\n } else {\n $news = new news();", " // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } \n \n $order = isset($this->params['order']) ? $this->params['order'] : 'publish DESC';\n $items = $news->find('all', $this->aggregateWhereClause('news'), $order, $limit);\n $this->data['records'] = $items;\n }", " $this->getImageBody($this->params['get']);\n return $this->data;\n }", "// private function youtube() { //FIXME must replace with media player and then removed\n// $this->data = array(); // initialize\n// if (!empty($this->params['id'])) {\n// $youtube = new youtube($this->params['id']);\n// $this->data['records'] = $youtube;\n// } else {\n// $youtube = new youtube();\n//\n// // figure out if should limit the results\n// if (isset($this->params['limit'])) {\n// $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n// } else {\n// $limit = '';\n// }\n//\n// $order = isset($this->params['order']) ? $this->params['order'] : 'created_at ASC';\n//\n// $items = $youtube->find('all', $this->aggregateWhereClause('youtube'), $order, $limit);\n// $this->data['records'] = $items;\n// }\n//\n// $this->getImageBody($this->params['get']);\n// return $this->data;\n// }", " private function media() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $media = new media($this->params['id']);\n $this->data['records'] = $media;\n } else {\n $media = new media();", " // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n }", " $order = isset($this->params['order']) ? $this->params['order'] : 'created_at ASC';", " $items = $media->find('all', $this->aggregateWhereClause('media'), $order, $limit);\n $this->data['records'] = $items;\n }", " $this->getImageBody($this->params['get']);\n return $this->data;\n }", " private function filedownload() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $filedownload = new filedownload($this->params['id']);\n $this->data['records'] = $filedownload;\n } else {\n $filedownload = new filedownload();", " // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } ", " $order = isset($this->params['order']) ? $this->params['order'] : 'created_at ASC';", " $items = $filedownload->find('all', $this->aggregateWhereClause('filedownload'), $order, $limit);\n $this->data['records'] = $items;\n }", " $this->getImageBody($this->params['get']);\n return $this->data;\n }", " private function photo() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $photo = new photo($this->params['id']);\n $this->data['records'] = $photo;\n } else {\n $photo = new photo();", " // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } \n \n $order = isset($this->params['order']) ? $this->params['order'] : 'rank';\n $items = $photo->find('all', $this->aggregateWhereClause('photo'), $order, $limit);\n $this->data['records'] = $items;\n }", " $this->getImageBody($this->params['get']);\n return $this->data;\n }", " private function blog() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $blog = new blog($this->params['id']);\n $this->data['records'] = $blog;\n } else {\n $blog = new blog();", " // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } \n \n $order = isset($this->params['order']) ? $this->params['order'] : 'publish DESC';\n $items = $blog->find('all', $this->aggregateWhereClause('blog'), $order, $limit);\n $this->data['records'] = $items;\n }", " $this->getImageBody($this->params['get']);\n return $this->data;\n }", " private function event() {\n $this->data = array(); // initialize\n if (!empty($this->params['id'])) {\n $event = new event($this->params['id']);\n $this->data['records'] = $event;\n } else {\n $event = new event();", " // figure out if we should limit the results\n if (isset($this->params['limit'])) {\n $limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];\n } else {\n $limit = '';\n } \n \n// $order = isset($this->params['order']) ? $this->params['order'] : 'created_at'; //FIXME we shoud be getting upcoming events\n// $items = $event->find('all', $this->aggregateWhereClause('event'), $order, $limit); //FIXME needs 'upcoming' type of find\n $items = $event->find('upcoming', $this->aggregateWhereClause('event'), false, $limit); //new 'upcoming' type of find\n $this->data['records'] = $items;\n }", " if (!empty($this->params['groupbydate'])&&!empty($items)) { // aggregate by day like with regular calendar\n $this->data['records'] = array();\n foreach ($items as $value) {\n $this->data['records'][date('r',$value->eventdate[0]->date)][] = $value;\n // edebug($value);\n }\n }", " $this->getImageBody($this->params['get']);\n return $this->data;\n }", " function configure() {\n expHistory::set('editable', $this->params);\n parent::configure();\n $order = isset($this->params['order']) ? $this->params['order'] : 'section';\n $dir = isset($this->params['dir']) ? $this->params['dir'] : '';\n \n $views = expTemplate::get_config_templates($this, $this->loc);\n $pullable = array();\n $page = array();", " foreach ($this->tabs as $tab => $name) {\n // news tab\n if ($tab!='aboutus') {\n $pullable[$tab] = expModules::listInstalledControllers($tab);\n $page[$tab] = new expPaginator(array(\n 'controller'=>$tab.'Controller',\n 'action' => $this->params['action'],\n 'records'=>$pullable[$tab],\n 'limit'=>count($pullable[$tab]),\n 'order'=>$order,\n 'dir'=>$dir,\n 'columns'=>array(gt('Title')=>'title',gt('Page')=>'section'),\n ));\n }", " $this->configImage($tab); // fix attached files for proper display of file manager control\n }\n // edebug($this->config['expFile']);", " assign_to_template(array(\n 'config'=>$this->config, // though already assigned in controllertemplate, we need to update expFiles\n 'pullable'=>$pullable,\n 'page'=>$page,\n// 'views'=>$views\n ));\n }", " private function configImage($tab) {\n if (count(@$this->config['expFile'][$tab.'_image'])>1) {\n $ftmp[] = new expFile($this->config['expFile'][$tab.'_image'][0]);\n $this->config['expFile'][$tab.'_image'] = $ftmp;\n } else {\n $this->config['expFile'][$tab.'_image'] = array();\n }\n }", " private function getImageBody($tab) {\n // create an empty 'banner' object to prevent errors in caller\n $this->data['banner']['obj'] = null;\n $this->data['banner']['obj']->url = null;\n $this->data['banner']['md5'] = null;", " if (count(@$this->config['expFile'][$tab.'_image'])>1) {\n $img = new expFile($this->config['expFile'][$tab.'_image'][0]);\n if ($img) {\n $this->data['banner']['obj'] = $img;\n $this->data['banner']['md5'] = md5_file($img->path);\n }\n }\n $this->data['html'] = $this->config[$tab.'_body'];\n }", " /**\n * Only return selected modules\n *\n * @param string $type\n * @return string\n */\n function aggregateWhereClause($type='') {\n $sql = '(0'; // simply to offset the 'OR' added in loop\n if (!empty($this->config[$type.'_aggregate'])) {\n foreach ($this->config[$type.'_aggregate'] as $src) {\n $loc = expCore::makeLocation($type, $src);\n $sql .= \" OR location_data ='\".serialize($loc).\"'\";\n }\n \n }\n $sql .= ')';\n $model = $this->basemodel_name;\n if ($this->$model->needs_approval && ENABLE_WORKFLOW) {\n $sql .= ' AND approved=1';\n }", " return $sql;\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class ealertController extends expController {\n public $basemodel_name = 'expeAlerts';", "", "\tpublic $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)", "\t", " static function displayname() { return gt(\"E-Alerts\"); }\n static function description() { return gt(\"This module will allow users to sign up for email alerts on a module by module basis.\"); }", " ", " static function hasSources() {\n return false;\n }", " public function showall() {\n $ealerts = new expeAlerts();\n $subscriptions = array();\n assign_to_template(array(\n 'ealerts'=>$ealerts->find('all'),\n 'subscriptions'=>$subscriptions\n ));\n }", " ", " public function send_confirm() {\n global $db;", " // find this E-Alert in the database", " $src = empty($this->params['src']) ? null : $this->params['src'];", " $ealert = $db->selectObject('expeAlerts', 'module=\"'.$this->params['orig_controller'].'\" AND src=\"'.$src.'\"');\n if (!empty($ealert->autosend_ealerts)) {\n redirect_to(array('controller'=>'ealert','action'=>'send_auto','model'=>$this->params['model'],'id'=>$this->params['id'], 'src'=>$this->params['src']));\n }", " // find the content for the E-Alerts\n $model = $this->params['model'];\n $record = new $model($this->params['id']);\n // setup the content for the view\n $subject = $record->title;\n $body = $record->body;", " ", " // figure out how many subscribers there are\n $number_of_subscribers = $db->countObjects('user_subscriptions', 'expeAlerts_id='.$ealert->id);", " ", " assign_to_template(array(\n 'record'=>$record,\n 'number_of_subscribers'=>$number_of_subscribers,\n 'ealert'=>$ealert\n ));\n }", " ", " public function send_process() {\n global $db, $router;", " $obj = new stdClass();\n $obj->subject = $this->params['subject'];\n $obj->body = $this->params['body'];\n $link = $router->makelink(array('controller'=>$this->params['model'], 'action'=>'show', 'title'=>$this->params['sef_url']));\n $obj->body .= '<hr><a href=\"'.$link.'\">'.gt('View posting').'.</a>';\n $obj->created_at = time();\n $id = $db->insertObject($obj, 'expeAlerts_temp');", " ", " $bot = new expBot(array(\n 'url'=>PATH_RELATIVE.\"index.php?controller=ealert&action=send&id=\".$id.'&ealert_id='.$this->params['id'],\n 'method'=>'POST',\n ));", " ", " $bot->fire();\n flash('message', gt(\"E-Alerts are being sent to subscribers.\"));\n expHistory::back();\n }", " ", " public function send_auto() {\n global $db, $router;", " // find this E-Alert in the database", " $src = empty($this->params['src']) ? null : $this->params['src'];", " $ealert = $db->selectObject('expeAlerts', 'module=\"'.$this->params['model'].'\" AND src=\"'.$src.'\"');", " // find the content for the E-Alerts\n $model = $this->params['model'];\n $record = new $model($this->params['id']);\n $obj = new stdClass();\n $obj->subject = gt('Notification of New Content Posted to').' '.$ealert->ealert_title;\n $obj->body .= \"<h3>\".gt('New content was added titled').\" '\".$record->title.\"'</h3><hr>\";\n if ($ealert->ealert_usebody == 0) {\n $obj->body .= $record->body;\n } elseif ($ealert->ealert_usebody == 1) {\n $obj->body .= expString::summarize($record->body,'html','paralinks');\n }\n $link = $router->makelink(array('controller'=>$this->params['model'], 'action'=>'show', 'title'=>$record->sef_url));\n $obj->body .= '<hr><a href=\"'.$link.'\">'.gt('View posting').'.</a>';\n $obj->created_at = time();\n $id = $db->insertObject($obj, 'expeAlerts_temp');", " $bot = new expBot(array(\n 'url'=>PATH_RELATIVE.\"index.php?controller=ealert&action=send&id=\".$id.'&ealert_id='.$ealert->id,\n 'method'=>'POST',\n ));", " $bot->fire();\n flash('message', gt(\"E-Alerts are being sent to subscribers.\"));\n expHistory::back();\n }", " public function send() {\n global $db, $router;", " ", " // get the message body we saved in the temp table\n $message = $db->selectObject('expeAlerts_temp', 'id='.$this->params['id']);", " ", " // look up the subscribers\n $sql = 'SELECT s.* FROM '.$db->prefix.'user_subscriptions es ';\n $sql .= 'LEFT JOIN '.$db->prefix.'user s ON s.id=es.user_id WHERE es.expeAlerts_id='.$this->params['ealert_id'];\n $subscribers = $db->selectObjectsBySql($sql);", " ", " $count = 1;\n $total = count($subscribers);\n foreach($subscribers as $subscriber) {\n// $link = $router->makelink(array('controller'=>'ealert', 'action'=>'subscriptions', 'id'=>$subscriber->id, 'key'=>$subscriber->hash));\n// $body = $message->body;\n// $body .= '<br><a href=\"'.$link.'\">'.gt('Click here to change your E-Alert subscription settings').'.</a>';", " ", " $mail = new expMail();\n $mail->quickSend(array(\n 'html_message'=>$message->body,\n\t\t 'to'=>array(trim($subscriber->email) => trim(user::getUserAttribution($subscriber->id))),\n 'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n\t\t 'subject'=>$message->subject,\n ));", " ", " $message->edited_at = time();\n $message->status = 'Sent message '.$count.' of '.$total;\n $db->updateObject($message, 'expeAlerts_temp');\n $count++;", " } \n ", " $db->delete('expeAlerts_temp', 'id='.$message->id);\n }", " public function subscribe() {\n global $user,$db;", " // make sure we have what we need.\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The id was not supplied.'));\n if (empty($user->id)) expQueue::flashAndFlow('error', gt('You must be logged on to subscribe.'));\n if (!$db->selectObject('user_subscriptions','user_id='.$user->id.' AND expeAlerts_id='.$this->params['id'])) {\n $subscription = new stdClass();\n $subscription->user_id = $user->id;\n $subscription->expeAlerts_id = $this->params['id'];\n $db->insertObject($subscription,'user_subscriptions');\n $ealert = $db->selectObject('expeAlerts','id='.$this->params['id']);\n flash('message', gt(\"You are now subscribed to receive email alerts for updates to\".\" \".$ealert->ealert_title));\n }\n expHistory::back();\n }", " public function unsubscribe() {\n global $user,$db;", " // make sure we have what we need.\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The id was not supplied.'));\n if (empty($user->id)) expQueue::flashAndFlow('error', gt('You must be logged on to un-subscribe.'));\n $db->delete('user_subscriptions','user_id='.$user->id.' AND expeAlerts_id='.$this->params['id']);\n $ealert = $db->selectObject('expeAlerts','id='.$this->params['id']);\n flash('message', gt(\"You are now un-subscribed from email alerts to\".\" \".$ealert->ealert_title));\n expHistory::back();\n }", " /**\n * @deprecated\n */", " public function subscriptions() {\n global $db;\n \n expHistory::set('manageable', $this->params);\n // make sure we have what we need.\n if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.'));\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.'));\n \n // verify the id/key pair \n $sub = new subscribers($this->params['id']);\n if (empty($sub->id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.'));\n \n // get this users subscriptions\n $subscriptions = $db->selectColumn('expeAlerts_subscribers', 'expeAlerts_id', 'subscribers_id='.$sub->id);\n \n // get a list of all available E-Alerts\n $ealerts = new expeAlerts();\n assign_to_template(array(\n 'subscriber'=>$sub,\n 'subscriptions'=>$subscriptions,\n 'ealerts'=>$ealerts->find('all')\n ));\n }\n \n /**\n * @deprecated\n */\n public function subscription_update() {\n global $db;\n \n // make sure we have what we need.\n if (empty($this->params['email'])) expQueue::flashAndFlow('error', gt('You must supply an email address to sign up for email alerts.'));\n if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.'));\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.'));\n \n // find the subscriber and validate the security key\n $subscriber = new subscribers($this->params['id']);\n if ($subscriber->hash != $this->params['key']) expQueue::flashAndFlow('error', gt('The security key you supplied does not match the one we have on file.'));\n \n // delete any old subscriptions and add the user to new subscriptions\n $db->delete('expeAlerts_subscribers', 'subscribers_id='.$subscriber->id);\n foreach($this->params['ealerts'] as $ea_id) {\n $obj = new stdClass();\n $obj->subscribers_id = $subscriber->id;\n $obj->expeAlerts_id = $ea_id;\n $db->insertObject($obj, 'expeAlerts_subscribers');\n }\n \n $count = count($this->params['ealerts']);\n \n if ($count > 0) {\n flash('message', gt(\"Your subscriptions have been updated. You are now subscriber to\").\" \".$count.' '.gt('E-Alerts.'));\n } else {\n flash('error', gt(\"You have been unsubscribed from all E-Alerts.\"));\n }\n \n expHistory::back();\n }\n \n /**\n * @deprecated\n */\n public function signup() {\n global $db;\n // check the anti-spam control\n expValidator::check_antispam($this->params, gt(\"Anti-spam verification failed. Please try again.\"));\n \n // make sure we have what we need.\n if (empty($this->params['email'])) expQueue::flashAndFlow('error', gt('You must supply an email address to sign up for email alerts.'));\n if (empty($this->params['ealerts'])) expQueue::flashAndFlow('error', gt('You did not select any E-Alert topics to subscribe to.'));\n \n // find or create the subscriber\n $id = $db->selectValue('subscribers', 'id', 'email=\"'.$this->params['email'].'\"');\n $subscriber = new subscribers($id);\n if (empty($subscriber->id)) {\n $subscriber->email = trim($this->params['email']);\n $subscriber->hash = md5($subscriber->email.time());\n $subscriber->save();\n }\n \n // delete any old subscriptions and add the user to new subscriptions\n $db->delete('expeAlerts_subscribers', 'subscribers_id='.$subscriber->id);\n foreach($this->params['ealerts'] as $ea_id) {\n $obj = new stdClass();\n $obj->subscribers_id = $subscriber->id;\n $obj->expeAlerts_id = $ea_id;\n $db->insertObject($obj, 'expeAlerts_subscribers');\n }\n \n // send a confirmation email to the user. \n $ealerts = $db->selectObjects('expeAlerts', 'id IN ('.implode(',', $this->params['ealerts']).')');\n $body = expTemplate::get_template_for_action($this, 'email/confirmation_email', $this->loc);\n $body->assign('ealerts', $ealerts);\n $body->assign('subscriber', $subscriber);\n \n $mail = new expMail();\n $mail->quickSend(array(\n 'html_message'=>$body->render(),\n\t\t 'to'=>$subscriber->email,\n 'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n\t\t 'subject'=>gt('Please confirm your E-Alert subscriptions'),\n ));\n \n redirect_to(array('controller'=>'ealert', 'action'=>'pending', 'id'=>$subscriber->id));\n }\n \n /**\n * @deprecated\n */\n public function pending() {", "// global $db;", " \n // make sure we have what we need.\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.'));", " // find the subscriber and their pending subscriptions\n $ealerts = expeAlerts::getPendingBySubscriber($this->params['id']);\n $subscriber = new subscribers($this->params['id']);\n \n // render the template\n assign_to_template(array(\n 'subscriber'=>$subscriber,\n 'ealerts'=>$ealerts\n ));\n }\n \n public function confirm() {\n global $db;\n \n // make sure we have what we need.\n if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.'));\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.'));\n \n // verify the id/key pair \n $id = $db->selectValue('subscribers','id', 'id='.$this->params['id'].' AND hash=\"'.$this->params['key'].'\"');\n if (empty($id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.'));\n \n // activate this users pending subscriptions\n $sub = new stdClass();\n $sub->enabled = 1;\n $db->updateObject($sub, 'expeAlerts_subscribers', 'subscribers_id='.$id);\n \n // find the users active subscriptions\n $ealerts = expeAlerts::getBySubscriber($id);\n assign_to_template(array(\n 'ealerts'=>$ealerts\n ));\n }", "}", "?>" ]
[ 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class ealertController extends expController {\n public $basemodel_name = 'expeAlerts';", " protected $manage_permissions = array(\n 'send'=>'Send E-Alert',\n );", "\tpublic $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)", "", " static function displayname() { return gt(\"E-Alerts\"); }\n static function description() { return gt(\"This module will allow users to sign up for email alerts on a module by module basis.\"); }", "", " static function hasSources() {\n return false;\n }", " public function showall() {\n $ealerts = new expeAlerts();\n $subscriptions = array();\n assign_to_template(array(\n 'ealerts'=>$ealerts->find('all'),\n 'subscriptions'=>$subscriptions\n ));\n }", "", " public function send_confirm() {\n global $db;", " // find this E-Alert in the database", " $src = empty($this->params['src']) ? null : expString::escape($this->params['src']);", " $ealert = $db->selectObject('expeAlerts', 'module=\"'.$this->params['orig_controller'].'\" AND src=\"'.$src.'\"');\n if (!empty($ealert->autosend_ealerts)) {\n redirect_to(array('controller'=>'ealert','action'=>'send_auto','model'=>$this->params['model'],'id'=>$this->params['id'], 'src'=>$this->params['src']));\n }", " // find the content for the E-Alerts\n $model = $this->params['model'];\n $record = new $model($this->params['id']);\n // setup the content for the view\n $subject = $record->title;\n $body = $record->body;", "", " // figure out how many subscribers there are\n $number_of_subscribers = $db->countObjects('user_subscriptions', 'expeAlerts_id='.$ealert->id);", "", " assign_to_template(array(\n 'record'=>$record,\n 'number_of_subscribers'=>$number_of_subscribers,\n 'ealert'=>$ealert\n ));\n }", "", " public function send_process() {\n global $db, $router;", " $obj = new stdClass();\n $obj->subject = $this->params['subject'];\n $obj->body = $this->params['body'];\n $link = $router->makelink(array('controller'=>$this->params['model'], 'action'=>'show', 'title'=>$this->params['sef_url']));\n $obj->body .= '<hr><a href=\"'.$link.'\">'.gt('View posting').'.</a>';\n $obj->created_at = time();\n $id = $db->insertObject($obj, 'expeAlerts_temp');", "", " $bot = new expBot(array(\n 'url'=>PATH_RELATIVE.\"index.php?controller=ealert&action=send&id=\".$id.'&ealert_id='.$this->params['id'],\n 'method'=>'POST',\n ));", "", " $bot->fire();\n flash('message', gt(\"E-Alerts are being sent to subscribers.\"));\n expHistory::back();\n }", "", " public function send_auto() {\n global $db, $router;", " // find this E-Alert in the database", " $src = empty($this->params['src']) ? null : expString::escape($this->params['src']);", " $ealert = $db->selectObject('expeAlerts', 'module=\"'.$this->params['model'].'\" AND src=\"'.$src.'\"');", " // find the content for the E-Alerts\n $model = $this->params['model'];\n $record = new $model($this->params['id']);\n $obj = new stdClass();\n $obj->subject = gt('Notification of New Content Posted to').' '.$ealert->ealert_title;\n $obj->body .= \"<h3>\".gt('New content was added titled').\" '\".$record->title.\"'</h3><hr>\";\n if ($ealert->ealert_usebody == 0) {\n $obj->body .= $record->body;\n } elseif ($ealert->ealert_usebody == 1) {\n $obj->body .= expString::summarize($record->body,'html','paralinks');\n }\n $link = $router->makelink(array('controller'=>$this->params['model'], 'action'=>'show', 'title'=>$record->sef_url));\n $obj->body .= '<hr><a href=\"'.$link.'\">'.gt('View posting').'.</a>';\n $obj->created_at = time();\n $id = $db->insertObject($obj, 'expeAlerts_temp');", " $bot = new expBot(array(\n 'url'=>PATH_RELATIVE.\"index.php?controller=ealert&action=send&id=\".$id.'&ealert_id='.$ealert->id,\n 'method'=>'POST',\n ));", " $bot->fire();\n flash('message', gt(\"E-Alerts are being sent to subscribers.\"));\n expHistory::back();\n }", " public function send() {\n global $db, $router;", "", " // get the message body we saved in the temp table\n $message = $db->selectObject('expeAlerts_temp', 'id='.$this->params['id']);", "", " // look up the subscribers\n $sql = 'SELECT s.* FROM '.$db->prefix.'user_subscriptions es ';\n $sql .= 'LEFT JOIN '.$db->prefix.'user s ON s.id=es.user_id WHERE es.expeAlerts_id='.$this->params['ealert_id'];\n $subscribers = $db->selectObjectsBySql($sql);", "", " $count = 1;\n $total = count($subscribers);\n foreach($subscribers as $subscriber) {\n// $link = $router->makelink(array('controller'=>'ealert', 'action'=>'subscriptions', 'id'=>$subscriber->id, 'key'=>$subscriber->hash));\n// $body = $message->body;\n// $body .= '<br><a href=\"'.$link.'\">'.gt('Click here to change your E-Alert subscription settings').'.</a>';", "", " $mail = new expMail();\n $mail->quickSend(array(\n 'html_message'=>$message->body,\n\t\t 'to'=>array(trim($subscriber->email) => trim(user::getUserAttribution($subscriber->id))),\n 'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n\t\t 'subject'=>$message->subject,\n ));", "", " $message->edited_at = time();\n $message->status = 'Sent message '.$count.' of '.$total;\n $db->updateObject($message, 'expeAlerts_temp');\n $count++;", " }\n", " $db->delete('expeAlerts_temp', 'id='.$message->id);\n }", " public function subscribe() {\n global $user,$db;", " // make sure we have what we need.\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The id was not supplied.'));\n if (empty($user->id)) expQueue::flashAndFlow('error', gt('You must be logged on to subscribe.'));\n if (!$db->selectObject('user_subscriptions','user_id='.$user->id.' AND expeAlerts_id='.$this->params['id'])) {\n $subscription = new stdClass();\n $subscription->user_id = $user->id;\n $subscription->expeAlerts_id = $this->params['id'];\n $db->insertObject($subscription,'user_subscriptions');\n $ealert = $db->selectObject('expeAlerts','id='.$this->params['id']);\n flash('message', gt(\"You are now subscribed to receive email alerts for updates to\".\" \".$ealert->ealert_title));\n }\n expHistory::back();\n }", " public function unsubscribe() {\n global $user,$db;", " // make sure we have what we need.\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The id was not supplied.'));\n if (empty($user->id)) expQueue::flashAndFlow('error', gt('You must be logged on to un-subscribe.'));\n $db->delete('user_subscriptions','user_id='.$user->id.' AND expeAlerts_id='.$this->params['id']);\n $ealert = $db->selectObject('expeAlerts','id='.$this->params['id']);\n flash('message', gt(\"You are now un-subscribed from email alerts to\".\" \".$ealert->ealert_title));\n expHistory::back();\n }", " /**\n * @deprecated\n */", "// public function subscriptions() {", "// global $db;", "//\n// expHistory::set('manageable', $this->params);\n// // make sure we have what we need.\n// if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.'));\n// if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.'));\n//\n// // verify the id/key pair\n// $sub = new subscribers($this->params['id']);\n// if (empty($sub->id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.'));\n//\n// // get this users subscriptions\n// $subscriptions = $db->selectColumn('expeAlerts_subscribers', 'expeAlerts_id', 'subscribers_id='.$sub->id);\n//\n// // get a list of all available E-Alerts\n// $ealerts = new expeAlerts();\n// assign_to_template(array(\n// 'subscriber'=>$sub,\n// 'subscriptions'=>$subscriptions,\n// 'ealerts'=>$ealerts->find('all')\n// ));\n// }", " /**\n * @deprecated\n */\n// public function subscription_update() {\n// global $db;\n//\n// // make sure we have what we need.\n// if (empty($this->params['email'])) expQueue::flashAndFlow('error', gt('You must supply an email address to sign up for email alerts.'));\n// if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.'));\n// if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.'));\n//\n// // find the subscriber and validate the security key\n// $subscriber = new subscribers($this->params['id']);\n// if ($subscriber->hash != $this->params['key']) expQueue::flashAndFlow('error', gt('The security key you supplied does not match the one we have on file.'));\n//\n// // delete any old subscriptions and add the user to new subscriptions\n// $db->delete('expeAlerts_subscribers', 'subscribers_id='.$subscriber->id);\n// foreach($this->params['ealerts'] as $ea_id) {\n// $obj = new stdClass();\n// $obj->subscribers_id = $subscriber->id;\n// $obj->expeAlerts_id = $ea_id;\n// $db->insertObject($obj, 'expeAlerts_subscribers');\n// }\n//\n// $count = count($this->params['ealerts']);\n//\n// if ($count > 0) {\n// flash('message', gt(\"Your subscriptions have been updated. You are now subscriber to\").\" \".$count.' '.gt('E-Alerts.'));\n// } else {\n// flash('error', gt(\"You have been unsubscribed from all E-Alerts.\"));\n// }\n//\n// expHistory::back();\n// }", " /**\n * @deprecated\n */\n// public function signup() {\n// global $db;\n// // check the anti-spam control\n// expValidator::check_antispam($this->params, gt(\"Anti-spam verification failed. Please try again.\"));\n//\n// // make sure we have what we need.\n// if (empty($this->params['email'])) expQueue::flashAndFlow('error', gt('You must supply an email address to sign up for email alerts.'));\n// if (empty($this->params['ealerts'])) expQueue::flashAndFlow('error', gt('You did not select any E-Alert topics to subscribe to.'));\n//\n// // find or create the subscriber\n// $id = $db->selectValue('subscribers', 'id', 'email=\"'.$this->params['email'].'\"');\n// $subscriber = new subscribers($id);\n// if (empty($subscriber->id)) {\n// $subscriber->email = trim($this->params['email']);\n// $subscriber->hash = md5($subscriber->email.time());\n// $subscriber->save();\n// }\n//\n// // delete any old subscriptions and add the user to new subscriptions\n// $db->delete('expeAlerts_subscribers', 'subscribers_id='.$subscriber->id);\n// foreach($this->params['ealerts'] as $ea_id) {\n// $obj = new stdClass();\n// $obj->subscribers_id = $subscriber->id;\n// $obj->expeAlerts_id = $ea_id;\n// $db->insertObject($obj, 'expeAlerts_subscribers');\n// }\n//\n// // send a confirmation email to the user.\n// $ealerts = $db->selectObjects('expeAlerts', 'id IN ('.implode(',', $this->params['ealerts']).')');\n// $body = expTemplate::get_template_for_action($this, 'email/confirmation_email', $this->loc);\n// $body->assign('ealerts', $ealerts);\n// $body->assign('subscriber', $subscriber);\n//\n// $mail = new expMail();\n// $mail->quickSend(array(\n// 'html_message'=>$body->render(),\n//\t\t 'to'=>$subscriber->email,\n// 'from'=>array(trim(SMTP_FROMADDRESS) => trim(ORGANIZATION_NAME)),\n//\t\t 'subject'=>gt('Please confirm your E-Alert subscriptions'),\n// ));\n//\n// redirect_to(array('controller'=>'ealert', 'action'=>'pending', 'id'=>$subscriber->id));\n// }", " /**\n * @deprecated\n */\n// public function pending() {\n//// global $db;\n//\n// // make sure we have what we need.\n// if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.'));\n//\n// // find the subscriber and their pending subscriptions\n// $ealerts = expeAlerts::getPendingBySubscriber($this->params['id']);\n// $subscriber = new subscribers($this->params['id']);\n//\n// // render the template\n// assign_to_template(array(\n// 'subscriber'=>$subscriber,\n// 'ealerts'=>$ealerts\n// ));\n// }", " /**\n * @deprecated\n */\n// public function confirm() {\n// global $db;\n//\n// // make sure we have what we need.\n// if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.'));\n// if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.'));\n//\n// // verify the id/key pair\n// $id = $db->selectValue('subscribers','id', 'id='.$this->params['id'].' AND hash=\"'.$this->params['key'].'\"');\n// if (empty($id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.'));\n//\n// // activate this users pending subscriptions\n// $sub = new stdClass();\n// $sub->enabled = 1;\n// $db->updateObject($sub, 'expeAlerts_subscribers', 'subscribers_id='.$id);\n//\n// // find the users active subscriptions\n// $ealerts = expeAlerts::getBySubscriber($id);\n// assign_to_template(array(\n// 'ealerts'=>$ealerts\n// ));\n// }\n", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class billingController extends expController {", " protected $add_permissions = array(\n 'activate'=>'Activate Payment Options'", " );", " ", " static function displayname() { return gt(\"e-Commerce Billing Controller\"); }\n static function description() { return \"\"; }\n\tstatic function hasSources() { return false; }", "\t", "\tfunction selectBillingCalculator() {\n\t\t$billing = new billing();\n\t\t$billing->billingmethod->update($this->params);\n\t\t$ar = new expAjaxReply(200, 'ok', $billing, array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}", "\tfunction setAddress() {\n\t\t$billing = new billing();\n\t\t$billing->billingmethod->setAddress($this->params['billing_address']);\n\t\t$ar = new expAjaxReply(200, 'ok', new address($billing->billingmethod->addresses_id), array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}", "\tfunction selectBillingOptions() {", "\t\t", "\t}", "\t", "\tfunction manage() {\n\t global $db;", "\t ", "\t expHistory::set('manageable', $this->params);\n//\t $classes = array();\n $dir = BASE.\"framework/modules/ecommerce/billingcalculators\";\n if (is_readable($dir)) {\n $dh = opendir($dir);\n while (($file = readdir($dh)) !== false) {\n if (is_file(\"$dir/$file\") && substr(\"$dir/$file\", -4) == \".php\") {\n include_once(\"$dir/$file\");\n $classname = substr($file, 0, -4);\n $id = $db->selectValue('billingcalculator', 'id', 'calculator_name=\"'.$classname.'\"');\n if (empty($id)) {\n// $calobj = null;\n $calcobj = new $classname();\n if ($calcobj->isSelectable() == true) {\n $obj = new billingcalculator(array(\n 'title'=>$calcobj->name(),\n// 'user_title'=>$calcobj->title,", " 'body'=>$calcobj->description(), ", " 'calculator_name'=>$classname,\n 'enabled'=>false));\n $obj->save();\n }\n }\n }\n }\n }", " ", " $bcalc = new billingcalculator();\n $calculators = $bcalc->find('all');\n assign_to_template(array(\n 'calculators'=>$calculators\n ));\n\t}", "\t\n\tpublic function activate(){\t", "\t if (isset($this->params['id'])) {\n\t $calc = new billingcalculator($this->params['id']);\n\t $calc->update($this->params);\n //FIXME we need to ensure our default calculator is still active\n\t if ($calc->calculator->hasConfig() && empty($calc->config)) {\n\t flash('message', $calc->calculator->name().' '.gt('requires configuration. Please do so now.'));\n\t redirect_to(array('controller'=>'billing', 'action'=>'configure', 'id'=>$calc->id));\n\t }\n\t }\n\t expHistory::back();\n\t}", " public function toggle_default() {\n \t global $db;", " $db->toggle('billingcalculator',\"is_default\",'is_default=1');\n \t if (isset($this->params['id'])) {\n $active = $db->selectObject('billingcalculator',\"id=\".$this->params['id']);\n $active->is_default = 1;\n $db->updateObject($active,'billingcalculator',null,'id');\n }\n if ($db->selectValue('billingcalculator', 'is_default', 'id='.$this->params['id']) && !$db->selectValue('billingcalculator', 'enabled', 'id='.$this->params['id'])) {\n $db->toggle('billingcalculator', 'enabled', 'id='.$this->params['id']);\n }\n \t expHistory::back();\n \t}", " public function configure() {\n if (empty($this->params['id'])) return false;\n $calc = new billingcalculator($this->params['id']);\n assign_to_template(array(\n 'calculator'=>$calc,\n 'title'=>static::displayname()\n ));\n }", " ", " public function saveconfig() {\n $calc = new billingcalculator($this->params['id']);\n $conf = serialize($calc->calculator->parseConfig($this->params));\n $calc->update(array('config'=>$conf));\n expHistory::back();\n }", "}", "?>" ]
[ 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class billingController extends expController {", " protected $manage_permissions = array(\n 'select'=>'Select Feature',\n 'toggle'=>'Toggle Feature',", " );", "", " static function displayname() { return gt(\"e-Commerce Billing Controller\"); }\n static function description() { return \"\"; }\n\tstatic function hasSources() { return false; }", "", "\tfunction selectBillingCalculator() {\n\t\t$billing = new billing();\n\t\t$billing->billingmethod->update($this->params);\n\t\t$ar = new expAjaxReply(200, 'ok', $billing, array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}", "\tfunction setAddress() {\n\t\t$billing = new billing();\n\t\t$billing->billingmethod->setAddress($this->params['billing_address']);\n\t\t$ar = new expAjaxReply(200, 'ok', new address($billing->billingmethod->addresses_id), array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}", "\tfunction selectBillingOptions() {", "", "\t}", "", "\tfunction manage() {\n\t global $db;", "", "\t expHistory::set('manageable', $this->params);\n//\t $classes = array();\n $dir = BASE.\"framework/modules/ecommerce/billingcalculators\";\n if (is_readable($dir)) {\n $dh = opendir($dir);\n while (($file = readdir($dh)) !== false) {\n if (is_file(\"$dir/$file\") && substr(\"$dir/$file\", -4) == \".php\") {\n include_once(\"$dir/$file\");\n $classname = substr($file, 0, -4);\n $id = $db->selectValue('billingcalculator', 'id', 'calculator_name=\"'.$classname.'\"');\n if (empty($id)) {\n// $calobj = null;\n $calcobj = new $classname();\n if ($calcobj->isSelectable() == true) {\n $obj = new billingcalculator(array(\n 'title'=>$calcobj->name(),\n// 'user_title'=>$calcobj->title,", " 'body'=>$calcobj->description(),", " 'calculator_name'=>$classname,\n 'enabled'=>false));\n $obj->save();\n }\n }\n }\n }\n }", "", " $bcalc = new billingcalculator();\n $calculators = $bcalc->find('all');\n assign_to_template(array(\n 'calculators'=>$calculators\n ));\n\t}", "\n\tpublic function activate(){", "\t if (isset($this->params['id'])) {\n\t $calc = new billingcalculator($this->params['id']);\n\t $calc->update($this->params);\n //FIXME we need to ensure our default calculator is still active\n\t if ($calc->calculator->hasConfig() && empty($calc->config)) {\n\t flash('message', $calc->calculator->name().' '.gt('requires configuration. Please do so now.'));\n\t redirect_to(array('controller'=>'billing', 'action'=>'configure', 'id'=>$calc->id));\n\t }\n\t }\n\t expHistory::back();\n\t}", " public function toggle_default() {\n \t global $db;", " $db->toggle('billingcalculator',\"is_default\",'is_default=1');\n \t if (isset($this->params['id'])) {\n $active = $db->selectObject('billingcalculator',\"id=\".$this->params['id']);\n $active->is_default = 1;\n $db->updateObject($active,'billingcalculator',null,'id');\n }\n if ($db->selectValue('billingcalculator', 'is_default', 'id='.$this->params['id']) && !$db->selectValue('billingcalculator', 'enabled', 'id='.$this->params['id'])) {\n $db->toggle('billingcalculator', 'enabled', 'id='.$this->params['id']);\n }\n \t expHistory::back();\n \t}", " public function configure() {\n if (empty($this->params['id'])) return false;\n $calc = new billingcalculator($this->params['id']);\n assign_to_template(array(\n 'calculator'=>$calc,\n 'title'=>static::displayname()\n ));\n }", "", " public function saveconfig() {\n $calc = new billingcalculator($this->params['id']);\n $conf = serialize($calc->calculator->parseConfig($this->params));\n $calc->update(array('config'=>$conf));\n expHistory::back();\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */\n/** @define \"BASE\" \"../../../..\" */", "class ecomconfigController extends expController {\n protected $add_permissions = array(\n 'show'=>'View Admin Options'\n );", "\t", " static function displayname() { return gt(\"e-Commerce Configuration Manager\"); }\n static function description() { return gt(\"Use this module to configure your e-Commerce store\"); }\n static function hasSources() { return false; }", " function show() {\n expHistory::set('manageable', $this->params);\n }", " ", " /*****************************************************************/\n /*************** PRODUCT OPTIONS *******************************/\n /*****************************************************************/\n function edit_optiongroup_master() {\n expHistory::set('editable', $this->params);", " ", " $id = isset($this->params['id']) ? $this->params['id'] : null;", " $record = new optiongroup_master($id); ", " assign_to_template(array(\n 'record'=>$record\n ));\n }", " ", " function update_optiongroup_master() {\n global $db;", " $id = empty($this->params['id']) ? null : $this->params['id'];\n $og = new optiongroup_master($id);\n $oldtitle = $og->title;\n $og->update($this->params);", " ", " // if the title of the master changed we should update the option groups that are already using it.\n if ($oldtitle != $og->title) {\n $db->sql('UPDATE '.$db->prefix.'optiongroup SET title=\"'.$og->title.'\" WHERE title=\"'.$oldtitle.'\"');\n }", " \n expHistory::back();\n }\n ", " function delete_optiongroup_master() {\n global $db;", " ", " $mastergroup = new optiongroup_master($this->params);", " ", " // delete all the options for this optiongroup master\n foreach ($mastergroup->option_master as $masteroption) {\n $db->delete('option', 'option_master_id='.$masteroption->id);\n $masteroption->delete();\n }", " ", " // delete the mastergroup\n $db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id);\n $mastergroup->delete();", " \n expHistory::back();\n }\n ", " function delete_option_master() {\n global $db;", " $masteroption = new option_master($this->params['id']);", " ", " // delete any implementations of this option master\n $db->delete('option', 'option_master_id='.$masteroption->id);\n $masteroption->delete('optiongroup_master_id=' . $masteroption->optiongroup_master_id);\n //eDebug($masteroption);\n expHistory::back();\n }", " ", " function edit_option_master() {\n expHistory::set('editable', $this->params);", " ", " $params = isset($this->params['id']) ? $this->params['id'] : $this->params;", " $record = new option_master($params); ", " assign_to_template(array(\n 'record'=>$record\n ));\n }", " \n function update_option_master() { ", " global $db;", " $id = empty($this->params['id']) ? null : $this->params['id'];\n $opt = new option_master($id);\n $oldtitle = $opt->title;", " ", " $opt->update($this->params);", " ", " // if the title of the master changed we should update the option groups that are already using it.\n if ($oldtitle != $opt->title) {", " ", " }$db->sql('UPDATE '.$db->prefix.'option SET title=\"'.$opt->title.'\" WHERE option_master_id='.$opt->id);", " \n expHistory::back();\n }\n ", " public function options() {\n expHistory::set('viewable', $this->params);\n $optiongroup = new optiongroup_master();\n $optiongroups = $optiongroup->find('all');\n assign_to_template(array(\n 'optiongroups'=>$optiongroups\n ));\n }", " ", " function rerank_optionmaster() {\n $om = new option_master($this->params['id']);\n $om->rerank($this->params['push'], 'optiongroup_master_id=' . $this->params['master_id']);\n expHistory::back();\n }", " ", " /*****************************************************************/\n /*************** DISCOUNTS *******************************/\n /*****************************************************************/\n public function manage_discounts() {\n expHistory::set('manageable', $this->params);", "\t\t", " $page = new expPaginator(array(\n 'model'=>'discounts',\n\t\t\t'sql'=>'SELECT * FROM '.DB_TABLE_PREFIX.'_discounts',\n\t\t\t'limit'=> 10,\n\t\t\t'order'=>isset($this->params['order']) ? $this->params['order'] : null,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n\t\t\t'columns'=>array(gt('Enabled')=>'enabled',gt('Name')=>'title',gt('Type')=>'action_type',gt('Coupon Code')=>'coupon_code',gt('Valid Until')=>'enddate'),\n ));", " assign_to_template(array(\n /*'apply_rules'=>$discountObj->apply_rules, 'discount_types'=>$discountObj->discount_types,*/\n 'page'=>$page\n ));\n }", " ", " public function edit_discount() {\n $id = empty($this->params['id']) ? null : $this->params['id'];\n $discount = new discounts($id);", " ", " //grab all user groups\n $group = new group();", " ", " //create two 'default' groups:", " $groups = array( ", " -1 => 'ALL LOGGED IN USERS',\n -2 => 'ALL NON-LOGGED IN USERS'\n );\n //loop our groups and append them to the array\n // foreach ($group->find() as $g){\n //this is a workaround for older code. Use the previous line if possible:\n $allGroups = group::getAllGroups();\n if (count($allGroups))\n {\n foreach ($allGroups as $g)\n {\n $groups[$g->id] = $g->name;\n };\n }\n //find our selected groups for this discount already", " // eDebug($discount); ", " $selected_groups = array();\n if (!empty($discount->group_ids))\n {\n $selected_groups = expUnserialize($discount->group_ids);\n }", " ", " if ($discount->minimum_order_amount == \"\") $discount->minimum_order_amount = 0;\n if ($discount->discount_amount == \"\") $discount->discount_amount = 0;\n if ($discount->discount_percent == \"\") $discount->discount_percent = 0;", " ", " // get the shipping options and their methods\n $shipping_services = array();\n $shipping_methods = array();\n// $shipping = new shipping();\n foreach (shipping::listAvailableCalculators() as $calcid=>$name) {\n if (class_exists($name)) {\n $calc = new $name($calcid);\n $shipping_services[$calcid] = $calc->title;\n $shipping_methods[$calcid] = $calc->availableMethods();\n }\n }", " ", " assign_to_template(array(\n 'discount'=>$discount,\n 'groups'=>$groups,\n 'selected_groups'=>$selected_groups,\n 'shipping_services'=>$shipping_services,\n 'shipping_methods'=>$shipping_methods\n ));\n }", " ", " public function update_discount() {\n $id = empty($this->params['id']) ? null : $this->params['id'];\n $discount = new discounts($id);\n // find required shipping method if needed\n if ($this->params['required_shipping_calculator_id'] > 0) {\n $this->params['required_shipping_method'] = $this->params['required_shipping_methods'][$this->params['required_shipping_calculator_id']];\n } else {\n $this->params['required_shipping_calculator_id'] = 0;\n }", " ", " $discount->update($this->params);\n expHistory::back();\n }", " \n public function activate_discount(){ ", " if (isset($this->params['id'])) {\n $discount = new discounts($this->params['id']);\n $discount->update($this->params);\n //if ($discount->discountulator->hasConfig() && empty($discount->config)) {\n //flash('messages', $discount->discountulator->name().' requires configuration. Please do so now.');\n //redirect_to(array('controller'=>'billing', 'action'=>'configure', 'id'=>$discount->id));\n //}\n }", " \n expHistory::back();\n }\n ", " /*****************************************************************/\n /*************** PROMO CODE *******************************/\n /*****************************************************************/\n\tpublic function manage_promocodes() {\n\t\texpHistory::set('manageable', $this->params);\n $pc = new promocodes();\n $do = new discounts();\n $promo_codes = $pc->find('all');\n $discounts = $do->find('all');\n\t\tassign_to_template(array(\n 'promo_codes'=>$promo_codes,\n 'discounts'=>$discounts\n ));\n\t}", "\tpublic function update_promocode() {\n//\t global $db;\n\t //$id = empty($this->params['id']) ? null : $this->params['id'];\n\t $code = new promocodes();\n\t $code->update($this->params);\n\t expHistory::back();\n\t}", "\t", " /*****************************************************************/\n /*************** GROUP DISCOUNTS *******************************/\n /*****************************************************************/\n\tpublic function manage_groupdiscounts() {\n\t\tglobal $db;", "\t\texpHistory::set('manageable', $this->params);\n\t\t$groups = group::getAllGroups();\n\t\t$discounts = $db->selectObjects('discounts');\n//\t\t$group_discounts = $db->selectObjects('groupdiscounts', null, 'rank');\n $gd = new groupdiscounts();\n $group_discounts = $gd->find('all', null, 'rank');\n if (!empty($group_discounts)) foreach ($group_discounts as $key=>$group_discount) {\n $group_discounts[$key]->title = $group_discount->group->name . ' (' . $group_discount->discounts->title . ')';\n }\n\t\tassign_to_template(array(\n 'groups'=>$groups,\n 'discounts'=>$discounts,\n 'group_discounts'=>$group_discounts\n ));\n\t}", "\tpublic function update_groupdiscounts() {\n\t global $db;", "\t ", "\t if (empty($this->params['id'])) {\n\t // look for existing discounts for the same group\n\t $existing_id = $db->selectValue('groupdiscounts', 'id', 'group_id='.$this->params['group_id']);\n\t if (!empty($existing_id)) flashAndFlow('error',gt('There is already a discount for that group.'));\n\t }", " $gd = new groupdiscounts();\n\t $gd->update($this->params);\n\t expHistory::back();\n\t}", "\t", "\tfunction rerank_groupdiscount() {\n $gd = new groupdiscounts($this->params['id']);\n $gd->rerank($this->params['push']);\n expHistory::back();\n }", " ", " /*****************************************************************/\n /*************** GENERAL STORE CONFIG *******************************/\n /*****************************************************************/\n function configure() {\n expHistory::set('editable', $this->params);\n // little bit of trickery so that that categories can have their own configs", " ", " $this->loc->src = \"@globalstoresettings\";\n $config = new expConfig($this->loc);\n $this->config = $config->config;\n $pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc);\n $views = expTemplate::get_config_templates($this, $this->loc);", " \n $gc = new geoCountry(); ", " $countries = $gc->find('all');", " \n $gr = new geoRegion(); ", " $regions = $gr->find('all');", " ", " assign_to_template(array(\n 'config'=>$this->config,\n 'pullable_modules'=>$pullable_modules,\n 'views'=>$views,\n 'countries'=>$countries,\n 'regions'=>$regions,\n 'title'=>static::displayname()\n ));", " } ", "\n function saveconfig() {\n $this->params['min_order'] = substr($this->params['min_order'], 1) ;\n \t\t$this->params['minimum_gift_card_purchase'] = substr($this->params['minimum_gift_card_purchase'], 1) ;\n \t\t$this->params['custom_message_product'] = substr($this->params['custom_message_product'], 1) ;\n if (isset($this->params['store']['address_country_id'])) {\n $this->params['store']['country'] = $this->params['store']['address_country_id'];\n unset($this->params['store']['address_country_id']);\n }\n if (isset($this->params['store']['address_region_id'])) {\n $this->params['store']['state'] = $this->params['store']['address_region_id'];\n unset($this->params['store']['address_region_id']);\n }\n \t\tparent::saveconfig();\n \t}", "\t/*****************************************************************/\n /*************** Upcharge Rate *******************************/\n /*****************************************************************/", "\t", "\t function manage_upcharge() {\n\t\t$this->loc->src = \"@globalstoresettings\";\n $config = new expConfig($this->loc);\n\t\t$this->config = $config->config;\n", "\t\t$gc = new geoCountry(); ", " $countries = $gc->find('all');", " \n $gr = new geoRegion(); ", " $regions = $gr->find('all',null,'rank asc,name asc');\n assign_to_template(array(\n 'countries'=>$countries,\n 'regions'=>$regions,\n 'upcharge'=>!empty($this->config['upcharge'])?$this->config['upcharge']:''\n ));\n\t }", "\t ", "\t function update_upcharge() {\n $this->loc->src = \"@globalstoresettings\";\n $config = new expConfig($this->loc);\n\t\t$this->config = $config->config;", "\t\t", "\t\t//This will make sure that only the country or region that given a rate value will be saved in the db\n\t\t$upcharge = array();\n\t\tforeach($this->params['upcharge'] as $key => $item) {\n\t\t\tif(!empty($item)) {\n\t\t\t\t$upcharge[$key] = $item;\n\t\t\t}\n\t\t}\n\t\t$this->config['upcharge'] = $upcharge;", "\t\t", " $config->update(array('config'=>$this->config));\n flash('message', gt('Configuration updated'));\n expHistory::back();\n }", "\t", "}", "?>" ]
[ 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */\n/** @define \"BASE\" \"../../../..\" */", "class ecomconfigController extends expController {\n protected $add_permissions = array(\n 'show'=>'View Admin Options'\n );", " protected $manage_permissions = array(\n 'options'=>'Display Options'\n );\n", " static function displayname() { return gt(\"e-Commerce Configuration Manager\"); }\n static function description() { return gt(\"Use this module to configure your e-Commerce store\"); }\n static function hasSources() { return false; }", " function show() {\n expHistory::set('manageable', $this->params);\n }", "", " /*****************************************************************/\n /*************** PRODUCT OPTIONS *******************************/\n /*****************************************************************/\n function edit_optiongroup_master() {\n expHistory::set('editable', $this->params);", "", " $id = isset($this->params['id']) ? $this->params['id'] : null;", " $record = new optiongroup_master($id);", " assign_to_template(array(\n 'record'=>$record\n ));\n }", "", " function update_optiongroup_master() {\n global $db;", " $id = empty($this->params['id']) ? null : $this->params['id'];\n $og = new optiongroup_master($id);\n $oldtitle = $og->title;\n $og->update($this->params);", "", " // if the title of the master changed we should update the option groups that are already using it.\n if ($oldtitle != $og->title) {\n $db->sql('UPDATE '.$db->prefix.'optiongroup SET title=\"'.$og->title.'\" WHERE title=\"'.$oldtitle.'\"');\n }", "\n expHistory::back();\n }\n", " function delete_optiongroup_master() {\n global $db;", "", " $mastergroup = new optiongroup_master($this->params);", "", " // delete all the options for this optiongroup master\n foreach ($mastergroup->option_master as $masteroption) {\n $db->delete('option', 'option_master_id='.$masteroption->id);\n $masteroption->delete();\n }", "", " // delete the mastergroup\n $db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id);\n $mastergroup->delete();", "\n expHistory::back();\n }\n", " function delete_option_master() {\n global $db;", " $masteroption = new option_master($this->params['id']);", "", " // delete any implementations of this option master\n $db->delete('option', 'option_master_id='.$masteroption->id);\n $masteroption->delete('optiongroup_master_id=' . $masteroption->optiongroup_master_id);\n //eDebug($masteroption);\n expHistory::back();\n }", "", " function edit_option_master() {\n expHistory::set('editable', $this->params);", "", " $params = isset($this->params['id']) ? $this->params['id'] : $this->params;", " $record = new option_master($params);", " assign_to_template(array(\n 'record'=>$record\n ));\n }", "\n function update_option_master() {", " global $db;", " $id = empty($this->params['id']) ? null : $this->params['id'];\n $opt = new option_master($id);\n $oldtitle = $opt->title;", "", " $opt->update($this->params);", "", " // if the title of the master changed we should update the option groups that are already using it.\n if ($oldtitle != $opt->title) {", "", " }$db->sql('UPDATE '.$db->prefix.'option SET title=\"'.$opt->title.'\" WHERE option_master_id='.$opt->id);", "\n expHistory::back();\n }\n", " public function options() {\n expHistory::set('viewable', $this->params);\n $optiongroup = new optiongroup_master();\n $optiongroups = $optiongroup->find('all');\n assign_to_template(array(\n 'optiongroups'=>$optiongroups\n ));\n }", "", " function rerank_optionmaster() {\n $om = new option_master($this->params['id']);\n $om->rerank($this->params['push'], 'optiongroup_master_id=' . $this->params['master_id']);\n expHistory::back();\n }", "", " /*****************************************************************/\n /*************** DISCOUNTS *******************************/\n /*****************************************************************/\n public function manage_discounts() {\n expHistory::set('manageable', $this->params);", "", " $page = new expPaginator(array(\n 'model'=>'discounts',\n\t\t\t'sql'=>'SELECT * FROM '.DB_TABLE_PREFIX.'_discounts',\n\t\t\t'limit'=> 10,\n\t\t\t'order'=>isset($this->params['order']) ? $this->params['order'] : null,\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n\t\t\t'columns'=>array(gt('Enabled')=>'enabled',gt('Name')=>'title',gt('Type')=>'action_type',gt('Coupon Code')=>'coupon_code',gt('Valid Until')=>'enddate'),\n ));", " assign_to_template(array(\n /*'apply_rules'=>$discountObj->apply_rules, 'discount_types'=>$discountObj->discount_types,*/\n 'page'=>$page\n ));\n }", "", " public function edit_discount() {\n $id = empty($this->params['id']) ? null : $this->params['id'];\n $discount = new discounts($id);", "", " //grab all user groups\n $group = new group();", "", " //create two 'default' groups:", " $groups = array(", " -1 => 'ALL LOGGED IN USERS',\n -2 => 'ALL NON-LOGGED IN USERS'\n );\n //loop our groups and append them to the array\n // foreach ($group->find() as $g){\n //this is a workaround for older code. Use the previous line if possible:\n $allGroups = group::getAllGroups();\n if (count($allGroups))\n {\n foreach ($allGroups as $g)\n {\n $groups[$g->id] = $g->name;\n };\n }\n //find our selected groups for this discount already", " // eDebug($discount);", " $selected_groups = array();\n if (!empty($discount->group_ids))\n {\n $selected_groups = expUnserialize($discount->group_ids);\n }", "", " if ($discount->minimum_order_amount == \"\") $discount->minimum_order_amount = 0;\n if ($discount->discount_amount == \"\") $discount->discount_amount = 0;\n if ($discount->discount_percent == \"\") $discount->discount_percent = 0;", "", " // get the shipping options and their methods\n $shipping_services = array();\n $shipping_methods = array();\n// $shipping = new shipping();\n foreach (shipping::listAvailableCalculators() as $calcid=>$name) {\n if (class_exists($name)) {\n $calc = new $name($calcid);\n $shipping_services[$calcid] = $calc->title;\n $shipping_methods[$calcid] = $calc->availableMethods();\n }\n }", "", " assign_to_template(array(\n 'discount'=>$discount,\n 'groups'=>$groups,\n 'selected_groups'=>$selected_groups,\n 'shipping_services'=>$shipping_services,\n 'shipping_methods'=>$shipping_methods\n ));\n }", "", " public function update_discount() {\n $id = empty($this->params['id']) ? null : $this->params['id'];\n $discount = new discounts($id);\n // find required shipping method if needed\n if ($this->params['required_shipping_calculator_id'] > 0) {\n $this->params['required_shipping_method'] = $this->params['required_shipping_methods'][$this->params['required_shipping_calculator_id']];\n } else {\n $this->params['required_shipping_calculator_id'] = 0;\n }", "", " $discount->update($this->params);\n expHistory::back();\n }", "\n public function activate_discount(){", " if (isset($this->params['id'])) {\n $discount = new discounts($this->params['id']);\n $discount->update($this->params);\n //if ($discount->discountulator->hasConfig() && empty($discount->config)) {\n //flash('messages', $discount->discountulator->name().' requires configuration. Please do so now.');\n //redirect_to(array('controller'=>'billing', 'action'=>'configure', 'id'=>$discount->id));\n //}\n }", "\n expHistory::back();\n }\n", " /*****************************************************************/\n /*************** PROMO CODE *******************************/\n /*****************************************************************/\n\tpublic function manage_promocodes() {\n\t\texpHistory::set('manageable', $this->params);\n $pc = new promocodes();\n $do = new discounts();\n $promo_codes = $pc->find('all');\n $discounts = $do->find('all');\n\t\tassign_to_template(array(\n 'promo_codes'=>$promo_codes,\n 'discounts'=>$discounts\n ));\n\t}", "\tpublic function update_promocode() {\n//\t global $db;\n\t //$id = empty($this->params['id']) ? null : $this->params['id'];\n\t $code = new promocodes();\n\t $code->update($this->params);\n\t expHistory::back();\n\t}", "", " /*****************************************************************/\n /*************** GROUP DISCOUNTS *******************************/\n /*****************************************************************/\n\tpublic function manage_groupdiscounts() {\n\t\tglobal $db;", "\t\texpHistory::set('manageable', $this->params);\n\t\t$groups = group::getAllGroups();\n\t\t$discounts = $db->selectObjects('discounts');\n//\t\t$group_discounts = $db->selectObjects('groupdiscounts', null, 'rank');\n $gd = new groupdiscounts();\n $group_discounts = $gd->find('all', null, 'rank');\n if (!empty($group_discounts)) foreach ($group_discounts as $key=>$group_discount) {\n $group_discounts[$key]->title = $group_discount->group->name . ' (' . $group_discount->discounts->title . ')';\n }\n\t\tassign_to_template(array(\n 'groups'=>$groups,\n 'discounts'=>$discounts,\n 'group_discounts'=>$group_discounts\n ));\n\t}", "\tpublic function update_groupdiscounts() {\n\t global $db;", "", "\t if (empty($this->params['id'])) {\n\t // look for existing discounts for the same group\n\t $existing_id = $db->selectValue('groupdiscounts', 'id', 'group_id='.$this->params['group_id']);\n\t if (!empty($existing_id)) flashAndFlow('error',gt('There is already a discount for that group.'));\n\t }", " $gd = new groupdiscounts();\n\t $gd->update($this->params);\n\t expHistory::back();\n\t}", "", "\tfunction rerank_groupdiscount() {\n $gd = new groupdiscounts($this->params['id']);\n $gd->rerank($this->params['push']);\n expHistory::back();\n }", "", " /*****************************************************************/\n /*************** GENERAL STORE CONFIG *******************************/\n /*****************************************************************/\n function configure() {\n expHistory::set('editable', $this->params);\n // little bit of trickery so that that categories can have their own configs", "", " $this->loc->src = \"@globalstoresettings\";\n $config = new expConfig($this->loc);\n $this->config = $config->config;\n $pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc);\n $views = expTemplate::get_config_templates($this, $this->loc);", "\n $gc = new geoCountry();", " $countries = $gc->find('all');", "\n $gr = new geoRegion();", " $regions = $gr->find('all');", "", " assign_to_template(array(\n 'config'=>$this->config,\n 'pullable_modules'=>$pullable_modules,\n 'views'=>$views,\n 'countries'=>$countries,\n 'regions'=>$regions,\n 'title'=>static::displayname()\n ));", " }", "\n function saveconfig() {\n $this->params['min_order'] = substr($this->params['min_order'], 1) ;\n \t\t$this->params['minimum_gift_card_purchase'] = substr($this->params['minimum_gift_card_purchase'], 1) ;\n \t\t$this->params['custom_message_product'] = substr($this->params['custom_message_product'], 1) ;\n if (isset($this->params['store']['address_country_id'])) {\n $this->params['store']['country'] = $this->params['store']['address_country_id'];\n unset($this->params['store']['address_country_id']);\n }\n if (isset($this->params['store']['address_region_id'])) {\n $this->params['store']['state'] = $this->params['store']['address_region_id'];\n unset($this->params['store']['address_region_id']);\n }\n \t\tparent::saveconfig();\n \t}", "\t/*****************************************************************/\n /*************** Upcharge Rate *******************************/\n /*****************************************************************/", "", "\t function manage_upcharge() {\n\t\t$this->loc->src = \"@globalstoresettings\";\n $config = new expConfig($this->loc);\n\t\t$this->config = $config->config;\n", "\t\t$gc = new geoCountry();", " $countries = $gc->find('all');", "\n $gr = new geoRegion();", " $regions = $gr->find('all',null,'rank asc,name asc');\n assign_to_template(array(\n 'countries'=>$countries,\n 'regions'=>$regions,\n 'upcharge'=>!empty($this->config['upcharge'])?$this->config['upcharge']:''\n ));\n\t }", "", "\t function update_upcharge() {\n $this->loc->src = \"@globalstoresettings\";\n $config = new expConfig($this->loc);\n\t\t$this->config = $config->config;", "", "\t\t//This will make sure that only the country or region that given a rate value will be saved in the db\n\t\t$upcharge = array();\n\t\tforeach($this->params['upcharge'] as $key => $item) {\n\t\t\tif(!empty($item)) {\n\t\t\t\t$upcharge[$key] = $item;\n\t\t\t}\n\t\t}\n\t\t$this->config['upcharge'] = $upcharge;", "", " $config->update(array('config'=>$this->config));\n flash('message', gt('Configuration updated'));\n expHistory::back();\n }", "", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */\nfunction compare($x, $y) {\n if ($x->eventdate == $y->eventdate)\n return 0;\n else if ($x->eventdate < $y->eventdate)\n return -1;\n else\n return 1;\n}", "class eventregistrationController extends expController {\n public $basemodel_name = 'eventregistration';", "", " public $useractions = array(\n 'showall' => 'Show all events',\n 'eventsCalendar' => 'Calendar View',\n 'upcomingEvents' => 'Upcoming Events',\n// 'showByTitle' => \"Show events by title\",\n );", "", " // hide the configs we don't need\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)", "\n protected $add_permissions = array(\n 'view_registrants'=> 'View Registrants',\n 'emailRegistrants'=> 'Email Registrants',\n );", "\n static function displayname() {\n return gt(\"e-Commerce Online Event Registration\");\n }", " static function description() {\n return gt(\"Manage event registrations on your website\");\n }", " function showall() {\n global $user;", " expHistory::set('viewable', $this->params);\n $limit = (!empty($this->config['limit'])) ? $this->config['limit'] : 10;", " $pass_events = array();\n if (!empty($this->params['past']) && $user->isAdmin()) {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\"', \"title ASC\", $limit);\n foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($event->eventdate <= time() && $event->eventenddate <= time()) {\n $pass_events[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }\n } else {\n if ($user->isAdmin()) {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\"', \"title ASC\", $limit);\n } else {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\" && active_type=0', \"title ASC\", $limit);\n }\n foreach ($events as $event) {\n if ($user->isAdmin()) {\n $endtime = $event->eventenddate;\n } else {\n $endtime = $event->signup_cutoff;\n }\n // $this->signup_cutoff > time()\n if ($event->eventdate > time() && $endtime > time()) {\n $pass_events[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }\n }\n // echo \"<pre>\";\n // print_r($pass_events);\n // exit();\n // uasort($pass_events,'compare');\n //eDebug($this->config['limit'], true);\n $page = new expPaginator(array(\n 'records'=>$pass_events,\n 'limit'=>$limit,\n 'order'=>\"eventdate ASC\",\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'view'=>empty($this->params['view']) ? null : $this->params['view'],\n 'columns'=>array(\n gt('Event')=>'title',\n gt('Date')=>'eventdate',\n gt('Seats')=>'quantity'\n ),\n ));\n assign_to_template(array(\n 'page'=> $page,\n 'admin'=> $user->isAdmin(),\n 'past'=> !empty($this->params['past'])\n ));\n }", " function eventsCalendar() {\n global $user;", " expHistory::set('viewable', $this->params);", " $time = isset($this->params['time']) ? $this->params['time'] : time();\n assign_to_template(array(\n 'time' => $time\n ));", "// $monthly = array();\n// $counts = array();", " $info = getdate($time);\n $nowinfo = getdate(time());\n if ($info['mon'] != $nowinfo['mon']) $nowinfo['mday'] = -10;\n // Grab non-day numbers only (before end of month)\n// $week = 0;\n $currentweek = -1;", " $timefirst = mktime(0, 0, 0, $info['mon'], 1, $info['year']);\n $week = intval(date('W', $timefirst));\n if ($week >= 52 && $info['mon'] == 1) $week = 1;\n $infofirst = getdate($timefirst);", "// if ($infofirst['wday'] == 0) {\n// $monthly[$week] = array(); // initialize for non days\n// $counts[$week] = array();\n// }\n// for ($i = 1 - $infofirst['wday']; $i < 1; $i++) {\n// $monthly[$week][$i] = array();\n// $counts[$week][$i] = -1;\n// }\n// $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n $monthly[$week] = array(); // initialize for non days\n $counts[$week] = array();\n if (($infofirst['wday'] == 0) && (DISPLAY_START_OF_WEEK == 1)) {\n for ($i = -6; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday'] + 7; // day number in grid. if 7+, switch weeks\n } else {\n for ($i = 1 - $infofirst['wday']; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n }\n // Grab day counts\n $endofmonth = date('t', $time);", " for ($i = 1; $i <= $endofmonth; $i++) {\n $start = mktime(0, 0, 0, $info['mon'], $i, $info['year']);\n if ($i == $nowinfo['mday']) $currentweek = $week;", "// $dates = $db->selectObjects(\"eventregistration\", \"`eventdate` = $start\");\n// $dates = $db->selectObjects(\"eventregistration\", \"(eventdate >= \" . expDateTime::startOfDayTimestamp($start) . \" AND eventdate <= \" . expDateTime::endOfDayTimestamp($start) . \")\");\n $er = new eventregistration();\n// $dates = $er->find('all', \"(eventdate >= \" . expDateTime::startOfDayTimestamp($start) . \" AND eventdate <= \" . expDateTime::endOfDayTimestamp($start) . \")\");", " if ($user->isAdmin()) {\n $events = $er->find('all', 'product_type=\"eventregistration\"', \"title ASC\");\n } else {\n $events = $er->find('all', 'product_type=\"eventregistration\" && active_type=0', \"title ASC\");\n }\n $dates = array();", " foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($event->eventdate >= expDateTime::startOfDayTimestamp($start) && $event->eventdate <= expDateTime::endOfDayTimestamp($start)) {\n $dates[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }", " $monthly[$week][$i] = $this->getEventsForDates($dates);\n $counts[$week][$i] = count($monthly[$week][$i]);\n if ($weekday >= (6 + DISPLAY_START_OF_WEEK)) {\n $week++;\n $monthly[$week] = array(); // allocate an array for the next week\n $counts[$week] = array();\n $weekday = DISPLAY_START_OF_WEEK;\n } else $weekday++;\n }\n // Grab non-day numbers only (after end of month)\n for ($i = 1; $weekday && $i < (8 + DISPLAY_START_OF_WEEK - $weekday); $i++) {\n $monthly[$week][$i + $endofmonth] = array();\n $counts[$week][$i + $endofmonth] = -1;\n }", " $this->params['time'] = $time;\n assign_to_template(array(\n 'currentweek' => $currentweek,\n 'monthly' => $monthly,\n 'counts' => $counts,\n \"prevmonth3\" => strtotime('-3 months', $timefirst),\n \"prevmonth2\" => strtotime('-2 months', $timefirst),\n \"prevmonth\" => strtotime('-1 months', $timefirst),\n \"nextmonth\" => strtotime('+1 months', $timefirst),\n \"nextmonth2\" => strtotime('+2 months', $timefirst),\n \"nextmonth3\" => strtotime('+3 months', $timefirst),\n 'now' => $timefirst,\n \"today\" => expDateTime::startOfDayTimestamp(time()),\n 'params' => $this->params,\n 'daynames' => event::dayNames(),\n ));\n }", " function upcomingEvents() {\n $sql = 'SELECT DISTINCT p.*, er.eventdate, er.event_starttime, er.signup_cutoff FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql .= 'JOIN ' . DB_TABLE_PREFIX . '_eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE er.signup_cutoff > ' . time() . ' AND er.eventdate > ' . time();", " $limit = empty($this->config['limit']) ? 10 : $this->config['limit'];\n $order = 'eventdate';\n $dir = 'ASC';", " $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));\n assign_to_template(array(\n 'page' => $page\n ));\n }", " function show() {\n global $order, $user;", " expHistory::set('viewable', $this->params);\n if (!empty($this->params['token'])) {\n $record = expSession::get(\"last_POST_Paypal\");\n } else {\n $record = expSession::get(\"last_POST\");\n }\n $id = isset($this->params['title']) ? addslashes($this->params['title']) : $this->params['id'];\n $product = new eventregistration($id);", " //FIXME we only have 0=active & 2=inactive ???\n if ($product->active_type == 1) {\n $product->user_message = \"This event is temporarily unavailable for registration.\";\n } elseif ($product->active_type == 2) {\n if ($user->isAdmin()) {\n $product->user_message = $product->title . \" is currently marked as unavailable for open registration or display. Normal users will not see this event.\";\n } else {\n flash(\"error\", $product->title . \" \" . gt(\"registration is currently unavailable for registration.\"));\n expHistory::back();\n }\n }", " $order_registrations = array();\n $count = 1;\n if (!empty($this->params['orderitem_id'])) { // editing an event already in the cart?\n $f = new forms($product->forms_id);\n $loc_data = new stdClass();\n $loc_data->order_id = $order->id;\n $loc_data->orderitem_id = $this->params['orderitem_id'];\n $loc_data->event_id = $product->id;\n $locdata = serialize($loc_data);\n// $order_registrations = $db->selectObjects('forms_' . $f->table_name, \"location_data='\" . $locdata . \"'\");\n $order_registrations = $f->getRecords(\"location_data='\" . $locdata . \"'\");", "// $registrants = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$order->id}' AND orderitem_id =\" . $this->params['orderitem_id'] . \" AND event_id =\" . $product->id);\n// if (!empty($registrants)) foreach ($registrants as $registrant) {\n// $order_registrations[] = expUnserialize($registrant->value);\n// }\n $item = $order->isItemInCart($product->id, $product->product_type, $this->params['orderitem_id']);\n if (!empty($item)) {\n $params['options'] = $item->opts;\n assign_to_template(array(\n 'params'=> $params,\n 'orderitem_id'=>$item->id\n ));\n $count = $item->quantity;\n }\n }", " //eDebug($product, true);\n assign_to_template(array(\n 'product'=> $product,\n// 'record'=> $record,\n 'registered' => $order_registrations,\n 'count' => $count,\n ));\n }", " function showByTitle() {\n global $order, $template, $user;\n expHistory::set('viewable', $this->params);\n if (!empty($this->params['token'])) {\n $record = expSession::get(\"last_POST_Paypal\");\n } else {\n $record = expSession::get(\"last_POST\");\n }\n $product = new eventregistration(addslashes($this->params['title']));", " //TODO should we pull in an existing reservation already in the cart to edit? e.g., the registrants\n //FIXME we only have 0=active & 2=inactive ???\n if ($product->active_type == 1) {\n $product->user_message = \"This event is temporarily unavailable for registration.\";\n } elseif ($product->active_type == 2) {\n if ($user->isAdmin()) {\n $product->user_message = $product->title . \" is currently marked as unavailable for open registration or display. Normal users will not see this event.\";\n } else {\n flash(\"error\", $product->title . \" \" . gt(\"registration is currently unavailable.\"));\n expHistory::back();\n }\n }", " //eDebug($product, true);\n assign_to_template(array(\n 'product'=> $product,\n 'record'=> $record\n ));\n }", " function manage() {\n global $user;", " expHistory::set('viewable', $this->params);\n $limit = (!empty($this->config['limit'])) ? $this->config['limit'] : 10;", " $pass_events = array();\n if (!empty($this->params['past']) && $user->isAdmin()) {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\"', \"title ASC\", $limit);\n foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($event->eventdate <= time() && $event->eventenddate <= time()) {\n $pass_events[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }\n } else {\n if ($user->isAdmin()) {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\"', \"title ASC\", $limit);\n } else {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\" && active_type=0', \"title ASC\", $limit);\n }\n foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($user->isAdmin()) {\n $endtime = $event->eventenddate;\n } else {\n $endtime = $event->signup_cutoff;\n }\n if ($event->eventdate > time() && $endtime > time()) {\n $pass_events[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }\n }\n foreach ($pass_events as $key=>$pass_event) {\n $pass_events[$key]->number_of_registrants = $pass_event->countRegistrants();\n }\n // echo \"<pre>\";\n // print_r($pass_events);\n // exit();\n // uasort($pass_events,'compare');\n //eDebug($this->config['limit'], true);\n $page = new expPaginator(array(\n 'records'=>$pass_events,\n 'limit'=>$limit,\n 'order'=>\"eventdate ASC\",\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'view'=>empty($this->params['view']) ? null : $this->params['view'],\n 'columns'=>array(\n gt('Event')=>'title',\n gt('Date')=>'eventdate',\n gt('Seats')=>'quantity'\n ),\n ));\n assign_to_template(array(\n 'page'=> $page,\n 'admin'=> $user->isAdmin(),\n 'past'=> !empty($this->params['past'])\n ));\n }", " function metainfo() {\n global $router;\n if (empty($router->params['action'])) return false;", " // figure out what metadata to pass back based on the action we are in.\n $action = $router->params['action'];\n $metainfo = array('title' => '', 'keywords' => '', 'description' => '', 'canonical'=> '', 'noindex' => false, 'nofollow' => false);\n $storename = ecomconfig::getConfig('storename');\n switch ($action) {\n case 'showall':\n case 'eventsCalendar':\n case 'upcomingEvents':\n $metainfo['title'] = gt('Event Registration') . ' - ' . $storename;\n $metainfo['keywords'] = gt('event registration online');\n $metainfo['description'] = gt(\"Make an event registration\");\n break;\n case 'show':\n case 'showByTitle':\n if (isset($router->params['id']) || isset($router->params['title'])) {\n $lookup = isset($router->params['id']) ? $router->params['id'] : $router->params['title'];\n $object = new eventregistration($lookup);\n // set the meta info\n if (!empty($object)) {\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n if (!empty($object->expTag)) {\n $keyw = '';\n foreach ($object->expTag as $tag) {\n if (!empty($keyw)) $keyw .= ', ';\n $keyw .= $tag->title;\n }\n } else {\n $keyw = SITE_KEYWORDS;\n }\n $metainfo['title'] = empty($object->meta_title) ? $object->title . \" - \" . $storename : $object->meta_title;\n $metainfo['keywords'] = empty($object->meta_keywords) ? $keyw : $object->meta_keywords;\n $metainfo['description'] = empty($object->meta_description) ? $desc : $object->meta_description;\n// $metainfo['canonical'] = empty($object->canonical) ? URL_FULL.substr($router->sefPath, 1) : $object->canonical;\n $metainfo['canonical'] = empty($object->canonical) ? $router->plainPath() : $object->canonical;\n $metainfo['noindex'] = empty($object->meta_noindex) ? false : $object->meta_noindex;\n $metainfo['nofollow'] = empty($object->meta_nofollow) ? false : $object->meta_nofollow;\n }\n break;\n }\n default:\n $metainfo['title'] = self::displayname() . \" - \" . $storename;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n }", " return $metainfo;\n }", " function eventregistration_process() { // FIXME only used by the eventregistration_form view (no method)\n global $db, $user, $order;", " //Clear the cart first\n foreach ($order->orderitem as $orderItem) {\n $orderItem->delete();\n }\n $order->refresh();", " eDebug($order, true);", " expHistory::set('viewable', $this->params);\n expSession::set('last_POST_Paypal', $this->params);\n expSession::set('terms_and_conditions', $product->terms_and_condition); //FIXME $product doesn't exist\n expSession::set('paypal_link', makeLink(array('controller'=> 'eventregistration', 'action'=> 'show', 'title'=> $product->sef_url)));", " //Validation for customValidation\n foreach ($this->params['event'] as $key => $value) {\n $expField = $db->selectObject(\"expDefinableFields\", \"name = '{$key}'\");\n $expFieldData = expUnserialize($expField->data);\n if (!empty($expFieldData->customvalidation)) {", " $customValidation = \"is_valid_\" . $expFieldData->customvalidation;\n $fieldname = $expField->name;\n $obj = new stdClass();\n $obj->$fieldname = $value;\n if ($fieldname == \"email\") { //Change this to much more loose coding\n $ret = expValidator::$customValidation($fieldname, $this->params['event']['email'], $this->params['event']['email_confirm']);\n } else {\n $ret = expValidator::$customValidation($fieldname, $obj, $obj);\n }\n if (strlen($ret) > 1) {", " expValidator::failAndReturnToForm($ret, $this->params);\n }\n }", " if (@$expFieldData->minimum_size > 0 || @$expFieldData->maximum_size > 0) {\n $ret = expValidator::check_size_of($expFieldData->identifier, $value, $expFieldData->minimum_size, $expFieldData->maximum_size);", " if (strlen($ret) > 1) {\n expValidator::failAndReturnToForm($ret, $this->params);\n }\n }\n }", " $event = new eventregistration();\n //Validation for ticker types\n if (isset($this->params['ticket_types']) && empty($this->params['options'])) {\n expValidator::failAndReturnToForm(\"Invalid ticket types.\", $this->params);\n }", "// if (!empty($this->params['event'])) {\n $sess_id = session_id();\n// $sess_id = expSession::getTicketString();\n// $data = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$order->id}' AND event_id =\" . $this->params['eventregistration']['product_id']);\n $data = $event->getRecords(\"connector_id ='{$order->id}' AND event_id =\" . $this->params['eventregistration']['product_id']);\n //FIXME change this to forms table\n if (!empty($data)) {\n foreach ($data as $item) {\n if (!empty($this->params['event'][$item->control_name])) {\n $item->value = $this->params['event'][$item->control_name];\n// $db->updateObject($item, \"eventregistration_registrants\");\n $event->updateRecord($item);\n }\n }\n } else {\n if (!empty($this->params['event'])) foreach ($this->params['event'] as $key => $value) {\n $obj = new stdClass();\n $obj->event_id = $this->params['eventregistration']['product_id'];\n $obj->control_name = $key;\n $obj->value = $value;\n $obj->connector_id = $order->id;\n $obj->registered_date = time();\n// $db->insertObject($obj, \"eventregistration_registrants\");\n $event->insertRecord($obj);\n } else {\n $obj = new stdClass();\n $obj->event_id = $this->params['eventregistration']['product_id'];\n $obj->connector_id = $order->id;\n $obj->registered_date = time();\n// $db->insertObject($obj, \"eventregistration_registrants\");\n $event->insertRecord($obj);\n }\n }\n expSession::set('session_id', $sess_id);\n// }", " //Add to Cart\n $product_id = $this->params['eventregistration']['product_id'];\n $product_type = \"eventregistration\";\n $product = new $product_type($product_id, true, true);", " if ($this->params['options']) {\n $this->params['eventregistration']['options'] = $this->params['options'];\n $this->params['eventregistration']['options_quantity'] = $this->params['options_quantity'];\n $product->addToCart($this->params['eventregistration']);\n } else {\n $this->params['eventregistration']['qtyr'] = $this->params['theValue'] + 1;\n $product->addToCart($this->params['eventregistration']);\n }", " $order->calculateGrandTotal();\n $order->setOrderType($this->params);\n $order->setOrderStatus($this->params);", " $billing = new billing();\n $result = $billing->calculator->preprocess($billing->billingmethod, $opts, $this->params, $order); //FIXME $opts doesn't exist\n redirect_to(array('controller'=> 'cart', 'action'=> 'preprocess'));\n }", " function delete() {\n redirect_to(array('controller'=> 'eventregistration', 'action'=> 'showall'));\n }", " function view_registrants() {\n expHistory::set('viewable', $this->params);\n $event = new eventregistration($this->params['id']);\n //Get all the registrants in the event\n// $registrants = $event->getRegistrants();\n assign_to_template(array(\n 'event'=> $event,\n 'registrants'=> $event->getRegistrants(),\n 'count'=> $event->countRegistrants(),\n// 'header'=> $header,\n// 'body'=> $body,\n// 'email'=> $email\n ));", "// $order_ids_complete = $db->selectColumn(\"eventregistration_registrants\", \"connector_id\", \"connector_id <> '0' AND event_id = {$event->id}\", \"registered_date\", true);\n// $orders = new order();\n// foreach ($order_ids_complete as $item) {\n// $connector = expUnserialize($item);\n//// $odr = $db->selectObject(\"orders\", \"id = {$item} and invoice_id <> 0\");\n//// $odr = $db->selectObject(\"orders\", \"id ='{$item}' and invoice_id <> 0\");\n// $odr = $orders->find(\"first\", \"id ='{$connector->order_id}' and invoice_id <> 0\");\n// if (!empty($odr) || strpos($connector->order_id, \"admin-created\") !== false) {\n// $order_ids[] = $connector->order_id;\n// }\n// }\n//\n// $header = array();\n// $control_names = array();\n// $header[] = 'Date Registered';\n// //Check if it has ticket types\n// if ($event->hasOptions()) {\n// $header[] = \"Types\"; //Add some configuration here\n// }\n// //Get the input labels as table headers\n// if (!empty($event->expDefinableField['registrant'])) foreach ($event->expDefinableField['registrant'] as $field) {\n// $data = expUnserialize($field->data);\n// if (!empty($data->caption)) {\n// $header[] = $data->caption;\n// } else {\n// $header[] = $field->name;\n// }\n// $control_names[] = $field->name;\n// }\n//\n// //Check if there are guests using expDefinableFields\n// if (!empty($event->num_guest_allowed)) {\n// for ($i = 1; $i <= $event->num_guest_allowed; $i++) {\n// if (!empty($event->expDefinableField['guest'])) foreach ($event->expDefinableField['guest'] as $field) {\n// $data = expUnserialize($field->data);\n// if (!empty($data->caption)) {\n// $header[] = $data->caption . \"_$i\";\n// } else {\n// $header[] = $field->name . \"_$i\";\n// }\n// $control_names[] = $field->name . \"_$i\";\n// }\n// }\n// }\n//\n// // new method to check for guests/registrants in eventregistration_registrants\n//// if (!empty($event->num_guest_allowed)) {\n// $registrants = array();\n// if (!empty($event->quantity)) {\n// $registered = array();\n// if (!empty($order_ids)) foreach ($order_ids as $order_id) {\n// $newregistrants = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$order_id}'\");\n// $registered = array_merge($registered,$newregistrants);\n// }\n// foreach ($registered as $person) {\n// $registrants[$person->id] = expUnserialize($person->value);\n// }\n// }\n//\n// //Get the data and registrant emails\n// $email = array();\n// $num_of_guest_fields = 0;\n// $num_of_guest = 0;\n// $num_of_guest_total = 0;\n//\n// $body = array();\n// if (!empty($order_ids)) foreach ($order_ids as $order_id) {\n// $body[$order_id][] = date(\"M d, Y h:i a\", $db->selectValue(\"eventregistration_registrants\", \"registered_date\", \"event_id = {$event->id} AND connector_id = '{$order_id}'\"));\n// if ($event->hasOptions()) {\n// $or = new order($order_id);\n// $orderitem = new orderitem();\n// if (isset($or->orderitem[0])) {\n// $body[$order_id][] = $orderitem->getOption($or->orderitem[0]->options);\n// } else {\n// $body[$order_id][] = '';\n// }\n// }\n// foreach ($control_names as $control_name) {\n// $value = $db->selectValue(\"eventregistration_registrants\", \"value\", \"event_id = {$event->id} AND control_name ='{$control_name}' AND connector_id = '{$order_id}'\");\n// $body[$order_id][] = $value;\n// if (expValidator::isValidEmail($value) === true) {\n// $email[$value] = $value;\n// }\n// }\n//\n// if (!empty($order_id)) {\n// $num_of_guest_total += $db->countObjects(\"eventregistration_registrants\", \"event_id ={$event->id} AND control_name LIKE 'guest_%' AND connector_id = '{$order_id}'\");\n// }\n// } else $order_ids = array();\n//\n// // check numbers based on expDefinableFields\n// $num_of_guest_fields = $db->countObjects(\"content_expDefinableFields\", \"content_id ={$event->id} AND subtype='guest'\");\n// if ($num_of_guest_fields <> 0) {\n// $num_of_guest = $num_of_guest_total / $num_of_guest_fields;\n// } else {\n// $num_of_guest = 0;\n// }\n//\n// //Removed duplicate emails\n// $email = array_unique($email);\n//\n// $registered = count($order_ids) + $num_of_guest;\n// if (!empty($event->registrants)) {\n// $event->registrants = expUnserialize($event->registrants);\n// } else {\n// $event->registrants = array();\n// }\n//\n// $event->number_of_registrants = $registered;\n// assign_to_template(array(\n// 'event'=> $event,\n// 'registrants'=> $registrants,\n//// 'header'=> $header,\n//// 'body'=> $body,\n//// 'email'=> $email\n// ));\n }", " public function delete_registrant() {\n// global $db;", " $event = new eventregistration($this->params['event_id']);\n $f = new forms($event->forms_id);\n if (!empty($f->is_saved)) { // is there user input data\n// $db->delete('forms_' . $f->table_name, \"id='{$this->params['id']}'\");\n $f->deleteRecord($this->params['id']);\n } else {\n// $db->delete('eventregistration_registrants', \"id ='{$this->params['id']}'\");\n $event->deleteRecord($this->params['id']);\n }\n flash('message', gt(\"Registrant successfully deleted.\"));\n expHistory::back();\n }", " public function edit_registrant() {\n// global $db;", "// $event_id = $this->params['event_id'];\n// $connector_id = @$this->params['connector_id'];\n// if (empty($connector_id)) {\n// $connector_id = \"admin-created\" . mt_rand() . time(); //Meaning it is been added by admin\n// }\n// $reg_data = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$connector_id}'\");", " $registrant = array();\n $event = new eventregistration($this->params['event_id']);\n if (!empty($this->params['id'])) {\n// $reg_data = $db->selectObject(\"eventregistration_registrants\", \"id ='{$this->params['id']}'\");\n $f = new forms($event->forms_id);", " // foreach ($reg_data as $item) {\n // $registrant[$item->control_name] = $item->value;\n // }\n// $registrant = expUnserialize($reg_data->value);\n if (!empty($f->is_saved)) {\n// $registrant = $db->selectObject('forms_' . $f->table_name, \"id ='{$this->params['id']}'\");\n $registrant = $f->getRecord($this->params['id']);\n// $registrant['id'] = $reg_data->id;\n// $eventid = $reg_data->event_id;\n// } else {\n// $eventid = $this->params['event_id'];\n } else {\n// $registrant = $db->selectObject(\"eventregistration_registrants\", \"id ='{$this->params['id']}'\");\n $registrant = $event->getRecord($this->params['id']);\n }\n }", " // eDebug($registrant, true);\n assign_to_template(array(\n 'registrant'=> $registrant,\n 'event'=> $event,\n// 'connector_id' => $connector_id\n ));\n }", " public function update_registrant() {\n global $db, $user;", " $event = new eventregistration($this->params['event_id']);\n // create a new order/invoice if needed\n if (empty($this->params['id'])) {\n //create new order\n $orderc= expModules::getController('order');\n $orderc->params = array(\n 'customer_type' => 1, // blank user/address\n 'addresses_id' => 0,\n 'order_status_id' => order::getDefaultOrderStatus(),\n 'order_type_id' => order::getDefaultOrderType(),\n 'no_redirect' => true,\n );\n $orderc_id = $orderc->save_new_order();\n //create new order item\n $orderc->params = array(\n 'orderid' => $orderc_id,\n 'product_id' => $event->id,\n 'product_type' => 'eventregistration',\n// 'products_price' => $event->getBasePrice(),\n// 'products_name' => $event->title,\n 'quantity' => $this->params['value'],\n 'no_redirect' => true,\n );\n $orderi_id = $orderc->save_order_item(); // will redirect us to the new order view\n }\n $f = new forms($event->forms_id);\n $registrant = new stdClass();\n// if (!empty($this->params['id'])) $registrant = $db->selectObject('forms_' . $f->table_name, \"id ='{$this->params['id']}'\");\n if (!empty($this->params['id'])) $registrant = $f->getRecord($this->params['id']);\n if (!empty($f->is_saved)) {\n $fc = new forms_control();\n $controls = $fc->find('all', \"forms_id=\" . $f->id . \" AND is_readonly=0\",'rank');\n foreach ($controls as $c) {\n $ctl = expUnserialize($c->data);\n $control_type = get_class($ctl);\n $def = call_user_func(array($control_type, \"getFieldDefinition\"));\n if ($def != null) {\n $emailValue = htmlspecialchars_decode(call_user_func(array($control_type, 'parseData'), $c->name, $this->params['registrant'], true));\n $value = stripslashes(expString::escape($emailValue));\n $varname = $c->name;\n $registrant->$varname = $value;\n }\n }\n if (!empty($registrant->id)) {\n// $db->updateObject($registrant, 'forms_' . $f->table_name);\n $f->updateRecord($registrant);\n } else { // create new registrant record\n $loc_data = new stdClass();\n// $loc_data->order_id = 'admin-created';\n// $loc_data->orderitem_id = 'admin-created';\n $loc_data->order_id = $orderc_id;\n $loc_data->orderitem_id = $orderi_id;\n $loc_data->event_id = $this->params['event_id'];\n $locdata = serialize($loc_data);\n $registrant->ip = $_SERVER['REMOTE_ADDR'];\n $registrant->referrer = $this->params['event_id'];\n $registrant->timestamp = time();\n if (expSession::loggedIn()) {\n $registrant->user_id = $user->id;\n } else {\n $registrant->user_id = 0;\n }\n $registrant->location_data = $locdata;\n// $db->insertObject($registrant, 'forms_' . $f->table_name);\n $f->insertRecord($registrant);\n }\n } else {\n// $registrant = $db->selectObject(\"eventregistration_registrants\", \"id ='{$this->params['id']}'\");\n $registrant = $event->getRecord($this->params['id']);\n if (!is_object($registrant)) $registrant = new stdClass();\n $registrant->control_name = $this->params['control_name'];\n //FIXME if $registrant->value != $this->params['value'] update order/invoice w/ new quantity???\n $registrant->value = $this->params['value'];\n if (!empty($registrant->id)) {\n// $db->updateObject($registrant, \"eventregistration_registrants\");\n $event->updateRecord($registrant);\n } else { // create new registrant record\n $registrant->event_id = $this->params['event_id'];\n// $registrant->connector_id = 'admin-created';\n// $registrant->orderitem_id = 'admin-created';\n $registrant->registered_date = time();\n $registrant->connector_id = $orderc_id;\n $registrant->orderitem_id = $orderi_id;\n// $db->insertObject($registrant, \"eventregistration_registrants\");\n $event->insertRecord($registrant);\n }\n }\n redirect_to(array('controller'=> 'eventregistration', 'action'=> 'view_registrants', 'id'=> $this->params['event_id']));\n }", " public function export() {\n// global $db;", " $event = new eventregistration($this->params['id']);", " $registrants = $event->getRegistrants();\n $f = new forms($event->forms_id);\n// $registrants = array();\n// if (!empty($f->is_saved)) { // is there user input data\n// $registrants = $db->selectObjects('forms_' . $f->table_name, \"referrer = {$event->id}\", \"timestamp\");\n// } else {\n// $registrants = $db->selectObjects('eventregistration_registrants', \"connector_id\", \"connector_id <> '0' AND event_id = {$event->id}\", \"timestamp\");\n// }\n// foreach ($registrants as $key=>$registrant) {\n// $order_data = expUnserialize($registrant->location_data);\n// if (is_numeric($order_data->order_id)) {\n// $order = new order($order_data->order_id);\n// $billingstatus = expUnserialize($order->billingmethod[0]->billing_options);\n// $registrants[$key]->payment = !empty($billingstatus->payment_due) ? gt('payment due') : gt('paid');\n// } else {\n// $registrants[$key]->payment = '???';\n// }\n// }", "// $sql = \"SELECT connector_id FROM \" . $db->prefix . \"eventregistration_registrants GROUP BY connector_id\";\n// $order_ids_complete = $db->selectColumn(\"eventregistration_registrants\", \"connector_id\", \"connector_id <> '0' AND event_id = {$event->id}\", \"registered_date\", true);\n//\n// $orders = new order();\n// foreach ($order_ids_complete as $item) {\n//// $odr = $db->selectObject(\"orders\", \"id = {$item} and invoice_id <> 0\");\n// $odr = $orders->find(\"first\", \"id ='{$item}' and invoice_id <> 0\");\n// if (!empty($odr) || strpos($item, \"admin-created\") !== false) {\n// $order_ids[] = $item;\n// }\n// }\n//\n// $header = array();\n// $control_names = array();\n// $header[] = '\"Date Registered\"';\n// //Check if it has ticket types\n// if ($event->hasOptions()) {\n// $header[] = '\"Ticket Types\"'; //Add some configuration here\n// }\n//\n// if (!empty($event->expDefinableField['registrant'])) foreach ($event->expDefinableField['registrant'] as $field) {\n// $data = expUnserialize($field->data);\n// if (!empty($data->caption)) {\n// $header[] = '\"' . $data->caption . '\"';\n// } else {\n// $header[] = '\"' . $field->name . '\"';\n// }\n// $control_names[] = $field->name;\n// }", " //FIXME we don't have a 'guest' definable field type\n// if ($event->num_guest_allowed > 0) {\n// for ($i = 1; $i <= $event->num_guest_allowed; $i++) {\n// if (!empty($event->expDefinableField['guest'])) foreach ($event->expDefinableField['guest'] as $field) {\n// $data = expUnserialize($field->data);\n// if (!empty($data->caption)) {\n// $header[] = $data->caption . \"_$i\";\n// } else {\n// $header[] = $field->name . \"_$i\";\n// }\n// $control_names[] = $field->name . \"_$i\";\n// }\n//\n// }\n// }", " // new method to check for guests/registrants\n// if (!empty($event->num_guest_allowed)) {\n// if (!empty($event->quantity)) {\n// $registered = array();\n// if (!empty($order_ids)) foreach ($order_ids as $order_id) {\n// $newregistrants = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$order_id}'\");\n// $registered = array_merge($registered,$newregistrants);\n// }\n//// $registrants = array();\n// foreach ($registered as $key=>$person) {\n// $registered[$key]->person = expUnserialize($person->value);\n// }\n if (!empty($f->is_saved)) {\n $controls = $event->getAllControls();\n if ($f->column_names_list == '') {\n //define some default columns...\n foreach ($controls as $control) {\n $rpt_columns[$control->name] = $control->caption;\n }\n } else {\n $rpt_columns2 = explode(\"|!|\", $f->column_names_list);\n $fc = new forms_control();\n foreach ($rpt_columns2 as $column) {\n $control = $fc->find('first', \"forms_id=\" . $f->id . \" AND name = '\" . $column . \"' AND is_readonly = 0 AND is_static = 0\", \"rank\");\n if (!empty($control)) {\n $rpt_columns[$control->name] = $control->caption;\n } else {\n switch ($column) {\n case 'ip':\n $rpt_columns[$column] = gt('IP Address');\n break;\n case 'referrer':\n $rpt_columns[$column] = gt('Event ID');\n break;\n case 'user_id':\n $rpt_columns[$column] = gt('Posted by');\n break;\n case 'timestamp':\n $rpt_columns[$column] = gt('Registered');\n break;\n }\n }\n }\n }\n $rpt_columns['payment'] = gt('Paid?');\n $fc = new forms_control();\n foreach ($rpt_columns as $column_name=>$column_caption) {\n if ($column_name == \"ip\" || $column_name == \"referrer\" || $column_name == \"location_data\") {\n } elseif ($column_name == \"user_id\") {\n foreach ($registrants as $key => $item) {\n if ($item->$column_name != 0) {\n $locUser = user::getUserById($item->$column_name);\n $item->$column_name = $locUser->username;\n } else {\n $item->$column_name = '';\n }\n $registrants[$key] = $item;\n }\n } elseif ($column_name == \"timestamp\") {\n foreach ($registrants as $key => $item) {\n $item->$column_name = strftime(\"%m/%d/%y %T\", $item->$column_name); // needs to be in a machine readable format\n $registrants[$key] = $item;\n }\n } else {\n $control = $fc->find('first', \"name='\" . $column_name . \"' AND forms_id=\" . $this->params['id'],'rank');\n if ($control) {\n $ctl = expUnserialize($control->data);\n $control_type = get_class($ctl);\n foreach ($registrants as $key => $item) {\n $item->$column_name = call_user_func(array($control_type, 'templateFormat'), $item->$column_name, $ctl);\n $registrants[$key] = $item;\n }\n }\n }\n }\n } else {\n $rpt_columns = array(\n 'user' => gt('Name'),\n 'qty' => gt('Quantity'),\n 'registered_date' => gt('Registered'),\n 'payment' => gt('Paid?'),\n );\n foreach ($registrants as $key=>$registrant) {\n $registrants[$key]->registered_date = strftime(DISPLAY_DATETIME_FORMAT, $registrants[$key]->registered_date);\n }\n }\n// $header = array(); //FIXME reset & pulled from above\n// $header[] = gt('IP Address'); //FIXME\n// $header[] = gt('Event');\n// $header[] = gt('Date Registered');\n// $header[] = gt('User');\n// $header[] = gt('Location');\n// foreach ($controls as $control) {\n// $header[] = $control->caption;\n// }\n// }", " if (LANG_CHARSET == 'UTF-8') {\n $out = chr(0xEF).chr(0xBB).chr(0xBF); // add utf-8 signature to file to open appropriately in Excel, etc...\n } else {\n $out = \"\";\n }\n// $out .= implode(\",\", $header);\n// $out .= \"\\n\";\n// $body = '';\n// foreach ($order_ids as $order_id) {\n// $body .= '\"' . date(\"M d, Y h:i a\", $db->selectValue(\"eventregistration_registrants\", \"registered_date\", \"event_id = {$event->id} AND connector_id = '{$order_id}'\")) . '\",';\n//\n// if ($event->hasOptions()) {\n// $or = new order($order_id);\n// $orderitem = new orderitem();\n// if (isset($or->orderitem[0])) {\n// $body .= '\"' . str_replace(\"<br />\", \" \", $orderitem->getOption($or->orderitem[0]->options)) . '\",';\n// ;\n// } else {\n// $body .= '\"\",';\n// }\n// }\n//\n// foreach ($control_names as $control_name) {\n// $value = $db->selectValue(\"eventregistration_registrants\", \"value\", \"event_id = {$event->id} AND control_name ='{$control_name}' AND connector_id = '{$order_id}'\");\n// $body .= '\"' . iconv(\"UTF-8\", \"ISO-8859-1\", $value) . '\",';\n// }\n// $body = substr($body, 0, -1) . \"\\n\";\n// }\n// foreach ($registrants as $person) {\n// $body .= '\"' . date(\"M d, Y h:i a\", $person->registered_date) . '\",';\n// foreach ($person->person as $value) {\n//// $body .= '\"' . iconv(\"UTF-8\", \"ISO-8859-1\", $value) . '\",';\n// $body .= '\"' . $value . '\",';\n// }\n// $body = substr($body, 0, -1) . \"\\n\";\n// }\n// $out .= $body;\n $out .= formsController::sql2csv($registrants, $rpt_columns);", " $fn = str_replace(' ', '_', $event->title) . '_' . gt('Roster') . '.csv';", "\t\t// CREATE A TEMP FILE\n\t\t$tmpfname = tempnam(getcwd(), \"rep\"); // Rig", "\t\t$handle = fopen($tmpfname, \"w\");\n\t\tfwrite($handle,$out);\n\t\tfclose($handle);", "\t\tif(file_exists($tmpfname)) {\n // NO buffering from here on out or things break unexpectedly. - RAM\n ob_end_clean();", " // This code was lifted from phpMyAdmin, but this is Open Source, right?\n // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n // It seems that other headers I've added make IE prefer octet-stream again. - RAM\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octet-stream;' : 'text/comma-separated-values;';\n header('Content-Type: ' . $mime_type . ' charset=' . LANG_CHARSET. \"'\");\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n header('Content-length: '.filesize($tmpfname));\n header('Content-Transfer-Encoding: binary');\n header('Content-Encoding:');\n header('Content-Disposition: attachment; filename=\"' . $fn . '\";');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n header('Vary: User-Agent');\n } else {\n header('Pragma: no-cache');\n }\n //Read the file out directly\n readfile($tmpfname);", "// if (DEVELOPMENT == 0) exit();\n unlink($tmpfname);\n exit();\n }\n }", " public function get_guest_controls($ajax = '') { //FIXME this is never used\n $id = $this->params['id'];\n $ctr = $this->params['counter'];\n $event = new eventregistration($id);", " $str = \"\";\n foreach ($event->expDefinableField['guest'] as $field) {\n $str = $str . $event->showControl($field, $field->name . \"_\" . $ctr);\n }", " echo $str;\n exit();\n }", " function emailRegistrants() {", " if (empty($this->params['email_addresses'])) {\n flash('error', gt('Please add at least one email.'));\n expHistory::back();\n }", " if (empty($this->params['email_subject']) || empty($this->params['email_message'])) {\n flash('error', gt('Nothing to Send! Please enter subject and message.'));\n expHistory::back();\n }", "// $email_arr = explode(\"|!|\", $this->params['email_addresses']);\n $email_addy = array_flip(array_flip($this->params['email_addresses']));\n $email_addy = array_map('trim', $email_addy);\n $email_addy = array_filter($email_addy);", " $headers = array(\n \"MIME-Version\" => \"1.0\",\n \"Content-type\" => \"text/html; charset=\" . LANG_CHARSET\n );", " $mail = new expMail();", "// foreach ($this->params['expFile']['attachments'] as $attach) {\n// $expFile = new expFile($attach);\n// if (!empty($expFile->id)) {\n// $mail->attach_file_on_disk($expFile->path, $expFile->mimetype);\n// }\n// }\n if (!empty($_FILES['attach']['size'])) {\n $dir = 'tmp';\n $filename = expFile::fixName(time() . '_' . $_FILES['attach']['name']);\n $dest = $dir . '/' . $filename;\n //Check to see if the directory exists. If not, create the directory structure.\n if (!file_exists(BASE.$dir)) expFile::makeDirectory($dir);\n // Move the temporary uploaded file into the destination directory, and change the name.\n $file = expFile::moveUploadedFile($_FILES['attach']['tmp_name'], BASE . $dest);\n// $finfo = finfo_open(FILEINFO_MIME_TYPE);\n// $relpath = str_replace(PATH_RELATIVE, '', BASE);\n// $ftype = finfo_file($finfo, BASE.$dest);\n// finfo_close($finfo);\n if (!empty($file)) $mail->attach_file_on_disk(BASE . $file, expFile::getMimeType(BASE . $file));\n }", " $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n $mail->quickBatchSend(array(\n \t'headers'=>$headers,\n 'html_message'=> $this->params['email_message'],\n 'text_message'=> strip_tags(str_replace(\"<br>\", \"\\r\\n\", $this->params['email_message'])),\n 'to' => $email_addy,\n 'from' => $from,\n 'subject' => $this->params['email_subject']\n ));\n if (!empty($file)) unlink(BASE . $file); // delete temp file attachment\n flash('message', gt(\"You're email to event registrants has been sent.\"));\n expHistory::back();\n }", " /**\n * function to return event registrations as calendar events\n *\n * @param $startdate\n * @param $enddate\n * @param string $color\n *\n * @return array\n */\n static function getRegEventsForDates($startdate, $enddate, $color=\"#FFFFFF\") {\n $er = new eventregistration();\n $events = $er->find('all', 'product_type=\"eventregistration\" && active_type=0');\n $pass_events = array();\n foreach ($events as $event) {\n if ($event->eventdate >= $startdate && $event->eventdate <= $enddate) {\n $newevent = new stdClass();\n $newevent->eventdate = new stdClass();\n $newevent->eventdate->date = $event->eventdate;\n $newevent->eventstart = $event->event_starttime + $event->eventdate;\n $newevent->eventend = $event->event_endtime + $event->eventdate;\n $newevent->title = $event->title;\n $newevent->body = $event->body;\n $newevent->location_data = 'eventregistration';\n $newevent->color = $color;\n $newevent->expFile = $event->expFile['mainimage'];\n $pass_events[$event->eventdate][] = $newevent;\n }\n }\n return $pass_events;\n }", " /*\n * Helper function for the Calendar view\n */\n function getEventsForDates($edates, $sort_asc = true) {\n global $db;", " $events = array();\n foreach ($edates as $edate) {\n// if (!isset($this->params['cat'])) {\n// if (isset($this->params['title']) && is_string($this->params['title'])) {\n// $default_id = $db->selectValue('storeCategories', 'id', \"sef_url='\" . $this->params['title'] . \"'\");\n// } elseif (!empty($this->config['category'])) {\n// $default_id = $this->config['category'];\n// } elseif (ecomconfig::getConfig('show_first_category')) {\n// $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');\n// } else {\n// $default_id = 0;\n// }\n// }\n//\n// $parent = isset($this->params['cat']) ? intval($this->params['cat']) : $default_id;\n//\n// $category = new storeCategory($parent);", " $sql = 'SELECT DISTINCT p.*, er.event_starttime, er.signup_cutoff FROM ' . $db->prefix . 'product p ';\n// $sql .= 'JOIN ' . $db->prefix . 'product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'JOIN ' . $db->prefix . 'eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE 1 ';\n// $sql .= ' AND sc.storecategories_id IN (SELECT id FROM exponent_storeCategories WHERE rgt BETWEEN ' . $category->lft . ' AND ' . $category->rgt . ')';\n// if ($category->hide_closed_events) {\n// $sql .= ' AND er.signup_cutoff > ' . time();\n// }\n// $sql .= ' AND er.id = ' . $edate->id;\n $sql .= ' AND er.id = ' . $edate->product_type_id;", " $order = 'event_starttime';\n $dir = 'ASC';", " $o = $db->selectObjectBySql($sql);\n $o->eventdate = $edate->eventdate;\n $o->eventstart = $edate->event_starttime + $edate->eventdate;\n $o->eventend = $edate->event_endtime + $edate->eventdate;\n $o->expFile = $edate->expFile;\n $events[] = $o;\n }\n $events = expSorter::sort(array('array' => $events, 'sortby' => 'eventstart', 'order' => $sort_asc ? 'ASC' : 'DESC'));\n return $events;\n }", " // create a pseudo global view_registrants permission\n public static function checkPermissions($permission,$location) {\n global $exponent_permissions_r, $router;", " // only applies to the 'view_registrants' method\n if (empty($location->src) && empty($location->int) && $router->params['action'] == 'view_registrants') {\n if (!empty($exponent_permissions_r['eventregistration'])) foreach ($exponent_permissions_r['eventregistration'] as $page) {\n foreach ($page as $pageperm) {\n if (!empty($pageperm['view_registrants']) || !empty($pageperm['manage'])) return true;\n }\n }\n }\n return false;\n }", "}", "?>" ]
[ 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */\nfunction compare($x, $y) {\n if ($x->eventdate == $y->eventdate)\n return 0;\n else if ($x->eventdate < $y->eventdate)\n return -1;\n else\n return 1;\n}", "class eventregistrationController extends expController {\n public $basemodel_name = 'eventregistration';", "", " public $useractions = array(\n 'showall' => 'Show all events',\n 'eventsCalendar' => 'Calendar View',\n 'upcomingEvents' => 'Upcoming Events',\n// 'showByTitle' => \"Show events by title\",\n );", " protected $add_permissions = array(\n// 'emailRegistrants'=> 'Email Registrants',\n );\n protected $manage_permissions = array(\n 'emailRegistrants'=> 'Email Registrants',\n );", " // hide the configs we don't need\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)", "", "\n static function displayname() {\n return gt(\"e-Commerce Online Event Registration\");\n }", " static function description() {\n return gt(\"Manage event registrations on your website\");\n }", " function showall() {\n global $user;", " expHistory::set('viewable', $this->params);\n $limit = (!empty($this->config['limit'])) ? $this->config['limit'] : 10;", " $pass_events = array();\n if (!empty($this->params['past']) && $user->isAdmin()) {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\"', \"title ASC\", $limit);\n foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($event->eventdate <= time() && $event->eventenddate <= time()) {\n $pass_events[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }\n } else {\n if ($user->isAdmin()) {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\"', \"title ASC\", $limit);\n } else {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\" && active_type=0', \"title ASC\", $limit);\n }\n foreach ($events as $event) {\n if ($user->isAdmin()) {\n $endtime = $event->eventenddate;\n } else {\n $endtime = $event->signup_cutoff;\n }\n // $this->signup_cutoff > time()\n if ($event->eventdate > time() && $endtime > time()) {\n $pass_events[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }\n }\n // echo \"<pre>\";\n // print_r($pass_events);\n // exit();\n // uasort($pass_events,'compare');\n //eDebug($this->config['limit'], true);\n $page = new expPaginator(array(\n 'records'=>$pass_events,\n 'limit'=>$limit,\n 'order'=>\"eventdate ASC\",\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'view'=>empty($this->params['view']) ? null : $this->params['view'],\n 'columns'=>array(\n gt('Event')=>'title',\n gt('Date')=>'eventdate',\n gt('Seats')=>'quantity'\n ),\n ));\n assign_to_template(array(\n 'page'=> $page,\n 'admin'=> $user->isAdmin(),\n 'past'=> !empty($this->params['past'])\n ));\n }", " function eventsCalendar() {\n global $user;", " expHistory::set('viewable', $this->params);", " $time = isset($this->params['time']) ? $this->params['time'] : time();\n assign_to_template(array(\n 'time' => $time\n ));", "// $monthly = array();\n// $counts = array();", " $info = getdate($time);\n $nowinfo = getdate(time());\n if ($info['mon'] != $nowinfo['mon']) $nowinfo['mday'] = -10;\n // Grab non-day numbers only (before end of month)\n// $week = 0;\n $currentweek = -1;", " $timefirst = mktime(0, 0, 0, $info['mon'], 1, $info['year']);\n $week = intval(date('W', $timefirst));\n if ($week >= 52 && $info['mon'] == 1) $week = 1;\n $infofirst = getdate($timefirst);", "// if ($infofirst['wday'] == 0) {\n// $monthly[$week] = array(); // initialize for non days\n// $counts[$week] = array();\n// }\n// for ($i = 1 - $infofirst['wday']; $i < 1; $i++) {\n// $monthly[$week][$i] = array();\n// $counts[$week][$i] = -1;\n// }\n// $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n $monthly[$week] = array(); // initialize for non days\n $counts[$week] = array();\n if (($infofirst['wday'] == 0) && (DISPLAY_START_OF_WEEK == 1)) {\n for ($i = -6; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday'] + 7; // day number in grid. if 7+, switch weeks\n } else {\n for ($i = 1 - $infofirst['wday']; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n }\n // Grab day counts\n $endofmonth = date('t', $time);", " for ($i = 1; $i <= $endofmonth; $i++) {\n $start = mktime(0, 0, 0, $info['mon'], $i, $info['year']);\n if ($i == $nowinfo['mday']) $currentweek = $week;", "// $dates = $db->selectObjects(\"eventregistration\", \"`eventdate` = $start\");\n// $dates = $db->selectObjects(\"eventregistration\", \"(eventdate >= \" . expDateTime::startOfDayTimestamp($start) . \" AND eventdate <= \" . expDateTime::endOfDayTimestamp($start) . \")\");\n $er = new eventregistration();\n// $dates = $er->find('all', \"(eventdate >= \" . expDateTime::startOfDayTimestamp($start) . \" AND eventdate <= \" . expDateTime::endOfDayTimestamp($start) . \")\");", " if ($user->isAdmin()) {\n $events = $er->find('all', 'product_type=\"eventregistration\"', \"title ASC\");\n } else {\n $events = $er->find('all', 'product_type=\"eventregistration\" && active_type=0', \"title ASC\");\n }\n $dates = array();", " foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($event->eventdate >= expDateTime::startOfDayTimestamp($start) && $event->eventdate <= expDateTime::endOfDayTimestamp($start)) {\n $dates[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }", " $monthly[$week][$i] = $this->getEventsForDates($dates);\n $counts[$week][$i] = count($monthly[$week][$i]);\n if ($weekday >= (6 + DISPLAY_START_OF_WEEK)) {\n $week++;\n $monthly[$week] = array(); // allocate an array for the next week\n $counts[$week] = array();\n $weekday = DISPLAY_START_OF_WEEK;\n } else $weekday++;\n }\n // Grab non-day numbers only (after end of month)\n for ($i = 1; $weekday && $i < (8 + DISPLAY_START_OF_WEEK - $weekday); $i++) {\n $monthly[$week][$i + $endofmonth] = array();\n $counts[$week][$i + $endofmonth] = -1;\n }", " $this->params['time'] = $time;\n assign_to_template(array(\n 'currentweek' => $currentweek,\n 'monthly' => $monthly,\n 'counts' => $counts,\n \"prevmonth3\" => strtotime('-3 months', $timefirst),\n \"prevmonth2\" => strtotime('-2 months', $timefirst),\n \"prevmonth\" => strtotime('-1 months', $timefirst),\n \"nextmonth\" => strtotime('+1 months', $timefirst),\n \"nextmonth2\" => strtotime('+2 months', $timefirst),\n \"nextmonth3\" => strtotime('+3 months', $timefirst),\n 'now' => $timefirst,\n \"today\" => expDateTime::startOfDayTimestamp(time()),\n 'params' => $this->params,\n 'daynames' => event::dayNames(),\n ));\n }", " function upcomingEvents() {\n $sql = 'SELECT DISTINCT p.*, er.eventdate, er.event_starttime, er.signup_cutoff FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql .= 'JOIN ' . DB_TABLE_PREFIX . '_eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE er.signup_cutoff > ' . time() . ' AND er.eventdate > ' . time();", " $limit = empty($this->config['limit']) ? 10 : $this->config['limit'];\n $order = 'eventdate';\n $dir = 'ASC';", " $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));\n assign_to_template(array(\n 'page' => $page\n ));\n }", " function show() {\n global $order, $user;", " expHistory::set('viewable', $this->params);\n if (!empty($this->params['token'])) {\n $record = expSession::get(\"last_POST_Paypal\");\n } else {\n $record = expSession::get(\"last_POST\");\n }\n $id = isset($this->params['title']) ? addslashes($this->params['title']) : $this->params['id'];\n $product = new eventregistration($id);", " //FIXME we only have 0=active & 2=inactive ???\n if ($product->active_type == 1) {\n $product->user_message = \"This event is temporarily unavailable for registration.\";\n } elseif ($product->active_type == 2) {\n if ($user->isAdmin()) {\n $product->user_message = $product->title . \" is currently marked as unavailable for open registration or display. Normal users will not see this event.\";\n } else {\n flash(\"error\", $product->title . \" \" . gt(\"registration is currently unavailable for registration.\"));\n expHistory::back();\n }\n }", " $order_registrations = array();\n $count = 1;\n if (!empty($this->params['orderitem_id'])) { // editing an event already in the cart?\n $f = new forms($product->forms_id);\n $loc_data = new stdClass();\n $loc_data->order_id = $order->id;\n $loc_data->orderitem_id = $this->params['orderitem_id'];\n $loc_data->event_id = $product->id;\n $locdata = serialize($loc_data);\n// $order_registrations = $db->selectObjects('forms_' . $f->table_name, \"location_data='\" . $locdata . \"'\");\n $order_registrations = $f->getRecords(\"location_data='\" . $locdata . \"'\");", "// $registrants = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$order->id}' AND orderitem_id =\" . $this->params['orderitem_id'] . \" AND event_id =\" . $product->id);\n// if (!empty($registrants)) foreach ($registrants as $registrant) {\n// $order_registrations[] = expUnserialize($registrant->value);\n// }\n $item = $order->isItemInCart($product->id, $product->product_type, $this->params['orderitem_id']);\n if (!empty($item)) {\n $params['options'] = $item->opts;\n assign_to_template(array(\n 'params'=> $params,\n 'orderitem_id'=>$item->id\n ));\n $count = $item->quantity;\n }\n }", " //eDebug($product, true);\n assign_to_template(array(\n 'product'=> $product,\n// 'record'=> $record,\n 'registered' => $order_registrations,\n 'count' => $count,\n ));\n }", " function showByTitle() {\n global $order, $template, $user;\n expHistory::set('viewable', $this->params);\n if (!empty($this->params['token'])) {\n $record = expSession::get(\"last_POST_Paypal\");\n } else {\n $record = expSession::get(\"last_POST\");\n }\n $product = new eventregistration(addslashes($this->params['title']));", " //TODO should we pull in an existing reservation already in the cart to edit? e.g., the registrants\n //FIXME we only have 0=active & 2=inactive ???\n if ($product->active_type == 1) {\n $product->user_message = \"This event is temporarily unavailable for registration.\";\n } elseif ($product->active_type == 2) {\n if ($user->isAdmin()) {\n $product->user_message = $product->title . \" is currently marked as unavailable for open registration or display. Normal users will not see this event.\";\n } else {\n flash(\"error\", $product->title . \" \" . gt(\"registration is currently unavailable.\"));\n expHistory::back();\n }\n }", " //eDebug($product, true);\n assign_to_template(array(\n 'product'=> $product,\n 'record'=> $record\n ));\n }", " function manage() {\n global $user;", " expHistory::set('viewable', $this->params);\n $limit = (!empty($this->config['limit'])) ? $this->config['limit'] : 10;", " $pass_events = array();\n if (!empty($this->params['past']) && $user->isAdmin()) {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\"', \"title ASC\", $limit);\n foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($event->eventdate <= time() && $event->eventenddate <= time()) {\n $pass_events[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }\n } else {\n if ($user->isAdmin()) {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\"', \"title ASC\", $limit);\n } else {\n $events = $this->eventregistration->find('all', 'product_type=\"eventregistration\" && active_type=0', \"title ASC\", $limit);\n }\n foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($user->isAdmin()) {\n $endtime = $event->eventenddate;\n } else {\n $endtime = $event->signup_cutoff;\n }\n if ($event->eventdate > time() && $endtime > time()) {\n $pass_events[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }\n }\n foreach ($pass_events as $key=>$pass_event) {\n $pass_events[$key]->number_of_registrants = $pass_event->countRegistrants();\n }\n // echo \"<pre>\";\n // print_r($pass_events);\n // exit();\n // uasort($pass_events,'compare');\n //eDebug($this->config['limit'], true);\n $page = new expPaginator(array(\n 'records'=>$pass_events,\n 'limit'=>$limit,\n 'order'=>\"eventdate ASC\",\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n 'src'=>$this->loc->src,\n 'view'=>empty($this->params['view']) ? null : $this->params['view'],\n 'columns'=>array(\n gt('Event')=>'title',\n gt('Date')=>'eventdate',\n gt('Seats')=>'quantity'\n ),\n ));\n assign_to_template(array(\n 'page'=> $page,\n 'admin'=> $user->isAdmin(),\n 'past'=> !empty($this->params['past'])\n ));\n }", " function metainfo() {\n global $router;\n if (empty($router->params['action'])) return false;", " // figure out what metadata to pass back based on the action we are in.\n $action = $router->params['action'];\n $metainfo = array('title' => '', 'keywords' => '', 'description' => '', 'canonical'=> '', 'noindex' => false, 'nofollow' => false);\n $storename = ecomconfig::getConfig('storename');\n switch ($action) {\n case 'showall':\n case 'eventsCalendar':\n case 'upcomingEvents':\n $metainfo['title'] = gt('Event Registration') . ' - ' . $storename;\n $metainfo['keywords'] = gt('event registration online');\n $metainfo['description'] = gt(\"Make an event registration\");\n break;\n case 'show':\n case 'showByTitle':\n if (isset($router->params['id']) || isset($router->params['title'])) {\n $lookup = isset($router->params['id']) ? $router->params['id'] : $router->params['title'];\n $object = new eventregistration($lookup);\n // set the meta info\n if (!empty($object)) {\n if (!empty($object->body)) {\n $desc = str_replace('\"',\"'\",expString::summarize($object->body,'html','para'));\n } else {\n $desc = SITE_DESCRIPTION;\n }\n if (!empty($object->expTag)) {\n $keyw = '';\n foreach ($object->expTag as $tag) {\n if (!empty($keyw)) $keyw .= ', ';\n $keyw .= $tag->title;\n }\n } else {\n $keyw = SITE_KEYWORDS;\n }\n $metainfo['title'] = empty($object->meta_title) ? $object->title . \" - \" . $storename : $object->meta_title;\n $metainfo['keywords'] = empty($object->meta_keywords) ? $keyw : $object->meta_keywords;\n $metainfo['description'] = empty($object->meta_description) ? $desc : $object->meta_description;\n// $metainfo['canonical'] = empty($object->canonical) ? URL_FULL.substr($router->sefPath, 1) : $object->canonical;\n $metainfo['canonical'] = empty($object->canonical) ? $router->plainPath() : $object->canonical;\n $metainfo['noindex'] = empty($object->meta_noindex) ? false : $object->meta_noindex;\n $metainfo['nofollow'] = empty($object->meta_nofollow) ? false : $object->meta_nofollow;\n }\n break;\n }\n default:\n $metainfo['title'] = self::displayname() . \" - \" . $storename;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n }", " return $metainfo;\n }", " function eventregistration_process() { // FIXME only used by the eventregistration_form view (no method)\n global $db, $user, $order;", " //Clear the cart first\n foreach ($order->orderitem as $orderItem) {\n $orderItem->delete();\n }\n $order->refresh();", " eDebug($order, true);", " expHistory::set('viewable', $this->params);\n expSession::set('last_POST_Paypal', $this->params);\n expSession::set('terms_and_conditions', $product->terms_and_condition); //FIXME $product doesn't exist\n expSession::set('paypal_link', makeLink(array('controller'=> 'eventregistration', 'action'=> 'show', 'title'=> $product->sef_url)));", " //Validation for customValidation\n foreach ($this->params['event'] as $key => $value) {\n $expField = $db->selectObject(\"expDefinableFields\", \"name = '{$key}'\");\n $expFieldData = expUnserialize($expField->data);\n if (!empty($expFieldData->customvalidation)) {", " $customValidation = \"is_valid_\" . $expFieldData->customvalidation;\n $fieldname = $expField->name;\n $obj = new stdClass();\n $obj->$fieldname = $value;\n if ($fieldname == \"email\") { //Change this to much more loose coding\n $ret = expValidator::$customValidation($fieldname, $this->params['event']['email'], $this->params['event']['email_confirm']);\n } else {\n $ret = expValidator::$customValidation($fieldname, $obj, $obj);\n }\n if (strlen($ret) > 1) {", " expValidator::failAndReturnToForm($ret, $this->params);\n }\n }", " if (@$expFieldData->minimum_size > 0 || @$expFieldData->maximum_size > 0) {\n $ret = expValidator::check_size_of($expFieldData->identifier, $value, $expFieldData->minimum_size, $expFieldData->maximum_size);", " if (strlen($ret) > 1) {\n expValidator::failAndReturnToForm($ret, $this->params);\n }\n }\n }", " $event = new eventregistration();\n //Validation for ticker types\n if (isset($this->params['ticket_types']) && empty($this->params['options'])) {\n expValidator::failAndReturnToForm(\"Invalid ticket types.\", $this->params);\n }", "// if (!empty($this->params['event'])) {\n $sess_id = session_id();\n// $sess_id = expSession::getTicketString();\n// $data = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$order->id}' AND event_id =\" . $this->params['eventregistration']['product_id']);\n $data = $event->getRecords(\"connector_id ='{$order->id}' AND event_id =\" . $this->params['eventregistration']['product_id']);\n //FIXME change this to forms table\n if (!empty($data)) {\n foreach ($data as $item) {\n if (!empty($this->params['event'][$item->control_name])) {\n $item->value = $this->params['event'][$item->control_name];\n// $db->updateObject($item, \"eventregistration_registrants\");\n $event->updateRecord($item);\n }\n }\n } else {\n if (!empty($this->params['event'])) foreach ($this->params['event'] as $key => $value) {\n $obj = new stdClass();\n $obj->event_id = $this->params['eventregistration']['product_id'];\n $obj->control_name = $key;\n $obj->value = $value;\n $obj->connector_id = $order->id;\n $obj->registered_date = time();\n// $db->insertObject($obj, \"eventregistration_registrants\");\n $event->insertRecord($obj);\n } else {\n $obj = new stdClass();\n $obj->event_id = $this->params['eventregistration']['product_id'];\n $obj->connector_id = $order->id;\n $obj->registered_date = time();\n// $db->insertObject($obj, \"eventregistration_registrants\");\n $event->insertRecord($obj);\n }\n }\n expSession::set('session_id', $sess_id);\n// }", " //Add to Cart\n $product_id = $this->params['eventregistration']['product_id'];\n $product_type = \"eventregistration\";\n $product = new $product_type($product_id, true, true);", " if ($this->params['options']) {\n $this->params['eventregistration']['options'] = $this->params['options'];\n $this->params['eventregistration']['options_quantity'] = $this->params['options_quantity'];\n $product->addToCart($this->params['eventregistration']);\n } else {\n $this->params['eventregistration']['qtyr'] = $this->params['theValue'] + 1;\n $product->addToCart($this->params['eventregistration']);\n }", " $order->calculateGrandTotal();\n $order->setOrderType($this->params);\n $order->setOrderStatus($this->params);", " $billing = new billing();\n $result = $billing->calculator->preprocess($billing->billingmethod, $opts, $this->params, $order); //FIXME $opts doesn't exist\n redirect_to(array('controller'=> 'cart', 'action'=> 'preprocess'));\n }", " function delete() {\n redirect_to(array('controller'=> 'eventregistration', 'action'=> 'showall'));\n }", " function view_registrants() {\n expHistory::set('viewable', $this->params);\n $event = new eventregistration($this->params['id']);\n //Get all the registrants in the event\n// $registrants = $event->getRegistrants();\n assign_to_template(array(\n 'event'=> $event,\n 'registrants'=> $event->getRegistrants(),\n 'count'=> $event->countRegistrants(),\n// 'header'=> $header,\n// 'body'=> $body,\n// 'email'=> $email\n ));", "// $order_ids_complete = $db->selectColumn(\"eventregistration_registrants\", \"connector_id\", \"connector_id <> '0' AND event_id = {$event->id}\", \"registered_date\", true);\n// $orders = new order();\n// foreach ($order_ids_complete as $item) {\n// $connector = expUnserialize($item);\n//// $odr = $db->selectObject(\"orders\", \"id = {$item} and invoice_id <> 0\");\n//// $odr = $db->selectObject(\"orders\", \"id ='{$item}' and invoice_id <> 0\");\n// $odr = $orders->find(\"first\", \"id ='{$connector->order_id}' and invoice_id <> 0\");\n// if (!empty($odr) || strpos($connector->order_id, \"admin-created\") !== false) {\n// $order_ids[] = $connector->order_id;\n// }\n// }\n//\n// $header = array();\n// $control_names = array();\n// $header[] = 'Date Registered';\n// //Check if it has ticket types\n// if ($event->hasOptions()) {\n// $header[] = \"Types\"; //Add some configuration here\n// }\n// //Get the input labels as table headers\n// if (!empty($event->expDefinableField['registrant'])) foreach ($event->expDefinableField['registrant'] as $field) {\n// $data = expUnserialize($field->data);\n// if (!empty($data->caption)) {\n// $header[] = $data->caption;\n// } else {\n// $header[] = $field->name;\n// }\n// $control_names[] = $field->name;\n// }\n//\n// //Check if there are guests using expDefinableFields\n// if (!empty($event->num_guest_allowed)) {\n// for ($i = 1; $i <= $event->num_guest_allowed; $i++) {\n// if (!empty($event->expDefinableField['guest'])) foreach ($event->expDefinableField['guest'] as $field) {\n// $data = expUnserialize($field->data);\n// if (!empty($data->caption)) {\n// $header[] = $data->caption . \"_$i\";\n// } else {\n// $header[] = $field->name . \"_$i\";\n// }\n// $control_names[] = $field->name . \"_$i\";\n// }\n// }\n// }\n//\n// // new method to check for guests/registrants in eventregistration_registrants\n//// if (!empty($event->num_guest_allowed)) {\n// $registrants = array();\n// if (!empty($event->quantity)) {\n// $registered = array();\n// if (!empty($order_ids)) foreach ($order_ids as $order_id) {\n// $newregistrants = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$order_id}'\");\n// $registered = array_merge($registered,$newregistrants);\n// }\n// foreach ($registered as $person) {\n// $registrants[$person->id] = expUnserialize($person->value);\n// }\n// }\n//\n// //Get the data and registrant emails\n// $email = array();\n// $num_of_guest_fields = 0;\n// $num_of_guest = 0;\n// $num_of_guest_total = 0;\n//\n// $body = array();\n// if (!empty($order_ids)) foreach ($order_ids as $order_id) {\n// $body[$order_id][] = date(\"M d, Y h:i a\", $db->selectValue(\"eventregistration_registrants\", \"registered_date\", \"event_id = {$event->id} AND connector_id = '{$order_id}'\"));\n// if ($event->hasOptions()) {\n// $or = new order($order_id);\n// $orderitem = new orderitem();\n// if (isset($or->orderitem[0])) {\n// $body[$order_id][] = $orderitem->getOption($or->orderitem[0]->options);\n// } else {\n// $body[$order_id][] = '';\n// }\n// }\n// foreach ($control_names as $control_name) {\n// $value = $db->selectValue(\"eventregistration_registrants\", \"value\", \"event_id = {$event->id} AND control_name ='{$control_name}' AND connector_id = '{$order_id}'\");\n// $body[$order_id][] = $value;\n// if (expValidator::isValidEmail($value) === true) {\n// $email[$value] = $value;\n// }\n// }\n//\n// if (!empty($order_id)) {\n// $num_of_guest_total += $db->countObjects(\"eventregistration_registrants\", \"event_id ={$event->id} AND control_name LIKE 'guest_%' AND connector_id = '{$order_id}'\");\n// }\n// } else $order_ids = array();\n//\n// // check numbers based on expDefinableFields\n// $num_of_guest_fields = $db->countObjects(\"content_expDefinableFields\", \"content_id ={$event->id} AND subtype='guest'\");\n// if ($num_of_guest_fields <> 0) {\n// $num_of_guest = $num_of_guest_total / $num_of_guest_fields;\n// } else {\n// $num_of_guest = 0;\n// }\n//\n// //Removed duplicate emails\n// $email = array_unique($email);\n//\n// $registered = count($order_ids) + $num_of_guest;\n// if (!empty($event->registrants)) {\n// $event->registrants = expUnserialize($event->registrants);\n// } else {\n// $event->registrants = array();\n// }\n//\n// $event->number_of_registrants = $registered;\n// assign_to_template(array(\n// 'event'=> $event,\n// 'registrants'=> $registrants,\n//// 'header'=> $header,\n//// 'body'=> $body,\n//// 'email'=> $email\n// ));\n }", " public function delete_registrant() {\n// global $db;", " $event = new eventregistration($this->params['event_id']);\n $f = new forms($event->forms_id);\n if (!empty($f->is_saved)) { // is there user input data\n// $db->delete('forms_' . $f->table_name, \"id='{$this->params['id']}'\");\n $f->deleteRecord($this->params['id']);\n } else {\n// $db->delete('eventregistration_registrants', \"id ='{$this->params['id']}'\");\n $event->deleteRecord($this->params['id']);\n }\n flash('message', gt(\"Registrant successfully deleted.\"));\n expHistory::back();\n }", " public function edit_registrant() {\n// global $db;", "// $event_id = $this->params['event_id'];\n// $connector_id = @$this->params['connector_id'];\n// if (empty($connector_id)) {\n// $connector_id = \"admin-created\" . mt_rand() . time(); //Meaning it is been added by admin\n// }\n// $reg_data = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$connector_id}'\");", " $registrant = array();\n $event = new eventregistration($this->params['event_id']);\n if (!empty($this->params['id'])) {\n// $reg_data = $db->selectObject(\"eventregistration_registrants\", \"id ='{$this->params['id']}'\");\n $f = new forms($event->forms_id);", " // foreach ($reg_data as $item) {\n // $registrant[$item->control_name] = $item->value;\n // }\n// $registrant = expUnserialize($reg_data->value);\n if (!empty($f->is_saved)) {\n// $registrant = $db->selectObject('forms_' . $f->table_name, \"id ='{$this->params['id']}'\");\n $registrant = $f->getRecord($this->params['id']);\n// $registrant['id'] = $reg_data->id;\n// $eventid = $reg_data->event_id;\n// } else {\n// $eventid = $this->params['event_id'];\n } else {\n// $registrant = $db->selectObject(\"eventregistration_registrants\", \"id ='{$this->params['id']}'\");\n $registrant = $event->getRecord($this->params['id']);\n }\n }", " // eDebug($registrant, true);\n assign_to_template(array(\n 'registrant'=> $registrant,\n 'event'=> $event,\n// 'connector_id' => $connector_id\n ));\n }", " public function update_registrant() {\n global $db, $user;", " $event = new eventregistration($this->params['event_id']);\n // create a new order/invoice if needed\n if (empty($this->params['id'])) {\n //create new order\n $orderc= expModules::getController('order');\n $orderc->params = array(\n 'customer_type' => 1, // blank user/address\n 'addresses_id' => 0,\n 'order_status_id' => order::getDefaultOrderStatus(),\n 'order_type_id' => order::getDefaultOrderType(),\n 'no_redirect' => true,\n );\n $orderc_id = $orderc->save_new_order();\n //create new order item\n $orderc->params = array(\n 'orderid' => $orderc_id,\n 'product_id' => $event->id,\n 'product_type' => 'eventregistration',\n// 'products_price' => $event->getBasePrice(),\n// 'products_name' => $event->title,\n 'quantity' => $this->params['value'],\n 'no_redirect' => true,\n );\n $orderi_id = $orderc->save_order_item(); // will redirect us to the new order view\n }\n $f = new forms($event->forms_id);\n $registrant = new stdClass();\n// if (!empty($this->params['id'])) $registrant = $db->selectObject('forms_' . $f->table_name, \"id ='{$this->params['id']}'\");\n if (!empty($this->params['id'])) $registrant = $f->getRecord($this->params['id']);\n if (!empty($f->is_saved)) {\n $fc = new forms_control();\n $controls = $fc->find('all', \"forms_id=\" . $f->id . \" AND is_readonly=0\",'rank');\n foreach ($controls as $c) {\n $ctl = expUnserialize($c->data);\n $control_type = get_class($ctl);\n $def = call_user_func(array($control_type, \"getFieldDefinition\"));\n if ($def != null) {\n $emailValue = htmlspecialchars_decode(call_user_func(array($control_type, 'parseData'), $c->name, $this->params['registrant'], true));\n $value = stripslashes(expString::escape($emailValue));\n $varname = $c->name;\n $registrant->$varname = $value;\n }\n }\n if (!empty($registrant->id)) {\n// $db->updateObject($registrant, 'forms_' . $f->table_name);\n $f->updateRecord($registrant);\n } else { // create new registrant record\n $loc_data = new stdClass();\n// $loc_data->order_id = 'admin-created';\n// $loc_data->orderitem_id = 'admin-created';\n $loc_data->order_id = $orderc_id;\n $loc_data->orderitem_id = $orderi_id;\n $loc_data->event_id = $this->params['event_id'];\n $locdata = serialize($loc_data);\n $registrant->ip = $_SERVER['REMOTE_ADDR'];\n $registrant->referrer = $this->params['event_id'];\n $registrant->timestamp = time();\n if (expSession::loggedIn()) {\n $registrant->user_id = $user->id;\n } else {\n $registrant->user_id = 0;\n }\n $registrant->location_data = $locdata;\n// $db->insertObject($registrant, 'forms_' . $f->table_name);\n $f->insertRecord($registrant);\n }\n } else {\n// $registrant = $db->selectObject(\"eventregistration_registrants\", \"id ='{$this->params['id']}'\");\n $registrant = $event->getRecord($this->params['id']);\n if (!is_object($registrant)) $registrant = new stdClass();\n $registrant->control_name = $this->params['control_name'];\n //FIXME if $registrant->value != $this->params['value'] update order/invoice w/ new quantity???\n $registrant->value = $this->params['value'];\n if (!empty($registrant->id)) {\n// $db->updateObject($registrant, \"eventregistration_registrants\");\n $event->updateRecord($registrant);\n } else { // create new registrant record\n $registrant->event_id = $this->params['event_id'];\n// $registrant->connector_id = 'admin-created';\n// $registrant->orderitem_id = 'admin-created';\n $registrant->registered_date = time();\n $registrant->connector_id = $orderc_id;\n $registrant->orderitem_id = $orderi_id;\n// $db->insertObject($registrant, \"eventregistration_registrants\");\n $event->insertRecord($registrant);\n }\n }\n redirect_to(array('controller'=> 'eventregistration', 'action'=> 'view_registrants', 'id'=> $this->params['event_id']));\n }", " public function export() {\n// global $db;", " $event = new eventregistration($this->params['id']);", " $registrants = $event->getRegistrants();\n $f = new forms($event->forms_id);\n// $registrants = array();\n// if (!empty($f->is_saved)) { // is there user input data\n// $registrants = $db->selectObjects('forms_' . $f->table_name, \"referrer = {$event->id}\", \"timestamp\");\n// } else {\n// $registrants = $db->selectObjects('eventregistration_registrants', \"connector_id\", \"connector_id <> '0' AND event_id = {$event->id}\", \"timestamp\");\n// }\n// foreach ($registrants as $key=>$registrant) {\n// $order_data = expUnserialize($registrant->location_data);\n// if (is_numeric($order_data->order_id)) {\n// $order = new order($order_data->order_id);\n// $billingstatus = expUnserialize($order->billingmethod[0]->billing_options);\n// $registrants[$key]->payment = !empty($billingstatus->payment_due) ? gt('payment due') : gt('paid');\n// } else {\n// $registrants[$key]->payment = '???';\n// }\n// }", "// $sql = \"SELECT connector_id FROM \" . $db->prefix . \"eventregistration_registrants GROUP BY connector_id\";\n// $order_ids_complete = $db->selectColumn(\"eventregistration_registrants\", \"connector_id\", \"connector_id <> '0' AND event_id = {$event->id}\", \"registered_date\", true);\n//\n// $orders = new order();\n// foreach ($order_ids_complete as $item) {\n//// $odr = $db->selectObject(\"orders\", \"id = {$item} and invoice_id <> 0\");\n// $odr = $orders->find(\"first\", \"id ='{$item}' and invoice_id <> 0\");\n// if (!empty($odr) || strpos($item, \"admin-created\") !== false) {\n// $order_ids[] = $item;\n// }\n// }\n//\n// $header = array();\n// $control_names = array();\n// $header[] = '\"Date Registered\"';\n// //Check if it has ticket types\n// if ($event->hasOptions()) {\n// $header[] = '\"Ticket Types\"'; //Add some configuration here\n// }\n//\n// if (!empty($event->expDefinableField['registrant'])) foreach ($event->expDefinableField['registrant'] as $field) {\n// $data = expUnserialize($field->data);\n// if (!empty($data->caption)) {\n// $header[] = '\"' . $data->caption . '\"';\n// } else {\n// $header[] = '\"' . $field->name . '\"';\n// }\n// $control_names[] = $field->name;\n// }", " //FIXME we don't have a 'guest' definable field type\n// if ($event->num_guest_allowed > 0) {\n// for ($i = 1; $i <= $event->num_guest_allowed; $i++) {\n// if (!empty($event->expDefinableField['guest'])) foreach ($event->expDefinableField['guest'] as $field) {\n// $data = expUnserialize($field->data);\n// if (!empty($data->caption)) {\n// $header[] = $data->caption . \"_$i\";\n// } else {\n// $header[] = $field->name . \"_$i\";\n// }\n// $control_names[] = $field->name . \"_$i\";\n// }\n//\n// }\n// }", " // new method to check for guests/registrants\n// if (!empty($event->num_guest_allowed)) {\n// if (!empty($event->quantity)) {\n// $registered = array();\n// if (!empty($order_ids)) foreach ($order_ids as $order_id) {\n// $newregistrants = $db->selectObjects(\"eventregistration_registrants\", \"connector_id ='{$order_id}'\");\n// $registered = array_merge($registered,$newregistrants);\n// }\n//// $registrants = array();\n// foreach ($registered as $key=>$person) {\n// $registered[$key]->person = expUnserialize($person->value);\n// }\n if (!empty($f->is_saved)) {\n $controls = $event->getAllControls();\n if ($f->column_names_list == '') {\n //define some default columns...\n foreach ($controls as $control) {\n $rpt_columns[$control->name] = $control->caption;\n }\n } else {\n $rpt_columns2 = explode(\"|!|\", $f->column_names_list);\n $fc = new forms_control();\n foreach ($rpt_columns2 as $column) {\n $control = $fc->find('first', \"forms_id=\" . $f->id . \" AND name = '\" . $column . \"' AND is_readonly = 0 AND is_static = 0\", \"rank\");\n if (!empty($control)) {\n $rpt_columns[$control->name] = $control->caption;\n } else {\n switch ($column) {\n case 'ip':\n $rpt_columns[$column] = gt('IP Address');\n break;\n case 'referrer':\n $rpt_columns[$column] = gt('Event ID');\n break;\n case 'user_id':\n $rpt_columns[$column] = gt('Posted by');\n break;\n case 'timestamp':\n $rpt_columns[$column] = gt('Registered');\n break;\n }\n }\n }\n }\n $rpt_columns['payment'] = gt('Paid?');\n $fc = new forms_control();\n foreach ($rpt_columns as $column_name=>$column_caption) {\n if ($column_name == \"ip\" || $column_name == \"referrer\" || $column_name == \"location_data\") {\n } elseif ($column_name == \"user_id\") {\n foreach ($registrants as $key => $item) {\n if ($item->$column_name != 0) {\n $locUser = user::getUserById($item->$column_name);\n $item->$column_name = $locUser->username;\n } else {\n $item->$column_name = '';\n }\n $registrants[$key] = $item;\n }\n } elseif ($column_name == \"timestamp\") {\n foreach ($registrants as $key => $item) {\n $item->$column_name = strftime(\"%m/%d/%y %T\", $item->$column_name); // needs to be in a machine readable format\n $registrants[$key] = $item;\n }\n } else {\n $control = $fc->find('first', \"name='\" . $column_name . \"' AND forms_id=\" . $this->params['id'],'rank');\n if ($control) {\n $ctl = expUnserialize($control->data);\n $control_type = get_class($ctl);\n foreach ($registrants as $key => $item) {\n $item->$column_name = call_user_func(array($control_type, 'templateFormat'), $item->$column_name, $ctl);\n $registrants[$key] = $item;\n }\n }\n }\n }\n } else {\n $rpt_columns = array(\n 'user' => gt('Name'),\n 'qty' => gt('Quantity'),\n 'registered_date' => gt('Registered'),\n 'payment' => gt('Paid?'),\n );\n foreach ($registrants as $key=>$registrant) {\n $registrants[$key]->registered_date = strftime(DISPLAY_DATETIME_FORMAT, $registrants[$key]->registered_date);\n }\n }\n// $header = array(); //FIXME reset & pulled from above\n// $header[] = gt('IP Address'); //FIXME\n// $header[] = gt('Event');\n// $header[] = gt('Date Registered');\n// $header[] = gt('User');\n// $header[] = gt('Location');\n// foreach ($controls as $control) {\n// $header[] = $control->caption;\n// }\n// }", " if (LANG_CHARSET == 'UTF-8') {\n $out = chr(0xEF).chr(0xBB).chr(0xBF); // add utf-8 signature to file to open appropriately in Excel, etc...\n } else {\n $out = \"\";\n }\n// $out .= implode(\",\", $header);\n// $out .= \"\\n\";\n// $body = '';\n// foreach ($order_ids as $order_id) {\n// $body .= '\"' . date(\"M d, Y h:i a\", $db->selectValue(\"eventregistration_registrants\", \"registered_date\", \"event_id = {$event->id} AND connector_id = '{$order_id}'\")) . '\",';\n//\n// if ($event->hasOptions()) {\n// $or = new order($order_id);\n// $orderitem = new orderitem();\n// if (isset($or->orderitem[0])) {\n// $body .= '\"' . str_replace(\"<br />\", \" \", $orderitem->getOption($or->orderitem[0]->options)) . '\",';\n// ;\n// } else {\n// $body .= '\"\",';\n// }\n// }\n//\n// foreach ($control_names as $control_name) {\n// $value = $db->selectValue(\"eventregistration_registrants\", \"value\", \"event_id = {$event->id} AND control_name ='{$control_name}' AND connector_id = '{$order_id}'\");\n// $body .= '\"' . iconv(\"UTF-8\", \"ISO-8859-1\", $value) . '\",';\n// }\n// $body = substr($body, 0, -1) . \"\\n\";\n// }\n// foreach ($registrants as $person) {\n// $body .= '\"' . date(\"M d, Y h:i a\", $person->registered_date) . '\",';\n// foreach ($person->person as $value) {\n//// $body .= '\"' . iconv(\"UTF-8\", \"ISO-8859-1\", $value) . '\",';\n// $body .= '\"' . $value . '\",';\n// }\n// $body = substr($body, 0, -1) . \"\\n\";\n// }\n// $out .= $body;\n $out .= formsController::sql2csv($registrants, $rpt_columns);", " $fn = str_replace(' ', '_', $event->title) . '_' . gt('Roster') . '.csv';", "\t\t// CREATE A TEMP FILE\n\t\t$tmpfname = tempnam(getcwd(), \"rep\"); // Rig", "\t\t$handle = fopen($tmpfname, \"w\");\n\t\tfwrite($handle,$out);\n\t\tfclose($handle);", "\t\tif(file_exists($tmpfname)) {\n // NO buffering from here on out or things break unexpectedly. - RAM\n ob_end_clean();", " // This code was lifted from phpMyAdmin, but this is Open Source, right?\n // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n // It seems that other headers I've added make IE prefer octet-stream again. - RAM\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octet-stream;' : 'text/comma-separated-values;';\n header('Content-Type: ' . $mime_type . ' charset=' . LANG_CHARSET. \"'\");\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n header('Content-length: '.filesize($tmpfname));\n header('Content-Transfer-Encoding: binary');\n header('Content-Encoding:');\n header('Content-Disposition: attachment; filename=\"' . $fn . '\";');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n header('Vary: User-Agent');\n } else {\n header('Pragma: no-cache');\n }\n //Read the file out directly\n readfile($tmpfname);", "// if (DEVELOPMENT == 0) exit();\n unlink($tmpfname);\n exit();\n }\n }", " public function get_guest_controls($ajax = '') { //FIXME this is never used\n $id = $this->params['id'];\n $ctr = $this->params['counter'];\n $event = new eventregistration($id);", " $str = \"\";\n foreach ($event->expDefinableField['guest'] as $field) {\n $str = $str . $event->showControl($field, $field->name . \"_\" . $ctr);\n }", " echo $str;\n exit();\n }", " function emailRegistrants() {", " if (empty($this->params['email_addresses'])) {\n flash('error', gt('Please add at least one email.'));\n expHistory::back();\n }", " if (empty($this->params['email_subject']) || empty($this->params['email_message'])) {\n flash('error', gt('Nothing to Send! Please enter subject and message.'));\n expHistory::back();\n }", "// $email_arr = explode(\"|!|\", $this->params['email_addresses']);\n $email_addy = array_flip(array_flip($this->params['email_addresses']));\n $email_addy = array_map('trim', $email_addy);\n $email_addy = array_filter($email_addy);", " $headers = array(\n \"MIME-Version\" => \"1.0\",\n \"Content-type\" => \"text/html; charset=\" . LANG_CHARSET\n );", " $mail = new expMail();", "// foreach ($this->params['expFile']['attachments'] as $attach) {\n// $expFile = new expFile($attach);\n// if (!empty($expFile->id)) {\n// $mail->attach_file_on_disk($expFile->path, $expFile->mimetype);\n// }\n// }\n if (!empty($_FILES['attach']['size'])) {\n $dir = 'tmp';\n $filename = expFile::fixName(time() . '_' . $_FILES['attach']['name']);\n $dest = $dir . '/' . $filename;\n //Check to see if the directory exists. If not, create the directory structure.\n if (!file_exists(BASE.$dir)) expFile::makeDirectory($dir);\n // Move the temporary uploaded file into the destination directory, and change the name.\n $file = expFile::moveUploadedFile($_FILES['attach']['tmp_name'], BASE . $dest);\n// $finfo = finfo_open(FILEINFO_MIME_TYPE);\n// $relpath = str_replace(PATH_RELATIVE, '', BASE);\n// $ftype = finfo_file($finfo, BASE.$dest);\n// finfo_close($finfo);\n if (!empty($file)) $mail->attach_file_on_disk(BASE . $file, expFile::getMimeType(BASE . $file));\n }", " $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n $mail->quickBatchSend(array(\n \t'headers'=>$headers,\n 'html_message'=> $this->params['email_message'],\n 'text_message'=> strip_tags(str_replace(\"<br>\", \"\\r\\n\", $this->params['email_message'])),\n 'to' => $email_addy,\n 'from' => $from,\n 'subject' => $this->params['email_subject']\n ));\n if (!empty($file)) unlink(BASE . $file); // delete temp file attachment\n flash('message', gt(\"You're email to event registrants has been sent.\"));\n expHistory::back();\n }", " /**\n * function to return event registrations as calendar events\n *\n * @param $startdate\n * @param $enddate\n * @param string $color\n *\n * @return array\n */\n static function getRegEventsForDates($startdate, $enddate, $color=\"#FFFFFF\") {\n $er = new eventregistration();\n $events = $er->find('all', 'product_type=\"eventregistration\" && active_type=0');\n $pass_events = array();\n foreach ($events as $event) {\n if ($event->eventdate >= $startdate && $event->eventdate <= $enddate) {\n $newevent = new stdClass();\n $newevent->eventdate = new stdClass();\n $newevent->eventdate->date = $event->eventdate;\n $newevent->eventstart = $event->event_starttime + $event->eventdate;\n $newevent->eventend = $event->event_endtime + $event->eventdate;\n $newevent->title = $event->title;\n $newevent->body = $event->body;\n $newevent->location_data = 'eventregistration';\n $newevent->color = $color;\n $newevent->expFile = $event->expFile['mainimage'];\n $pass_events[$event->eventdate][] = $newevent;\n }\n }\n return $pass_events;\n }", " /*\n * Helper function for the Calendar view\n */\n function getEventsForDates($edates, $sort_asc = true) {\n global $db;", " $events = array();\n foreach ($edates as $edate) {\n// if (!isset($this->params['cat'])) {\n// if (isset($this->params['title']) && is_string($this->params['title'])) {\n// $default_id = $db->selectValue('storeCategories', 'id', \"sef_url='\" . $this->params['title'] . \"'\");\n// } elseif (!empty($this->config['category'])) {\n// $default_id = $this->config['category'];\n// } elseif (ecomconfig::getConfig('show_first_category')) {\n// $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');\n// } else {\n// $default_id = 0;\n// }\n// }\n//\n// $parent = isset($this->params['cat']) ? intval($this->params['cat']) : $default_id;\n//\n// $category = new storeCategory($parent);", " $sql = 'SELECT DISTINCT p.*, er.event_starttime, er.signup_cutoff FROM ' . $db->prefix . 'product p ';\n// $sql .= 'JOIN ' . $db->prefix . 'product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'JOIN ' . $db->prefix . 'eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE 1 ';\n// $sql .= ' AND sc.storecategories_id IN (SELECT id FROM exponent_storeCategories WHERE rgt BETWEEN ' . $category->lft . ' AND ' . $category->rgt . ')';\n// if ($category->hide_closed_events) {\n// $sql .= ' AND er.signup_cutoff > ' . time();\n// }\n// $sql .= ' AND er.id = ' . $edate->id;\n $sql .= ' AND er.id = ' . $edate->product_type_id;", " $order = 'event_starttime';\n $dir = 'ASC';", " $o = $db->selectObjectBySql($sql);\n $o->eventdate = $edate->eventdate;\n $o->eventstart = $edate->event_starttime + $edate->eventdate;\n $o->eventend = $edate->event_endtime + $edate->eventdate;\n $o->expFile = $edate->expFile;\n $events[] = $o;\n }\n $events = expSorter::sort(array('array' => $events, 'sortby' => 'eventstart', 'order' => $sort_asc ? 'ASC' : 'DESC'));\n return $events;\n }", " // create a pseudo global view_registrants permission\n public static function checkPermissions($permission,$location) {\n global $exponent_permissions_r, $router;", " // only applies to the 'view_registrants' method\n if (empty($location->src) && empty($location->int) && $router->params['action'] == 'view_registrants') {\n if (!empty($exponent_permissions_r['eventregistration'])) foreach ($exponent_permissions_r['eventregistration'] as $page) {\n foreach ($page as $pageperm) {\n if (!empty($pageperm['view_registrants']) || !empty($pageperm['manage'])) return true;\n }\n }\n }\n return false;\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class orderController extends expController {", " protected $add_permissions = array(", " 'showall' => 'Manage',\n 'show' => 'View Orders',", " 'setStatus' => 'Change Status',\n 'edit_payment_info' => 'Edit Payment Info',\n 'save_payment_info'=> 'Save Payment Info',\n 'edit_address' => 'Edit Address',\n 'save_address'=> 'Save Address',\n 'edit_order_item' => 'Edit Order Item',\n 'save_order_item'=> 'Save Order Item',\n 'add_order_item' => 'Add Order Item',\n 'save_new_order_item'=> 'Save New Order Item',\n 'edit_totals' => 'Edit Totals',\n 'save_totals'=> 'Save Totals',\n 'edit_invoice_id' => 'Edit Invoice Id',\n 'save_invoice_id'=> 'Save Invoice Id',\n 'update_sales_reps' => 'Manage Sales Reps',\n 'quickfinder'=> 'Do a quick order lookup',\n 'edit_shipping_method'=> 'Edit Shipping Method',\n 'save_shipping_method'=> 'Save Shipping Method',\n 'create_new_order' => 'Create A New Order',\n 'save_new_order'=> 'Save a new order',\n 'createReferenceOrder'=> 'Create Reference Order',\n 'save_reference_order'=> 'Save Reference Order'", " );", " static function displayname() {\n return gt(\"e-Commerce Order Manager\");\n }", " static function description() {\n return gt(\"Use this module to manage the orders from your ecommerce store.\");\n }", " function showall() {\n global $db;", " expHistory::set('viewable', $this->params);", " // remove abaondoned carts\n /*$count = $db->countObjects('orders', 'purchased=0');\n for($i=0; $i<$count; $i++) {\n // get the cart\n $cart = $db->selectObject('orders','purchased=0');", " ", " // check to make sure this isn't an active session\n $ticket = $db->selectObject('sessionticket', \"ticket='\".$cart->sessionticket_ticket.\"'\");\n if (empty($ticket)) {\n // delete all the order items for this cart and their shippingmethods\n foreach($db->selectObjects('orderitems', 'orders_id='.$cart->id) as $oi) {\n $db->delete('shippingmethods', 'id='.$oi->shippingmethods_id);", " $db->delete('orderitems', 'orders_id='.$cart->id); ", " }", " ", " // delete the billing methods for this cart.\n $db->delete('billingmethods', 'orders_id='.$cart->id);\n $db->delete('orders', 'id='.$cart->id);", " } \n ", " } */", " // find orders with a \"closed\" status type\n// $closed_count = 0;\n if (empty($this->params['showclosed'])) {\n $closed_status = $db->selectColumn('order_status', 'id', 'treat_as_closed=1');\n $closed_status = implode(',',$closed_status);\n// $status_where = '';\n $status_where = ' AND order_status_id NOT IN (' . $closed_status . ')';", "// foreach ($closed_status as $status) {\n// if (empty($status_where)) {\n// $status_where .= ' AND (order_status_id!=' . $status;\n// } else {\n// $status_where .= ' AND order_status_id!=' . $status;\n// }\n// $closed_count += $db->countObjects('orders', 'order_status_id=' . $status);\n// }\n $closed_count = $db->countObjects('orders', 'order_status_id IN (' . $closed_status . ')');\n } else {\n $status_where = '';\n $closed_count = -1;\n }", " // build out a SQL query that gets all the data we need and is sortable.\n $sql = 'SELECT o.*, b.firstname as firstname, b.billing_cost as total, b.transaction_state as paid, b.billingcalculator_id as method, b.middlename as middlename, b.lastname as lastname, os.title as status, ot.title as order_type ';\n $sql .= 'FROM ' . $db->prefix . 'orders o, ' . $db->prefix . 'billingmethods b, ';\n $sql .= $db->prefix . 'order_status os, ';\n $sql .= $db->prefix . 'order_type ot ';\n $sql .= 'WHERE o.id = b.orders_id AND o.order_status_id = os.id AND o.order_type_id = ot.id AND o.purchased > 0';\n //FIXME this sql isn't correct???\n// if (!empty($status_where)) {\n// $status_where .= ')';\n $sql .= $status_where;\n// }\n if (ECOM_LARGE_DB) {\n $limit = empty($this->config['limit']) ? 50 : $this->config['limit'];\n } else {\n $limit = 0; // we'll paginate on the page\n }\n //eDebug($sql, true);\n $page = new expPaginator(array(\n //'model'=>'order',\n 'sql' => $sql,\n 'order' => 'purchased',\n 'dir' => 'DESC',\n 'limit' => $limit,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=> $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Customer') => 'lastname',\n gt('Inv #') => 'invoice_id',\n gt('Total') => 'total',\n gt('Payment') => 'method',\n gt('Purchased') => 'purchased',\n gt('Type') => 'order_type_id',\n gt('Status') => 'order_status_id',\n gt('Ref') => 'orig_referrer',\n )\n ));\n //eDebug($page,true);\n assign_to_template(array(\n 'page' => $page,\n 'closed_count'=> $closed_count,\n 'new_order' => order::getDefaultOrderStatus()\n ));\n }", " function show() {\n global $db, $user;\n//eDebug($_REQUEST);\n//eDebug($this->params,true);\n//if (!empty($this->params['printerfriendly'])) $_REQUEST['printerfriendly'] = 1;", " expHistory::set('viewable', $this->params);", " if (!empty($this->params['invoice']) && empty($this->params['id'])) {\n $ord = new order();\n $order = $ord->find('first', 'invoice_id=' . $this->params['invoice']);\n $this->params['id'] = $order->id;\n } elseif (!empty($this->params['id'])) {\n $order = new order($this->params['id']);\n }\n if (empty($order->id)) {\n flash('notice', gt('That order does not exist.'));\n expHistory::back();\n }", " // We're forcing the location. Global store setting will always have this loc\n// $storeConfig = new expConfig(expCore::makeLocation(\"ecomconfig\",\"@globalstoresettings\",\"\"));", " $billing = new billing($this->params['id']);\n $status_messages = $db->selectObjects('order_status_messages');\n $order_type = $order->getOrderType();\n //eDebug($order->billingmethod[0]->billingtransaction);\n $order->billingmethod[0]->billingtransaction = array_reverse($order->billingmethod[0]->billingtransaction);\n if (empty($order->billingmethod[0]->billingtransaction[0]->billingcalculator_id)) {\n $calc_name = $order->billingmethod[0]->billingcalculator->calculator_name;\n $order->billingmethod[0]->billingtransaction[0]->billingcalculator = new $calc_name();\n }\n //eDebug($order->billingmethod[0]->billingtransaction);\n if (isset($this->params['printerfriendly']))\n $pf = $this->params['printerfriendly'];\n else\n $pf = 0;", " $to_addresses[] = $order->billingmethod[0]->email;\n// $s = array_pop($order->shippingmethods); //FIXME we don't really want to 'pop' it off the object\n $s = reset($order->shippingmethods);\n if ($s->email != $order->billingmethod[0]->email) $to_addresses[] = $s->email;", " $from_addresses = array();\n $from_addresses[SMTP_FROMADDRESS] = SMTP_FROMADDRESS;\n $from_addresses[ecomconfig::getConfig('from_address')] = ecomconfig::getConfig('from_address');\n $from_addresses[$user->email] = $user->email;\n $from_addresses['other'] = 'Other (enter below)';\n $from_addresses = array_filter($from_addresses);\n $from_default = ecomconfig::getConfig('from_address');\n $from_default = !empty($from_default) ? $from_default : SMTP_FROMADDRESS;", " $email_subject = 'Message from ' . ecomconfig::getConfig('storename') . ' about your order (#' . $order->invoice_id . ')';", " $order->setReferencingIds();", " $css = file_get_contents(BASE . 'framework/modules/ecommerce/assets/css/print-invoice.css');", " assign_to_template(array(\n 'css' => $css,\n 'pf' => $pf,\n 'order' => $order,\n 'order_user' => new user($order->user_id),\n// 'shipping' => $order->orderitem[0], //FIXME what about new orders with no items??\n 'billing' => $billing,\n 'billinginfo' => $billing->getBillingInfo(),\n 'messages' => $status_messages,\n 'order_type' => $order_type,\n// 'storeConfig' => $storeConfig->config,\n 'sales_reps' => order::getSalesReps(),\n 'from_addresses' => $from_addresses,\n 'from_default' => $from_default,\n 'email_subject' => $email_subject,\n 'to_addresses' => implode(',', $to_addresses)\n ));\n if ($order->shipping_required) {\n assign_to_template(array(\n 'shipping' => $order->orderitem[0], //FIXME what about new orders with no items??\n ));\n }\n }", " function myOrder() {\n global $user, $db;", " $order = new order($this->params['id']);\n if ($order->purchased == 0)\n flashAndFlow('error', gt('You do not have permission to view this order.'));", " $this->loc->src = \"@globalstoresettings\";", " // We're forcing the location. Global store setting will always have this loc\n// $storeConfig = new expConfig(expCore::makeLocation(\"ecomconfig\",\"@globalstoresettings\",\"\"));", " //check here for the hash in the params, or session set w/ perms to view...shs = xaf7y0s87d7elshd70 etc\n //if present, prompt user for the order number and email address on the order\n //and if they pass, show the order to them. Need to maybe set something in the session then for subsequent", " //viewing of the order? ", " if ($user->id != $order->user_id) {\n if ($user->isAdmin()) {\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['id']));\n } else {\n flashAndFlow('error', gt('You do not have permission to view this order.'));\n }\n }", " expHistory::set('viewable', $this->params);", " $billing = new billing($this->params['id']);\n $status_messages = $db->selectObjects('order_status_messages');\n $order_type = $order->getOrderType();\n $order->total_items = 0;\n foreach ($order->orderitem as $item) {\n $order->total_items += $item->quantity;\n $order->shipping_city = $item->shippingmethod->city;\n $order->shipping_state = $item->shippingmethod->state;\n }\n $state = new geoRegion($order->shipping_state);\n $country = new geoCountry($state->country_id);\n $order->shipping_country = $country->iso_code_3letter;\n $order->shipping_state = $state->name;", " //eDebug($order,true);", " $order->billingmethod[0]->billingtransaction = array_reverse($order->billingmethod[0]->billingtransaction);\n if (isset($this->params['printerfriendly'])) $pf = $this->params['printerfriendly'];\n else $pf = 0;\n $css = file_get_contents(BASE . 'framework/modules/ecommerce/assets/css/print-invoice.css');", " $order->calculateGrandTotal();", " $trackMe = false;\n if (isset($this->params['tc']) && $this->params['tc'] == 1) {\n if (expSession::is_set('orders_tracked')) {\n $trackingArray = expSession::get('orders_tracked');\n if (in_array($order->invoice_id, $trackingArray)) {\n $trackMe = false;\n } else {\n $trackMe = true;\n $trackingArray[] = $order->invoice_id;\n expSession::set('orders_tracked', $trackingArray);\n }\n } else {\n $trackMe = true;\n $trackingArray[] = $order->invoice_id;\n expSession::set('orders_tracked', $trackingArray);\n }\n }\n if (DEVELOPMENT != 0)\n $trackMe = false;\n assign_to_template(array(\n 'printerfriendly'=> $pf,\n 'css' => $css,\n 'order' => $order,\n 'shipping' => $order->orderitem[0],\n 'billing' => $billing,\n 'billinginfo' => $billing->getBillingInfo(),\n 'order_type' => $order_type,\n// 'storeConfig' => $storeConfig->config,\n 'tc' => $trackMe,\n 'checkout' => !empty($this->params['tc']) //FIXME we'll use the tc param for now\n ));", " }", " function email() {\n global $template, $user;", " // setup a template suitable for emailing\n $template = expTemplate::get_template_for_action($this, 'email_invoice', $this->loc);\n $order = new order($this->params['id']);\n $billing = new billing($this->params['id']);\n// if ($billing->calculator != null) {\n// $billinginfo = $billing->calculator->userView(unserialize($billing->billingmethod->billing_options));\n// } else {\n// if (empty($opts)) {\n// $billinginfo = false;\n// } else {\n// $billinginfo = gt(\"No Cost\");\n// if (!empty($opts->payment_due)) {\n// $billinginfo .= '<br>'.gt('Payment Due') . ': ' . expCore::getCurrencySymbol() . number_format($opts->payment_due, 2, \".\", \",\");\n// }\n// }\n// }\n $css = file_get_contents(BASE.'framework/modules/ecommerce/assets/css/print-invoice.css');\n assign_to_template(array(\n 'css' => $css,\n 'order' => $order,\n 'shipping' => $order->orderitem[0],\n 'billing' => $billing,\n 'billinginfo' => $billing->getBillingInfo(),\n ));", " // build the html and text versions of the message\n $html = $template->render();\n $txt = strip_tags($html);", " // send email invoices to the admins if needed\n if (ecomconfig::getConfig('email_invoice') == true) {\n $addresses = explode(',', ecomconfig::getConfig('email_invoice_addresses'));\n foreach ($addresses as $address) {\n $mail = new expMail();\n $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n $mail->quickSend(array(\n 'html_message'=> $html,\n 'text_message'=> $txt,\n 'to' => trim($address),\n 'from' => $from,\n 'subject' => 'An order was placed on the ' . ecomconfig::getConfig('storename'),\n ));\n }\n }", " // email the invoice to the user if we need to\n if (ecomconfig::getConfig('email_invoice_to_user') == true && !empty($user->email)) {\n $usermsg = \"<p>\" . ecomconfig::getConfig('invoice_msg') . \"<p>\";\n $usermsg .= $html;\n// $usermsg .= ecomconfig::getConfig('ecomfooter');", " $mail = new expMail();\n $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n $mail->quickSend(array(\n 'html_message'=> $usermsg,\n 'text_message'=> $txt,\n 'to' => array(trim($user->email) => trim(user::getUserAttribution($user->id))),\n //'to'=>$order->billingmethod[0]->email,\n 'from' => $from,\n 'subject' => ecomconfig::getConfig('invoice_subject'),\n ));\n }\n }", " function update_shipping() {\n $order = new order($this->params['id']);\n $this->params['shipped'] = datetimecontrol::parseData('shipped', $this->params);\n $order->update($this->params);\n flash('message', gt('Shipping information updated.'));\n expHistory::back();\n }", " function getPDF($orders = null) {\n global $user, $timer;", " $invoice = '<!DOCTYPE HTML><HTML><HEAD>';\n // the basic styles\n if (!bs3())\n $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'external/normalize/normalize.css\" >';\n if (!bs())\n// $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'external/normalize/normalize.css\" >';\n if (bs2())\n $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'external/bootstrap/css/bootstrap.css\" >';\n if (bs3())\n $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'external/bootstrap3/css/bootstrap.css\" >';\n $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'framework/modules/ecommerce/assets/css/print-invoice.css\">\n <style>\n html{background:none;}\n #store-header{text-align:left;}\n </style>';\n $invoice .= '</HEAD><BODY>';\n if (is_array($orders)) {\n foreach ($orders as $order) {\n if ($user->isAdmin()) {\n $invoice .= renderAction(array('controller'=> 'order', 'action'=> 'show', 'view'=> 'show_printable', 'id'=> $order['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));", " //eDebug($order['id'] . \": \" . $timer->mark()); ", " } else {\n $invoice .= renderAction(array('controller'=> 'order', 'action'=> 'myOrder', 'view'=> 'show_printable', 'id'=> $order['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));\n }\n $invoice .= '<p style=\"page-break-before: always;\"></p>';\n }\n $invoice = substr($invoice, 0, (strlen($invoice) - 42));\n } else {\n if ($user->isAdmin()) {\n $invoice .= renderAction(array('controller'=> 'order', 'action'=> 'show', 'view'=> 'show_printable', 'id'=> $this->params['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));\n } else {\n $invoice .= renderAction(array('controller'=> 'order', 'action'=> 'myOrder', 'view'=> 'show_printable', 'id'=> $this->params['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));\n }\n }", " $invoice .= \"</BODY></HTML>\";\n $invoice = mb_convert_encoding($invoice, 'HTML-ENTITIES', \"UTF-8\");\n // eDebug($invoice);\n $org_name = str_ireplace(\" \", \"_\", ORGANIZATION_NAME);", " //eDebug(\"Here\",1);\n // Actually create/output the pdf file", " /**\n * to do this same thing as below using html2pdf\n * //FIXME uncomment to implement, comment out above\n require_once(BASE.'external/html2pdf_v4.03/html2pdf.class.php');\n $html2pdf = new HTMLTPDF('P', 'LETTER', substr(LOCALE,0,2));\n $html2pdf->writeHTML($invoice);\n $html2pdf->Output($org_name . \"_Invoice\" . \".pdf\",HTMLTOPDF_OUTPUT?'D':'');\n exit();\n */\n /**\n * to do this same thing as below using dompdf\n * //FIXME uncomment to implement, comment out above\n require_once(BASE.'external/dompdf/dompdf_config.inc.php');\n $mypdf = new DOMPDF();\n $mypdf->load_html($invoice);\n $mypdf->set_paper('letter','portrait');\n $mypdf->render();\n $mypdf->stream($org_name . \"_Invoice\" . \".pdf\",array('Attachment'=>HTMLTOPDF_OUTPUT));\n exit();\n */\n /**\n * to do this same thing as below using expHtmlToPDF\n */\n $mypdf = new expHtmlToPDF('Letter','portrait',$invoice);\n $mypdf->createpdf('D',$org_name . \"_Invoice\" . \".pdf\");\n exit();", " if (stristr(PHP_OS, 'Win')) {\n if (file_exists(HTMLTOPDF_PATH)) {\n do {\n $htmltopdftmp = HTMLTOPDF_PATH_TMP . mt_rand() . '.html';\n } while (file_exists($htmltopdftmp));\n }\n file_put_contents($htmltopdftmp, $invoice);", " exec(HTMLTOPDF_PATH . \" \" . $htmltopdftmp . \" \" . HTMLTOPDF_PATH_TMP . $org_name . \"_Invoice.pdf\");\n $this->returnFile(HTMLTOPDF_PATH_TMP . $org_name . \"_Invoice.pdf\", $org_name . \"_Invoice.pdf\", \"pdf\");\n exit();\n } else {", " //require_once(BASE.'external/tcpdf/config/lang/eng.php');\n //require_once(BASE.'external/tcpdf/tcpdf.php');", " //----\n // create new PDF document\n /*$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);", "// set document information\n$pdf->SetCreator(PDF_CREATOR);\n$pdf->SetAuthor('Nicola Asuni');\n$pdf->SetTitle('TCPDF Example 001');\n$pdf->SetSubject('TCPDF Tutorial');\n$pdf->SetKeywords('TCPDF, PDF, example, test, guide');", "// set default header data\npdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING);", "// set header and footer fonts\n$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));\n$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));", "// set default monospaced font\n$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);", "//set margins\n$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);\n$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);\n$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);", "// remove default header/footer\n$pdf->setPrintHeader(false);\n$pdf->setPrintFooter(false);", "//set auto page breaks\n$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);", "//set image scale factor\n$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);", "//set some language-dependent strings\n$pdf->setLanguageArray($l);", "// ---------------------------------------------------------", "// set default font subsetting mode\n//$pdf->setFontSubsetting(true);", "// Set font\n// dejavusans is a UTF-8 Unicode font, if you only need to\n// print standard ASCII chars, you can use core fonts like\n// helvetica or times to reduce file size.\n//$pdf->SetFont('helvetica', '', 14, '', true);", "// Add a page\n// This method has several options, check the source code documentation for more information.\n$pdf->AddPage();\n//eDebug($invoice,1);\n// Print text using writeHTMLCell()\n//$pdf->writeHTML($w=0, $h=0, $x='', $y='', $invoice, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);\n$pdf->writeHTML($invoice);", "// ---------------------------------------------------------", "// Close and output PDF document\n// This method has several options, check the source code documentation for more information.\nob_clean();\n$pdf->Output('example_001.pdf', 'I');\nexit();\n//============================================================+\n// END OF FILE\n//============================================================+\n", " ", " // create new PDF document\n $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);", " // set document information\n $pdf->SetCreator(PDF_CREATOR);\n $pdf->SetAuthor(ORGANIZATION_NAME);\n $pdf->SetTitle($org_name . \"_Invoice\");\n $pdf->SetSubject($org_name . \"_Invoice\");\n // remove default header/footer\n $pdf->setPrintHeader(false);\n $pdf->setPrintFooter(false);", " // set default monospaced font\n $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);", " //set margins\n $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);", " //set auto page breaks\n $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);\n $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $invoice, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);\n $pdf->Output($org_name . \"_Invoice\" . \".pdf\", 'I');\n exit();*/\n eDebug(\"Done rendering invoice html. Starting PDF Generation: \" . $timer->mark());\n $pdfer = new expHtmlToPDF('Letter', 'Portrait', $invoice);\n// $pdfer->set_html($invoice);\n// $pdfer->set_orientation('Portrait');\n// $pdfer->set_page_size('Letter');\n $pdfer->set_grayscale(true);\n// $pdfer->render();\n eDebug(\"Done rendering PDF \" . $timer->mark());\n// exit();\n ob_clean();\n $pdfer->createpdf('D', $org_name . \"_Invoice\" . \".pdf\");\n exit();\n }\n }", " private function returnFile($file, $name, $mime_type = '') {\n /*\n This function takes a path to a file to output ($file),\n the filename that the browser will see ($name) and\n the MIME type of the file ($mime_type, optional).", " If you want to do something on download abort/finish,\n register_shutdown_function('function_name');\n */\n if (!is_readable($file)) die('File not found or inaccessible!');", " $size = filesize($file);\n $name = rawurldecode($name);", " /* Figure out the MIME type (if not specified) */\n $known_mime_types = array(\n \"pdf\" => \"application/pdf\",\n \"txt\" => \"text/plain\",\n \"html\" => \"text/html\",\n \"htm\" => \"text/html\",\n \"exe\" => \"application/octet-stream\",\n \"zip\" => \"application/zip\",\n \"doc\" => \"application/msword\",\n \"xls\" => \"application/vnd.ms-excel\",\n \"ppt\" => \"application/vnd.ms-powerpoint\",\n \"gif\" => \"image/gif\",\n \"png\" => \"image/png\",\n \"jpeg\" => \"image/jpg\",\n \"jpg\" => \"image/jpg\",\n \"php\" => \"text/plain\"\n );", " if ($mime_type == '') {\n// $file_extension = strtolower(substr(strrchr($file, \".\"), 1));\n//\n// if (array_key_exists($file_extension, $known_mime_types)) {\n// $mime_type = $known_mime_types[$file_extension];\n// } else {\n// $mime_type = \"application/force-download\";\n// }\n $mime_type = expFile::getMimeType($file);\n }", " //@ob_end_clean(); //turn off output buffering to decrease cpu usage\n // required for IE, otherwise Content-Disposition may be ignored\n if (ini_get('zlib.output_compression'))\n ini_set('zlib.output_compression', 'Off');", " header('Content-Type: ' . $mime_type);\n header('Content-Disposition: attachment; filename=\"' . $name . '\"');\n header('Content-Transfer-Encoding: binary');\n header('Accept-Ranges: bytes');", " /* The three lines below basically make the download non-cacheable */\n header('Cache-control: private');\n header('Pragma: private');\n// header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');", " // multipart-download and download resuming support\n if (isset($_SERVER['HTTP_RANGE'])) {\n list($a, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);\n list($range) = explode(',', $range, 2);\n list($range, $range_end) = explode('-', $range);", " $range = intval($range);", " $range_end = (!$range_end) ? $size - 1 : intval($range_end);\n $new_length = $range_end - $range + 1;", " header('HTTP/1.1 206 Partial Content');\n header('Content-Length: ' . $new_length);\n header('Content-Range: bytes ' . ($range - $range_end / $size));\n } else {\n $new_length = $size;", " header('Content-Length: ' . $size);\n }", " /* output the file itself */\n $chunksize = 1 * (1024 * 1024); //you may want to change this\n $bytes_send = 0;", " if ($file = fopen($file, 'r')) {\n if (isset($_SERVER['HTTP_RANGE'])) fseek($file, $range);", " while (!feof($file) && (!connection_aborted()) && ($bytes_send < $new_length)) {\n $buffer = fread($file, $chunksize);", " print($buffer);\n flush();", " $bytes_send += strlen($buffer);\n }", " fclose($file);\n } else {\n die('Error - can not open file.');\n }\n }", " function set_order_type() { //FIXME never used\n// global $db;", " if (empty($this->params['id'])) expHistory::back();", " // get the order and update the type\n $order = new order($this->params['id']);\n $order->order_type_id = $this->params['order_type_id'];\n $order->save();\n flash('message', gt('Invoice #') . $order->invoice_id . ' ' . gt('has been set to') . ' ' . $order->getOrderType());\n expHistory::back();\n }", " /**\n * Change order status and email notification if necessary\n */\n function setStatus() {\n global $db, $template;", " if (empty($this->params['id'])) expHistory::back();", " // get the order and create a new order_Status_change\n $order = new order($this->params['id']);", " //set order type\n if (isset($this->params['order_type_id'])) $order->order_type_id = $this->params['order_type_id'];", " //only save the status change if it actually changed to something different\n if ($order->order_status_id != $this->params['order_status_id']) {\n if (empty($this->params['order_status_messages'])) {\n $comment = $this->params['comment'];\n } else {\n $comment = $this->params['order_status_messages'];\n }\n // save the order status change\n $change = new order_status_changes();\n $change->from_status_id = $order->order_status_id;\n $change->comment = $comment;\n $change->to_status_id = $this->params['order_status_id'];\n $change->orders_id = $order->id;\n $change->save();", " // update the status of the order\n $order->order_status_id = $this->params['order_status_id'];", " // Save the message for future use if that is what the user wanted.\n if (!empty($this->params['save_message']) && !empty($this->params['comment'])) {\n $message = new stdClass();\n $message->body = $this->params['comment'];\n $db->insertObject($message, 'order_status_messages');\n }", " // email the user if we need to\n if (!empty($this->params['email_user'])) {\n $email_addy = $order->billingmethod[0]->email;\n if (!empty($email_addy)) {\n $from_status = $db->selectValue('order_status', 'title', 'id=' . $change->from_status_id);\n $to_status = $db->selectValue('order_status', 'title', 'id=' . $change->to_status_id);", " if ($order->shippingmethod->carrier == 'UPS') {\n $carrierTrackingLink = \"http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=\";\n } elseif ($order->shippingmethod->carrier == 'FedEx') {\n $carrierTrackingLink = \"http://www.fedex.com/Tracking?action=track&tracknumbers=\";\n } elseif ($order->shippingmethod->carrier == 'USPS') {\n $carrierTrackingLink = \"https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=\";\n }", " assign_to_template(array(\n 'comment' => $change->comment,\n 'to_status' => $to_status,\n 'from_status' => $from_status,\n 'order' => $order,\n 'date' => date(\"F j, Y, g:i a\"),\n 'storename' => ecomconfig::getConfig('storename'),\n 'include_shipping'=> isset($this->params['include_shipping_info']) ? true : false,\n 'tracking_link' => $carrierTrackingLink . $order->shipping_tracking_number,\n 'carrier' => $order->shippingmethod->carrier\n ));", " $html = $template->render();\n $html .= ecomconfig::getConfig('ecomfooter');", " $mail = new expMail();\n $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n $mail->quickSend(array(\n 'html_message'=> $html,\n 'text_message'=> str_replace(\"<br>\", \"\\r\\n\", $template->render()),\n 'to' => array($email_addy => $order->billingmethod[0]->firstname . ' ' . $order->billingmethod[0]->lastname),\n 'from' => $from,\n 'subject' => 'The status of your order (#' . $order->invoice_id . ') has been updated on ' . ecomconfig::getConfig('storename') . '.'\n ));\n } else {\n flash('error', gt('The email address was NOT send. An email address count not be found for this customer'));\n }\n }\n flash('message', gt('Order Type and/or Status Updated.'));\n } else {\n flash('message', gt('Order Type and/or Status was not changed.'));\n }", " $order->save();\n expHistory::back();\n }", " function emailCustomer() {\n //eDebug($this->params,true);\n global $db, $template, $user;", " if (empty($this->params['id'])) expHistory::back();", " // get the order\n $order = new order($this->params['id']);", " if (empty($this->params['order_status_messages'])) {\n $email_message = $this->params['email_message'];\n } else {\n $email_message = $this->params['order_status_messages'];\n }", " // Save the message for future use if that is what the user wanted.\n if (!empty($this->params['save_message']) && !empty($this->params['email_message'])) {\n $message = new stdClass();\n $message->body = $this->params['email_message'];\n $db->insertObject($message, 'order_status_messages');\n }", " $email_addys = explode(',', $this->params['to_addresses']); //$order->billingmethod[0]->email;\n //eDebug($email_addy,true);\n if (!empty($email_addys)) {\n assign_to_template(array(\n 'message'=> $email_message\n ));\n $html = $template->render();\n if (!empty($this->params['include_invoice'])) {\n $html .= '<hr><br>';\n $html .= renderAction(array('controller'=> 'order', 'action'=> 'show', 'view'=> 'email_invoice', 'id'=> $this->params['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));\n } else {\n $html .= ecomconfig::getConfig('ecomfooter');\n }", " //eDebug($html,true);\n if (isset($this->params['from_address'])) {\n if ($this->params['from_address'] == 'other') {\n $from = $this->params['other_from_address'];\n } else {\n $from = $this->params['from_address'];\n }\n } else {\n $from = ecomconfig::getConfig('from_address');\n }\n if (empty($from[0])) $from = SMTP_FROMADDRESS;", " if (isset($this->params['email_subject'])) {\n $email_subject = $this->params['email_subject'];\n } else {\n $email_subject = gt('Message from') . ' ' . ecomconfig::getConfig('storename') . ' ' . gt('about your order') . ' (#' . $order->invoice_id . ')';\n }", " $mail = new expMail();\n //FIXME Unless you need each mail sent separately, you can now set 'to'=>$email_addys and let expMail send a single email to all addresses\n foreach ($email_addys as $email_addy) {\n $mail->quickSend(array(\n 'html_message'=> $html,\n 'text_message'=> str_replace(\"<br>\", \"\\r\\n\", $template->render()),\n 'to' => $email_addy,\n 'from' => $from,\n 'subject' => $email_subject\n ));\n }\n $emailed_to = implode(',', $email_addys);", " // manually add/attach an expSimpleNote to the order\n $note = new expSimpleNote();\n $note->body = \"<strong>[\" . gt('action') . \"]: \" . gt('Emailed message to') . \" \" . $emailed_to . \":</strong>\" . $email_message;\n $note->approved = 1;\n $note->name = $user->firstname . \" \" . $user->lastname;\n $note->email = $user->email;", " $note->save();\n $note->refresh();\n// $noteObj = new stdClass();\n// $noteObj->expsimplenote_id = $note->id;\n// $noteObj->content_id = $order->id;\n// $noteObj->content_type = 'order';\n// $db->insertObject($noteObj, 'content_expSimpleNote');\n $note->attachNote('order', $order->id);\n", " //eDebug($note,true); ", " } else {\n flash('error', gt('The email was NOT sent. An email address was not found for this customer'));\n expHistory::back();\n }", " flash('message', gt('Email sent.'));\n expHistory::back();\n }", " function ordersbyuser() {\n global $user;", " // if the user isn't logged in flash an error msg\n if (!$user->isLoggedIn()) expQueue::flashAndFlow('error', gt('You must be logged in to view past orders.'));", " expHistory::set('viewable', $this->params);\n $page = new expPaginator(array(\n 'model' => 'order', //FIXME we should also be getting the order status name\n 'where' => 'purchased > 0 AND user_id=' . $user->id,\n 'limit' => 10,\n 'order' => 'purchased',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=> $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Date Purchased')=> 'purchased',\n gt('Invoice #') => 'invoice_id',\n )\n ));\n assign_to_template(array(\n 'page'=> $page\n ));", " }", " function metainfo() {\n global $router;", " if (empty($router->params['action'])) return false;\n", " // figure out what metadata to pass back based on the action ", " // we are in.\n $action = $router->params['action'];\n $metainfo = array('title'=>'', 'keywords'=>'', 'description'=>'', 'canonical'=> '', 'noindex' => true, 'nofollow' => true);\n $storename = ecomconfig::getConfig('storename');\n switch ($action) {\n case 'myOrder':\n case 'show':\n case 'showByTitle':\n if (!empty($router->params['id'])) {\n $order = new order($router->params['id']);\n } elseif (!empty($router->params['invoice'])) {\n $order = $this->order->find('first', 'invoice_id=' . $router->params['invoice']);\n } else {\n $order = $this->order;\n }\n $metainfo['title'] = gt('Viewing Order') . ' #' . $order->invoice_id . ' - ' . $storename;\n $metainfo['keywords'] = empty($order->meta_keywords) ? SITE_KEYWORDS : $order->meta_keywords;\n $metainfo['description'] = empty($order->meta_description) ? SITE_DESCRIPTION : $order->meta_description;\n// $metainfo['canonical'] = empty($order->canonical) ? $router->plainPath() : $order->canonical;\n// $metainfo['noindex'] = empty($order->meta_noindex) ? false : $order->meta_noindex;\n// $metainfo['nofollow'] = empty($order->meta_nofollow) ? false : $order->meta_nofollow;\n break;\n case 'showall':\n case 'ordersbyuser':\n default:\n $metainfo['title'] = gt(\"Order Management\") . \" - \" . $storename;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n }", " return $metainfo;\n }", " function captureAuthorization() {\n //eDebug($this->params,true);\n $order = new order($this->params['id']);", " /*eDebug($this->params); ", " //eDebug($order,true);*/\n //eDebug($order,true);\n //$billing = new billing();", " //eDebug($billing, true);\n //$billing->calculator = new $calcname($order->billingmethod[0]->billingcalculator_id);\n $calc = $order->billingmethod[0]->billingcalculator->calculator;\n $calc->config = $order->billingmethod[0]->billingcalculator->config;", " //$calc = new $calc-\n //eDebug($calc,true);\n if (!method_exists($calc, 'delayed_capture')) {\n flash('error', gt('The Billing Calculator does not support delayed capture'));\n expHistory::back();\n }", " $result = $calc->delayed_capture($order->billingmethod[0], $this->params['capture_amt'], $order);", " if (empty($result->errorCode)) {\n flash('message', gt('The authorized payment was successfully captured'));\n expHistory::back();", " } else {\n flash('error', gt('An error was encountered while capturing the authorized payment.') . '<br /><br />' . $result->message);\n expHistory::back();\n }\n }", " function voidAuthorization() {\n $order = new order($this->params['id']);\n $billing = $order->billingmethod[0];", " $calc = $order->billingmethod[0]->billingcalculator->calculator;\n $calc->config = $order->billingmethod[0]->billingcalculator->config;", " if (!method_exists($calc, 'void_transaction')) {\n flash('error', gt('The Billing Calculator does not support void'));\n expHistory::back();\n }", " $result = $calc->void_transaction($order->billingmethod[0], $order);", " if (empty($result->errorCode)) {\n flash('message', gt('The transaction has been successfully voided'));\n expHistory::back();", " } else {\n flash('error', gt('An error was encountered while voiding the authorized payment.') . '<br /><br />' . $result->message);\n expHistory::back();\n }\n }", " function creditTransaction() {\n $order = new order($this->params['id']);\n $billing = new billing($this->params['id']);\n //eDebug($this->params,true);\n $result = $billing->calculator->credit_transaction($billing->billingmethod, $this->params['capture_amt'],$order);", " if ($result->errorCode == '0') {\n flash('message', gt('The transaction has been credited'));\n expHistory::back();", " } else {\n flash('error', gt('An error was encountered while capturing the authorized payment.') . '<br /><br />' . $result->message);\n expHistory::back();\n }\n }", " function edit_payment_info() {\n //$order = new order($this->params['id']);\n $billing = new billing($this->params['id']);\n $opts = expUnserialize($billing->billingmethod->billing_options); //FIXME already unserialized???\n //eDebug($billing);\n// eDebug($opts);\n assign_to_template(array(\n 'orderid'=> $this->params['id'],\n 'opts' => $opts, //FIXME credit card doesn't have a result\n 'billing_cost' => $billing->billingmethod->billing_cost,\n 'transaction_state' => $billing->billingmethod->transaction_state\n ));\n }", " function save_payment_info() {\n //need to save billing methods and billing options\n //$order = new order($this->params['id']);\n //eDebug($this->params, true);\n $res_obj = new stdClass();\n foreach ($this->params['result'] as $resultKey=> $resultItem) {\n $res_obj->$resultKey = $resultItem;\n }\n// $res = serialize($res_obj);\n $billing = new billing($this->params['id']);\n // eDebug($billing);\n $billingmethod = $billing->billingmethod;\n $billingtransaction = $billingmethod->billingtransaction[0];", " // update billing method\n $billingmethod->billing_cost = $this->params['billing_cost'];\n $billingmethod->transaction_state = $this->params['transaction_state'];\n $bmopts = expUnserialize($billingmethod->billing_options);\n $bmopts->result = $res_obj;\n $billingmethod->billing_options = serialize($bmopts);\n// if (!empty($this->params['result']['payment_status']))\n// $billingmethod->transaction_state = $this->params['result']['payment_status']; //FIXME should this be discrete??\n $billingmethod->save();", " // add new billing transaction\n $billingtransaction->billing_cost = $this->params['billing_cost'];\n $billingtransaction->transaction_state = $this->params['transaction_state'];\n $btopts = expUnserialize($billingtransaction->billing_options);\n $btopts->result = $res_obj;\n $billingtransaction->billing_options = serialize($btopts);\n// if (!empty($this->params['result']['payment_status']))\n// $billingtransaction->transaction_state = $this->params['result']['payment_status'];\n $billingtransaction->id = null; // force a new record by erasing the id, easy method to copy record\n// $order = new order($this->params['id']);\n// $billingtransaction->billing_cost = $order->grand_total; //FIXME should it always be the grand total???\n $billingtransaction->save();", "// flashAndFlow('message', gt('Payment info updated.'));\n flash('message', gt('Payment info updated.'));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['id']));\n }", " function edit_shipping_method() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $order = new order($this->params['id']);\n $s = array_pop($order->shippingmethods); //FIXME only getting 1st one and then removing it\n $sm = new shippingmethod($s->id);\n //eDebug($sm);\n assign_to_template(array(\n 'orderid' => $this->params['id'],\n 'shipping'=> $sm\n ));\n }", " function save_shipping_method() {\n if (!isset($this->params['id']) || !isset($this->params['sid']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['sid']);\n $sm->option_title = $this->params['shipping_method_title'];\n $sm->carrier = $this->params['shipping_method_carrier'];\n $sm->save();\n flashAndFlow('message', gt('Shipping method updated.'));\n }", " function edit_parcel() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator(); // add calculator object\n assign_to_template(array(\n 'shipping'=> $sm\n ));\n }", " function save_parcel() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n if (!isset($this->params['in_box']) || !isset($this->params['qty'])) {\n flashAndFlow('notice', gt('Nothing was included in the shipping package!'));\n } else {\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n// $sm_new = clone($sm); // prepare for another 'package' if needed since we didn't place everything in this one\n// $sm_new->id = null;\n// $sm_new->orderitem = array();\n //FIXME for now multiple shipping methods will crash ecom with shipping->__construct()\n foreach ($sm->orderitem as $key => $oi) {\n if (!array_key_exists($oi->id, $this->params['in_box'])) {\n // one of the items by type is not in this package and needs to be moved to another package\n// $tmp = 1;\n// $sm_new->update(); // we don't need to actually create a new shippingmethod until needed\n// $sm->orderitem[$key]->shippingmethods_id = $sm_new->id;\n// $sm->orderitem[$key]->update();\n// unset($sm->orderitem[$key]);\n //NOTE $sm_new->update(); ???\n } else {\n if ($oi->quantity != $this->params['qty'][$oi->id]) {\n // one of the items by quantity is not in this package and remaining items need to be moved another package\n// $tmp = 1;\n// $new_quantity = $oi->quantity - $this->params['qty'][$oi->id];\n// $sm->orderitem[$key]->quantity = $this->params['qty'][$oi->id]; // adjust to new quantity\n// $sm->orderitem[$key]->update();\n// $sm_new->update(); // we don't need to actually create a new shippingmethod until needed\n// $oi->id = null; // create a new orderitem copy\n// $oi->shippingmethods_id = $sm_new->id;\n// $oi->quantity = $new_quantity;\n// $oi->update();\n //NOTE $sm_new->update(); ???\n }\n }\n }\n // update $sm with the passed $this->params (package data)\n $sm->update($this->params); //NOTE will this update assoc orderitems???\n $msg = $sm->calculator->createLabel($sm);\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Shipping package updated.'));\n } else {\n expHistory::back();\n }\n }\n }", " function edit_label() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $method = explode(':', $sm->option);\n//FIXME check for existing rate, if not get next cheapest? (based on predefined package?)\n assign_to_template(array(\n 'shipping'=> $sm,\n 'cost' => $sm->shipping_options['shipment_rates'][$method[0]][$method[1]]['cost']\n ));\n }", " function save_label() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $msg = $sm->calculator->buyLabel($sm);\n// $sm->refresh(); //FIXME updated with new options we may need to take action on like tracking number?\n// $order->shipping_tracking_number = $sm->shipping_options['shipment_tracking_number'];\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Shipping label purchased.'));\n } else {\n expHistory::back();\n }\n }", " function download_label() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $label = $sm->calculator->getLabel($sm);\n expHistory::back();\n }", " function delete_label() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $msg = $sm->calculator->cancelLabel($sm);\n // also need to cancel the pickup if created/purchased\n if (!is_string($msg) && ($sm->shipping_options['pickup_status'] == 'created' || $sm->shipping_options['pickup_status'] == 'purchased')) {\n $msg = $sm->calculator->cancelPickup($sm);\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Shipping label and pickup cancelled and refunded.'));\n }\n } else {\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Shipping label cancelled and refunded.'));\n }\n }\n expHistory::back();\n }", " function edit_pickup()\n {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n assign_to_template(array(\n 'shipping'=> $sm,\n ));\n }", " function edit_pickup2() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $this->params['pickupdate'] = strtotime($this->params['pickupdate']);\n $this->params['pickupenddate'] = strtotime($this->params['pickupenddate']);\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $pickup = $sm->calculator->createPickup($sm, $this->params['pickupdate'], $this->params['pickupenddate'], $this->params['instructions']);\n $sm->refresh();\n $pickup_rates = array();\n foreach ($sm->shipping_options['pickup_rates'] as $pu_rate) {\n $pickup_rates[$pu_rate['id']] = $pu_rate['id'] . ' - ' . expCore::getCurrency($pu_rate['cost']);\n }\n assign_to_template(array(\n 'shipping'=> $sm,\n 'rates' => $pickup_rates\n ));\n }", " function save_pickup() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n //FIXME should we add the params to the $sm->shipping_options, or pass them??\n $msg = $sm->calculator->buyPickup($sm, $this->params['pickuprate']);\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Package pickup ordered.'));\n } else {\n expHistory::back();\n }\n }", " function delete_pickup() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $msg = $sm->calculator->cancelPickup($sm);\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Package pickup cancelled.'));\n } else {\n expHistory::back();\n }\n }", " function createReferenceOrder() {\n if (!isset($this->params['id'])) {\n flashAndFlow('error', gt('Unable to process request. Invalid order number.'));\n// expHistory::back();\n }\n $order = new order($this->params['id']);\n assign_to_template(array(\n 'order'=> $order\n ));\n }", " function save_reference_order() {\n// global $user;", " //eDebug($this->params,true);\n $order = new order($this->params['original_orderid']);", " //eDebug($order,true); ", " //x\n $newOrder = new order();\n $newOrder->order_status_id = $this->params['order_status_id'];\n $newOrder->order_type_id = $this->params['order_type_id'];\n //$newOrder->order_references = $order->id;\n $newOrder->reference_id = $order->id;\n $newOrder->user_id = $order->user_id;\n $newOrder->purchased = time();\n $newOrder->updated = time();\n $newOrder->invoice_id = $newOrder->getInvoiceNumber();\n $newOrder->orderitem = array();\n $newOrder->subtotal = $this->params['subtotal'];\n $newOrder->total_discounts = $this->params['total_discounts'];\n $newOrder->tax = $this->params['tax'];\n $newOrder->shipping_total = $this->params['shipping_total'];\n $newOrder->surcharge_total = $this->params['surcharge_total'];", " if ($this->params['autocalc'] == true) {\n $newOrder->grand_total = ($newOrder->subtotal - $newOrder->total_discounts) + $newOrder->tax + $newOrder->shipping_total + $newOrder->surcharge_total;\n } else {\n $newOrder->grand_total = round($this->params['grand_total'], 2);\n }\n $newOrder->save();\n $newOrder->refresh();", " // save initial order status\n $change = new order_status_changes();\n// $change->from_status_id = null;\n $change->to_status_id = $newOrder->order_status_id;\n $change->orders_id = $newOrder->id;\n $change->save();", " $tObj = new stdClass();\n $tObj->result = new stdClass();\n $tObj->result->errorCode = 0;\n $tObj->result->message = \"Reference Order Pending\";\n $tObj->result->PNREF = \"Pending\";\n $tObj->result->authorization_code = \"Pending\";\n $tObj->result->AVSADDR = \"Pending\";\n $tObj->result->AVSZIP = \"Pending\";\n $tObj->result->CVV2MATCH = \"Pending\";\n $tObj->result->traction_type = \"Pending\";\n $tObj->result->payment_status = \"Pending\";", " $newBillingMethod = $order->billingmethod[0];\n $newBillingMethod->id = null;\n $newBillingMethod->orders_id = $newOrder->id;\n// $newBillingMethod->billingcalculator_id = 6;\n $newBillingMethod->billingcalculator_id = billingcalculator::getDefault();\n $newBillingMethod->billing_cost = 0;\n $newBillingMethod->transaction_state = 'authorization pending';\n $newBillingMethod->billing_options = serialize($tObj);\n $newBillingMethod->save();\n", " //eDebug(expUnserialize($order->billingmethod[0]->billing_options)); \n //eDebug(expUnserialize($order->billingmethod[0]->billingtransaction[0]->billing_options),true); ", "\n $newBillingTransaction = new billingtransaction();\n// $newBillingTransaction->billingcalculator_id = 6; ///setting to manual/passthru\n $newBillingTransaction->billingcalculator_id = billingcalculator::getDefault();\n $newBillingTransaction->billing_cost = 0;\n $newBillingTransaction->billingmethods_id = $newBillingMethod->id;\n $newBillingTransaction->transaction_state = 'authorization pending';", " $newBillingTransaction->billing_options = serialize($tObj);\n $newBillingTransaction->save();", " $sid = $order->orderitem[0]->shippingmethods_id;\n $newShippingMethod = $order->shippingmethods[$sid];\n $newShippingMethod->id = null;\n $newShippingMethod->shipping_cost = 0;\n $newShippingMethod->save();\n $newShippingMethod->refresh();", " foreach ($this->params['oi'] as $oikey=> $oi) {\n //eDebug($oikey);\n $newOi = new orderitem($oikey);\n $newOi->id = null;\n $newOi->quantity = $this->params['quantity'][$oikey];\n $newOi->orders_id = $newOrder->id;\n $newOi->products_name = $this->params['products_name'][$oikey];\n $newOi->products_price = $this->params['products_price'][$oikey];\n $newOi->products_price_adjusted = $this->params['products_price'][$oikey];", " //$newOi->products_tax = 0; ", " $newOi->shippingmethods_id = $newShippingMethod->id;\n $newOi->save();\n }", " $newOrder->shippingmethod = $newShippingMethod;\n $newOrder->billingmethod = $newBillingMethod;\n $newOrder->update(); //FIXME do we need to do this?", " flash('message', gt('Reference Order #') . $newOrder->invoice_id . \" \" . gt(\"created successfully.\"));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $newOrder->id));\n }", " function create_new_order() {\n// $order = new order();\n// assign_to_template(array(\n// 'order'=> $order\n// ));\n }", " function save_new_order() {\n //eDebug($this->params);\n /*addresses_id\n customer_type = 1 //new\n customer_type = 2 //existing Internal\n customer_type = 3 //existing external*/\n// global $user, $db;\n //eDebug($this->params,true);\n //$order = new order($this->params['original_orderid']);", " //eDebug($order,true); ", "\n $newAddy = new address();\n if ($this->params['customer_type'] == 1) {\n //blank order\n $newAddy->save(false);\n } else if ($this->params['customer_type'] == 2) {\n //internal customer\n $newAddy = new address($this->params['addresses_id']);\n } else if ($this->params['customer_type'] == 3) {\n //other customer\n $otherAddy = new external_address($this->params['addresses_id']);\n $newAddy->user_id = $otherAddy->user_id;\n $newAddy->firstname = $otherAddy->firstname;\n $newAddy->lastname = $otherAddy->lastname;\n $newAddy->organization = $otherAddy->organization;\n $newAddy->address1 = $otherAddy->address1;\n $newAddy->address2 = $otherAddy->address2;\n $newAddy->city = $otherAddy->city;\n $newAddy->state = $otherAddy->state;\n $newAddy->zip = $otherAddy->zip;\n $newAddy->phone = $otherAddy->phone;\n $newAddy->email = $otherAddy->email;\n $newAddy->save();\n }", " $newOrder = new order();\n $newOrder->order_status_id = $this->params['order_status_id'];\n $newOrder->order_type_id = $this->params['order_type_id'];\n //$newOrder->order_references = $order->id;\n $newOrder->reference_id = 0;\n $newOrder->user_id = $newAddy->user_id;\n $newOrder->purchased = time();\n $newOrder->updated = time();\n $newOrder->invoice_id = $newOrder->getInvoiceNumber();\n $newOrder->orderitem = array();\n $newOrder->subtotal = 0;\n $newOrder->total_discounts = 0;\n $newOrder->tax = 0;\n $newOrder->shipping_total = 0;\n $newOrder->surcharge_total = 0;\n $newOrder->grand_total = 0;\n $newOrder->save();\n $newOrder->refresh();", " // save initial order status\n $change = new order_status_changes();\n// $change->from_status_id = null;\n $change->to_status_id = $newOrder->order_status_id;\n $change->orders_id = $newOrder->id;\n $change->save();", " $tObj = new stdClass();\n $tObj->result = new stdClass();\n $tObj->result->errorCode = 0;\n $tObj->result->message = \"Reference Order Pending\";\n $tObj->result->PNREF = \"Pending\";\n $tObj->result->authorization_code = \"Pending\";\n $tObj->result->AVSADDR = \"Pending\";\n $tObj->result->AVSZIP = \"Pending\";\n $tObj->result->CVV2MATCH = \"Pending\";\n $tObj->result->traction_type = \"Pending\";\n $tObj->result->payment_status = \"Pending\";", " $newBillingMethod = new billingmethod();\n $newBillingMethod->addresses_id = $newAddy->id;\n $newBillingMethod->orders_id = $newOrder->id;\n// $newBillingMethod->billingcalculator_id = 6;\n $newBillingMethod->billingcalculator_id = billingcalculator::getDefault();\n $newBillingMethod->billing_cost = 0;\n $newBillingMethod->transaction_state = 'authorization pending';\n $newBillingMethod->billing_options = serialize($tObj);\n $newBillingMethod->firstname = $newAddy->firstname;\n $newBillingMethod->lastname = $newAddy->lastname;\n $newBillingMethod->organization = $newAddy->organization;\n $newBillingMethod->address1 = $newAddy->address1;\n $newBillingMethod->address2 = $newAddy->address2;\n $newBillingMethod->city = $newAddy->city;\n $newBillingMethod->state = $newAddy->state;\n $newBillingMethod->zip = $newAddy->zip;\n $newBillingMethod->phone = $newAddy->phone;\n $newBillingMethod->email = $newAddy->email;\n $newBillingMethod->save();\n", " //eDebug(expUnserialize($order->billingmethod[0]->billing_options)); \n //eDebug(expUnserialize($order->billingmethod[0]->billingtransaction[0]->billing_options),true); ", "\n $newBillingTransaction = new billingtransaction();\n// $newBillingTransaction->billingcalculator_id = 6; ///setting to manual/passthru\n $newBillingTransaction->billingcalculator_id = billingcalculator::getDefault();\n $newBillingTransaction->billing_cost = 0;\n $newBillingTransaction->billingmethods_id = $newBillingMethod->id;\n $newBillingTransaction->transaction_state = 'authorization pending';\n $newBillingTransaction->billing_options = serialize($tObj);\n $newBillingTransaction->save();", " $newShippingMethod = new shippingmethod();\n $newShippingMethod->shipping_cost = 0;\n// $newShippingMethod->shippingcalculator_id = $db->selectValue('shippingcalculator', 'id', 'is_default=1');\n $newShippingMethod->shippingcalculator_id = shippingcalculator::getDefault();\n $newShippingMethod->addresses_id = $newAddy->id;\n $newShippingMethod->firstname = $newAddy->firstname;\n $newShippingMethod->lastname = $newAddy->lastname;\n $newShippingMethod->organization = $newAddy->organization;\n $newShippingMethod->address1 = $newAddy->address1;\n $newShippingMethod->address2 = $newAddy->address2;\n $newShippingMethod->city = $newAddy->city;\n $newShippingMethod->state = $newAddy->state;\n $newShippingMethod->zip = $newAddy->zip;\n $newShippingMethod->phone = $newAddy->phone;\n $newShippingMethod->email = $newAddy->email;\n $newShippingMethod->save();\n $newShippingMethod->refresh();", " //FIXME add a fake item?\n// $oi = new orderitem();\n// $oi->orders_id = $newOrder->id;\n// $oi->product_id = 0;\n// $oi->product_type = 'product';\n// $oi->products_name = \"N/A\";\n// $oi->products_model = \"N/A\";\n// $oi->products_price = 0;\n// $oi->shippingmethods_id = $newShippingMethod->id;\n// $oi->save(false);", " $newOrder->shippingmethod = $newShippingMethod;\n $newOrder->billingmethod = $newBillingMethod;\n $newOrder->update();", " flash('message', gt('New Order #') . $newOrder->invoice_id . \" \" . gt(\"created successfully.\"));\n if (empty($this->params['no_redirect'])) {\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $newOrder->id));\n } else {\n return $newOrder->id;\n }\n }", " function edit_address() {\n //if $type = 'b' - business\n //if $type = 's' - shipping\n //addresses_id\n $order = new order($this->params['id']);\n $same = false;", " $sm = array_pop($order->shippingmethods); //FIXME only getting 1st one and then removing it\n //$bm = array_pop($order->billingmethods);", " //eDebug($sm->addresses_id);\n //eDebug($order->billingmethod[0]->addresses_id);\n if ($sm->addresses_id == $order->billingmethod[0]->addresses_id) {\n $same = true;\n // echo \"Yes\";\n //$addy = new address($sm->addresses_id);\n }", " if ($this->params['type'] == 'b') {\n $type = 'billing';\n $addy = new address($order->billingmethod[0]->addresses_id);\n } else if ($this->params['type'] == 's') {\n $type = 'shipping';\n $addy = new address($sm->addresses_id);\n }\n /* eDebug($this->params);\n eDebug($addy);\n eDebug($order,true);*/\n $billingmethod = new billingmethod($this->params['id']);\n //eDebug($billingmethod,true);\n //$opts = expUnserialize($billing->billingmethod->billing_options);\n //eDebug($billing);\n //eDebug($opts);\n assign_to_template(array(\n 'orderid'=> $this->params['id'],\n 'record' => $addy,\n 'same' => $same,\n 'type' => $type\n ));\n }", " function save_address() {\n global $db;", " $order = new order($this->params['orderid']);\n $billing = new billing($this->params['orderid']);\n $s = array_pop($order->shippingmethods); //FIXME only getting 1st one and then removing it\n $shippingmethod = new shippingmethod($s->id);", " //eDebug($order);\n //eDebug($this->params,true);\n //eDebug($shippingmethod);\n $billingmethod = $billing->billingmethod;\n /*\n eDebug($order);\n eDebug($shippingmethod);\n eDebug($billingmethod);*/", " if ($this->params['save_option'] == 0) {\n //update existing\n //echo \"Update\";\n $addy = new address($this->params['addyid']);\n } else if ($this->params['save_option'] == 1) {\n //create new\n //echo \"New\";\n $oldaddy = new address($this->params['addyid']);\n $addy = new address();\n $addy->user_id = $oldaddy->user_id;\n }", " //eDebug($addy,true);", " foreach ($this->params['address'] as $key=> $val) {\n if ($key == 'address_country_id') {\n $key = 'country';\n }\n if ($key == 'address_region_id') {\n $key = 'state';\n }\n $addy->$key = $val;\n if (isset($billingmethod->$key)) $billingmethod->$key = $val;\n if (isset($shippingmethod->$key)) $shippingmethod->$key = $val;\n }\n $addy->is_billing = 0;\n $addy->is_shipping = 0;\n $addy->save();\n $addy->refresh();", " if ($this->params['type'] == 'billing' || ($this->params['same'] == true && $this->params['save_option'] == 0)) {\n //echo \"Billing\";\n $billingmethod->addresses_id = $addy->id;\n $billingmethod->save();\n $addy->is_billing = 1;\n }", " if ($this->params['type'] == 'shipping' || ($this->params['same'] == true && $this->params['save_option'] == 0)) {\n //eDebug(\"Shipping\",true);\n $shippingmethod->addresses_id = $addy->id;\n $shippingmethod->save();\n $addy->is_shipping = 1;\n }", " $addy->save();\n if ($addy->is_default) $db->setUniqueFlag($addy, 'addresses', 'is_default', 'user_id=' . $addy->user_id);", " //eDebug($shippingmethod,true);\n// flashAndFlow('message', gt('Address updated.'));\n flash('message', gt('Address updated.'));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['id']));\n }", " function edit_order_item() {\n $oi = new orderitem($this->params['id'], true, true);\n if (empty($oi->id)) {\n flash('error', gt('Order item doesn\\'t exist.'));\n expHistory::back();\n }\n $oi->user_input_fields = expUnserialize($oi->user_input_fields);\n $params['options'] = $oi->opts;\n $params['user_input_fields'] = $oi->user_input_fields;\n $oi->product = new product($oi->product->id, true, true);\n if ($oi->product->parent_id != 0) {\n $parProd = new product($oi->product->parent_id);", " //$oi->product->optiongroup = $parProd->optiongroup; ", " $oi->product = $parProd;\n }\n //FIXME we don't use selectedOpts?\n// $oi->selectedOpts = array();\n// if (!empty($oi->opts)) {\n// foreach ($oi->opts as $opt) {\n// $option = new option($opt[0]);\n// $og = new optiongroup($option->optiongroup_id);\n// if (!isset($oi->selectedOpts[$og->id]) || !is_array($oi->selectedOpts[$og->id]))\n// $oi->selectedOpts[$og->id] = array($option->id);\n// else\n// array_push($oi->selectedOpts[$og->id], $option->id);\n// }\n// }\n //eDebug($oi->selectedOpts);", " assign_to_template(array(\n 'oi' => $oi,\n 'params' => $params\n ));\n }", " function delete_order_item() {\n $order = new order($this->params['orderid']);\n if (count($order->orderitem) <= 1) {\n flash('error', gt('You may not delete the only item on an order. Please edit this item, or add another item before removing this one.'));\n expHistory::back();\n }", " $oi = new orderitem($this->params['id']);\n $oi->delete();", " $s = array_pop($order->shippingmethods); //FIXME only getting 1st one and then removing it\n $sm = new shippingmethod($s->id);", " $shippingCalc = new shippingcalculator($sm->shippingcalculator_id);\n $calcName = $shippingCalc->calculator_name;\n $calculator = new $calcName($shippingCalc->id);\n $pricelist = $calculator->getRates($order);", " foreach ($pricelist as $rate) {\n if ($rate['id'] == $sm->option) {\n $sm->shipping_cost = $rate['cost'];\n }\n }\n $sm->save();", " $order->refresh();\n $order->calculateGrandTotal();\n $order->save();", "// flashAndFlow('message', gt('Order item removed and order totals updated.'));\n flash('message', gt('Order item removed and order totals updated.'));\n if (empty($this->params['no_redirect'])) redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['orderid']));\n }", " function save_order_item() {\n if (!empty($this->params['id'])) {\n $oi = new orderitem($this->params['id']);\n } else {\n $oi = new orderitem($this->params);\n }\n //eDebug($this->params);", " /*eDebug($oi);\n eDebug(expUnserialize($oi->options));\n eDebug(expUnserialize($oi->user_input_fields),true);*/\n if (!empty($this->params['products_price'])) $oi->products_price = expUtil::currency_to_float($this->params['products_price']);\n $oi->quantity = $this->params['quantity'];\n if (!empty($this->params['products_name'])) $oi->products_name = $this->params['products_name'];", " if ($oi->product->parent_id != 0) {\n $oi->product = new product($oi->product->parent_id, true, false);\n } else {\n //reattach the product so we get the option fields and such\n $oi->product = new product($oi->product->id, true, false);\n }", " if (isset($this->params['product_status_id'])) {\n $ps = new product_status($this->params['product_status_id']);\n $oi->products_status = $ps->title;\n }", " $options = array();\n foreach ($oi->product->optiongroup as $og) {\n $isOptionEmpty = true;\n if (!empty($this->params['options'][$og->id])) {\n foreach ($this->params['options'][$og->id] as $opt) {\n if (!empty($opt)) $isOptionEmpty = false;\n }\n }\n if (!$isOptionEmpty) {\n foreach ($this->params['options'][$og->id] as $opt_id) {\n $selected_option = new option($opt_id);\n $cost = $selected_option->modtype == '$' ? $selected_option->amount : $this->getBasePrice() * ($selected_option->amount * .01);\n $cost = $selected_option->updown == '+' ? $cost : $cost * -1;\n $options[] = array($selected_option->id, $selected_option->title, $selected_option->modtype, $selected_option->updown, $selected_option->amount);\n }\n }\n }", " eDebug($this->params);\n //eDebug($oi,true);", " $user_input_info = array();\n //check user input fields\n //$this->user_input_fields = expUnserialize($this->user_input_fields);\n //eDebug($this,true);\n if (!empty($oi->product->user_input_fields)) foreach ($oi->product->user_input_fields as $uifkey=> $uif) {", " /*if ($uif['is_required'] || (!$uif['is_required'] && strlen($params['user_input_fields'][$uifkey]) > 0)) ", " {\n if (strlen($params['user_input_fields'][$uifkey]) < $uif['min_length'])\n {", " //flash('error', 'test'); \n //redirect_to(array('controller'=>cart, 'action'=>'displayForm', 'form'=>'addToCart', 'product_id'=>$this->id, 'product_type'=>$this->product_type)); ", " $params['error'] .= $uif['name'].' field has a minimum requirement of ' . $uif['min_length'] . ' characters.<br/>';", " ", " }else if (strlen($params['user_input_fields'][$uifkey]) > $uif['max_length'] && $uif['max_length'] > 0)\n {", " //flash('error', ); \n //redirect_to(array('controller'=>cart, 'action'=>'displayForm', 'form'=>'addToCart', 'product_id'=>$this->id, 'product_type'=>$this->product_type)); ", " $params['error'] .= $uif['name'].' field has a maximum requirement of ' . $uif['max_length'] . ' characters.<br/>';", " } ", " }*/\n $user_input_info[] = array($uif['name']=> $this->params['user_input_fields'][$uifkey]);\n }\n //eDebug($options);\n //eDebug($user_input_info,true);", " $oi->options = serialize($options);\n $oi->user_input_fields = serialize($user_input_info);", " //eDebug($oi); ", " $oi->save();\n $oi->refresh();\n //eDebug($oi,true);", " $order = new order($oi->orders_id);\n $order->calculateGrandTotal();", " $s = array_pop($order->shippingmethods); //FIXME only getting 1st one and thenremoving it\n eDebug($s);\n $sm = new shippingmethod($s->id);", " $shippingCalc = new shippingcalculator($sm->shippingcalculator_id);\n $calcName = $shippingCalc->calculator_name;\n $calculator = new $calcName($shippingCalc->id);\n $pricelist = $calculator->getRates($order);", " foreach ($pricelist as $rate) {\n if ($rate['id'] == $sm->option) {\n $sm->shipping_cost = $rate['cost'];\n break;\n }\n }\n $sm->save();\n $order->refresh();\n $order->calculateGrandTotal();\n //FIXME attempt to update w/ new billing transaction\n// $bmopts = expUnserialize($order->billingmethod[0]->billing_options);\n// $bmopts->result->transId = gt('Item edited in order');\n// $order->billingmethod[0]->update(array('billing_options' => serialize($bmopts), 'transaction_state' => $transaction_state));\n// $order->billingmethod[0]->billingcalculator->calculator->createBillingTransaction($order->billingmethod[0], number_format($order->grand_total, 2, '.', ''), $bmopts->result, $bmopts->result->payment_status);\n $order->save();", "// flashAndFlow('message', gt('Order item updated and order totals recalculated.'));\n flash('message', gt('Order item updated and order totals recalculated.'));\n if (empty($this->params['no_redirect'])) {\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['orderid']));\n } else {\n return $oi->id;\n }\n }", " function add_order_item() {\n// eDebug($this->params);\n $product = new product($this->params['product_id']);\n $paramsArray = array('orderid'=> $this->params['orderid']);\n assign_to_template(array(\n 'product'=> $product,\n 'params' => $paramsArray\n ));\n }", " function save_new_order_item() { //FIXME we need to be able to call this from program with $params also, addToOrder\n //eDebug($this->params,true);\n //check for multiple product adding\n $order = new order($this->params['orderid']);\n if (isset($this->params['prod-quantity'])) {\n //we are adding multiple children, so we approach a bit different", " //we'll send over the product_id of the parent, along with id's and quantities of children we're adding ", " foreach ($this->params['prod-quantity'] as $qkey=> &$quantity) {\n if (in_array($qkey, $this->params['prod-check'])) {\n $this->params['children'][$qkey] = $quantity;\n }\n if (isset($child)) $this->params['product_id'] = $child->parent_id;\n }\n }", " $pt = $this->params['product_type'];\n $product = new $pt($this->params['product_id'], true, true); //need true here?", " if ($product->addToCart($this->params, $this->params['orderid'])) {\n $order->refresh();\n $order->calculateGrandTotal();\n //FIXME attempt to update w/ new billing transaction\n// $bmopts = expUnserialize($order->billingmethod[0]->billing_options);\n// $bmopts->result->transId = gt('Item added to order');\n// $order->billingmethod[0]->billingcalculator->calculator->createBillingTransaction($order->billingmethod[0], number_format($order->grand_total, 2, '.', ''), $bmopts->result, $bmopts->result->payment_status);\n $order->save();\n// flashAndFlow('message', gt('Product added to order and order totals recalculated.'));\n flash('message', gt('Product added to order and order totals recalculated.'));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['orderid']));\n }\n /*else\n {\n expHistory::back();\n }*/\n }", " function edit_invoice_id() {\n if (!isset($this->params['id'])) flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $order = new order($this->params['id']);\n assign_to_template(array(\n 'orderid' => $this->params['id'],\n 'invoice_id'=> $order->invoice_id\n ));\n }", " function save_invoice_id() {\n if (!isset($this->params['id'])) flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n if (empty($this->params['invoice_id']) || !is_numeric($this->params['invoice_id'])) flashAndFlow('error', gt('Unable to process request. Invoice ID #.'));\n $order = new order($this->params['id']);\n $order->invoice_id = $this->params['invoice_id'];\n $order->save(false);\n flashAndFlow('message', gt('Invoice # saved.'));\n }", " function edit_totals() {\n //eDebug($this->params);\n $order = new order($this->params['orderid']);\n assign_to_template(array(\n// 'orderid'=>$this->params['id'],\n 'order'=> $order\n ));\n }", " function save_totals() {\n //eDebug($this->params);\n //if(!is_numeric($this->params['subtotal']))\n $order = new order($this->params['orderid']);\n $order->subtotal = expUtil::currency_to_float($this->params['subtotal']);\n $order->total_discounts = expUtil::currency_to_float($this->params['total_discounts']);\n $order->total = round($order->subtotal - $order->total_discounts, 2);\n $order->tax = expUtil::currency_to_float($this->params['tax']);\n $order->shipping_total = expUtil::currency_to_float($this->params['shipping_total']);\n //note: the shippingmethod record will still reflect the ORIGINAL shipping amount for this order.\n $order->surcharge_total = expUtil::currency_to_float($this->params['surcharge_total']);", " if ($this->params['autocalc'] == true) {\n $order->grand_total = round(($order->subtotal - $order->total_discounts) + $order->tax + $order->shipping_total + $order->surcharge_total, 2);\n } else {\n $order->grand_total = round(expUtil::currency_to_float($this->params['grand_total']), 2);\n }\n //FIXME attempt to update w/ new billing transaction\n// $bmopts = expUnserialize($order->billingmethod[0]->billing_options);\n// $bmopts->result->transId = gt('Totals Adjusted');\n// $order->billingmethod[0]->billingcalculator->calculator->createBillingTransaction($order->billingmethod[0], number_format($order->grand_total, 2, '.', ''), $bmopts->result, $bmopts->result->payment_status);\n $order->save();", "// flashAndFlow('message', gt('Order totals updated.'));\n flash('message', gt('Order totals updated.'));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['orderid']));\n }", " function update_sales_reps() {\n if (!isset($this->params['id'])) {\n flashAndFlow('error', gt('Unable to process request. Invalid order number.'));\n //expHistory::back();\n }\n $order = new order($this->params['id']);\n $order->sales_rep_1_id = $this->params['sales_rep_1_id'];\n $order->sales_rep_2_id = $this->params['sales_rep_2_id'];\n $order->sales_rep_3_id = $this->params['sales_rep_3_id'];\n $order->save();\n flashAndFlow('message', gt('Sales reps updated.'));\n }", " function quickfinder() {\n global $db;", " $search = $this->params['ordernum'];\n $searchInv = intval($search);", " $sql = \"SELECT DISTINCT(o.id), o.invoice_id, FROM_UNIXTIME(o.purchased,'%c/%e/%y %h:%i:%s %p') as purchased_date, b.firstname as bfirst, b.lastname as blast, concat('\".expCore::getCurrencySymbol().\"',format(o.grand_total,2)) as grand_total, os.title as status_title, ot.title as order_type\";\n $sql .= \" from \" . $db->prefix . \"orders as o \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"orderitems as oi ON oi.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_type as ot ON ot.id = o.order_type_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_status as os ON os.id = o.order_status_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"billingmethods as b ON b.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"shippingmethods as s ON s.id = oi.shippingmethods_id \";", " $sqlwhere = \"WHERE o.purchased != 0\";\n if ($searchInv != 0) $sqlwhere .= \" AND (o.invoice_id LIKE '%\" . $searchInv . \"%' OR\";\n else $sqlwhere .= \" AND (\";\n $sqlwhere .= \" b.firstname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR s.firstname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR b.lastname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR s.lastname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR b.email LIKE '%\" . $search . \"%')\";", " $limit = empty($this->config['limit']) ? 350 : $this->config['limit'];\n //eDebug($sql . $sqlwhere) ;\n $page = new expPaginator(array(\n 'sql' => $sql . $sqlwhere,\n 'limit' => $limit,\n 'order' => 'o.invoice_id',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=> $this->baseclassname,\n 'action' => $this->params['action'],\n 'columns' => array(\n 'actupon' => true,\n gt('Order #') => 'invoice_id|controller=order,action=show,showby=id',\n gt('Purchased Date')=> 'purchased_date',\n gt('First') => 'bfirst',\n gt('Last') => 'blast',\n gt('Total') => 'grand_total',\n gt('Order Type') => 'order_type',\n gt('Status') => 'status_title'\n ),\n ));\n assign_to_template(array(\n 'page'=> $page,\n 'term'=> $search\n ));", " //eDebug($this->params);\n /*$o = new order();\n $b = new billingmethod();\n $s = new shippingmethod();", " ", " $search = intval($this->params['ordernum']);\n if (is_int($oid) && $oid > 0)\n {\n $orders = $o->find('all',\"invoice_id LIKE '%\".$oid.\"%'\");\n if(count($orders == 1))\n {", " redirect_to(array('controller'=>'order','action'=>'show','id'=>$order[0]->id)); ", " }\n else\n {\n flashAndFlow('message',\"Orders containing \" . $search . \" in the order number not found.\");\n }\n }\n else\n {\n //lookup just a customer\n $bms = $b->find('all', )\n }*/\n /*$o = new order();\n $oid = intval($this->params['ordernum']);\n if (is_int($oid) && $oid > 0)\n {\n $order = $o->find('first','invoice_id='.$oid);\n if(!empty($order->id))\n {", " redirect_to(array('controller'=>'order','action'=>'show','id'=>$order->id)); ", " }\n else\n {\n flashAndFlow('message',\"Order #\" . intval($this->params['ordernum']) . \" not found.\");\n }\n }\n else\n {", " flashAndFlow('message','Invalid order number.'); ", " }*/\n }", " public function verifyReturnShopper() {\n// global $user, $order;", " $sessAr = expSession::get('verify_shopper');\n if (isset($sessAr)) {\n assign_to_template(array(\n 'firstname'=> $sessAr['firstname'],\n 'cid'=> $sessAr['cid']", " ));\n /*eDebug(expSession::get('verify_shopper'));\n eDebug($this->params);\n eDebug(\"here\");\n eDebug($user);\n eDebug($order);*/\n }\n }", " public function verifyAndRestoreCart() {\n// global $user, $order;", " $sessAr = expSession::get('verify_shopper');\n if (isset($sessAr) && isset($this->params['cid']) && $this->params['cid'] == $sessAr['cid']) {\n $tmpCart = new order($sessAr['cid']);\n if (isset($tmpCart->id)) {", " //eDebug($tmpCart,true); ", " $shippingMethod = $tmpCart->shippingmethod;\n $billingMethod = $tmpCart->billingmethod[0];", " if (($this->params['lastname'] == $shippingMethod->lastname || $this->params['lastname'] == $billingMethod->lastname) &&\n ($this->params['email'] == $shippingMethod->email || $this->params['email'] == $billingMethod->email) &&\n ($this->params['zip_code'] == $shippingMethod->zip || $this->params['zip_code'] == $billingMethod->zip)\n ) {\n //validatio succeed, so restore order, login user and continue on to orig_path\n //eDebug(\"Validated\",true);\n $sessAr['validated'] = true;\n expSession::set('verify_shopper', $sessAr);\n redirect_to($sessAr['orig_path']);\n } else {\n //eDebug(\"Validated NOT\",true);\n //validation failed, so go back\n flash('error', gt(\"We're sorry, but we could not verify your information. Please try again, or start a new shopping cart.\"));\n redirect_to(array('controller'=> 'order', 'action'=> 'verifyReturnShopper', 'id'=> $sessAr['cid']));\n }\n } else {\n flash('error', gt('We were unable to restore the previous order, we apologize for the inconvenience. Please start a new shopping cart.'));\n $this->clearCart();\n }\n }\n }", " public static function clearCartCookie() {\n expSession::un_set('verify_shopper');\n order::setCartCookie(null);\n }", " public function clearCart() {\n global $order;", " $sessAr = expSession::get('verify_shopper');\n if (isset($sessAr)) {\n order::setCartCookie($order);\n $orig_path = $sessAr['orig_path'];\n expSession::un_set('verify_shopper');\n redirect_to($orig_path);\n } else {\n expHistory::back();\n }\n }", " /**\n * AJAX search for internal (addressController) addresses\n *\n */\n public function search() {\n// global $db, $user;\n global $db;", " $sql = \"select DISTINCT(a.id) as id, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email \";", " $sql .= \"from \" . $db->prefix . \"addresses as a \"; //R JOIN \" . ", " //$db->prefix . \"billingmethods as bm ON bm.addresses_id=a.id \";\n $sql .= \" WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('\" . $this->params['query'] .\n \"*' IN BOOLEAN MODE) \";\n $sql .= \"order by match (a.firstname,a.lastname,a.email,a.organization) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) ASC LIMIT 12\";\n $res = $db->selectObjectsBySql($sql);\n foreach ($res as $key=>$record) {\n $res[$key]->title = $record->firstname . ' ' . $record->lastname;\n }\n //eDebug($sql);\n $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }", " /**\n * Ajax search for external addresses\n *\n */\n public function search_external() {\n// global $db, $user;\n global $db;", " $sql = \"select DISTINCT(a.id) as id, a.source as source, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email \";", " $sql .= \"from \" . $db->prefix . \"external_addresses as a \"; //R JOIN \" . ", " //$db->prefix . \"billingmethods as bm ON bm.addresses_id=a.id \";\n $sql .= \" WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('\" . $this->params['query'] .\n \"*' IN BOOLEAN MODE) \";\n $sql .= \"order by match (a.firstname,a.lastname,a.email,a.organization) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) ASC LIMIT 12\";\n $res = $db->selectObjectsBySql($sql);\n foreach ($res as $key=>$record) {\n $res[$key]->title = $record->firstname . ' ' . $record->lastname;\n }\n //eDebug($sql);\n $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }", "}", "?>" ]
[ 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class orderController extends expController {", " protected $manage_permissions = array(\n 'add_order_item' => 'Add Order Item',\n 'download' => 'Download Label',\n// 'create_new_order' => 'Create A New Order',\n// 'createReferenceOrder'=> 'Create Reference Order',\n// 'edit_address' => 'Edit Address',\n// 'edit_invoice_id' => 'Edit Invoice Id',\n// 'edit_order_item' => 'Edit Order Item',\n// 'edit_payment_info' => 'Edit Payment Info',\n// 'edit_shipping_method'=> 'Edit Shipping Method',\n// 'edit_totals' => 'Edit Totals',\n 'email' => 'Send Email',\n 'quickfinder'=> 'Do a quick order lookup',\n 'save_payment_info'=> 'Save Payment Info',\n 'save_address'=> 'Save Address',\n 'save_order_item'=> 'Save Order Item',\n// 'save_new_order_item'=> 'Save New Order Item',\n 'save_totals'=> 'Save Totals',\n 'save_invoice_id'=> 'Save Invoice Id',\n 'save_shipping_method'=> 'Save Shipping Method',\n 'save_new_order'=> 'Save a new order',\n 'save_reference_order'=> 'Save Reference Order',\n 'set' => 'Change Status',", " 'showall' => 'Manage',\n 'show' => 'View Orders',", " 'update' => 'update order',", " );", " static function displayname() {\n return gt(\"e-Commerce Order Manager\");\n }", " static function description() {\n return gt(\"Use this module to manage the orders from your ecommerce store.\");\n }", " function showall() {\n global $db;", " expHistory::set('viewable', $this->params);", " // remove abaondoned carts\n /*$count = $db->countObjects('orders', 'purchased=0');\n for($i=0; $i<$count; $i++) {\n // get the cart\n $cart = $db->selectObject('orders','purchased=0');", "", " // check to make sure this isn't an active session\n $ticket = $db->selectObject('sessionticket', \"ticket='\".$cart->sessionticket_ticket.\"'\");\n if (empty($ticket)) {\n // delete all the order items for this cart and their shippingmethods\n foreach($db->selectObjects('orderitems', 'orders_id='.$cart->id) as $oi) {\n $db->delete('shippingmethods', 'id='.$oi->shippingmethods_id);", " $db->delete('orderitems', 'orders_id='.$cart->id);", " }", "", " // delete the billing methods for this cart.\n $db->delete('billingmethods', 'orders_id='.$cart->id);\n $db->delete('orders', 'id='.$cart->id);", " }\n", " } */", " // find orders with a \"closed\" status type\n// $closed_count = 0;\n if (empty($this->params['showclosed'])) {\n $closed_status = $db->selectColumn('order_status', 'id', 'treat_as_closed=1');\n $closed_status = implode(',',$closed_status);\n// $status_where = '';\n $status_where = ' AND order_status_id NOT IN (' . $closed_status . ')';", "// foreach ($closed_status as $status) {\n// if (empty($status_where)) {\n// $status_where .= ' AND (order_status_id!=' . $status;\n// } else {\n// $status_where .= ' AND order_status_id!=' . $status;\n// }\n// $closed_count += $db->countObjects('orders', 'order_status_id=' . $status);\n// }\n $closed_count = $db->countObjects('orders', 'order_status_id IN (' . $closed_status . ')');\n } else {\n $status_where = '';\n $closed_count = -1;\n }", " // build out a SQL query that gets all the data we need and is sortable.\n $sql = 'SELECT o.*, b.firstname as firstname, b.billing_cost as total, b.transaction_state as paid, b.billingcalculator_id as method, b.middlename as middlename, b.lastname as lastname, os.title as status, ot.title as order_type ';\n $sql .= 'FROM ' . $db->prefix . 'orders o, ' . $db->prefix . 'billingmethods b, ';\n $sql .= $db->prefix . 'order_status os, ';\n $sql .= $db->prefix . 'order_type ot ';\n $sql .= 'WHERE o.id = b.orders_id AND o.order_status_id = os.id AND o.order_type_id = ot.id AND o.purchased > 0';\n //FIXME this sql isn't correct???\n// if (!empty($status_where)) {\n// $status_where .= ')';\n $sql .= $status_where;\n// }\n if (ECOM_LARGE_DB) {\n $limit = empty($this->config['limit']) ? 50 : $this->config['limit'];\n } else {\n $limit = 0; // we'll paginate on the page\n }\n //eDebug($sql, true);\n $page = new expPaginator(array(\n //'model'=>'order',\n 'sql' => $sql,\n 'order' => 'purchased',\n 'dir' => 'DESC',\n 'limit' => $limit,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=> $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Customer') => 'lastname',\n gt('Inv #') => 'invoice_id',\n gt('Total') => 'total',\n gt('Payment') => 'method',\n gt('Purchased') => 'purchased',\n gt('Type') => 'order_type_id',\n gt('Status') => 'order_status_id',\n gt('Ref') => 'orig_referrer',\n )\n ));\n //eDebug($page,true);\n assign_to_template(array(\n 'page' => $page,\n 'closed_count'=> $closed_count,\n 'new_order' => order::getDefaultOrderStatus()\n ));\n }", " function show() {\n global $db, $user;\n//eDebug($_REQUEST);\n//eDebug($this->params,true);\n//if (!empty($this->params['printerfriendly'])) $_REQUEST['printerfriendly'] = 1;", " expHistory::set('viewable', $this->params);", " if (!empty($this->params['invoice']) && empty($this->params['id'])) {\n $ord = new order();\n $order = $ord->find('first', 'invoice_id=' . $this->params['invoice']);\n $this->params['id'] = $order->id;\n } elseif (!empty($this->params['id'])) {\n $order = new order($this->params['id']);\n }\n if (empty($order->id)) {\n flash('notice', gt('That order does not exist.'));\n expHistory::back();\n }", " // We're forcing the location. Global store setting will always have this loc\n// $storeConfig = new expConfig(expCore::makeLocation(\"ecomconfig\",\"@globalstoresettings\",\"\"));", " $billing = new billing($this->params['id']);\n $status_messages = $db->selectObjects('order_status_messages');\n $order_type = $order->getOrderType();\n //eDebug($order->billingmethod[0]->billingtransaction);\n $order->billingmethod[0]->billingtransaction = array_reverse($order->billingmethod[0]->billingtransaction);\n if (empty($order->billingmethod[0]->billingtransaction[0]->billingcalculator_id)) {\n $calc_name = $order->billingmethod[0]->billingcalculator->calculator_name;\n $order->billingmethod[0]->billingtransaction[0]->billingcalculator = new $calc_name();\n }\n //eDebug($order->billingmethod[0]->billingtransaction);\n if (isset($this->params['printerfriendly']))\n $pf = $this->params['printerfriendly'];\n else\n $pf = 0;", " $to_addresses[] = $order->billingmethod[0]->email;\n// $s = array_pop($order->shippingmethods); //FIXME we don't really want to 'pop' it off the object\n $s = reset($order->shippingmethods);\n if ($s->email != $order->billingmethod[0]->email) $to_addresses[] = $s->email;", " $from_addresses = array();\n $from_addresses[SMTP_FROMADDRESS] = SMTP_FROMADDRESS;\n $from_addresses[ecomconfig::getConfig('from_address')] = ecomconfig::getConfig('from_address');\n $from_addresses[$user->email] = $user->email;\n $from_addresses['other'] = 'Other (enter below)';\n $from_addresses = array_filter($from_addresses);\n $from_default = ecomconfig::getConfig('from_address');\n $from_default = !empty($from_default) ? $from_default : SMTP_FROMADDRESS;", " $email_subject = 'Message from ' . ecomconfig::getConfig('storename') . ' about your order (#' . $order->invoice_id . ')';", " $order->setReferencingIds();", " $css = file_get_contents(BASE . 'framework/modules/ecommerce/assets/css/print-invoice.css');", " assign_to_template(array(\n 'css' => $css,\n 'pf' => $pf,\n 'order' => $order,\n 'order_user' => new user($order->user_id),\n// 'shipping' => $order->orderitem[0], //FIXME what about new orders with no items??\n 'billing' => $billing,\n 'billinginfo' => $billing->getBillingInfo(),\n 'messages' => $status_messages,\n 'order_type' => $order_type,\n// 'storeConfig' => $storeConfig->config,\n 'sales_reps' => order::getSalesReps(),\n 'from_addresses' => $from_addresses,\n 'from_default' => $from_default,\n 'email_subject' => $email_subject,\n 'to_addresses' => implode(',', $to_addresses)\n ));\n if ($order->shipping_required) {\n assign_to_template(array(\n 'shipping' => $order->orderitem[0], //FIXME what about new orders with no items??\n ));\n }\n }", " function myOrder() {\n global $user, $db;", " $order = new order($this->params['id']);\n if ($order->purchased == 0)\n flashAndFlow('error', gt('You do not have permission to view this order.'));", " $this->loc->src = \"@globalstoresettings\";", " // We're forcing the location. Global store setting will always have this loc\n// $storeConfig = new expConfig(expCore::makeLocation(\"ecomconfig\",\"@globalstoresettings\",\"\"));", " //check here for the hash in the params, or session set w/ perms to view...shs = xaf7y0s87d7elshd70 etc\n //if present, prompt user for the order number and email address on the order\n //and if they pass, show the order to them. Need to maybe set something in the session then for subsequent", " //viewing of the order?", " if ($user->id != $order->user_id) {\n if ($user->isAdmin()) {\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['id']));\n } else {\n flashAndFlow('error', gt('You do not have permission to view this order.'));\n }\n }", " expHistory::set('viewable', $this->params);", " $billing = new billing($this->params['id']);\n $status_messages = $db->selectObjects('order_status_messages');\n $order_type = $order->getOrderType();\n $order->total_items = 0;\n foreach ($order->orderitem as $item) {\n $order->total_items += $item->quantity;\n $order->shipping_city = $item->shippingmethod->city;\n $order->shipping_state = $item->shippingmethod->state;\n }\n $state = new geoRegion($order->shipping_state);\n $country = new geoCountry($state->country_id);\n $order->shipping_country = $country->iso_code_3letter;\n $order->shipping_state = $state->name;", " //eDebug($order,true);", " $order->billingmethod[0]->billingtransaction = array_reverse($order->billingmethod[0]->billingtransaction);\n if (isset($this->params['printerfriendly'])) $pf = $this->params['printerfriendly'];\n else $pf = 0;\n $css = file_get_contents(BASE . 'framework/modules/ecommerce/assets/css/print-invoice.css');", " $order->calculateGrandTotal();", " $trackMe = false;\n if (isset($this->params['tc']) && $this->params['tc'] == 1) {\n if (expSession::is_set('orders_tracked')) {\n $trackingArray = expSession::get('orders_tracked');\n if (in_array($order->invoice_id, $trackingArray)) {\n $trackMe = false;\n } else {\n $trackMe = true;\n $trackingArray[] = $order->invoice_id;\n expSession::set('orders_tracked', $trackingArray);\n }\n } else {\n $trackMe = true;\n $trackingArray[] = $order->invoice_id;\n expSession::set('orders_tracked', $trackingArray);\n }\n }\n if (DEVELOPMENT != 0)\n $trackMe = false;\n assign_to_template(array(\n 'printerfriendly'=> $pf,\n 'css' => $css,\n 'order' => $order,\n 'shipping' => $order->orderitem[0],\n 'billing' => $billing,\n 'billinginfo' => $billing->getBillingInfo(),\n 'order_type' => $order_type,\n// 'storeConfig' => $storeConfig->config,\n 'tc' => $trackMe,\n 'checkout' => !empty($this->params['tc']) //FIXME we'll use the tc param for now\n ));", " }", " function email() {\n global $template, $user;", " // setup a template suitable for emailing\n $template = expTemplate::get_template_for_action($this, 'email_invoice', $this->loc);\n $order = new order($this->params['id']);\n $billing = new billing($this->params['id']);\n// if ($billing->calculator != null) {\n// $billinginfo = $billing->calculator->userView(unserialize($billing->billingmethod->billing_options));\n// } else {\n// if (empty($opts)) {\n// $billinginfo = false;\n// } else {\n// $billinginfo = gt(\"No Cost\");\n// if (!empty($opts->payment_due)) {\n// $billinginfo .= '<br>'.gt('Payment Due') . ': ' . expCore::getCurrencySymbol() . number_format($opts->payment_due, 2, \".\", \",\");\n// }\n// }\n// }\n $css = file_get_contents(BASE.'framework/modules/ecommerce/assets/css/print-invoice.css');\n assign_to_template(array(\n 'css' => $css,\n 'order' => $order,\n 'shipping' => $order->orderitem[0],\n 'billing' => $billing,\n 'billinginfo' => $billing->getBillingInfo(),\n ));", " // build the html and text versions of the message\n $html = $template->render();\n $txt = strip_tags($html);", " // send email invoices to the admins if needed\n if (ecomconfig::getConfig('email_invoice') == true) {\n $addresses = explode(',', ecomconfig::getConfig('email_invoice_addresses'));\n foreach ($addresses as $address) {\n $mail = new expMail();\n $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n $mail->quickSend(array(\n 'html_message'=> $html,\n 'text_message'=> $txt,\n 'to' => trim($address),\n 'from' => $from,\n 'subject' => 'An order was placed on the ' . ecomconfig::getConfig('storename'),\n ));\n }\n }", " // email the invoice to the user if we need to\n if (ecomconfig::getConfig('email_invoice_to_user') == true && !empty($user->email)) {\n $usermsg = \"<p>\" . ecomconfig::getConfig('invoice_msg') . \"<p>\";\n $usermsg .= $html;\n// $usermsg .= ecomconfig::getConfig('ecomfooter');", " $mail = new expMail();\n $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n $mail->quickSend(array(\n 'html_message'=> $usermsg,\n 'text_message'=> $txt,\n 'to' => array(trim($user->email) => trim(user::getUserAttribution($user->id))),\n //'to'=>$order->billingmethod[0]->email,\n 'from' => $from,\n 'subject' => ecomconfig::getConfig('invoice_subject'),\n ));\n }\n }", " function update_shipping() {\n $order = new order($this->params['id']);\n $this->params['shipped'] = datetimecontrol::parseData('shipped', $this->params);\n $order->update($this->params);\n flash('message', gt('Shipping information updated.'));\n expHistory::back();\n }", " function getPDF($orders = null) {\n global $user, $timer;", " $invoice = '<!DOCTYPE HTML><HTML><HEAD>';\n // the basic styles\n if (!bs3())\n $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'external/normalize/normalize.css\" >';\n if (!bs())\n// $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'external/normalize/normalize.css\" >';\n if (bs2())\n $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'external/bootstrap/css/bootstrap.css\" >';\n if (bs3())\n $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'external/bootstrap3/css/bootstrap.css\" >';\n $invoice .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.URL_FULL.'framework/modules/ecommerce/assets/css/print-invoice.css\">\n <style>\n html{background:none;}\n #store-header{text-align:left;}\n </style>';\n $invoice .= '</HEAD><BODY>';\n if (is_array($orders)) {\n foreach ($orders as $order) {\n if ($user->isAdmin()) {\n $invoice .= renderAction(array('controller'=> 'order', 'action'=> 'show', 'view'=> 'show_printable', 'id'=> $order['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));", " //eDebug($order['id'] . \": \" . $timer->mark());", " } else {\n $invoice .= renderAction(array('controller'=> 'order', 'action'=> 'myOrder', 'view'=> 'show_printable', 'id'=> $order['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));\n }\n $invoice .= '<p style=\"page-break-before: always;\"></p>';\n }\n $invoice = substr($invoice, 0, (strlen($invoice) - 42));\n } else {\n if ($user->isAdmin()) {\n $invoice .= renderAction(array('controller'=> 'order', 'action'=> 'show', 'view'=> 'show_printable', 'id'=> $this->params['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));\n } else {\n $invoice .= renderAction(array('controller'=> 'order', 'action'=> 'myOrder', 'view'=> 'show_printable', 'id'=> $this->params['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));\n }\n }", " $invoice .= \"</BODY></HTML>\";\n $invoice = mb_convert_encoding($invoice, 'HTML-ENTITIES', \"UTF-8\");\n // eDebug($invoice);\n $org_name = str_ireplace(\" \", \"_\", ORGANIZATION_NAME);", " //eDebug(\"Here\",1);\n // Actually create/output the pdf file", " /**\n * to do this same thing as below using html2pdf\n * //FIXME uncomment to implement, comment out above\n require_once(BASE.'external/html2pdf_v4.03/html2pdf.class.php');\n $html2pdf = new HTMLTPDF('P', 'LETTER', substr(LOCALE,0,2));\n $html2pdf->writeHTML($invoice);\n $html2pdf->Output($org_name . \"_Invoice\" . \".pdf\",HTMLTOPDF_OUTPUT?'D':'');\n exit();\n */\n /**\n * to do this same thing as below using dompdf\n * //FIXME uncomment to implement, comment out above\n require_once(BASE.'external/dompdf/dompdf_config.inc.php');\n $mypdf = new DOMPDF();\n $mypdf->load_html($invoice);\n $mypdf->set_paper('letter','portrait');\n $mypdf->render();\n $mypdf->stream($org_name . \"_Invoice\" . \".pdf\",array('Attachment'=>HTMLTOPDF_OUTPUT));\n exit();\n */\n /**\n * to do this same thing as below using expHtmlToPDF\n */\n $mypdf = new expHtmlToPDF('Letter','portrait',$invoice);\n $mypdf->createpdf('D',$org_name . \"_Invoice\" . \".pdf\");\n exit();", " if (stristr(PHP_OS, 'Win')) {\n if (file_exists(HTMLTOPDF_PATH)) {\n do {\n $htmltopdftmp = HTMLTOPDF_PATH_TMP . mt_rand() . '.html';\n } while (file_exists($htmltopdftmp));\n }\n file_put_contents($htmltopdftmp, $invoice);", " exec(HTMLTOPDF_PATH . \" \" . $htmltopdftmp . \" \" . HTMLTOPDF_PATH_TMP . $org_name . \"_Invoice.pdf\");\n $this->returnFile(HTMLTOPDF_PATH_TMP . $org_name . \"_Invoice.pdf\", $org_name . \"_Invoice.pdf\", \"pdf\");\n exit();\n } else {", " //require_once(BASE.'external/tcpdf/config/lang/eng.php');\n //require_once(BASE.'external/tcpdf/tcpdf.php');", " //----\n // create new PDF document\n /*$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);", "// set document information\n$pdf->SetCreator(PDF_CREATOR);\n$pdf->SetAuthor('Nicola Asuni');\n$pdf->SetTitle('TCPDF Example 001');\n$pdf->SetSubject('TCPDF Tutorial');\n$pdf->SetKeywords('TCPDF, PDF, example, test, guide');", "// set default header data\npdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING);", "// set header and footer fonts\n$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));\n$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));", "// set default monospaced font\n$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);", "//set margins\n$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);\n$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);\n$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);", "// remove default header/footer\n$pdf->setPrintHeader(false);\n$pdf->setPrintFooter(false);", "//set auto page breaks\n$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);", "//set image scale factor\n$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);", "//set some language-dependent strings\n$pdf->setLanguageArray($l);", "// ---------------------------------------------------------", "// set default font subsetting mode\n//$pdf->setFontSubsetting(true);", "// Set font\n// dejavusans is a UTF-8 Unicode font, if you only need to\n// print standard ASCII chars, you can use core fonts like\n// helvetica or times to reduce file size.\n//$pdf->SetFont('helvetica', '', 14, '', true);", "// Add a page\n// This method has several options, check the source code documentation for more information.\n$pdf->AddPage();\n//eDebug($invoice,1);\n// Print text using writeHTMLCell()\n//$pdf->writeHTML($w=0, $h=0, $x='', $y='', $invoice, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);\n$pdf->writeHTML($invoice);", "// ---------------------------------------------------------", "// Close and output PDF document\n// This method has several options, check the source code documentation for more information.\nob_clean();\n$pdf->Output('example_001.pdf', 'I');\nexit();\n//============================================================+\n// END OF FILE\n//============================================================+\n", "", " // create new PDF document\n $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);", " // set document information\n $pdf->SetCreator(PDF_CREATOR);\n $pdf->SetAuthor(ORGANIZATION_NAME);\n $pdf->SetTitle($org_name . \"_Invoice\");\n $pdf->SetSubject($org_name . \"_Invoice\");\n // remove default header/footer\n $pdf->setPrintHeader(false);\n $pdf->setPrintFooter(false);", " // set default monospaced font\n $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);", " //set margins\n $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);", " //set auto page breaks\n $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);\n $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $invoice, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);\n $pdf->Output($org_name . \"_Invoice\" . \".pdf\", 'I');\n exit();*/\n eDebug(\"Done rendering invoice html. Starting PDF Generation: \" . $timer->mark());\n $pdfer = new expHtmlToPDF('Letter', 'Portrait', $invoice);\n// $pdfer->set_html($invoice);\n// $pdfer->set_orientation('Portrait');\n// $pdfer->set_page_size('Letter');\n $pdfer->set_grayscale(true);\n// $pdfer->render();\n eDebug(\"Done rendering PDF \" . $timer->mark());\n// exit();\n ob_clean();\n $pdfer->createpdf('D', $org_name . \"_Invoice\" . \".pdf\");\n exit();\n }\n }", " private function returnFile($file, $name, $mime_type = '') {\n /*\n This function takes a path to a file to output ($file),\n the filename that the browser will see ($name) and\n the MIME type of the file ($mime_type, optional).", " If you want to do something on download abort/finish,\n register_shutdown_function('function_name');\n */\n if (!is_readable($file)) die('File not found or inaccessible!');", " $size = filesize($file);\n $name = rawurldecode($name);", " /* Figure out the MIME type (if not specified) */\n $known_mime_types = array(\n \"pdf\" => \"application/pdf\",\n \"txt\" => \"text/plain\",\n \"html\" => \"text/html\",\n \"htm\" => \"text/html\",\n \"exe\" => \"application/octet-stream\",\n \"zip\" => \"application/zip\",\n \"doc\" => \"application/msword\",\n \"xls\" => \"application/vnd.ms-excel\",\n \"ppt\" => \"application/vnd.ms-powerpoint\",\n \"gif\" => \"image/gif\",\n \"png\" => \"image/png\",\n \"jpeg\" => \"image/jpg\",\n \"jpg\" => \"image/jpg\",\n \"php\" => \"text/plain\"\n );", " if ($mime_type == '') {\n// $file_extension = strtolower(substr(strrchr($file, \".\"), 1));\n//\n// if (array_key_exists($file_extension, $known_mime_types)) {\n// $mime_type = $known_mime_types[$file_extension];\n// } else {\n// $mime_type = \"application/force-download\";\n// }\n $mime_type = expFile::getMimeType($file);\n }", " //@ob_end_clean(); //turn off output buffering to decrease cpu usage\n // required for IE, otherwise Content-Disposition may be ignored\n if (ini_get('zlib.output_compression'))\n ini_set('zlib.output_compression', 'Off');", " header('Content-Type: ' . $mime_type);\n header('Content-Disposition: attachment; filename=\"' . $name . '\"');\n header('Content-Transfer-Encoding: binary');\n header('Accept-Ranges: bytes');", " /* The three lines below basically make the download non-cacheable */\n header('Cache-control: private');\n header('Pragma: private');\n// header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');", " // multipart-download and download resuming support\n if (isset($_SERVER['HTTP_RANGE'])) {\n list($a, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);\n list($range) = explode(',', $range, 2);\n list($range, $range_end) = explode('-', $range);", " $range = intval($range);", " $range_end = (!$range_end) ? $size - 1 : intval($range_end);\n $new_length = $range_end - $range + 1;", " header('HTTP/1.1 206 Partial Content');\n header('Content-Length: ' . $new_length);\n header('Content-Range: bytes ' . ($range - $range_end / $size));\n } else {\n $new_length = $size;", " header('Content-Length: ' . $size);\n }", " /* output the file itself */\n $chunksize = 1 * (1024 * 1024); //you may want to change this\n $bytes_send = 0;", " if ($file = fopen($file, 'r')) {\n if (isset($_SERVER['HTTP_RANGE'])) fseek($file, $range);", " while (!feof($file) && (!connection_aborted()) && ($bytes_send < $new_length)) {\n $buffer = fread($file, $chunksize);", " print($buffer);\n flush();", " $bytes_send += strlen($buffer);\n }", " fclose($file);\n } else {\n die('Error - can not open file.');\n }\n }", " function set_order_type() { //FIXME never used\n// global $db;", " if (empty($this->params['id'])) expHistory::back();", " // get the order and update the type\n $order = new order($this->params['id']);\n $order->order_type_id = $this->params['order_type_id'];\n $order->save();\n flash('message', gt('Invoice #') . $order->invoice_id . ' ' . gt('has been set to') . ' ' . $order->getOrderType());\n expHistory::back();\n }", " /**\n * Change order status and email notification if necessary\n */\n function setStatus() {\n global $db, $template;", " if (empty($this->params['id'])) expHistory::back();", " // get the order and create a new order_Status_change\n $order = new order($this->params['id']);", " //set order type\n if (isset($this->params['order_type_id'])) $order->order_type_id = $this->params['order_type_id'];", " //only save the status change if it actually changed to something different\n if ($order->order_status_id != $this->params['order_status_id']) {\n if (empty($this->params['order_status_messages'])) {\n $comment = $this->params['comment'];\n } else {\n $comment = $this->params['order_status_messages'];\n }\n // save the order status change\n $change = new order_status_changes();\n $change->from_status_id = $order->order_status_id;\n $change->comment = $comment;\n $change->to_status_id = $this->params['order_status_id'];\n $change->orders_id = $order->id;\n $change->save();", " // update the status of the order\n $order->order_status_id = $this->params['order_status_id'];", " // Save the message for future use if that is what the user wanted.\n if (!empty($this->params['save_message']) && !empty($this->params['comment'])) {\n $message = new stdClass();\n $message->body = $this->params['comment'];\n $db->insertObject($message, 'order_status_messages');\n }", " // email the user if we need to\n if (!empty($this->params['email_user'])) {\n $email_addy = $order->billingmethod[0]->email;\n if (!empty($email_addy)) {\n $from_status = $db->selectValue('order_status', 'title', 'id=' . $change->from_status_id);\n $to_status = $db->selectValue('order_status', 'title', 'id=' . $change->to_status_id);", " if ($order->shippingmethod->carrier == 'UPS') {\n $carrierTrackingLink = \"http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=\";\n } elseif ($order->shippingmethod->carrier == 'FedEx') {\n $carrierTrackingLink = \"http://www.fedex.com/Tracking?action=track&tracknumbers=\";\n } elseif ($order->shippingmethod->carrier == 'USPS') {\n $carrierTrackingLink = \"https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=\";\n }", " assign_to_template(array(\n 'comment' => $change->comment,\n 'to_status' => $to_status,\n 'from_status' => $from_status,\n 'order' => $order,\n 'date' => date(\"F j, Y, g:i a\"),\n 'storename' => ecomconfig::getConfig('storename'),\n 'include_shipping'=> isset($this->params['include_shipping_info']) ? true : false,\n 'tracking_link' => $carrierTrackingLink . $order->shipping_tracking_number,\n 'carrier' => $order->shippingmethod->carrier\n ));", " $html = $template->render();\n $html .= ecomconfig::getConfig('ecomfooter');", " $mail = new expMail();\n $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n $mail->quickSend(array(\n 'html_message'=> $html,\n 'text_message'=> str_replace(\"<br>\", \"\\r\\n\", $template->render()),\n 'to' => array($email_addy => $order->billingmethod[0]->firstname . ' ' . $order->billingmethod[0]->lastname),\n 'from' => $from,\n 'subject' => 'The status of your order (#' . $order->invoice_id . ') has been updated on ' . ecomconfig::getConfig('storename') . '.'\n ));\n } else {\n flash('error', gt('The email address was NOT send. An email address count not be found for this customer'));\n }\n }\n flash('message', gt('Order Type and/or Status Updated.'));\n } else {\n flash('message', gt('Order Type and/or Status was not changed.'));\n }", " $order->save();\n expHistory::back();\n }", " function emailCustomer() {\n //eDebug($this->params,true);\n global $db, $template, $user;", " if (empty($this->params['id'])) expHistory::back();", " // get the order\n $order = new order($this->params['id']);", " if (empty($this->params['order_status_messages'])) {\n $email_message = $this->params['email_message'];\n } else {\n $email_message = $this->params['order_status_messages'];\n }", " // Save the message for future use if that is what the user wanted.\n if (!empty($this->params['save_message']) && !empty($this->params['email_message'])) {\n $message = new stdClass();\n $message->body = $this->params['email_message'];\n $db->insertObject($message, 'order_status_messages');\n }", " $email_addys = explode(',', $this->params['to_addresses']); //$order->billingmethod[0]->email;\n //eDebug($email_addy,true);\n if (!empty($email_addys)) {\n assign_to_template(array(\n 'message'=> $email_message\n ));\n $html = $template->render();\n if (!empty($this->params['include_invoice'])) {\n $html .= '<hr><br>';\n $html .= renderAction(array('controller'=> 'order', 'action'=> 'show', 'view'=> 'email_invoice', 'id'=> $this->params['id'], 'printerfriendly'=> '1', 'no_output'=> 'true'));\n } else {\n $html .= ecomconfig::getConfig('ecomfooter');\n }", " //eDebug($html,true);\n if (isset($this->params['from_address'])) {\n if ($this->params['from_address'] == 'other') {\n $from = $this->params['other_from_address'];\n } else {\n $from = $this->params['from_address'];\n }\n } else {\n $from = ecomconfig::getConfig('from_address');\n }\n if (empty($from[0])) $from = SMTP_FROMADDRESS;", " if (isset($this->params['email_subject'])) {\n $email_subject = $this->params['email_subject'];\n } else {\n $email_subject = gt('Message from') . ' ' . ecomconfig::getConfig('storename') . ' ' . gt('about your order') . ' (#' . $order->invoice_id . ')';\n }", " $mail = new expMail();\n //FIXME Unless you need each mail sent separately, you can now set 'to'=>$email_addys and let expMail send a single email to all addresses\n foreach ($email_addys as $email_addy) {\n $mail->quickSend(array(\n 'html_message'=> $html,\n 'text_message'=> str_replace(\"<br>\", \"\\r\\n\", $template->render()),\n 'to' => $email_addy,\n 'from' => $from,\n 'subject' => $email_subject\n ));\n }\n $emailed_to = implode(',', $email_addys);", " // manually add/attach an expSimpleNote to the order\n $note = new expSimpleNote();\n $note->body = \"<strong>[\" . gt('action') . \"]: \" . gt('Emailed message to') . \" \" . $emailed_to . \":</strong>\" . $email_message;\n $note->approved = 1;\n $note->name = $user->firstname . \" \" . $user->lastname;\n $note->email = $user->email;", " $note->save();\n $note->refresh();\n// $noteObj = new stdClass();\n// $noteObj->expsimplenote_id = $note->id;\n// $noteObj->content_id = $order->id;\n// $noteObj->content_type = 'order';\n// $db->insertObject($noteObj, 'content_expSimpleNote');\n $note->attachNote('order', $order->id);\n", " //eDebug($note,true);", " } else {\n flash('error', gt('The email was NOT sent. An email address was not found for this customer'));\n expHistory::back();\n }", " flash('message', gt('Email sent.'));\n expHistory::back();\n }", " function ordersbyuser() {\n global $user;", " // if the user isn't logged in flash an error msg\n if (!$user->isLoggedIn()) expQueue::flashAndFlow('error', gt('You must be logged in to view past orders.'));", " expHistory::set('viewable', $this->params);\n $page = new expPaginator(array(\n 'model' => 'order', //FIXME we should also be getting the order status name\n 'where' => 'purchased > 0 AND user_id=' . $user->id,\n 'limit' => 10,\n 'order' => 'purchased',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=> $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Date Purchased')=> 'purchased',\n gt('Invoice #') => 'invoice_id',\n )\n ));\n assign_to_template(array(\n 'page'=> $page\n ));", " }", " function metainfo() {\n global $router;", " if (empty($router->params['action'])) return false;\n", " // figure out what metadata to pass back based on the action", " // we are in.\n $action = $router->params['action'];\n $metainfo = array('title'=>'', 'keywords'=>'', 'description'=>'', 'canonical'=> '', 'noindex' => true, 'nofollow' => true);\n $storename = ecomconfig::getConfig('storename');\n switch ($action) {\n case 'myOrder':\n case 'show':\n case 'showByTitle':\n if (!empty($router->params['id'])) {\n $order = new order($router->params['id']);\n } elseif (!empty($router->params['invoice'])) {\n $order = $this->order->find('first', 'invoice_id=' . $router->params['invoice']);\n } else {\n $order = $this->order;\n }\n $metainfo['title'] = gt('Viewing Order') . ' #' . $order->invoice_id . ' - ' . $storename;\n $metainfo['keywords'] = empty($order->meta_keywords) ? SITE_KEYWORDS : $order->meta_keywords;\n $metainfo['description'] = empty($order->meta_description) ? SITE_DESCRIPTION : $order->meta_description;\n// $metainfo['canonical'] = empty($order->canonical) ? $router->plainPath() : $order->canonical;\n// $metainfo['noindex'] = empty($order->meta_noindex) ? false : $order->meta_noindex;\n// $metainfo['nofollow'] = empty($order->meta_nofollow) ? false : $order->meta_nofollow;\n break;\n case 'showall':\n case 'ordersbyuser':\n default:\n $metainfo['title'] = gt(\"Order Management\") . \" - \" . $storename;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n }", " return $metainfo;\n }", " function captureAuthorization() {\n //eDebug($this->params,true);\n $order = new order($this->params['id']);", " /*eDebug($this->params);", " //eDebug($order,true);*/\n //eDebug($order,true);\n //$billing = new billing();", " //eDebug($billing, true);\n //$billing->calculator = new $calcname($order->billingmethod[0]->billingcalculator_id);\n $calc = $order->billingmethod[0]->billingcalculator->calculator;\n $calc->config = $order->billingmethod[0]->billingcalculator->config;", " //$calc = new $calc-\n //eDebug($calc,true);\n if (!method_exists($calc, 'delayed_capture')) {\n flash('error', gt('The Billing Calculator does not support delayed capture'));\n expHistory::back();\n }", " $result = $calc->delayed_capture($order->billingmethod[0], $this->params['capture_amt'], $order);", " if (empty($result->errorCode)) {\n flash('message', gt('The authorized payment was successfully captured'));\n expHistory::back();", " } else {\n flash('error', gt('An error was encountered while capturing the authorized payment.') . '<br /><br />' . $result->message);\n expHistory::back();\n }\n }", " function voidAuthorization() {\n $order = new order($this->params['id']);\n $billing = $order->billingmethod[0];", " $calc = $order->billingmethod[0]->billingcalculator->calculator;\n $calc->config = $order->billingmethod[0]->billingcalculator->config;", " if (!method_exists($calc, 'void_transaction')) {\n flash('error', gt('The Billing Calculator does not support void'));\n expHistory::back();\n }", " $result = $calc->void_transaction($order->billingmethod[0], $order);", " if (empty($result->errorCode)) {\n flash('message', gt('The transaction has been successfully voided'));\n expHistory::back();", " } else {\n flash('error', gt('An error was encountered while voiding the authorized payment.') . '<br /><br />' . $result->message);\n expHistory::back();\n }\n }", " function creditTransaction() {\n $order = new order($this->params['id']);\n $billing = new billing($this->params['id']);\n //eDebug($this->params,true);\n $result = $billing->calculator->credit_transaction($billing->billingmethod, $this->params['capture_amt'],$order);", " if ($result->errorCode == '0') {\n flash('message', gt('The transaction has been credited'));\n expHistory::back();", " } else {\n flash('error', gt('An error was encountered while capturing the authorized payment.') . '<br /><br />' . $result->message);\n expHistory::back();\n }\n }", " function edit_payment_info() {\n //$order = new order($this->params['id']);\n $billing = new billing($this->params['id']);\n $opts = expUnserialize($billing->billingmethod->billing_options); //FIXME already unserialized???\n //eDebug($billing);\n// eDebug($opts);\n assign_to_template(array(\n 'orderid'=> $this->params['id'],\n 'opts' => $opts, //FIXME credit card doesn't have a result\n 'billing_cost' => $billing->billingmethod->billing_cost,\n 'transaction_state' => $billing->billingmethod->transaction_state\n ));\n }", " function save_payment_info() {\n //need to save billing methods and billing options\n //$order = new order($this->params['id']);\n //eDebug($this->params, true);\n $res_obj = new stdClass();\n foreach ($this->params['result'] as $resultKey=> $resultItem) {\n $res_obj->$resultKey = $resultItem;\n }\n// $res = serialize($res_obj);\n $billing = new billing($this->params['id']);\n // eDebug($billing);\n $billingmethod = $billing->billingmethod;\n $billingtransaction = $billingmethod->billingtransaction[0];", " // update billing method\n $billingmethod->billing_cost = $this->params['billing_cost'];\n $billingmethod->transaction_state = $this->params['transaction_state'];\n $bmopts = expUnserialize($billingmethod->billing_options);\n $bmopts->result = $res_obj;\n $billingmethod->billing_options = serialize($bmopts);\n// if (!empty($this->params['result']['payment_status']))\n// $billingmethod->transaction_state = $this->params['result']['payment_status']; //FIXME should this be discrete??\n $billingmethod->save();", " // add new billing transaction\n $billingtransaction->billing_cost = $this->params['billing_cost'];\n $billingtransaction->transaction_state = $this->params['transaction_state'];\n $btopts = expUnserialize($billingtransaction->billing_options);\n $btopts->result = $res_obj;\n $billingtransaction->billing_options = serialize($btopts);\n// if (!empty($this->params['result']['payment_status']))\n// $billingtransaction->transaction_state = $this->params['result']['payment_status'];\n $billingtransaction->id = null; // force a new record by erasing the id, easy method to copy record\n// $order = new order($this->params['id']);\n// $billingtransaction->billing_cost = $order->grand_total; //FIXME should it always be the grand total???\n $billingtransaction->save();", "// flashAndFlow('message', gt('Payment info updated.'));\n flash('message', gt('Payment info updated.'));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['id']));\n }", " function edit_shipping_method() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $order = new order($this->params['id']);\n $s = array_pop($order->shippingmethods); //FIXME only getting 1st one and then removing it\n $sm = new shippingmethod($s->id);\n //eDebug($sm);\n assign_to_template(array(\n 'orderid' => $this->params['id'],\n 'shipping'=> $sm\n ));\n }", " function save_shipping_method() {\n if (!isset($this->params['id']) || !isset($this->params['sid']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['sid']);\n $sm->option_title = $this->params['shipping_method_title'];\n $sm->carrier = $this->params['shipping_method_carrier'];\n $sm->save();\n flashAndFlow('message', gt('Shipping method updated.'));\n }", " function edit_parcel() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator(); // add calculator object\n assign_to_template(array(\n 'shipping'=> $sm\n ));\n }", " function save_parcel() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n if (!isset($this->params['in_box']) || !isset($this->params['qty'])) {\n flashAndFlow('notice', gt('Nothing was included in the shipping package!'));\n } else {\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n// $sm_new = clone($sm); // prepare for another 'package' if needed since we didn't place everything in this one\n// $sm_new->id = null;\n// $sm_new->orderitem = array();\n //FIXME for now multiple shipping methods will crash ecom with shipping->__construct()\n foreach ($sm->orderitem as $key => $oi) {\n if (!array_key_exists($oi->id, $this->params['in_box'])) {\n // one of the items by type is not in this package and needs to be moved to another package\n// $tmp = 1;\n// $sm_new->update(); // we don't need to actually create a new shippingmethod until needed\n// $sm->orderitem[$key]->shippingmethods_id = $sm_new->id;\n// $sm->orderitem[$key]->update();\n// unset($sm->orderitem[$key]);\n //NOTE $sm_new->update(); ???\n } else {\n if ($oi->quantity != $this->params['qty'][$oi->id]) {\n // one of the items by quantity is not in this package and remaining items need to be moved another package\n// $tmp = 1;\n// $new_quantity = $oi->quantity - $this->params['qty'][$oi->id];\n// $sm->orderitem[$key]->quantity = $this->params['qty'][$oi->id]; // adjust to new quantity\n// $sm->orderitem[$key]->update();\n// $sm_new->update(); // we don't need to actually create a new shippingmethod until needed\n// $oi->id = null; // create a new orderitem copy\n// $oi->shippingmethods_id = $sm_new->id;\n// $oi->quantity = $new_quantity;\n// $oi->update();\n //NOTE $sm_new->update(); ???\n }\n }\n }\n // update $sm with the passed $this->params (package data)\n $sm->update($this->params); //NOTE will this update assoc orderitems???\n $msg = $sm->calculator->createLabel($sm);\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Shipping package updated.'));\n } else {\n expHistory::back();\n }\n }\n }", " function edit_label() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $method = explode(':', $sm->option);\n//FIXME check for existing rate, if not get next cheapest? (based on predefined package?)\n assign_to_template(array(\n 'shipping'=> $sm,\n 'cost' => $sm->shipping_options['shipment_rates'][$method[0]][$method[1]]['cost']\n ));\n }", " function save_label() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $msg = $sm->calculator->buyLabel($sm);\n// $sm->refresh(); //FIXME updated with new options we may need to take action on like tracking number?\n// $order->shipping_tracking_number = $sm->shipping_options['shipment_tracking_number'];\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Shipping label purchased.'));\n } else {\n expHistory::back();\n }\n }", " function download_label() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $label = $sm->calculator->getLabel($sm);\n expHistory::back();\n }", " function delete_label() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $msg = $sm->calculator->cancelLabel($sm);\n // also need to cancel the pickup if created/purchased\n if (!is_string($msg) && ($sm->shipping_options['pickup_status'] == 'created' || $sm->shipping_options['pickup_status'] == 'purchased')) {\n $msg = $sm->calculator->cancelPickup($sm);\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Shipping label and pickup cancelled and refunded.'));\n }\n } else {\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Shipping label cancelled and refunded.'));\n }\n }\n expHistory::back();\n }", " function edit_pickup()\n {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n assign_to_template(array(\n 'shipping'=> $sm,\n ));\n }", " function edit_pickup2() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $this->params['pickupdate'] = strtotime($this->params['pickupdate']);\n $this->params['pickupenddate'] = strtotime($this->params['pickupenddate']);\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $pickup = $sm->calculator->createPickup($sm, $this->params['pickupdate'], $this->params['pickupenddate'], $this->params['instructions']);\n $sm->refresh();\n $pickup_rates = array();\n foreach ($sm->shipping_options['pickup_rates'] as $pu_rate) {\n $pickup_rates[$pu_rate['id']] = $pu_rate['id'] . ' - ' . expCore::getCurrency($pu_rate['cost']);\n }\n assign_to_template(array(\n 'shipping'=> $sm,\n 'rates' => $pickup_rates\n ));\n }", " function save_pickup() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n //FIXME should we add the params to the $sm->shipping_options, or pass them??\n $msg = $sm->calculator->buyPickup($sm, $this->params['pickuprate']);\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Package pickup ordered.'));\n } else {\n expHistory::back();\n }\n }", " function delete_pickup() {\n if (!isset($this->params['id']))\n flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $sm = new shippingmethod($this->params['id']);\n $sm->attachCalculator();\n $msg = $sm->calculator->cancelPickup($sm);\n if (!is_string($msg)) {\n flashAndFlow('message', gt('Package pickup cancelled.'));\n } else {\n expHistory::back();\n }\n }", " function createReferenceOrder() {\n if (!isset($this->params['id'])) {\n flashAndFlow('error', gt('Unable to process request. Invalid order number.'));\n// expHistory::back();\n }\n $order = new order($this->params['id']);\n assign_to_template(array(\n 'order'=> $order\n ));\n }", " function save_reference_order() {\n// global $user;", " //eDebug($this->params,true);\n $order = new order($this->params['original_orderid']);", " //eDebug($order,true);", " //x\n $newOrder = new order();\n $newOrder->order_status_id = $this->params['order_status_id'];\n $newOrder->order_type_id = $this->params['order_type_id'];\n //$newOrder->order_references = $order->id;\n $newOrder->reference_id = $order->id;\n $newOrder->user_id = $order->user_id;\n $newOrder->purchased = time();\n $newOrder->updated = time();\n $newOrder->invoice_id = $newOrder->getInvoiceNumber();\n $newOrder->orderitem = array();\n $newOrder->subtotal = $this->params['subtotal'];\n $newOrder->total_discounts = $this->params['total_discounts'];\n $newOrder->tax = $this->params['tax'];\n $newOrder->shipping_total = $this->params['shipping_total'];\n $newOrder->surcharge_total = $this->params['surcharge_total'];", " if ($this->params['autocalc'] == true) {\n $newOrder->grand_total = ($newOrder->subtotal - $newOrder->total_discounts) + $newOrder->tax + $newOrder->shipping_total + $newOrder->surcharge_total;\n } else {\n $newOrder->grand_total = round($this->params['grand_total'], 2);\n }\n $newOrder->save();\n $newOrder->refresh();", " // save initial order status\n $change = new order_status_changes();\n// $change->from_status_id = null;\n $change->to_status_id = $newOrder->order_status_id;\n $change->orders_id = $newOrder->id;\n $change->save();", " $tObj = new stdClass();\n $tObj->result = new stdClass();\n $tObj->result->errorCode = 0;\n $tObj->result->message = \"Reference Order Pending\";\n $tObj->result->PNREF = \"Pending\";\n $tObj->result->authorization_code = \"Pending\";\n $tObj->result->AVSADDR = \"Pending\";\n $tObj->result->AVSZIP = \"Pending\";\n $tObj->result->CVV2MATCH = \"Pending\";\n $tObj->result->traction_type = \"Pending\";\n $tObj->result->payment_status = \"Pending\";", " $newBillingMethod = $order->billingmethod[0];\n $newBillingMethod->id = null;\n $newBillingMethod->orders_id = $newOrder->id;\n// $newBillingMethod->billingcalculator_id = 6;\n $newBillingMethod->billingcalculator_id = billingcalculator::getDefault();\n $newBillingMethod->billing_cost = 0;\n $newBillingMethod->transaction_state = 'authorization pending';\n $newBillingMethod->billing_options = serialize($tObj);\n $newBillingMethod->save();\n", " //eDebug(expUnserialize($order->billingmethod[0]->billing_options));\n //eDebug(expUnserialize($order->billingmethod[0]->billingtransaction[0]->billing_options),true);", "\n $newBillingTransaction = new billingtransaction();\n// $newBillingTransaction->billingcalculator_id = 6; ///setting to manual/passthru\n $newBillingTransaction->billingcalculator_id = billingcalculator::getDefault();\n $newBillingTransaction->billing_cost = 0;\n $newBillingTransaction->billingmethods_id = $newBillingMethod->id;\n $newBillingTransaction->transaction_state = 'authorization pending';", " $newBillingTransaction->billing_options = serialize($tObj);\n $newBillingTransaction->save();", " $sid = $order->orderitem[0]->shippingmethods_id;\n $newShippingMethod = $order->shippingmethods[$sid];\n $newShippingMethod->id = null;\n $newShippingMethod->shipping_cost = 0;\n $newShippingMethod->save();\n $newShippingMethod->refresh();", " foreach ($this->params['oi'] as $oikey=> $oi) {\n //eDebug($oikey);\n $newOi = new orderitem($oikey);\n $newOi->id = null;\n $newOi->quantity = $this->params['quantity'][$oikey];\n $newOi->orders_id = $newOrder->id;\n $newOi->products_name = $this->params['products_name'][$oikey];\n $newOi->products_price = $this->params['products_price'][$oikey];\n $newOi->products_price_adjusted = $this->params['products_price'][$oikey];", " //$newOi->products_tax = 0;", " $newOi->shippingmethods_id = $newShippingMethod->id;\n $newOi->save();\n }", " $newOrder->shippingmethod = $newShippingMethod;\n $newOrder->billingmethod = $newBillingMethod;\n $newOrder->update(); //FIXME do we need to do this?", " flash('message', gt('Reference Order #') . $newOrder->invoice_id . \" \" . gt(\"created successfully.\"));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $newOrder->id));\n }", " function create_new_order() {\n// $order = new order();\n// assign_to_template(array(\n// 'order'=> $order\n// ));\n }", " function save_new_order() {\n //eDebug($this->params);\n /*addresses_id\n customer_type = 1 //new\n customer_type = 2 //existing Internal\n customer_type = 3 //existing external*/\n// global $user, $db;\n //eDebug($this->params,true);\n //$order = new order($this->params['original_orderid']);", " //eDebug($order,true);", "\n $newAddy = new address();\n if ($this->params['customer_type'] == 1) {\n //blank order\n $newAddy->save(false);\n } else if ($this->params['customer_type'] == 2) {\n //internal customer\n $newAddy = new address($this->params['addresses_id']);\n } else if ($this->params['customer_type'] == 3) {\n //other customer\n $otherAddy = new external_address($this->params['addresses_id']);\n $newAddy->user_id = $otherAddy->user_id;\n $newAddy->firstname = $otherAddy->firstname;\n $newAddy->lastname = $otherAddy->lastname;\n $newAddy->organization = $otherAddy->organization;\n $newAddy->address1 = $otherAddy->address1;\n $newAddy->address2 = $otherAddy->address2;\n $newAddy->city = $otherAddy->city;\n $newAddy->state = $otherAddy->state;\n $newAddy->zip = $otherAddy->zip;\n $newAddy->phone = $otherAddy->phone;\n $newAddy->email = $otherAddy->email;\n $newAddy->save();\n }", " $newOrder = new order();\n $newOrder->order_status_id = $this->params['order_status_id'];\n $newOrder->order_type_id = $this->params['order_type_id'];\n //$newOrder->order_references = $order->id;\n $newOrder->reference_id = 0;\n $newOrder->user_id = $newAddy->user_id;\n $newOrder->purchased = time();\n $newOrder->updated = time();\n $newOrder->invoice_id = $newOrder->getInvoiceNumber();\n $newOrder->orderitem = array();\n $newOrder->subtotal = 0;\n $newOrder->total_discounts = 0;\n $newOrder->tax = 0;\n $newOrder->shipping_total = 0;\n $newOrder->surcharge_total = 0;\n $newOrder->grand_total = 0;\n $newOrder->save();\n $newOrder->refresh();", " // save initial order status\n $change = new order_status_changes();\n// $change->from_status_id = null;\n $change->to_status_id = $newOrder->order_status_id;\n $change->orders_id = $newOrder->id;\n $change->save();", " $tObj = new stdClass();\n $tObj->result = new stdClass();\n $tObj->result->errorCode = 0;\n $tObj->result->message = \"Reference Order Pending\";\n $tObj->result->PNREF = \"Pending\";\n $tObj->result->authorization_code = \"Pending\";\n $tObj->result->AVSADDR = \"Pending\";\n $tObj->result->AVSZIP = \"Pending\";\n $tObj->result->CVV2MATCH = \"Pending\";\n $tObj->result->traction_type = \"Pending\";\n $tObj->result->payment_status = \"Pending\";", " $newBillingMethod = new billingmethod();\n $newBillingMethod->addresses_id = $newAddy->id;\n $newBillingMethod->orders_id = $newOrder->id;\n// $newBillingMethod->billingcalculator_id = 6;\n $newBillingMethod->billingcalculator_id = billingcalculator::getDefault();\n $newBillingMethod->billing_cost = 0;\n $newBillingMethod->transaction_state = 'authorization pending';\n $newBillingMethod->billing_options = serialize($tObj);\n $newBillingMethod->firstname = $newAddy->firstname;\n $newBillingMethod->lastname = $newAddy->lastname;\n $newBillingMethod->organization = $newAddy->organization;\n $newBillingMethod->address1 = $newAddy->address1;\n $newBillingMethod->address2 = $newAddy->address2;\n $newBillingMethod->city = $newAddy->city;\n $newBillingMethod->state = $newAddy->state;\n $newBillingMethod->zip = $newAddy->zip;\n $newBillingMethod->phone = $newAddy->phone;\n $newBillingMethod->email = $newAddy->email;\n $newBillingMethod->save();\n", " //eDebug(expUnserialize($order->billingmethod[0]->billing_options));\n //eDebug(expUnserialize($order->billingmethod[0]->billingtransaction[0]->billing_options),true);", "\n $newBillingTransaction = new billingtransaction();\n// $newBillingTransaction->billingcalculator_id = 6; ///setting to manual/passthru\n $newBillingTransaction->billingcalculator_id = billingcalculator::getDefault();\n $newBillingTransaction->billing_cost = 0;\n $newBillingTransaction->billingmethods_id = $newBillingMethod->id;\n $newBillingTransaction->transaction_state = 'authorization pending';\n $newBillingTransaction->billing_options = serialize($tObj);\n $newBillingTransaction->save();", " $newShippingMethod = new shippingmethod();\n $newShippingMethod->shipping_cost = 0;\n// $newShippingMethod->shippingcalculator_id = $db->selectValue('shippingcalculator', 'id', 'is_default=1');\n $newShippingMethod->shippingcalculator_id = shippingcalculator::getDefault();\n $newShippingMethod->addresses_id = $newAddy->id;\n $newShippingMethod->firstname = $newAddy->firstname;\n $newShippingMethod->lastname = $newAddy->lastname;\n $newShippingMethod->organization = $newAddy->organization;\n $newShippingMethod->address1 = $newAddy->address1;\n $newShippingMethod->address2 = $newAddy->address2;\n $newShippingMethod->city = $newAddy->city;\n $newShippingMethod->state = $newAddy->state;\n $newShippingMethod->zip = $newAddy->zip;\n $newShippingMethod->phone = $newAddy->phone;\n $newShippingMethod->email = $newAddy->email;\n $newShippingMethod->save();\n $newShippingMethod->refresh();", " //FIXME add a fake item?\n// $oi = new orderitem();\n// $oi->orders_id = $newOrder->id;\n// $oi->product_id = 0;\n// $oi->product_type = 'product';\n// $oi->products_name = \"N/A\";\n// $oi->products_model = \"N/A\";\n// $oi->products_price = 0;\n// $oi->shippingmethods_id = $newShippingMethod->id;\n// $oi->save(false);", " $newOrder->shippingmethod = $newShippingMethod;\n $newOrder->billingmethod = $newBillingMethod;\n $newOrder->update();", " flash('message', gt('New Order #') . $newOrder->invoice_id . \" \" . gt(\"created successfully.\"));\n if (empty($this->params['no_redirect'])) {\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $newOrder->id));\n } else {\n return $newOrder->id;\n }\n }", " function edit_address() {\n //if $type = 'b' - business\n //if $type = 's' - shipping\n //addresses_id\n $order = new order($this->params['id']);\n $same = false;", " $sm = array_pop($order->shippingmethods); //FIXME only getting 1st one and then removing it\n //$bm = array_pop($order->billingmethods);", " //eDebug($sm->addresses_id);\n //eDebug($order->billingmethod[0]->addresses_id);\n if ($sm->addresses_id == $order->billingmethod[0]->addresses_id) {\n $same = true;\n // echo \"Yes\";\n //$addy = new address($sm->addresses_id);\n }", " if ($this->params['type'] == 'b') {\n $type = 'billing';\n $addy = new address($order->billingmethod[0]->addresses_id);\n } else if ($this->params['type'] == 's') {\n $type = 'shipping';\n $addy = new address($sm->addresses_id);\n }\n /* eDebug($this->params);\n eDebug($addy);\n eDebug($order,true);*/\n $billingmethod = new billingmethod($this->params['id']);\n //eDebug($billingmethod,true);\n //$opts = expUnserialize($billing->billingmethod->billing_options);\n //eDebug($billing);\n //eDebug($opts);\n assign_to_template(array(\n 'orderid'=> $this->params['id'],\n 'record' => $addy,\n 'same' => $same,\n 'type' => $type\n ));\n }", " function save_address() {\n global $db;", " $order = new order($this->params['orderid']);\n $billing = new billing($this->params['orderid']);\n $s = array_pop($order->shippingmethods); //FIXME only getting 1st one and then removing it\n $shippingmethod = new shippingmethod($s->id);", " //eDebug($order);\n //eDebug($this->params,true);\n //eDebug($shippingmethod);\n $billingmethod = $billing->billingmethod;\n /*\n eDebug($order);\n eDebug($shippingmethod);\n eDebug($billingmethod);*/", " if ($this->params['save_option'] == 0) {\n //update existing\n //echo \"Update\";\n $addy = new address($this->params['addyid']);\n } else if ($this->params['save_option'] == 1) {\n //create new\n //echo \"New\";\n $oldaddy = new address($this->params['addyid']);\n $addy = new address();\n $addy->user_id = $oldaddy->user_id;\n }", " //eDebug($addy,true);", " foreach ($this->params['address'] as $key=> $val) {\n if ($key == 'address_country_id') {\n $key = 'country';\n }\n if ($key == 'address_region_id') {\n $key = 'state';\n }\n $addy->$key = $val;\n if (isset($billingmethod->$key)) $billingmethod->$key = $val;\n if (isset($shippingmethod->$key)) $shippingmethod->$key = $val;\n }\n $addy->is_billing = 0;\n $addy->is_shipping = 0;\n $addy->save();\n $addy->refresh();", " if ($this->params['type'] == 'billing' || ($this->params['same'] == true && $this->params['save_option'] == 0)) {\n //echo \"Billing\";\n $billingmethod->addresses_id = $addy->id;\n $billingmethod->save();\n $addy->is_billing = 1;\n }", " if ($this->params['type'] == 'shipping' || ($this->params['same'] == true && $this->params['save_option'] == 0)) {\n //eDebug(\"Shipping\",true);\n $shippingmethod->addresses_id = $addy->id;\n $shippingmethod->save();\n $addy->is_shipping = 1;\n }", " $addy->save();\n if ($addy->is_default) $db->setUniqueFlag($addy, 'addresses', 'is_default', 'user_id=' . $addy->user_id);", " //eDebug($shippingmethod,true);\n// flashAndFlow('message', gt('Address updated.'));\n flash('message', gt('Address updated.'));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['id']));\n }", " function edit_order_item() {\n $oi = new orderitem($this->params['id'], true, true);\n if (empty($oi->id)) {\n flash('error', gt('Order item doesn\\'t exist.'));\n expHistory::back();\n }\n $oi->user_input_fields = expUnserialize($oi->user_input_fields);\n $params['options'] = $oi->opts;\n $params['user_input_fields'] = $oi->user_input_fields;\n $oi->product = new product($oi->product->id, true, true);\n if ($oi->product->parent_id != 0) {\n $parProd = new product($oi->product->parent_id);", " //$oi->product->optiongroup = $parProd->optiongroup;", " $oi->product = $parProd;\n }\n //FIXME we don't use selectedOpts?\n// $oi->selectedOpts = array();\n// if (!empty($oi->opts)) {\n// foreach ($oi->opts as $opt) {\n// $option = new option($opt[0]);\n// $og = new optiongroup($option->optiongroup_id);\n// if (!isset($oi->selectedOpts[$og->id]) || !is_array($oi->selectedOpts[$og->id]))\n// $oi->selectedOpts[$og->id] = array($option->id);\n// else\n// array_push($oi->selectedOpts[$og->id], $option->id);\n// }\n// }\n //eDebug($oi->selectedOpts);", " assign_to_template(array(\n 'oi' => $oi,\n 'params' => $params\n ));\n }", " function delete_order_item() {\n $order = new order($this->params['orderid']);\n if (count($order->orderitem) <= 1) {\n flash('error', gt('You may not delete the only item on an order. Please edit this item, or add another item before removing this one.'));\n expHistory::back();\n }", " $oi = new orderitem($this->params['id']);\n $oi->delete();", " $s = array_pop($order->shippingmethods); //FIXME only getting 1st one and then removing it\n $sm = new shippingmethod($s->id);", " $shippingCalc = new shippingcalculator($sm->shippingcalculator_id);\n $calcName = $shippingCalc->calculator_name;\n $calculator = new $calcName($shippingCalc->id);\n $pricelist = $calculator->getRates($order);", " foreach ($pricelist as $rate) {\n if ($rate['id'] == $sm->option) {\n $sm->shipping_cost = $rate['cost'];\n }\n }\n $sm->save();", " $order->refresh();\n $order->calculateGrandTotal();\n $order->save();", "// flashAndFlow('message', gt('Order item removed and order totals updated.'));\n flash('message', gt('Order item removed and order totals updated.'));\n if (empty($this->params['no_redirect'])) redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['orderid']));\n }", " function save_order_item() {\n if (!empty($this->params['id'])) {\n $oi = new orderitem($this->params['id']);\n } else {\n $oi = new orderitem($this->params);\n }\n //eDebug($this->params);", " /*eDebug($oi);\n eDebug(expUnserialize($oi->options));\n eDebug(expUnserialize($oi->user_input_fields),true);*/\n if (!empty($this->params['products_price'])) $oi->products_price = expUtil::currency_to_float($this->params['products_price']);\n $oi->quantity = $this->params['quantity'];\n if (!empty($this->params['products_name'])) $oi->products_name = $this->params['products_name'];", " if ($oi->product->parent_id != 0) {\n $oi->product = new product($oi->product->parent_id, true, false);\n } else {\n //reattach the product so we get the option fields and such\n $oi->product = new product($oi->product->id, true, false);\n }", " if (isset($this->params['product_status_id'])) {\n $ps = new product_status($this->params['product_status_id']);\n $oi->products_status = $ps->title;\n }", " $options = array();\n foreach ($oi->product->optiongroup as $og) {\n $isOptionEmpty = true;\n if (!empty($this->params['options'][$og->id])) {\n foreach ($this->params['options'][$og->id] as $opt) {\n if (!empty($opt)) $isOptionEmpty = false;\n }\n }\n if (!$isOptionEmpty) {\n foreach ($this->params['options'][$og->id] as $opt_id) {\n $selected_option = new option($opt_id);\n $cost = $selected_option->modtype == '$' ? $selected_option->amount : $this->getBasePrice() * ($selected_option->amount * .01);\n $cost = $selected_option->updown == '+' ? $cost : $cost * -1;\n $options[] = array($selected_option->id, $selected_option->title, $selected_option->modtype, $selected_option->updown, $selected_option->amount);\n }\n }\n }", " eDebug($this->params);\n //eDebug($oi,true);", " $user_input_info = array();\n //check user input fields\n //$this->user_input_fields = expUnserialize($this->user_input_fields);\n //eDebug($this,true);\n if (!empty($oi->product->user_input_fields)) foreach ($oi->product->user_input_fields as $uifkey=> $uif) {", " /*if ($uif['is_required'] || (!$uif['is_required'] && strlen($params['user_input_fields'][$uifkey]) > 0))", " {\n if (strlen($params['user_input_fields'][$uifkey]) < $uif['min_length'])\n {", " //flash('error', 'test');\n //redirect_to(array('controller'=>cart, 'action'=>'displayForm', 'form'=>'addToCart', 'product_id'=>$this->id, 'product_type'=>$this->product_type));", " $params['error'] .= $uif['name'].' field has a minimum requirement of ' . $uif['min_length'] . ' characters.<br/>';", "", " }else if (strlen($params['user_input_fields'][$uifkey]) > $uif['max_length'] && $uif['max_length'] > 0)\n {", " //flash('error', );\n //redirect_to(array('controller'=>cart, 'action'=>'displayForm', 'form'=>'addToCart', 'product_id'=>$this->id, 'product_type'=>$this->product_type));", " $params['error'] .= $uif['name'].' field has a maximum requirement of ' . $uif['max_length'] . ' characters.<br/>';", " }", " }*/\n $user_input_info[] = array($uif['name']=> $this->params['user_input_fields'][$uifkey]);\n }\n //eDebug($options);\n //eDebug($user_input_info,true);", " $oi->options = serialize($options);\n $oi->user_input_fields = serialize($user_input_info);", " //eDebug($oi);", " $oi->save();\n $oi->refresh();\n //eDebug($oi,true);", " $order = new order($oi->orders_id);\n $order->calculateGrandTotal();", " $s = array_pop($order->shippingmethods); //FIXME only getting 1st one and thenremoving it\n eDebug($s);\n $sm = new shippingmethod($s->id);", " $shippingCalc = new shippingcalculator($sm->shippingcalculator_id);\n $calcName = $shippingCalc->calculator_name;\n $calculator = new $calcName($shippingCalc->id);\n $pricelist = $calculator->getRates($order);", " foreach ($pricelist as $rate) {\n if ($rate['id'] == $sm->option) {\n $sm->shipping_cost = $rate['cost'];\n break;\n }\n }\n $sm->save();\n $order->refresh();\n $order->calculateGrandTotal();\n //FIXME attempt to update w/ new billing transaction\n// $bmopts = expUnserialize($order->billingmethod[0]->billing_options);\n// $bmopts->result->transId = gt('Item edited in order');\n// $order->billingmethod[0]->update(array('billing_options' => serialize($bmopts), 'transaction_state' => $transaction_state));\n// $order->billingmethod[0]->billingcalculator->calculator->createBillingTransaction($order->billingmethod[0], number_format($order->grand_total, 2, '.', ''), $bmopts->result, $bmopts->result->payment_status);\n $order->save();", "// flashAndFlow('message', gt('Order item updated and order totals recalculated.'));\n flash('message', gt('Order item updated and order totals recalculated.'));\n if (empty($this->params['no_redirect'])) {\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['orderid']));\n } else {\n return $oi->id;\n }\n }", " function add_order_item() {\n// eDebug($this->params);\n $product = new product($this->params['product_id']);\n $paramsArray = array('orderid'=> $this->params['orderid']);\n assign_to_template(array(\n 'product'=> $product,\n 'params' => $paramsArray\n ));\n }", " function save_new_order_item() { //FIXME we need to be able to call this from program with $params also, addToOrder\n //eDebug($this->params,true);\n //check for multiple product adding\n $order = new order($this->params['orderid']);\n if (isset($this->params['prod-quantity'])) {\n //we are adding multiple children, so we approach a bit different", " //we'll send over the product_id of the parent, along with id's and quantities of children we're adding", " foreach ($this->params['prod-quantity'] as $qkey=> &$quantity) {\n if (in_array($qkey, $this->params['prod-check'])) {\n $this->params['children'][$qkey] = $quantity;\n }\n if (isset($child)) $this->params['product_id'] = $child->parent_id;\n }\n }", " $pt = $this->params['product_type'];\n $product = new $pt($this->params['product_id'], true, true); //need true here?", " if ($product->addToCart($this->params, $this->params['orderid'])) {\n $order->refresh();\n $order->calculateGrandTotal();\n //FIXME attempt to update w/ new billing transaction\n// $bmopts = expUnserialize($order->billingmethod[0]->billing_options);\n// $bmopts->result->transId = gt('Item added to order');\n// $order->billingmethod[0]->billingcalculator->calculator->createBillingTransaction($order->billingmethod[0], number_format($order->grand_total, 2, '.', ''), $bmopts->result, $bmopts->result->payment_status);\n $order->save();\n// flashAndFlow('message', gt('Product added to order and order totals recalculated.'));\n flash('message', gt('Product added to order and order totals recalculated.'));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['orderid']));\n }\n /*else\n {\n expHistory::back();\n }*/\n }", " function edit_invoice_id() {\n if (!isset($this->params['id'])) flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n $order = new order($this->params['id']);\n assign_to_template(array(\n 'orderid' => $this->params['id'],\n 'invoice_id'=> $order->invoice_id\n ));\n }", " function save_invoice_id() {\n if (!isset($this->params['id'])) flashAndFlow('error', gt('Unable to process request. Order invalid.'));\n if (empty($this->params['invoice_id']) || !is_numeric($this->params['invoice_id'])) flashAndFlow('error', gt('Unable to process request. Invoice ID #.'));\n $order = new order($this->params['id']);\n $order->invoice_id = $this->params['invoice_id'];\n $order->save(false);\n flashAndFlow('message', gt('Invoice # saved.'));\n }", " function edit_totals() {\n //eDebug($this->params);\n $order = new order($this->params['orderid']);\n assign_to_template(array(\n// 'orderid'=>$this->params['id'],\n 'order'=> $order\n ));\n }", " function save_totals() {\n //eDebug($this->params);\n //if(!is_numeric($this->params['subtotal']))\n $order = new order($this->params['orderid']);\n $order->subtotal = expUtil::currency_to_float($this->params['subtotal']);\n $order->total_discounts = expUtil::currency_to_float($this->params['total_discounts']);\n $order->total = round($order->subtotal - $order->total_discounts, 2);\n $order->tax = expUtil::currency_to_float($this->params['tax']);\n $order->shipping_total = expUtil::currency_to_float($this->params['shipping_total']);\n //note: the shippingmethod record will still reflect the ORIGINAL shipping amount for this order.\n $order->surcharge_total = expUtil::currency_to_float($this->params['surcharge_total']);", " if ($this->params['autocalc'] == true) {\n $order->grand_total = round(($order->subtotal - $order->total_discounts) + $order->tax + $order->shipping_total + $order->surcharge_total, 2);\n } else {\n $order->grand_total = round(expUtil::currency_to_float($this->params['grand_total']), 2);\n }\n //FIXME attempt to update w/ new billing transaction\n// $bmopts = expUnserialize($order->billingmethod[0]->billing_options);\n// $bmopts->result->transId = gt('Totals Adjusted');\n// $order->billingmethod[0]->billingcalculator->calculator->createBillingTransaction($order->billingmethod[0], number_format($order->grand_total, 2, '.', ''), $bmopts->result, $bmopts->result->payment_status);\n $order->save();", "// flashAndFlow('message', gt('Order totals updated.'));\n flash('message', gt('Order totals updated.'));\n redirect_to(array('controller'=> 'order', 'action'=> 'show', 'id'=> $this->params['orderid']));\n }", " function update_sales_reps() {\n if (!isset($this->params['id'])) {\n flashAndFlow('error', gt('Unable to process request. Invalid order number.'));\n //expHistory::back();\n }\n $order = new order($this->params['id']);\n $order->sales_rep_1_id = $this->params['sales_rep_1_id'];\n $order->sales_rep_2_id = $this->params['sales_rep_2_id'];\n $order->sales_rep_3_id = $this->params['sales_rep_3_id'];\n $order->save();\n flashAndFlow('message', gt('Sales reps updated.'));\n }", " function quickfinder() {\n global $db;", " $search = $this->params['ordernum'];\n $searchInv = intval($search);", " $sql = \"SELECT DISTINCT(o.id), o.invoice_id, FROM_UNIXTIME(o.purchased,'%c/%e/%y %h:%i:%s %p') as purchased_date, b.firstname as bfirst, b.lastname as blast, concat('\".expCore::getCurrencySymbol().\"',format(o.grand_total,2)) as grand_total, os.title as status_title, ot.title as order_type\";\n $sql .= \" from \" . $db->prefix . \"orders as o \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"orderitems as oi ON oi.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_type as ot ON ot.id = o.order_type_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_status as os ON os.id = o.order_status_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"billingmethods as b ON b.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"shippingmethods as s ON s.id = oi.shippingmethods_id \";", " $sqlwhere = \"WHERE o.purchased != 0\";\n if ($searchInv != 0) $sqlwhere .= \" AND (o.invoice_id LIKE '%\" . $searchInv . \"%' OR\";\n else $sqlwhere .= \" AND (\";\n $sqlwhere .= \" b.firstname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR s.firstname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR b.lastname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR s.lastname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR b.email LIKE '%\" . $search . \"%')\";", " $limit = empty($this->config['limit']) ? 350 : $this->config['limit'];\n //eDebug($sql . $sqlwhere) ;\n $page = new expPaginator(array(\n 'sql' => $sql . $sqlwhere,\n 'limit' => $limit,\n 'order' => 'o.invoice_id',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=> $this->baseclassname,\n 'action' => $this->params['action'],\n 'columns' => array(\n 'actupon' => true,\n gt('Order #') => 'invoice_id|controller=order,action=show,showby=id',\n gt('Purchased Date')=> 'purchased_date',\n gt('First') => 'bfirst',\n gt('Last') => 'blast',\n gt('Total') => 'grand_total',\n gt('Order Type') => 'order_type',\n gt('Status') => 'status_title'\n ),\n ));\n assign_to_template(array(\n 'page'=> $page,\n 'term'=> $search\n ));", " //eDebug($this->params);\n /*$o = new order();\n $b = new billingmethod();\n $s = new shippingmethod();", "", " $search = intval($this->params['ordernum']);\n if (is_int($oid) && $oid > 0)\n {\n $orders = $o->find('all',\"invoice_id LIKE '%\".$oid.\"%'\");\n if(count($orders == 1))\n {", " redirect_to(array('controller'=>'order','action'=>'show','id'=>$order[0]->id));", " }\n else\n {\n flashAndFlow('message',\"Orders containing \" . $search . \" in the order number not found.\");\n }\n }\n else\n {\n //lookup just a customer\n $bms = $b->find('all', )\n }*/\n /*$o = new order();\n $oid = intval($this->params['ordernum']);\n if (is_int($oid) && $oid > 0)\n {\n $order = $o->find('first','invoice_id='.$oid);\n if(!empty($order->id))\n {", " redirect_to(array('controller'=>'order','action'=>'show','id'=>$order->id));", " }\n else\n {\n flashAndFlow('message',\"Order #\" . intval($this->params['ordernum']) . \" not found.\");\n }\n }\n else\n {", " flashAndFlow('message','Invalid order number.');", " }*/\n }", " public function verifyReturnShopper() {\n// global $user, $order;", " $sessAr = expSession::get('verify_shopper');\n if (isset($sessAr)) {\n assign_to_template(array(\n 'firstname'=> $sessAr['firstname'],\n 'cid'=> $sessAr['cid']", " ));\n /*eDebug(expSession::get('verify_shopper'));\n eDebug($this->params);\n eDebug(\"here\");\n eDebug($user);\n eDebug($order);*/\n }\n }", " public function verifyAndRestoreCart() {\n// global $user, $order;", " $sessAr = expSession::get('verify_shopper');\n if (isset($sessAr) && isset($this->params['cid']) && $this->params['cid'] == $sessAr['cid']) {\n $tmpCart = new order($sessAr['cid']);\n if (isset($tmpCart->id)) {", " //eDebug($tmpCart,true);", " $shippingMethod = $tmpCart->shippingmethod;\n $billingMethod = $tmpCart->billingmethod[0];", " if (($this->params['lastname'] == $shippingMethod->lastname || $this->params['lastname'] == $billingMethod->lastname) &&\n ($this->params['email'] == $shippingMethod->email || $this->params['email'] == $billingMethod->email) &&\n ($this->params['zip_code'] == $shippingMethod->zip || $this->params['zip_code'] == $billingMethod->zip)\n ) {\n //validatio succeed, so restore order, login user and continue on to orig_path\n //eDebug(\"Validated\",true);\n $sessAr['validated'] = true;\n expSession::set('verify_shopper', $sessAr);\n redirect_to($sessAr['orig_path']);\n } else {\n //eDebug(\"Validated NOT\",true);\n //validation failed, so go back\n flash('error', gt(\"We're sorry, but we could not verify your information. Please try again, or start a new shopping cart.\"));\n redirect_to(array('controller'=> 'order', 'action'=> 'verifyReturnShopper', 'id'=> $sessAr['cid']));\n }\n } else {\n flash('error', gt('We were unable to restore the previous order, we apologize for the inconvenience. Please start a new shopping cart.'));\n $this->clearCart();\n }\n }\n }", " public static function clearCartCookie() {\n expSession::un_set('verify_shopper');\n order::setCartCookie(null);\n }", " public function clearCart() {\n global $order;", " $sessAr = expSession::get('verify_shopper');\n if (isset($sessAr)) {\n order::setCartCookie($order);\n $orig_path = $sessAr['orig_path'];\n expSession::un_set('verify_shopper');\n redirect_to($orig_path);\n } else {\n expHistory::back();\n }\n }", " /**\n * AJAX search for internal (addressController) addresses\n *\n */\n public function search() {\n// global $db, $user;\n global $db;", " $sql = \"select DISTINCT(a.id) as id, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email \";", " $sql .= \"from \" . $db->prefix . \"addresses as a \"; //R JOIN \" .", " //$db->prefix . \"billingmethods as bm ON bm.addresses_id=a.id \";\n $sql .= \" WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('\" . $this->params['query'] .\n \"*' IN BOOLEAN MODE) \";\n $sql .= \"order by match (a.firstname,a.lastname,a.email,a.organization) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) ASC LIMIT 12\";\n $res = $db->selectObjectsBySql($sql);\n foreach ($res as $key=>$record) {\n $res[$key]->title = $record->firstname . ' ' . $record->lastname;\n }\n //eDebug($sql);\n $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }", " /**\n * Ajax search for external addresses\n *\n */\n public function search_external() {\n// global $db, $user;\n global $db;", " $sql = \"select DISTINCT(a.id) as id, a.source as source, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email \";", " $sql .= \"from \" . $db->prefix . \"external_addresses as a \"; //R JOIN \" .", " //$db->prefix . \"billingmethods as bm ON bm.addresses_id=a.id \";\n $sql .= \" WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('\" . $this->params['query'] .\n \"*' IN BOOLEAN MODE) \";\n $sql .= \"order by match (a.firstname,a.lastname,a.email,a.organization) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) ASC LIMIT 12\";\n $res = $db->selectObjectsBySql($sql);\n foreach ($res as $key=>$record) {\n $res[$key]->title = $record->firstname . ' ' . $record->lastname;\n }\n //eDebug($sql);\n $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class order_statusController extends expController {", "", " static function displayname() { return gt(\"e-Commerce Order Statuses\"); }\n static function description() { return gt(\"Manage e-Commerce order status codes\"); }\n static function hasSources() { return false; }\n static function hasContent() { return false; }", " ", " public function manage() {\n expHistory::set('viewable', $this->params);", " ", " $page = new expPaginator(array(\n\t\t\t'model'=>'order_status',\n\t\t\t'where'=>1,\n 'limit'=>10,\n\t\t\t'order'=>'rank',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n //'columns'=>array('Name'=>'title')\n ));", "\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }", " ", " public function manage_messages() {\n expHistory::set('manageable', $this->params);", " ", " $page = new expPaginator(array(\n\t\t\t'model'=>'order_status_messages',\n\t\t\t'where'=>1,\n 'limit'=>10,\n\t\t\t'order'=>'body',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n\t\t\t//'columns'=>array('Name'=>'title')\n ));", " //eDebug($page);\n\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }", " ", " public function edit_message() {\n $id = isset($this->params['id']) ? $this->params['id'] : null;\n $msg = new order_status_messages($id);\n assign_to_template(array(\n 'record'=>$msg\n ));\n //$msg->update($this->params);\n }", " ", " public function update_message() {\n $id = isset($this->params['id']) ? $this->params['id'] : null;\n $msg = new order_status_messages($id);\n $msg->update($this->params);\n expHistory::back();\n }", " ", " public function delete_message() {\n if (empty($this->params['id'])) return false;\n $msg = new order_status_messages($this->params['id']);\n $msg->delete();\n expHistory::back();\n }", " ", " public function toggle_closed() {\n global $db;", " $db->toggle('order_status', 'treat_as_closed', 'id='.$this->params['id']);\n expHistory::back();\n }", " ", " public function toggle_default() {\n global $db;", " $order_status = new order_status($this->params['id']);\n $db->setUniqueFlag($order_status, 'order_status', 'is_default');\n expHistory::back();\n }", " ", " public function showall() {\n redirect_to(array('controller'=>'order_status', 'action'=>'manage'));\n// $this->manage();\n }", " ", " public function show() {\n redirect_to(array('controller'=>'order_status', 'action'=>'manage'));\n// $this->manage();\n }", " ", "}", "?>" ]
[ 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class order_statusController extends expController {", " protected $manage_permissions = array(\n 'toggle'=>'Toggle Status'\n );", " static function displayname() { return gt(\"e-Commerce Order Statuses\"); }\n static function description() { return gt(\"Manage e-Commerce order status codes\"); }\n static function hasSources() { return false; }\n static function hasContent() { return false; }", "", " public function manage() {\n expHistory::set('viewable', $this->params);", "", " $page = new expPaginator(array(\n\t\t\t'model'=>'order_status',\n\t\t\t'where'=>1,\n 'limit'=>10,\n\t\t\t'order'=>'rank',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n //'columns'=>array('Name'=>'title')\n ));", "\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }", "", " public function manage_messages() {\n expHistory::set('manageable', $this->params);", "", " $page = new expPaginator(array(\n\t\t\t'model'=>'order_status_messages',\n\t\t\t'where'=>1,\n 'limit'=>10,\n\t\t\t'order'=>'body',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n\t\t\t//'columns'=>array('Name'=>'title')\n ));", " //eDebug($page);\n\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }", "", " public function edit_message() {\n $id = isset($this->params['id']) ? $this->params['id'] : null;\n $msg = new order_status_messages($id);\n assign_to_template(array(\n 'record'=>$msg\n ));\n //$msg->update($this->params);\n }", "", " public function update_message() {\n $id = isset($this->params['id']) ? $this->params['id'] : null;\n $msg = new order_status_messages($id);\n $msg->update($this->params);\n expHistory::back();\n }", "", " public function delete_message() {\n if (empty($this->params['id'])) return false;\n $msg = new order_status_messages($this->params['id']);\n $msg->delete();\n expHistory::back();\n }", "", " public function toggle_closed() {\n global $db;", " $db->toggle('order_status', 'treat_as_closed', 'id='.$this->params['id']);\n expHistory::back();\n }", "", " public function toggle_default() {\n global $db;", " $order_status = new order_status($this->params['id']);\n $db->setUniqueFlag($order_status, 'order_status', 'is_default');\n expHistory::back();\n }", "", " public function showall() {\n redirect_to(array('controller'=>'order_status', 'action'=>'manage'));\n// $this->manage();\n }", "", " public function show() {\n redirect_to(array('controller'=>'order_status', 'action'=>'manage'));\n// $this->manage();\n }", "", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class purchaseOrderController extends expController {", "", "", "\tpublic $basemodel_name = 'purchase_order';\n\tprotected $add_permissions = array(\n 'manage'=>'Manage Purchase Orders',\n 'edit'=>'Edit Purchase Orders',\n 'manage_vendors'=>'Manage Vendors',\n 'show_vendor'=>'Show Vendor Details',\n 'edit_vendor'=>'Edit Vendor',\n 'update_vendor'=>'Update Vendor',\n 'delete_vendor'=>'Delete vendors',\n );\n\t", " static function displayname() { return gt(\"e-Commerce Purchase Order Manager\"); }\n static function description() { return gt(\"Use this module to create and manage purchase orders for your ecommerce store.\"); }", "\t", "\tfunction manage () {\n\t expHistory::set('viewable', $this->params);", "\t\t", "\t\t$vendor = new vendor();\n\t\t$vendors = $vendor->find('all');\n\t\tif(!empty($this->params['vendor'])) {\n\t\t\t$purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']);\n\t\t} else {\n\t\t\t$purchase_orders = $this->purchase_order->find('all');\n\t\t}", "\t\t", "\t\tassign_to_template(array(\n 'purchase_orders'=>$purchase_orders,\n 'vendors' => $vendors,\n 'vendor_id' => @$this->params['vendor']\n ));\n\t}", "\t", "\tfunction edit () {\n//\t global $db;\n\t assign_to_template(array(\n 'record'=>$this->params\n ));\n\t}", " ", "\tfunction manage_vendors () {\n\t expHistory::set('viewable', $this->params);\n\t\t$vendor = new vendor();", "\t\t", "\t\t$vendors = $vendor->find('all');\n\t\tassign_to_template(array(\n 'vendors'=>$vendors\n ));\n\t}", "\t", "\tfunction show_vendor () {\n\t\t$vendor = new vendor();", "\t\t", "\t\tif(isset($this->params['id'])) {\n\t\t\t$vendor = $vendor->find('first', 'id =' .$this->params['id']);\n\t\t\t$vendor_title = $vendor->title;\n\t\t\t$state = new geoRegion($vendor->state);\n\t\t\t$vendor->state = $state->name;\n\t\t\t//Removed unnecessary fields\n\t\t\tunset(\n $vendor->title,\n $vendor->table,\n $vendor->tablename,\n $vendor->classname,\n $vendor->identifier\n );", "\t\t", "\t\t\tassign_to_template(array(\n 'vendor_title' => $vendor_title,\n 'vendor'=>$vendor\n ));\n\t\t}\n\t}", "\t", "\tfunction edit_vendor() {\n\t\t$vendor = new vendor();", "\t\t", "\t\tif(isset($this->params['id'])) {\n\t\t\t$vendor = $vendor->find('first', 'id =' .$this->params['id']);\n\t\t\tassign_to_template(array(\n 'vendor'=>$vendor\n ));\n\t\t}\n\t}", "\t", "\tfunction update_vendor() {\n\t\t$vendor = new vendor();", "\t\t", "\t\t$vendor->update($this->params['vendor']);\n expHistory::back();\n }", "\t", "\tfunction delete_vendor() {\n\t\tglobal $db;", "\t\t", " if (!empty($this->params['id'])){\n\t\t\t$db->delete('vendor', 'id =' .$this->params['id']);\n\t\t}\n expHistory::back();\n }", "\t", "\tpublic function getPurchaseOrderByJSON() {", "\t\t", "\t\tif(!empty($this->params['vendor'])) {\n\t\t\t$purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']);\n\t\t} else {\n\t\t\t$purchase_orders = $this->purchase_order->find('all');\n\t\t}", "\t\t", "\t\techo json_encode($purchase_orders);\n\t}", " ", "}", "?>" ]
[ 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class purchaseOrderController extends expController {", "\tpublic $basemodel_name = 'purchase_order';\n\tprotected $manage_permissions = array(\n 'show_vendor'=>'Show Vendor Details',\n );", "", "", " static function displayname() { return gt(\"e-Commerce Purchase Order Manager\"); }\n static function description() { return gt(\"Use this module to create and manage purchase orders for your ecommerce store.\"); }", "", "\tfunction manage () {\n\t expHistory::set('viewable', $this->params);", "", "\t\t$vendor = new vendor();\n\t\t$vendors = $vendor->find('all');\n\t\tif(!empty($this->params['vendor'])) {\n\t\t\t$purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']);\n\t\t} else {\n\t\t\t$purchase_orders = $this->purchase_order->find('all');\n\t\t}", "", "\t\tassign_to_template(array(\n 'purchase_orders'=>$purchase_orders,\n 'vendors' => $vendors,\n 'vendor_id' => @$this->params['vendor']\n ));\n\t}", "", "\tfunction edit () {\n//\t global $db;\n\t assign_to_template(array(\n 'record'=>$this->params\n ));\n\t}", "", "\tfunction manage_vendors () {\n\t expHistory::set('viewable', $this->params);\n\t\t$vendor = new vendor();", "", "\t\t$vendors = $vendor->find('all');\n\t\tassign_to_template(array(\n 'vendors'=>$vendors\n ));\n\t}", "", "\tfunction show_vendor () {\n\t\t$vendor = new vendor();", "", "\t\tif(isset($this->params['id'])) {\n\t\t\t$vendor = $vendor->find('first', 'id =' .$this->params['id']);\n\t\t\t$vendor_title = $vendor->title;\n\t\t\t$state = new geoRegion($vendor->state);\n\t\t\t$vendor->state = $state->name;\n\t\t\t//Removed unnecessary fields\n\t\t\tunset(\n $vendor->title,\n $vendor->table,\n $vendor->tablename,\n $vendor->classname,\n $vendor->identifier\n );", "", "\t\t\tassign_to_template(array(\n 'vendor_title' => $vendor_title,\n 'vendor'=>$vendor\n ));\n\t\t}\n\t}", "", "\tfunction edit_vendor() {\n\t\t$vendor = new vendor();", "", "\t\tif(isset($this->params['id'])) {\n\t\t\t$vendor = $vendor->find('first', 'id =' .$this->params['id']);\n\t\t\tassign_to_template(array(\n 'vendor'=>$vendor\n ));\n\t\t}\n\t}", "", "\tfunction update_vendor() {\n\t\t$vendor = new vendor();", "", "\t\t$vendor->update($this->params['vendor']);\n expHistory::back();\n }", "", "\tfunction delete_vendor() {\n\t\tglobal $db;", "", " if (!empty($this->params['id'])){\n\t\t\t$db->delete('vendor', 'id =' .$this->params['id']);\n\t\t}\n expHistory::back();\n }", "", "\tpublic function getPurchaseOrderByJSON() {", "", "\t\tif(!empty($this->params['vendor'])) {\n\t\t\t$purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']);\n\t\t} else {\n\t\t\t$purchase_orders = $this->purchase_order->find('all');\n\t\t}", "", "\t\techo json_encode($purchase_orders);\n\t}", "", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class shippingController extends expController {", " protected $add_permissions = array(\n 'toggle'=>'Enable/Disable Options'", " );", " static function displayname() { return gt(\"e-Commerce Shipping Controller\"); }\n static function description() { return \"\"; }\n\tstatic function hasSources() { return false; }\n static function hasContent() { return false; }", " /**\n * Ajax method to return a shipping calculator object within a shipping object\n */\n\tfunction selectShippingCalculator() {\n\t global $db;", "\t\t$shipping = new shipping();", "\t\t", "\t\t// update the shippingmethod\n\t\t$shipping->shippingmethod->update(array('shippingcalculator_id'=>$this->params['shippingcalculator_id'],'option'=>null,'option_title'=>null));", "\t\t", "\t\t// fetch the calculator\n\t\t$calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['shippingcalculator_id']);\n\t\t//eDebug($this->params['shippingcalculator_id']);\n\t\t//eDebug($calcname);\n\t\t$shipping->calculator = new $calcname($this->params['shippingcalculator_id']);", "\t\t", "\t\t$ar = new expAjaxReply(200, 'ok', $shipping, array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}", " /**\n * Ajax method to select/update a shipping method\n */\n\tfunction selectShippingOption() {\n\t global $order; //FIXME we do NOT want the global $order", "\t\t$shipping = new shipping();\n\t\t$id = $this->params['option'];\n\t\t$rates = $shipping->calculator->getRates($order); //FIXME a lot of work just to get one set of data since we'll be doing it again for cart/checkout redisplay...maybe cache???\n\t\t$rate = $rates[$id];\n\t\t$shipping->shippingmethod->update(array('option'=>$id,'option_title'=>$rate['title'],'shipping_cost'=>$rate['cost']));\n\t\t$ar = new expAjaxReply(200, 'ok', array('title'=>$rate['title'], 'cost'=>number_format($rate['cost'], 2)), array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}", " /**\n * Ajax method to set a shipping address\n */\n\tfunction setAddress() {\n\t\t$shipping = new shipping();\n\t\t$shipping->shippingmethod->setAddress($this->params['shipping_address']);\n\t\t$shipping->refresh();\n\t\t$ar = new expAjaxReply(200, 'ok', new address($shipping->shippingmethod->addresses_id), array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}", "\t", " /**\n * Ajax method to set a shipping 'gift' message\n */\n\tfunction leaveMessage() {\n\t\tif (!empty($this->params['shippingmessageid'])) {\n\t\t $sm = new shippingmethod($this->params['shippingmessageid']);", "\t\t ", "\t\t if ($this->params['nosave'] == false) {", "\t\t $sm->to = empty($this->params['shpmessageto']) ? null : $this->params['shpmessageto']; \n\t\t $sm->from = empty($this->params['shpmessagefrom']) ? null : $this->params['shpmessagefrom']; \n\t\t $sm->message = empty($this->params['shpmessage']) ? null : $this->params['shpmessage']; ", "\t\t $sm->save();\n\t\t }\n\t\t}", "\t\t", "\t\t$ar = new expAjaxReply(200, 'ok', $sm, array('controller'=>'cart', 'action'=>'checkout'),true);", "\t\t$ar->send();\t\t\n\t}\n\t", "\tfunction renderOptions() { //FIXME do we ever call this?\n//\t global $db, $order;\n global $order; //FIXME we do NOT want the global $order", "\t $shipping = new shipping();\n //FIXME perhaps check for cached rates if calculator didn't change???\n $shipping->pricelist = $shipping->calculator->getRates($order);\n $shipping->multiple_carriers = $shipping->calculator->multiple_carriers;", " if (empty($shipping->shippingmethod->option)) {\n if ($shipping->multiple_carriers) {\n $opt = current($shipping->pricelist[0]);\n } else {\n $opt = current($shipping->pricelist);\n }\n } else {\n if ($shipping->multiple_carriers) {\n $opt = $shipping->pricelist[0][$shipping->shippingmethod->option];\n } else {\n $opt = $shipping->pricelist[$shipping->shippingmethod->option];\n }\n }", " ", " $shipping->shippingmethod->update(array('option'=>$opt['id'],'option_title'=>$opt['title'],'shipping_cost'=>$opt['cost']));", " ", " assign_to_template(array(\n 'shipping'=>$shipping,\n 'order'=>$order\n ));\n\t}", "\t", " /**\n * Ajax method to return a shipping calculator object within a shipping object\n */\n\tfunction listPrices() {\n\t $shipping = new shipping(); //FIXME this model has no listPrices() method???\n\t $ar = new expAjaxReply(200, 'ok', $shipping->listPrices(), array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}", "\t", "\tfunction manage() {\n\t global $db;", "\t ", "\t expHistory::set('manageable', $this->params);\n\t $calculators = array();\n $dir = BASE.\"framework/modules/ecommerce/shippingcalculators\";\n $default = false;\n $on = false;\n if (is_readable($dir)) {\n $dh = opendir($dir);\n while (($file = readdir($dh)) !== false) {\n if (is_file(\"$dir/$file\") && substr(\"$dir/$file\", -4) == \".php\") {\n include_once(\"$dir/$file\");\n $classname = substr($file, 0, -4);", " $id = $db->selectValue('shippingcalculator', 'id', 'calculator_name=\"'.$classname.'\"'); ", " if (empty($id)) {\n $calcobj = new $classname($this->params);", " if ($calcobj->isSelectable() == true) { ", " $calcobj->update(array('title'=>$calcobj->name(),'body'=>$calcobj->description(),'calculator_name'=>$classname,'enabled'=>false));\n }\n } else {\n $calcobj = new $classname($id);\n }\n $calculators[] = $calcobj;\n if (!$default) $default = $calcobj->is_default;\n if (!$on && $calcobj->enabled) $on = $calcobj->id;\n }\n }\n if (!$default && $on) {\n $db->toggle('shippingcalculator', 'is_default', 'id='.$on);\n foreach ($calculators as $idx=>$calc) {\n if ($calc->id == $on) $calculators[$idx]->is_default = 1;\n }\n }\n }\n assign_to_template(array(\n 'calculators'=>$calculators\n ));\n\t}", "\t\n\t\t", "\tpublic function toggle() {\n\t global $db;", "\t if (isset($this->params['id'])) $db->toggle('shippingcalculator', 'enabled', 'id='.$this->params['id']);\n //FIXME we need to ensure our default calculator is still active...not sure this does it\n if ($db->selectValue('shippingcalculator', 'is_default', 'id='.$this->params['id']) && !$db->selectValue('shippingcalculator', 'enabled', 'id='.$this->params['id'])) {\n $db->toggle('shippingcalculator', 'is_default', 'id='.$this->params['id']);\n }", " $calc = new shippingcalculator($this->params['id']);\n $calc_obj = new $calc->calculator_name();\n if ($calc_obj->hasConfig() && empty($calc->config)) {\n flash('message', $calc_obj->name().' '.gt('requires configuration. Please do so now.'));\n redirect_to(array('controller'=>'shipping', 'action'=>'configure', 'id'=>$calc->id));\n }\n\t expHistory::back();\n\t}", " public function toggle_default() {\n \t global $db;", " $db->toggle('shippingcalculator',\"is_default\",'is_default=1');\n \t if (isset($this->params['id'])) {\n $active = $db->selectObject('shippingcalculator',\"id=\".$this->params['id']);\n $active->is_default = 1;\n $db->updateObject($active,'shippingcalculator',null,'id');\n }\n if ($db->selectValue('shippingcalculator', 'is_default', 'id='.$this->params['id']) && !$db->selectValue('shippingcalculator', 'enabled', 'id='.$this->params['id'])) {\n $db->toggle('shippingcalculator', 'enabled', 'id='.$this->params['id']);\n }\n \t expHistory::back();\n \t}", " public function configure() {\n global $db;", " if (empty($this->params['id'])) return false;\n $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);\n $calc = new $calcname($this->params['id']);\n assign_to_template(array(\n 'calculator'=>$calc,\n 'title'=>static::displayname()\n ));\n }", " ", " public function saveconfig() {\n global $db;", " if (empty($this->params['id'])) return false;\n $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);\n $calc = new $calcname($this->params['id']);", " $conf = serialize($calc->parseConfig($this->params)); ", " $calc->update(array('config'=>$conf));\n expHistory::back();\n }", "\t", "\tpublic function editspeed() {\n global $db;", " if (empty($this->params['id'])) return false;\n $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);\n $calc = new $calcname($this->params['id']);\n assign_to_template(array(\n 'calculator'=>$calc\n ));", "\t\t\n }\n\t", "\tpublic function saveEditSpeed() {\n\t\tglobal $db;", " $obj = new stdClass();\n\t\t$obj->speed = $this->params['speed'];\n\t\t$obj->shippingcalculator_id = $this->params['shippingcalculator_id'];\n\t\t$db->insertObject($obj, $this->params['table']);\n\t\tredirect_to(array('controller'=>'shipping', 'action'=>'configure', 'id'=>$this->params['shippingcalculator_id']));\n\t}", "\t", "\tpublic function deleteSpeed() {\n\t\tglobal $db;", " if (empty($this->params['id'])) return false;\n\t\t$db->delete('shippingspeeds',' id =' . $this->params['id']);\n\t\texpHistory::back();\n\t}", " public function tracker() {\n global $db;", " // we ALWAYS assume this is coming from easypost webhook\n $calc_id = $db->selectValue('shippingcalculator','id','calculator_name=\"easypostcalculator\" AND enabled=1');\n if ($calc_id) {\n $ep = new easypostcalculator($calc_id);\n if ($ep->trackerEnabled()) {\n $ep->handleTracking();\n }\n }\n exit(); // graceful exit\n }", "}", "?>" ]
[ 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class shippingController extends expController {", " protected $manage_permissions = array(\n 'editspeed'=>'Edit Shipping Speed',\n 'save'=>'Save Configuration',\n 'select'=>'Select Feature',\n 'toggle'=>'Enable/Disable Options',", " );", " static function displayname() { return gt(\"e-Commerce Shipping Controller\"); }\n static function description() { return \"\"; }\n\tstatic function hasSources() { return false; }\n static function hasContent() { return false; }", " /**\n * Ajax method to return a shipping calculator object within a shipping object\n */\n\tfunction selectShippingCalculator() {\n\t global $db;", "\t\t$shipping = new shipping();", "", "\t\t// update the shippingmethod\n\t\t$shipping->shippingmethod->update(array('shippingcalculator_id'=>$this->params['shippingcalculator_id'],'option'=>null,'option_title'=>null));", "", "\t\t// fetch the calculator\n\t\t$calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['shippingcalculator_id']);\n\t\t//eDebug($this->params['shippingcalculator_id']);\n\t\t//eDebug($calcname);\n\t\t$shipping->calculator = new $calcname($this->params['shippingcalculator_id']);", "", "\t\t$ar = new expAjaxReply(200, 'ok', $shipping, array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}", " /**\n * Ajax method to select/update a shipping method\n */\n\tfunction selectShippingOption() {\n\t global $order; //FIXME we do NOT want the global $order", "\t\t$shipping = new shipping();\n\t\t$id = $this->params['option'];\n\t\t$rates = $shipping->calculator->getRates($order); //FIXME a lot of work just to get one set of data since we'll be doing it again for cart/checkout redisplay...maybe cache???\n\t\t$rate = $rates[$id];\n\t\t$shipping->shippingmethod->update(array('option'=>$id,'option_title'=>$rate['title'],'shipping_cost'=>$rate['cost']));\n\t\t$ar = new expAjaxReply(200, 'ok', array('title'=>$rate['title'], 'cost'=>number_format($rate['cost'], 2)), array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}", " /**\n * Ajax method to set a shipping address\n */\n\tfunction setAddress() {\n\t\t$shipping = new shipping();\n\t\t$shipping->shippingmethod->setAddress($this->params['shipping_address']);\n\t\t$shipping->refresh();\n\t\t$ar = new expAjaxReply(200, 'ok', new address($shipping->shippingmethod->addresses_id), array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}", "", " /**\n * Ajax method to set a shipping 'gift' message\n */\n\tfunction leaveMessage() {\n\t\tif (!empty($this->params['shippingmessageid'])) {\n\t\t $sm = new shippingmethod($this->params['shippingmessageid']);", "", "\t\t if ($this->params['nosave'] == false) {", "\t\t $sm->to = empty($this->params['shpmessageto']) ? null : $this->params['shpmessageto'];\n\t\t $sm->from = empty($this->params['shpmessagefrom']) ? null : $this->params['shpmessagefrom'];\n\t\t $sm->message = empty($this->params['shpmessage']) ? null : $this->params['shpmessage'];", "\t\t $sm->save();\n\t\t }\n\t\t}", "", "\t\t$ar = new expAjaxReply(200, 'ok', $sm, array('controller'=>'cart', 'action'=>'checkout'),true);", "\t\t$ar->send();\n\t}\n", "\tfunction renderOptions() { //FIXME do we ever call this?\n//\t global $db, $order;\n global $order; //FIXME we do NOT want the global $order", "\t $shipping = new shipping();\n //FIXME perhaps check for cached rates if calculator didn't change???\n $shipping->pricelist = $shipping->calculator->getRates($order);\n $shipping->multiple_carriers = $shipping->calculator->multiple_carriers;", " if (empty($shipping->shippingmethod->option)) {\n if ($shipping->multiple_carriers) {\n $opt = current($shipping->pricelist[0]);\n } else {\n $opt = current($shipping->pricelist);\n }\n } else {\n if ($shipping->multiple_carriers) {\n $opt = $shipping->pricelist[0][$shipping->shippingmethod->option];\n } else {\n $opt = $shipping->pricelist[$shipping->shippingmethod->option];\n }\n }", "", " $shipping->shippingmethod->update(array('option'=>$opt['id'],'option_title'=>$opt['title'],'shipping_cost'=>$opt['cost']));", "", " assign_to_template(array(\n 'shipping'=>$shipping,\n 'order'=>$order\n ));\n\t}", "", " /**\n * Ajax method to return a shipping calculator object within a shipping object\n */\n\tfunction listPrices() {\n\t $shipping = new shipping(); //FIXME this model has no listPrices() method???\n\t $ar = new expAjaxReply(200, 'ok', $shipping->listPrices(), array('controller'=>'cart', 'action'=>'checkout'),true);\n\t\t$ar->send();\n\t}", "", "\tfunction manage() {\n\t global $db;", "", "\t expHistory::set('manageable', $this->params);\n\t $calculators = array();\n $dir = BASE.\"framework/modules/ecommerce/shippingcalculators\";\n $default = false;\n $on = false;\n if (is_readable($dir)) {\n $dh = opendir($dir);\n while (($file = readdir($dh)) !== false) {\n if (is_file(\"$dir/$file\") && substr(\"$dir/$file\", -4) == \".php\") {\n include_once(\"$dir/$file\");\n $classname = substr($file, 0, -4);", " $id = $db->selectValue('shippingcalculator', 'id', 'calculator_name=\"'.$classname.'\"');", " if (empty($id)) {\n $calcobj = new $classname($this->params);", " if ($calcobj->isSelectable() == true) {", " $calcobj->update(array('title'=>$calcobj->name(),'body'=>$calcobj->description(),'calculator_name'=>$classname,'enabled'=>false));\n }\n } else {\n $calcobj = new $classname($id);\n }\n $calculators[] = $calcobj;\n if (!$default) $default = $calcobj->is_default;\n if (!$on && $calcobj->enabled) $on = $calcobj->id;\n }\n }\n if (!$default && $on) {\n $db->toggle('shippingcalculator', 'is_default', 'id='.$on);\n foreach ($calculators as $idx=>$calc) {\n if ($calc->id == $on) $calculators[$idx]->is_default = 1;\n }\n }\n }\n assign_to_template(array(\n 'calculators'=>$calculators\n ));\n\t}", "\n", "\tpublic function toggle() {\n\t global $db;", "\t if (isset($this->params['id'])) $db->toggle('shippingcalculator', 'enabled', 'id='.$this->params['id']);\n //FIXME we need to ensure our default calculator is still active...not sure this does it\n if ($db->selectValue('shippingcalculator', 'is_default', 'id='.$this->params['id']) && !$db->selectValue('shippingcalculator', 'enabled', 'id='.$this->params['id'])) {\n $db->toggle('shippingcalculator', 'is_default', 'id='.$this->params['id']);\n }", " $calc = new shippingcalculator($this->params['id']);\n $calc_obj = new $calc->calculator_name();\n if ($calc_obj->hasConfig() && empty($calc->config)) {\n flash('message', $calc_obj->name().' '.gt('requires configuration. Please do so now.'));\n redirect_to(array('controller'=>'shipping', 'action'=>'configure', 'id'=>$calc->id));\n }\n\t expHistory::back();\n\t}", " public function toggle_default() {\n \t global $db;", " $db->toggle('shippingcalculator',\"is_default\",'is_default=1');\n \t if (isset($this->params['id'])) {\n $active = $db->selectObject('shippingcalculator',\"id=\".$this->params['id']);\n $active->is_default = 1;\n $db->updateObject($active,'shippingcalculator',null,'id');\n }\n if ($db->selectValue('shippingcalculator', 'is_default', 'id='.$this->params['id']) && !$db->selectValue('shippingcalculator', 'enabled', 'id='.$this->params['id'])) {\n $db->toggle('shippingcalculator', 'enabled', 'id='.$this->params['id']);\n }\n \t expHistory::back();\n \t}", " public function configure() {\n global $db;", " if (empty($this->params['id'])) return false;\n $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);\n $calc = new $calcname($this->params['id']);\n assign_to_template(array(\n 'calculator'=>$calc,\n 'title'=>static::displayname()\n ));\n }", "", " public function saveconfig() {\n global $db;", " if (empty($this->params['id'])) return false;\n $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);\n $calc = new $calcname($this->params['id']);", " $conf = serialize($calc->parseConfig($this->params));", " $calc->update(array('config'=>$conf));\n expHistory::back();\n }", "", "\tpublic function editspeed() {\n global $db;", " if (empty($this->params['id'])) return false;\n $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);\n $calc = new $calcname($this->params['id']);\n assign_to_template(array(\n 'calculator'=>$calc\n ));", "\n }\n", "\tpublic function saveEditSpeed() {\n\t\tglobal $db;", " $obj = new stdClass();\n\t\t$obj->speed = $this->params['speed'];\n\t\t$obj->shippingcalculator_id = $this->params['shippingcalculator_id'];\n\t\t$db->insertObject($obj, $this->params['table']);\n\t\tredirect_to(array('controller'=>'shipping', 'action'=>'configure', 'id'=>$this->params['shippingcalculator_id']));\n\t}", "", "\tpublic function deleteSpeed() {\n\t\tglobal $db;", " if (empty($this->params['id'])) return false;\n\t\t$db->delete('shippingspeeds',' id =' . $this->params['id']);\n\t\texpHistory::back();\n\t}", " public function tracker() {\n global $db;", " // we ALWAYS assume this is coming from easypost webhook\n $calc_id = $db->selectValue('shippingcalculator','id','calculator_name=\"easypostcalculator\" AND enabled=1');\n if ($calc_id) {\n $ep = new easypostcalculator($calc_id);\n if ($ep->trackerEnabled()) {\n $ep->handleTracking();\n }\n }\n exit(); // graceful exit\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class storeCategoryController extends expNestedNodeController {", " static function displayname() {\n return gt(\"e-Commerce Category Manager\");\n }", " static function description() {\n return gt(\"This module is for managing categories in your store.\");\n }", " protected $add_permissions = array(", " 'fix_categories' => 'to run this action.'\n );", "", " // hide the configs we don't need\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'module',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)", "", "\n static function canImportData() {\n return true;\n }", " static function canExportData() {\n return true;\n }", " public function edit() {\n global $db;", " $id = empty($this->params['id']) ? null : $this->params['id'];\n $record = new storeCategoryFeeds($id);\n $site_page_default = ecomconfig::getConfig('pagination_default');\n $product_types = ecomconfig::getConfig('product_types');", " //Declaration of array variables for product types bing and google\n $arr_product_type = ''; //A Multi-dimentional array to be passed in the view that contains the html of listbuildercontrol for product types like bing and google", " if (!empty($product_types)) foreach ($product_types as $value) {", " $product_type = $value . 's';\n $product_type_id = $value . 's_id';\n $product_type_list = $value . 's_list';\n $new_product_type = new $product_type;\n $f_recorded_product_types = '';\n $f_types = '';\n //Import product type records if it is empty\n if ($db->tableIsEmpty($product_type)) {\n $file = BASE . \"framework/modules/ecommerce/assets/sql/exponent_{$product_type}.sql\";\n if (is_readable($file)) {\n $templine = '';\n // Read in entire file\n $lines = file($file);\n // Loop through each line\n foreach ($lines as $line) {\n // Only continue if it's not a comment\n if (substr($line, 0, 2) != '--' && $line != '') {\n // Add this line to the current segment\n $templine .= $line;\n // If it has a semicolon at the end, it's the end of the query\n if (substr(trim($line), -1, 1) == ';') {\n //Query the sql statement making sure that it will not be escape since we are dummping data\n $db->sql($templine, false);\n // Reset temp variable to empty\n $templine = '';\n }\n }\n }\n }\n }", " $recorded_product_type = $db->selectObjectsBySql(\"SELECT {$product_type_id}, title FROM \" . $db->prefix . \"{$value}s_storeCategories, \" . $db->prefix . \"{$product_type} WHERE {$product_type_id} = id and storecategories_id = \" . $id);", " foreach ($db->selectFormattedNestedTree(\"{$product_type}\") as $item) {\n $f_types[$item->id] = $item->title;\n }", " foreach ($recorded_product_type as $item) {\n $f_recorded_product_types[$item->$product_type_id] = trim($item->title);\n }\n $control = new listbuildercontrol(@$f_recorded_product_types, $f_types);\n $arr_product_type[$value] = $control->controlToHTML($product_type_list, \"copy\");\n }", " assign_to_template(array(\n 'product_types' => $product_types,\n 'site_page_default' => $site_page_default,\n 'record' => $record,\n 'product_type' => $arr_product_type\n ));", " parent::edit();\n }", " function configure() {\n expHistory::set('editable', $this->params);", " $cat = new storeCategoryFeeds($this->params['id']);\n // little bit of trickery so that that categories can have their own configs\n $this->loc->src = \"@store-\" . $this->params['id'];\n $config = new expConfig($this->loc);\n $this->config = $config->config;\n// $pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc);\n $views = expTemplate::get_config_templates($this, $this->loc);\n assign_to_template(array(\n 'config' => $this->config,\n// 'pullable_modules' => $pullable_modules,\n 'views' => $views,\n// 'title'=>static::displayname()\n 'title' => gt('Store Category named') . ' ' . $cat->title\n ));\n }", " function saveconfig() {\n // unset some unneeded params\n unset(\n $this->params['module'],\n $this->params['controller'],\n $this->params['src'],\n $this->params['int'],\n $this->params['id'],\n $this->params['action'],\n $this->params['PHPSESSID'],\n $this->params['__utma'],\n $this->params['__utmb'],\n $this->params['__utmc'],\n $this->params['__utmz'],\n $this->params['__utmt'],\n $this->params['__utmli'],\n $this->params['__cfduid']\n );", " // setup and save the config\n $this->loc->src = \"@store-\" . $this->params['cat-id'];\n $config = new expConfig($this->loc);\n $config->update(array('config' => $this->params));\n flash('message', gt('Configuration updated'));\n expHistory::back();\n }", " function manage_ranks() {\n global $db;", " $rank = 1;\n $category = new storeCategory($this->params['id']);\n foreach ($this->params['rerank'] as $id) {\n $sql = \"SELECT DISTINCT sc.* FROM \" . $db->prefix . \"product_storeCategories sc JOIN \" . $db->prefix . \"product p ON p.id = sc.product_id WHERE p.id=\" . $id . \" AND sc.storecategories_id IN (SELECT id FROM \" . $db->prefix . \"storeCategories WHERE rgt BETWEEN \" . $category->lft . \" AND \" . $category->rgt . \") ORDER BY rank ASC\";\n $prod = $db->selectObjectBySQL($sql);\n $prod->rank = $rank;\n $db->updateObject($prod, \"product_storeCategories\", \"storecategories_id=\" . $prod->storecategories_id . \" AND product_id=\" . $id);\n $rank++;\n }", " expHistory::back();\n }", " function manage() {\n expHistory::set('viewable', $this->params);\n // $category = new storeCategory();\n // $categories = $category->getFullTree();", " // ", " // // foreach($categories as $i=>$val){\n // // if (!empty($this->values) && in_array($val->id,$this->values)) {\n // // $this->tags[$i]->value = true;\n // // } else {\n // // $this->tags[$i]->value = false;\n // // }", " // // $this->tags[$i]->draggable = $this->draggable; \n // // $this->tags[$i]->checkable = $this->checkable; ", " // // }\n //", " // $obj = json_encode($categories); ", " }", " public function update() {\n $product_types = ecomconfig::getConfig('product_types');", " foreach ($product_types as $value) {\n $this->params[\"{$value}s\"] = listbuildercontrol::parseData($this->params, \"{$value}s_list\");\n }", " $curcat = new storeCategory($this->params);\n $children = $curcat->getChildren();\n foreach ($children as $child) {\n $chldcat = new storeCategory($child->id);\n $chldcat->is_active = $this->params['is_active'];\n $chldcat->save();\n }", " foreach ($product_types as $value) {\n $type = $value . 's';\n $product_type = new $type();\n $product_type->saveCategories($this->params[\"{$type}\"], $curcat->id, $type);\n }", " parent::update();\n }", " function export() {\n $out = '\"storeCategory\"' . chr(13) . chr(10); //FIXME or should this simply be 'category'?\n $sc = new storeCategory();\n $cats = $sc->find('all');\n set_time_limit(0);\n foreach ($cats as $cat) {\n $out .= expString::outputField(storeCategory::buildCategoryString($cat->id, true), chr(13) . chr(10));\n }", " $filename = 'storecategory_export_' . time() . '.csv';", " ob_end_clean();\n ob_start(\"ob_gzhandler\");", " // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';", " header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }\n echo $out;\n exit; // Exit, since we are exporting\n }", " function import() {\n assign_to_template(array(\n 'type' => $this\n ));\n }", " function importCategory($file=null) {\n if (empty($file->path)) {\n $file = new stdClass();\n $file->path = $_FILES['import_file']['tmp_name'];\n }\n if (empty($file->path)) {\n echo gt('Not a Store Category Import CSV File');\n return;\n }\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");", " // read in the header line\n $header = fgetcsv($handle, 10000, \",\");\n if (!in_array('storeCategory', $header)) { //FIXME or should this simply be 'category' and a rank?\n echo gt('Not a Store Category Import CSV File');\n return;\n }", " $count = 1;\n $errorSet = array();", " // read in the data lines\n while (($row = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;\n $data = array_combine($header, $row);", " if (empty($data['storeCategory'])) { //FIXME or should this simply be 'category' and a rank?\n $errorSet[$count] = gt(\"Is not a store category.\");\n continue;\n } else {\n $result = storeCategory::importCategoryString($data['storeCategory']);\n if ($result) {\n echo \"Successfully added row \" . $count . \", category: \" . $data['storeCategory'] . \"<br/>\";\n } else {\n echo \"Already existed row \" . $count . \", category: \" . $data['storeCategory'] . \"<br/>\";\n }\n }\n }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);", " if (count($errorSet)) {\n echo \"<br/><hr><br/><div style='color:red'><strong>\".gt('The following records were NOT imported').\":</strong><br/>\";\n foreach ($errorSet as $rownum => $err) {\n echo \"Row: \" . $rownum;\n if (is_array($err)) {\n foreach ($err as $e) {\n echo \" -- \" . $e . \"<br/>\";\n }\n } else echo \" -- \" . $err . \"<br/>\";\n }\n echo \"</div>\";\n }\n }", " function fix_categories() {\n //--Flat Structure--//\n// global $db;", " $baseCat = new storeCategory();\n //$Nodes = $db->selectObjects('storeCategories');\n $Nodes = $baseCat->find('all', '', 'lft ASC');", " //--This function converts flat structure into an array--//\n function BuildTree($TheNodes, $ID = 0, $depth = -1) {\n $Tree = array();\n if (is_array($TheNodes)) {\n foreach ($TheNodes as $Node) {\n if ($Node->parent_id == $ID) {\n array_push($Tree, $Node);\n }\n }\n $depth++;\n for ($x = 0, $xMax = count($Tree); $x < $xMax; $x++) {\n $Tree[$x]->depth = $depth;\n $Tree[$x]->kids = BuildTree($TheNodes, $Tree[$x]->id, $depth);\n //array_merge($test,$Tree[$x][\"kids\"]);\n }\n return ($Tree);\n }\n }", " //--Call Build Tree (returns structured array)\n $TheTree = BuildTree($Nodes);", " //eDebug($TheTree,true);\n // flattens a tree created by parent/child relationships", " function recurseBuild(&$thisNode, &$thisLeft, &$thisRight) {\n $thisNode->lft = $thisLeft;\n if (count($thisNode->kids) > 0) {\n $thisLeft = $thisNode->lft + 1;\n foreach ($thisNode->kids as &$myKidNode) {\n $thisRight = $thisLeft + 1;\n recurseBuild($myKidNode, $thisLeft, $thisRight);\n $myKidNode->save();\n }\n $thisNode->rgt = $thisLeft;\n $thisLeft = $thisRight;\n } else {\n $thisNode->rgt = $thisRight;", " $thisLeft = $thisRight + 1;\n }", " $thisRight = $thisLeft + 1;\n $thisNode->save();\n }", " //if kids, set lft, but not right\n //else set both and move down\n $newLeft = 1;\n $newRight = 2;\n foreach ($TheTree as &$myNode) {\n recurseBuild($myNode, $newLeft, $newRight);\n }\n //eDebug($TheTree,true);", " echo \"Done\";", " /*function flattenArray(array $array){\n $ret_array = array();\n $counter=0;\n foreach(new RecursiveIteratorIterator(new RecursiveArrayIterator($array)) as $key=>$value) {\n if ($key=='id') {\n $counter++;\n }\n $ret_array[$counter][$key] = $value;\n }\n return $ret_array;\n }*/", " // takes a flat array with propper parent/child relationships in propper order\n // and adds the lft and rgt extents correctly for a nested set", " /*function nestify($categories) {", " // Trees mapped ", " $trees = array();\n $trackParents = array();\n $depth=0;\n $counter=1;\n $prevDepth=0;", " foreach ($categories as $key=>$val) {\n if ($counter==1) {\n # first in loop. We should only hit this once: first.\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else if ($val['depth']>$prevDepth) {\n # we have a child of the previous node\n $trackParents[] = $key-1;\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else if ($val['depth']==$prevDepth) {\n # we have a sibling of the previous node\n $categories[$key-1]['rgt'] = $counter;\n $counter++;\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else {\n # we have moved up in depth, but how far up?\n $categories[$key-1]['rgt'] = $counter;\n $counter++;\n $l=count($trackParents);\n while($l > 0 && $trackParents[$l - 1]['depth'] >= $val['depth']) {\n $categories[$trackParents[$l - 1]]['rgt'] = $counter;\n array_pop($trackParents);\n $counter++;\n $l--;\n }", " ", " $categories[$key]['lft'] = $counter;\n //???$counter++;", " } ", " $prevDepth=$val['depth'];\n }", " $categories[$key]['rgt'] = $counter;\n return $categories;\n } */", " // takes a flat nested set formatted array and creates a multi-dimensional array from it", " /*function toHierarchy($collection)\n {\n // Trees mapped\n $trees = array();\n $l = 0;", " if (count($collection) > 0) {\n // Node Stack. Used to help building the hierarchy\n $stack = array();", " foreach ($collection as $node) {\n $item = $node;\n $item['children'] = array();", " // Number of stack items\n $l = count($stack);", " // Check if we're dealing with different levels\n while($l > 0 && $stack[$l - 1]['depth'] >= $item['depth']) {\n array_pop($stack);\n $l--;\n }", " // Stack is empty (we are inspecting the root)\n if ($l == 0) {\n // Assigning the root node\n $i = count($trees);\n $trees[$i] = $item;\n $stack[] = & $trees[$i];\n } else {\n // Add node to parent\n $i = count($stack[$l - 1]['children']);\n $stack[$l - 1]['children'][$i] = $item;\n $stack[] = & $stack[$l - 1]['children'][$i];\n }\n }\n }", " return $trees;\n }*/", " // this will test our data manipulation\n // eDebug(toHierarchy(nestify(flattenArray($TheTree))),1);", " /*$flat_fixed_cats = nestify(flattenArray($TheTree));", " ", " foreach ($flat_fixed_cats as $k=>$v) {\n $cat = new storeCategory($v['id']);\n $cat->lft = $v['lft'];\n $cat->rgt = $v['rgt'];\n $cat->save();\n eDebug($cat);\n }\n */\n //-Show Array Structure--//\n // print_r($TheTree);", " // \n // ", " // //--Print the Categories, and send their children to DrawBranch--//\n // //--The code below allows you to keep track of what category you're currently drawing--//", " // ", " // printf(\"<ul>\");", " // ", " // foreach($TheTree as $MyNode) {\n // printf(\"<li>{$MyNode['Name']}</li>\");\n // if(is_array($MyNode[\"Children\"]) && !empty($MyNode[\"Children\"])) {\n // DrawBranch($MyNode[\"Children\"]);\n // }\n // }\n // printf(\"</ul>\");\n // //--Recursive printer, should draw a child, and any of its children--//", " // ", " // function DrawBranch($Node){\n // printf(\"<ul>\");", " // ", " // foreach($Node as $Entity) {\n // printf(\"<li>{$Entity['Name']}</li>\");", " // ", " // if(is_array($Entity[\"Children\"]) && !empty($Entity[\"Children\"])) {\n // DrawBranch($Entity[\"Children\"]);\n // }", " // ", " // printf(\"</ul>\");\n // }\n // }\n }", "}", "?>" ]
[ 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */", "class storeCategoryController extends expNestedNodeController {", " protected $manage_permissions = array(\n// 'import' => 'Import Category',\n// 'importCategory' => 'Import Category',", " 'fix_categories' => 'to run this action.'\n );", "", " // hide the configs we don't need\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'module',\n 'pagination',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)", "\n static function displayname() {\n return gt(\"e-Commerce Category Manager\");\n }", " static function description() {\n return gt(\"This module is for managing categories in your store.\");\n }", "\n static function canImportData() {\n return true;\n }", " static function canExportData() {\n return true;\n }", " public function edit() {\n global $db;", " $id = empty($this->params['id']) ? null : $this->params['id'];\n $record = new storeCategoryFeeds($id);\n $site_page_default = ecomconfig::getConfig('pagination_default');\n $product_types = ecomconfig::getConfig('product_types');", " //Declaration of array variables for product types bing and google\n $arr_product_type = ''; //A Multi-dimentional array to be passed in the view that contains the html of listbuildercontrol for product types like bing and google", " if (!empty($product_types)) foreach ($product_types as $value) {", " $product_type = $value . 's';\n $product_type_id = $value . 's_id';\n $product_type_list = $value . 's_list';\n $new_product_type = new $product_type;\n $f_recorded_product_types = '';\n $f_types = '';\n //Import product type records if it is empty\n if ($db->tableIsEmpty($product_type)) {\n $file = BASE . \"framework/modules/ecommerce/assets/sql/exponent_{$product_type}.sql\";\n if (is_readable($file)) {\n $templine = '';\n // Read in entire file\n $lines = file($file);\n // Loop through each line\n foreach ($lines as $line) {\n // Only continue if it's not a comment\n if (substr($line, 0, 2) != '--' && $line != '') {\n // Add this line to the current segment\n $templine .= $line;\n // If it has a semicolon at the end, it's the end of the query\n if (substr(trim($line), -1, 1) == ';') {\n //Query the sql statement making sure that it will not be escape since we are dummping data\n $db->sql($templine, false);\n // Reset temp variable to empty\n $templine = '';\n }\n }\n }\n }\n }", " $recorded_product_type = $db->selectObjectsBySql(\"SELECT {$product_type_id}, title FROM \" . $db->prefix . \"{$value}s_storeCategories, \" . $db->prefix . \"{$product_type} WHERE {$product_type_id} = id and storecategories_id = \" . $id);", " foreach ($db->selectFormattedNestedTree(\"{$product_type}\") as $item) {\n $f_types[$item->id] = $item->title;\n }", " foreach ($recorded_product_type as $item) {\n $f_recorded_product_types[$item->$product_type_id] = trim($item->title);\n }\n $control = new listbuildercontrol(@$f_recorded_product_types, $f_types);\n $arr_product_type[$value] = $control->controlToHTML($product_type_list, \"copy\");\n }", " assign_to_template(array(\n 'product_types' => $product_types,\n 'site_page_default' => $site_page_default,\n 'record' => $record,\n 'product_type' => $arr_product_type\n ));", " parent::edit();\n }", " function configure() {\n expHistory::set('editable', $this->params);", " $cat = new storeCategoryFeeds($this->params['id']);\n // little bit of trickery so that that categories can have their own configs\n $this->loc->src = \"@store-\" . $this->params['id'];\n $config = new expConfig($this->loc);\n $this->config = $config->config;\n// $pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc);\n $views = expTemplate::get_config_templates($this, $this->loc);\n assign_to_template(array(\n 'config' => $this->config,\n// 'pullable_modules' => $pullable_modules,\n 'views' => $views,\n// 'title'=>static::displayname()\n 'title' => gt('Store Category named') . ' ' . $cat->title\n ));\n }", " function saveconfig() {\n // unset some unneeded params\n unset(\n $this->params['module'],\n $this->params['controller'],\n $this->params['src'],\n $this->params['int'],\n $this->params['id'],\n $this->params['action'],\n $this->params['PHPSESSID'],\n $this->params['__utma'],\n $this->params['__utmb'],\n $this->params['__utmc'],\n $this->params['__utmz'],\n $this->params['__utmt'],\n $this->params['__utmli'],\n $this->params['__cfduid']\n );", " // setup and save the config\n $this->loc->src = \"@store-\" . $this->params['cat-id'];\n $config = new expConfig($this->loc);\n $config->update(array('config' => $this->params));\n flash('message', gt('Configuration updated'));\n expHistory::back();\n }", " function manage_ranks() {\n global $db;", " $rank = 1;\n $category = new storeCategory($this->params['id']);\n foreach ($this->params['rerank'] as $id) {\n $sql = \"SELECT DISTINCT sc.* FROM \" . $db->prefix . \"product_storeCategories sc JOIN \" . $db->prefix . \"product p ON p.id = sc.product_id WHERE p.id=\" . $id . \" AND sc.storecategories_id IN (SELECT id FROM \" . $db->prefix . \"storeCategories WHERE rgt BETWEEN \" . $category->lft . \" AND \" . $category->rgt . \") ORDER BY rank ASC\";\n $prod = $db->selectObjectBySQL($sql);\n $prod->rank = $rank;\n $db->updateObject($prod, \"product_storeCategories\", \"storecategories_id=\" . $prod->storecategories_id . \" AND product_id=\" . $id);\n $rank++;\n }", " expHistory::back();\n }", " function manage() {\n expHistory::set('viewable', $this->params);\n // $category = new storeCategory();\n // $categories = $category->getFullTree();", " //", " // // foreach($categories as $i=>$val){\n // // if (!empty($this->values) && in_array($val->id,$this->values)) {\n // // $this->tags[$i]->value = true;\n // // } else {\n // // $this->tags[$i]->value = false;\n // // }", " // // $this->tags[$i]->draggable = $this->draggable;\n // // $this->tags[$i]->checkable = $this->checkable;", " // // }\n //", " // $obj = json_encode($categories);", " }", " public function update() {\n $product_types = ecomconfig::getConfig('product_types');", " foreach ($product_types as $value) {\n $this->params[\"{$value}s\"] = listbuildercontrol::parseData($this->params, \"{$value}s_list\");\n }", " $curcat = new storeCategory($this->params);\n $children = $curcat->getChildren();\n foreach ($children as $child) {\n $chldcat = new storeCategory($child->id);\n $chldcat->is_active = $this->params['is_active'];\n $chldcat->save();\n }", " foreach ($product_types as $value) {\n $type = $value . 's';\n $product_type = new $type();\n $product_type->saveCategories($this->params[\"{$type}\"], $curcat->id, $type);\n }", " parent::update();\n }", " function export() {\n $out = '\"storeCategory\"' . chr(13) . chr(10); //FIXME or should this simply be 'category'?\n $sc = new storeCategory();\n $cats = $sc->find('all');\n set_time_limit(0);\n foreach ($cats as $cat) {\n $out .= expString::outputField(storeCategory::buildCategoryString($cat->id, true), chr(13) . chr(10));\n }", " $filename = 'storecategory_export_' . time() . '.csv';", " ob_end_clean();\n ob_start(\"ob_gzhandler\");", " // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';", " header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }\n echo $out;\n exit; // Exit, since we are exporting\n }", " function import() {\n assign_to_template(array(\n 'type' => $this\n ));\n }", " function importCategory($file=null) {\n if (empty($file->path)) {\n $file = new stdClass();\n $file->path = $_FILES['import_file']['tmp_name'];\n }\n if (empty($file->path)) {\n echo gt('Not a Store Category Import CSV File');\n return;\n }\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");", " // read in the header line\n $header = fgetcsv($handle, 10000, \",\");\n if (!in_array('storeCategory', $header)) { //FIXME or should this simply be 'category' and a rank?\n echo gt('Not a Store Category Import CSV File');\n return;\n }", " $count = 1;\n $errorSet = array();", " // read in the data lines\n while (($row = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;\n $data = array_combine($header, $row);", " if (empty($data['storeCategory'])) { //FIXME or should this simply be 'category' and a rank?\n $errorSet[$count] = gt(\"Is not a store category.\");\n continue;\n } else {\n $result = storeCategory::importCategoryString($data['storeCategory']);\n if ($result) {\n echo \"Successfully added row \" . $count . \", category: \" . $data['storeCategory'] . \"<br/>\";\n } else {\n echo \"Already existed row \" . $count . \", category: \" . $data['storeCategory'] . \"<br/>\";\n }\n }\n }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);", " if (count($errorSet)) {\n echo \"<br/><hr><br/><div style='color:red'><strong>\".gt('The following records were NOT imported').\":</strong><br/>\";\n foreach ($errorSet as $rownum => $err) {\n echo \"Row: \" . $rownum;\n if (is_array($err)) {\n foreach ($err as $e) {\n echo \" -- \" . $e . \"<br/>\";\n }\n } else echo \" -- \" . $err . \"<br/>\";\n }\n echo \"</div>\";\n }\n }", " function fix_categories() {\n //--Flat Structure--//\n// global $db;", " $baseCat = new storeCategory();\n //$Nodes = $db->selectObjects('storeCategories');\n $Nodes = $baseCat->find('all', '', 'lft ASC');", " //--This function converts flat structure into an array--//\n function BuildTree($TheNodes, $ID = 0, $depth = -1) {\n $Tree = array();\n if (is_array($TheNodes)) {\n foreach ($TheNodes as $Node) {\n if ($Node->parent_id == $ID) {\n array_push($Tree, $Node);\n }\n }\n $depth++;\n for ($x = 0, $xMax = count($Tree); $x < $xMax; $x++) {\n $Tree[$x]->depth = $depth;\n $Tree[$x]->kids = BuildTree($TheNodes, $Tree[$x]->id, $depth);\n //array_merge($test,$Tree[$x][\"kids\"]);\n }\n return ($Tree);\n }\n }", " //--Call Build Tree (returns structured array)\n $TheTree = BuildTree($Nodes);", " //eDebug($TheTree,true);\n // flattens a tree created by parent/child relationships", " function recurseBuild(&$thisNode, &$thisLeft, &$thisRight) {\n $thisNode->lft = $thisLeft;\n if (count($thisNode->kids) > 0) {\n $thisLeft = $thisNode->lft + 1;\n foreach ($thisNode->kids as &$myKidNode) {\n $thisRight = $thisLeft + 1;\n recurseBuild($myKidNode, $thisLeft, $thisRight);\n $myKidNode->save();\n }\n $thisNode->rgt = $thisLeft;\n $thisLeft = $thisRight;\n } else {\n $thisNode->rgt = $thisRight;", " $thisLeft = $thisRight + 1;\n }", " $thisRight = $thisLeft + 1;\n $thisNode->save();\n }", " //if kids, set lft, but not right\n //else set both and move down\n $newLeft = 1;\n $newRight = 2;\n foreach ($TheTree as &$myNode) {\n recurseBuild($myNode, $newLeft, $newRight);\n }\n //eDebug($TheTree,true);", " echo \"Done\";", " /*function flattenArray(array $array){\n $ret_array = array();\n $counter=0;\n foreach(new RecursiveIteratorIterator(new RecursiveArrayIterator($array)) as $key=>$value) {\n if ($key=='id') {\n $counter++;\n }\n $ret_array[$counter][$key] = $value;\n }\n return $ret_array;\n }*/", " // takes a flat array with propper parent/child relationships in propper order\n // and adds the lft and rgt extents correctly for a nested set", " /*function nestify($categories) {", " // Trees mapped", " $trees = array();\n $trackParents = array();\n $depth=0;\n $counter=1;\n $prevDepth=0;", " foreach ($categories as $key=>$val) {\n if ($counter==1) {\n # first in loop. We should only hit this once: first.\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else if ($val['depth']>$prevDepth) {\n # we have a child of the previous node\n $trackParents[] = $key-1;\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else if ($val['depth']==$prevDepth) {\n # we have a sibling of the previous node\n $categories[$key-1]['rgt'] = $counter;\n $counter++;\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else {\n # we have moved up in depth, but how far up?\n $categories[$key-1]['rgt'] = $counter;\n $counter++;\n $l=count($trackParents);\n while($l > 0 && $trackParents[$l - 1]['depth'] >= $val['depth']) {\n $categories[$trackParents[$l - 1]]['rgt'] = $counter;\n array_pop($trackParents);\n $counter++;\n $l--;\n }", "", " $categories[$key]['lft'] = $counter;\n //???$counter++;", " }", " $prevDepth=$val['depth'];\n }", " $categories[$key]['rgt'] = $counter;\n return $categories;\n } */", " // takes a flat nested set formatted array and creates a multi-dimensional array from it", " /*function toHierarchy($collection)\n {\n // Trees mapped\n $trees = array();\n $l = 0;", " if (count($collection) > 0) {\n // Node Stack. Used to help building the hierarchy\n $stack = array();", " foreach ($collection as $node) {\n $item = $node;\n $item['children'] = array();", " // Number of stack items\n $l = count($stack);", " // Check if we're dealing with different levels\n while($l > 0 && $stack[$l - 1]['depth'] >= $item['depth']) {\n array_pop($stack);\n $l--;\n }", " // Stack is empty (we are inspecting the root)\n if ($l == 0) {\n // Assigning the root node\n $i = count($trees);\n $trees[$i] = $item;\n $stack[] = & $trees[$i];\n } else {\n // Add node to parent\n $i = count($stack[$l - 1]['children']);\n $stack[$l - 1]['children'][$i] = $item;\n $stack[] = & $stack[$l - 1]['children'][$i];\n }\n }\n }", " return $trees;\n }*/", " // this will test our data manipulation\n // eDebug(toHierarchy(nestify(flattenArray($TheTree))),1);", " /*$flat_fixed_cats = nestify(flattenArray($TheTree));", "", " foreach ($flat_fixed_cats as $k=>$v) {\n $cat = new storeCategory($v['id']);\n $cat->lft = $v['lft'];\n $cat->rgt = $v['rgt'];\n $cat->save();\n eDebug($cat);\n }\n */\n //-Show Array Structure--//\n // print_r($TheTree);", " //\n //", " // //--Print the Categories, and send their children to DrawBranch--//\n // //--The code below allows you to keep track of what category you're currently drawing--//", " //", " // printf(\"<ul>\");", " //", " // foreach($TheTree as $MyNode) {\n // printf(\"<li>{$MyNode['Name']}</li>\");\n // if(is_array($MyNode[\"Children\"]) && !empty($MyNode[\"Children\"])) {\n // DrawBranch($MyNode[\"Children\"]);\n // }\n // }\n // printf(\"</ul>\");\n // //--Recursive printer, should draw a child, and any of its children--//", " //", " // function DrawBranch($Node){\n // printf(\"<ul>\");", " //", " // foreach($Node as $Entity) {\n // printf(\"<li>{$Entity['Name']}</li>\");", " //", " // if(is_array($Entity[\"Children\"]) && !empty($Entity[\"Children\"])) {\n // DrawBranch($Entity[\"Children\"]);\n // }", " //", " // printf(\"</ul>\");\n // }\n // }\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */\n/** @define \"BASE\" \"../../../..\" */", "class storeController extends expController {\n public $basemodel_name = 'product';", "", " public $useractions = array(\n 'showall' => 'Products - All Products and Categories',\n 'showallFeaturedProducts' => 'Products - Only Featured',\n 'showallCategoryFeaturedProducts' => 'Products - Featured Products under current category',\n 'showallManufacturers' => 'Products - By Manufacturer',\n 'showTopLevel' => 'Product Categories Menu - Show Top Level',\n 'showFullTree' => 'Product Categories Menu - Show Full Tree', //FIXME image variant needs a separate method\n 'showallSubcategories' => 'Product Categories Menu - Subcategories of current category',\n// 'upcomingEvents' => 'Event Registration - Upcoming Events',\n// 'eventsCalendar' => 'Event Registration - Calendar View',\n 'ecomSearch' => 'Product Search - Autocomplete',\n 'searchByModel' => 'Product Search - By Model',\n 'quicklinks' => 'Links - User Links',\n 'showGiftCards' => 'Gift Cards UI',\n );", "", " // hide the configs we don't need\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n// 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)", "\n //protected $permissions = array_merge(array(\"test\"=>'Test'), array('copyProduct'=>\"Copy Product\"));\n protected $add_permissions = array(\n 'copyProduct' => \"Copy Product\",\n 'delete_children' => \"Delete Children\",\n 'reimport' => 'ReImport Products',\n 'findDupes' => 'Fix Duplicate SEF Names',\n 'manage_sales_reps' => 'Manage Sales Reps',\n 'batch_process' => 'Batch capture order transactions',\n 'process_orders' => 'Batch capture order transactions',\n 'import_external_addresses' => 'Import addresses from other sources',\n 'showallImpropercategorized' => 'View products in top level categories that should not be',\n 'showallUncategorized' => 'View all uncategorized products',\n 'nonUnicodeProducts' => 'View all non-unicode charset products',\n 'cleanNonUnicodeProducts' => 'Clean all non-unicode charset products',\n 'uploadModelAliases' => 'Upload model aliases',\n 'processModelAliases' => 'Process uploaded model aliases',\n 'saveModelAliases' => 'Save uploaded model aliases',\n 'deleteProcessedModelAliases' => 'Delete processed uploaded model aliases',\n 'delete_model_alias' => 'Process model aliases',\n 'update_model_alias' => 'Save model aliases',\n 'edit_model_alias' => 'Delete model aliases',\n 'import' => 'Import Products',\n 'export' => 'Export Products',\n );", "\n static function displayname() {\n return gt(\"e-Commerce Store Front\");\n }", " static function description() {\n return gt(\"Displays the products and categories in your store\");\n }", " static function author() {\n return \"OIC Group, Inc\";\n }", " static function isSearchable() {\n return true;\n }", " public function searchName() {\n return gt('e-Commerce Item');\n }", " static function canImportData() {\n return true;\n }", " static function canExportData() {\n return true;\n }", " function __construct($src = null, $params = array()) {\n global $db, $router, $section, $user;\n// parent::__construct($src = null, $params);\n if (empty($params)) {\n $params = $router->params;\n }\n parent::__construct($src, $params);", " // we're setting the config here from the module and globally\n $this->grabConfig();", "// if (expTheme::inAction() && !empty($router->url_parts[1]) && ($router->url_parts[0] == \"store\" && $router->url_parts[1] == \"showall\")) {\n if (!empty($params['action']) && ($params['controller'] == \"store\" && $params['action'] == \"showall\") ) {\n// if (isset($router->url_parts[array_search('title', $router->url_parts) + 1]) && is_string($router->url_parts[array_search('title', $router->url_parts) + 1])) {\n if (isset($params['title']) && is_string($params['title'])) {\n// $default_id = $db->selectValue('storeCategories', 'id', \"sef_url='\" . $router->url_parts[array_search('title', $router->url_parts) + 1] . \"'\");\n// $active = $db->selectValue('storeCategories', 'is_active', \"sef_url='\" . $router->url_parts[array_search('title', $router->url_parts) + 1] . \"'\");\n $default_id = $db->selectValue('storeCategories', 'id', \"sef_url='\" . $params['title'] . \"'\");\n $active = $db->selectValue('storeCategories', 'is_active', \"sef_url='\" . $params['title'] . \"'\");\n if (empty($active) && !$user->isAdmin()) {\n redirect_to(array(\"section\" => SITE_DEFAULT_SECTION)); // selected category is NOT active\n }\n } elseif (isset($this->config['category'])) { // the module category to display\n $default_id = $this->config['category'];\n } else {\n $default_id = 0;\n }\n// } elseif (expTheme::inAction() && !empty($router->url_parts[1]) && ($router->url_parts[0] == \"store\" && ($router->url_parts[1] == \"show\" || $router->url_parts[1] == \"showByTitle\"))) {\n } elseif (!empty($params['action']) && ($params['controller'] == \"store\" && ($params['action'] == \"show\" || $params['action'] == \"showByTitle\" || $params['action'] == \"categoryBreadcrumb\"))) {\n// if (isset($router->url_parts[array_search('id', $router->url_parts) + 1]) && ($router->url_parts[array_search('id', $router->url_parts) + 1] != 0)) {\n if (!empty($params['id'])) {\n// $default_id = $db->selectValue('product_storeCategories', 'storecategories_id', \"product_id='\" . $router->url_parts[array_search('id', $router->url_parts) + 1] . \"'\");\n $default_id = $db->selectValue('product_storeCategories', 'storecategories_id', \"product_id='\" . $params['id'] . \"'\");\n } elseif (!empty($params['title'])) {\n// $prod_id = $db->selectValue('product', 'id', \"sef_url='\" . $router->url_parts[array_search('title', $router->url_parts) + 1] . \"'\");\n $prod_id = $db->selectValue('product', 'id', \"sef_url='\" . $params['title'] . \"'\");\n $default_id = $db->selectValue('product_storeCategories', 'storecategories_id', \"product_id='\" . $prod_id . \"'\");\n }\n } elseif (isset($this->config['show_first_category']) || (!expTheme::inAction() && $section == SITE_DEFAULT_SECTION)) {\n if (!empty($this->config['show_first_category'])) {\n $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');\n } else {\n $default_id = null;\n// flash('error','store-show first category empty, but default seciton');\n }\n } elseif (!isset($this->config['show_first_category']) && !expTheme::inAction()) {\n $default_id = null;\n// flash('error','store-don\\'t show first category empty');\n } else {\n $default_id = null;\n }\n// if (empty($default_id)) $default_id = 0;\n if (!is_null($default_id)) expSession::set('catid', $default_id);", " // figure out if we need to show all categories and products or default to showing the first category.\n // elseif (!empty($this->config['category'])) {\n // $default_id = $this->config['category'];\n // } elseif (ecomconfig::getConfig('show_first_category')) {\n // $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');\n // } else {\n // $default_id = 0;\n // }", " $this->parent = expSession::get('catid');\n $this->category = new storeCategory($this->parent);\n if ($this->parent) { // we're setting the config here for the category\n $this->grabConfig($this->category);\n }\n }", " function showall() {\n global $db, $user, $router;", " expHistory::set('viewable', $this->params);", " if (empty($this->category->is_events)) {\n $count_sql_start = 'SELECT COUNT(DISTINCT p.id) as c FROM ' . $db->prefix . 'product p ';", " $sql_start = 'SELECT DISTINCT p.*, IF(base_price > special_price AND use_special_price=1,special_price, base_price) as price FROM ' . $db->prefix . 'product p ';\n $sql = 'JOIN ' . $db->prefix . 'product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'WHERE ';\n if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n $sql .= 'sc.storecategories_id IN (';\n $sql .= 'SELECT id FROM ' . $db->prefix . 'storeCategories WHERE rgt BETWEEN ' . $this->category->lft . ' AND ' . $this->category->rgt . ')';", " $count_sql = $count_sql_start . $sql;\n $sql = $sql_start . $sql;", "// $order = 'title'; // $order = 'sc.rank'; //$this->config['orderby'];\n// $dir = 'ASC'; //$this->config['orderby_dir'];\n $order = !empty($this->params['order']) ? $this->params['order'] : $this->config['orderby'];\n $dir = !empty($this->params['dir']) ? $this->params['dir'] : $this->config['orderby_dir'];\n if (empty($order)) $order = 'title';\n if (empty($dir)) $dir = 'ASC';\n } else { // this is an event category\n $sql_start = 'SELECT DISTINCT p.*, er.event_starttime, er.signup_cutoff FROM ' . $db->prefix . 'product p ';\n $count_sql_start = 'SELECT COUNT(DISTINCT p.id) as c, er.event_starttime, er.signup_cutoff FROM ' . $db->prefix . 'product p ';\n $sql = 'JOIN ' . $db->prefix . 'product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'JOIN ' . $db->prefix . 'eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE sc.storecategories_id IN (';\n $sql .= 'SELECT id FROM ' . $db->prefix . 'storeCategories WHERE rgt BETWEEN ' . $this->category->lft . ' AND ' . $this->category->rgt . ')';\n if ($this->category->hide_closed_events) {\n $sql .= ' AND er.signup_cutoff > ' . time();\n }", " $count_sql = $count_sql_start . $sql;\n $sql = $sql_start . $sql;", " $order = !empty($this->params['order']) ? $this->params['order'] : 'event_starttime';\n $dir = !empty($this->params['dir']) ? $this->params['dir'] : 'ASC';\n }", " if (empty($router->params['title'])) // we need to pass on the category for proper paging\n $router->params['title'] = $this->category->sef_url;\n $limit = !empty($this->config['limit']) ? $this->config['limit'] : (!empty($this->config['pagination_default']) ? $this->config['pagination_default'] : 10);\n if ($this->category->find('count') > 0) { // there are categories\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'count_sql' => $count_sql,\n 'limit' => $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'price'\n ),\n ));\n } else { // there are no categories\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => 'SELECT * FROM ' . $db->prefix . 'product WHERE 1',\n 'limit' => $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'price'\n ),\n ));\n }", " $ancestors = $this->category->pathToNode();\n $categories = ($this->parent == 0) ? $this->category->getTopLevel(null, false, true) : $this->category->getChildren(null, false, true);", " $rerankSQL = \"SELECT DISTINCT p.* FROM \" . $db->prefix . \"product p JOIN \" . $db->prefix . \"product_storeCategories sc ON p.id = sc.product_id WHERE sc.storecategories_id=\" . $this->category->id . \" ORDER BY rank ASC\";\n //eDebug($router);\n $defaultSort = $router->current_url;", " assign_to_template(array(\n 'page' => $page,\n 'defaultSort' => $defaultSort,\n 'ancestors' => $ancestors,\n 'categories' => $categories,\n 'current_category' => $this->category,\n 'rerankSQL' => $rerankSQL\n ));\n $this->categoryBreadcrumb();\n }", " function grabConfig($category = null) {", " // grab the configs for the passed category\n if (is_object($category)) {\n $catConfig = new expConfig(expCore::makeLocation(\"storeCategory\",\"@store-\" . $category->id,\"\"));\n } elseif (empty($this->config)) { // config not set yet\n $global_config = new expConfig(expCore::makeLocation(\"ecomconfig\",\"@globalstoresettings\",\"\"));\n $this->config = $global_config->config;\n return;\n }", " // grab the store general settings\n $config = new expConfig(expCore::makeLocation(\"ecomconfig\",\"@globalstoresettings\",\"\"));", " // $this->config currently holds the module settings - merge together with any cat config settings having priority\n $this->config = empty($catConfig->config) || @$catConfig->config['use_global'] == 1 ? @array_merge($config->config, $this->config) : @array_merge($config->config, $this->config, $catConfig->config);", " //This is needed since in the first installation of ecom the value for this will be empty and we are doing % operation for this value\n //So we need to ensure if the value is = 0, we make it the default\n if (empty($this->config['images_per_row'])) {\n $this->config['images_per_row'] = 3;\n }\n }", " /**\n * @deprecated 2.0.0 moved to eventregistration\n */\n function upcomingEvents() {\n $this->params['controller'] = 'eventregistration';\n redirect_to($this->params);", " //fixme old code\n $sql = 'SELECT DISTINCT p.*, er.event_starttime, er.signup_cutoff FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql .= 'JOIN ' . DB_TABLE_PREFIX . '_eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE 1 AND er.signup_cutoff > ' . time();", " $limit = empty($this->config['event_limit']) ? 10 : $this->config['event_limit'];\n $order = 'eventdate';\n $dir = 'ASC';", " $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));", " assign_to_template(array(\n 'page' => $page\n ));\n }", " /**\n * @deprecated 2.0.0 moved to eventregistration\n */\n function eventsCalendar() {\n $this->params['controller'] = 'eventregistration';\n redirect_to($this->params);", " //fixme old code\n global $db, $user;", " expHistory::set('viewable', $this->params);", " $time = isset($this->params['time']) ? $this->params['time'] : time();\n assign_to_template(array(\n 'time' => $time\n ));", "// $monthly = array();\n// $counts = array();", " $info = getdate($time);\n $nowinfo = getdate(time());\n if ($info['mon'] != $nowinfo['mon']) $nowinfo['mday'] = -10;\n // Grab non-day numbers only (before end of month)\n// $week = 0;\n $currentweek = -1;", " $timefirst = mktime(0, 0, 0, $info['mon'], 1, $info['year']);\n $week = intval(date('W', $timefirst));\n if ($week >= 52 && $info['mon'] == 1) $week = 1;\n $infofirst = getdate($timefirst);", "// if ($infofirst['wday'] == 0) {\n// $monthly[$week] = array(); // initialize for non days\n// $counts[$week] = array();\n// }\n// for ($i = 1 - $infofirst['wday']; $i < 1; $i++) {\n// $monthly[$week][$i] = array();\n// $counts[$week][$i] = -1;\n// }\n// $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n $monthly[$week] = array(); // initialize for non days\n $counts[$week] = array();\n if (($infofirst['wday'] == 0) && (DISPLAY_START_OF_WEEK == 1)) {\n for ($i = -6; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday'] + 7; // day number in grid. if 7+, switch weeks\n } else {\n for ($i = 1 - $infofirst['wday']; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n }\n // Grab day counts\n $endofmonth = date('t', $time);", " for ($i = 1; $i <= $endofmonth; $i++) {\n $start = mktime(0, 0, 0, $info['mon'], $i, $info['year']);\n if ($i == $nowinfo['mday']) $currentweek = $week;", "// $dates = $db->selectObjects(\"eventregistration\", \"`eventdate` = $start\");\n// $dates = $db->selectObjects(\"eventregistration\", \"(eventdate >= \" . expDateTime::startOfDayTimestamp($start) . \" AND eventdate <= \" . expDateTime::endOfDayTimestamp($start) . \")\");\n $er = new eventregistration();\n// $dates = $er->find('all', \"(eventdate >= \" . expDateTime::startOfDayTimestamp($start) . \" AND eventdate <= \" . expDateTime::endOfDayTimestamp($start) . \")\");", " if ($user->isAdmin()) {\n $events = $er->find('all', 'product_type=\"eventregistration\"', \"title ASC\");\n } else {\n $events = $er->find('all', 'product_type=\"eventregistration\" && active_type=0', \"title ASC\");\n }\n $dates = array();", " foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($event->eventdate >= expDateTime::startOfDayTimestamp($start) && $event->eventdate <= expDateTime::endOfDayTimestamp($start)) {\n $dates[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }", " $monthly[$week][$i] = $this->getEventsForDates($dates);\n $counts[$week][$i] = count($monthly[$week][$i]);\n if ($weekday >= (6 + DISPLAY_START_OF_WEEK)) {\n $week++;\n $monthly[$week] = array(); // allocate an array for the next week\n $counts[$week] = array();\n $weekday = DISPLAY_START_OF_WEEK;\n } else $weekday++;\n }\n // Grab non-day numbers only (after end of month)\n for ($i = 1; $weekday && $i < (8 + DISPLAY_START_OF_WEEK - $weekday); $i++) {\n $monthly[$week][$i + $endofmonth] = array();\n $counts[$week][$i + $endofmonth] = -1;\n }", " $this->params['time'] = $time;\n assign_to_template(array(\n 'currentweek' => $currentweek,\n 'monthly' => $monthly,\n 'counts' => $counts,\n \"prevmonth3\" => strtotime('-3 months', $timefirst),\n \"prevmonth2\" => strtotime('-2 months', $timefirst),\n \"prevmonth\" => strtotime('-1 months', $timefirst),\n \"nextmonth\" => strtotime('+1 months', $timefirst),\n \"nextmonth2\" => strtotime('+2 months', $timefirst),\n \"nextmonth3\" => strtotime('+3 months', $timefirst),\n 'now' => $timefirst,\n \"today\" => expDateTime::startOfDayTimestamp(time()),\n 'params' => $this->params,\n 'daynames' => event::dayNames(),\n ));\n }", " /*\n * Helper function for the Calendar view\n * @deprecated 2.0.0 moved to eventregistration\n */\n function getEventsForDates($edates, $sort_asc = true) {\n global $db;\n $events = array();\n foreach ($edates as $edate) {\n// if (!isset($this->params['cat'])) {\n// if (isset($this->params['title']) && is_string($this->params['title'])) {\n// $default_id = $db->selectValue('storeCategories', 'id', \"sef_url='\" . $this->params['title'] . \"'\");\n// } elseif (!empty($this->config['category'])) {\n// $default_id = $this->config['category'];\n// } elseif (ecomconfig::getConfig('show_first_category')) {\n// $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');\n// } else {\n// $default_id = 0;\n// }\n// }\n//\n// $parent = isset($this->params['cat']) ? intval($this->params['cat']) : $default_id;\n//\n// $category = new storeCategory($parent);", " $sql = 'SELECT DISTINCT p.*, er.event_starttime, er.signup_cutoff FROM ' . $db->prefix . 'product p ';\n// $sql .= 'JOIN ' . $db->prefix . 'product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'JOIN ' . $db->prefix . 'eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE 1 ';\n// $sql .= ' AND sc.storecategories_id IN (SELECT id FROM exponent_storeCategories WHERE rgt BETWEEN ' . $category->lft . ' AND ' . $category->rgt . ')';\n// if ($category->hide_closed_events) {\n// $sql .= ' AND er.signup_cutoff > ' . time();\n// }\n// $sql .= ' AND er.id = ' . $edate->id;\n $sql .= ' AND er.id = ' . $edate->product_type_id;", " $order = 'event_starttime';\n $dir = 'ASC';", " $o = $db->selectObjectBySql($sql);\n $o->eventdate = $edate->eventdate;\n $o->eventstart = $edate->event_starttime + $edate->eventdate;\n $o->eventend = $edate->event_endtime + $edate->eventdate;\n $o->expFile = $edate->expFile;\n $events[] = $o;\n }\n $events = expSorter::sort(array('array' => $events, 'sortby' => 'eventstart', 'order' => $sort_asc ? 'ASC' : 'DESC'));\n return $events;\n }", " function categoryBreadcrumb() {\n// global $db, $router;", " //eDebug($this->category);", " /*if(isset($router->params['action']))\n {", " $ancestors = $this->category->pathToNode(); ", " }else if(isset($router->params['section']))\n {\n $current = $db->selectObject('section',' id= '.$router->params['section']);\n $ancestors[] = $current;\n if( $current->parent != -1 || $current->parent != 0 )", " { ", " while ($db->selectObject('section',' id= '.$router->params['section']);)\n if ($section->id == $id) {\n $current = $section;\n break;\n }\n }\n }\n eDebug($sections);", " $ancestors = $this->category->pathToNode(); ", " }*/", " $ancestors = $this->category->pathToNode();\n // eDebug($ancestors);\n assign_to_template(array(\n 'ancestors' => $ancestors\n ));\n }", " function showallUncategorized() {\n expHistory::set('viewable', $this->params);", "// $sql = 'SELECT p.* FROM ' . DB_TABLE_PREFIX . '_product p JOIN ' . DB_TABLE_PREFIX . '_product_storeCategories ';\n// $sql .= 'sc ON p.id = sc.product_id WHERE sc.storecategories_id = 0 AND parent_id=0';\n $sql = 'SELECT p.* FROM ' . DB_TABLE_PREFIX . '_product p LEFT OUTER JOIN ' . DB_TABLE_PREFIX . '_product_storeCategories ';\n $sql .= 'sc ON p.id = sc.product_id WHERE sc.product_id is null AND p.parent_id=0';", " expSession::set('product_export_query', $sql);", " $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));", " assign_to_template(array(\n 'page' => $page,\n 'moduletitle' => 'Uncategorized Products'\n ));\n }", " function manage() {\n expHistory::set('manageable', $this->params);", " if (ECOM_LARGE_DB) {\n $limit = !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : 10;\n } else {\n $limit = 0; // we'll paginate on the page\n }\n $page = new expPaginator(array(\n 'model' => 'product',\n 'where' => 'parent_id=0',\n 'limit' => $limit,\n 'order' => (isset($this->params['order']) ? $this->params['order'] : 'title'),\n 'dir' => (isset($this->params['dir']) ? $this->params['dir'] : 'ASC'),\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Type') => 'product_type',\n gt('Product Name') => 'title',\n gt('Model #') => 'model',\n gt('Price') => 'base_price'\n )\n ));\n assign_to_template(array(\n 'page' => $page\n ));\n }", " function showallImpropercategorized() {\n expHistory::set('viewable', $this->params);", " //FIXME not sure this is the correct sql, not sure what we are trying to pull out\n $sql = 'SELECT DISTINCT(p.id),p.product_type FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql .= 'JOIN ' . DB_TABLE_PREFIX . '_product_storeCategories psc ON p.id = psc.product_id ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_storeCategories sc ON psc.storecategories_id = sc.parent_id ';\n $sql .= 'WHERE p.parent_id=0 AND sc.parent_id != 0';", " expSession::set('product_export_query', $sql);", " $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));", " assign_to_template(array(\n 'page' => $page,\n 'moduletitle' => 'Improperly Categorized Products'\n ));\n }", " function exportMe() {\n redirect_to(array('controller' => 'report', 'action' => 'batch_export', 'applytoall' => true));\n }", " function export() {\n global $db;", " $this->params['applytoall'] = 1; //FIXME we simply do all now", " //eDebug($this->params);\n //$sql = \"SELECT * INTO OUTFILE '\" . BASE . \"tmp/export.csv' FIELDS TERMINATED BY ',' FROM exponent_product WHERE 1 LIMIT 10\";\n// $out = '\"id\",\"parent_id\",\"child_rank\",\"title\",\"body\",\"model\",\"warehouse_location\",\"sef_url\",\"canonical\",\"meta_title\",\"meta_keywords\",\"meta_description\",\"tax_class_id\",\"quantity\",\"availability_type\",\"base_price\",\"special_price\",\"use_special_price\",\"active_type\",\"product_status_id\",\"category1\",\"category2\",\"category3\",\"category4\",\"category5\",\"category6\",\"category7\",\"category8\",\"category9\",\"category10\",\"category11\",\"category12\",\"surcharge\",\"category_rank\",\"feed_title\",\"feed_body\"' . chr(13) . chr(10);\n $out = '\"id\",\"parent_id\",\"child_rank\",\"title\",\"body\",\"model\",\"warehouse_location\",\"sef_url\",\"meta_title\",\"meta_keywords\",\"meta_description\",\"tax_class_id\",\"quantity\",\"availability_type\",\"base_price\",\"special_price\",\"use_special_price\",\"active_type\",\"product_status_id\",\"category1\",\"category2\",\"category3\",\"category4\",\"category5\",\"category6\",\"category7\",\"category8\",\"category9\",\"category10\",\"category11\",\"category12\",\"surcharge\",\"category_rank\",\"feed_title\",\"feed_body\",\"weight\",\"width\",\"height\",\"length\",\"image1\",\"image2\",\"image3\",\"image4\",\"image5\",\"companies_id\"' . chr(13) . chr(10);\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $sql = expSession::get('product_export_query');\n if (empty($sql)) $sql = 'SELECT DISTINCT(p.id) from ' . $db->prefix . 'product as p WHERE (product_type=\"product\")';\n //eDebug($sql);\n //expSession::set('product_export_query','');\n $prods = $db->selectArraysBySql($sql);\n //eDebug($prods);\n } else {\n foreach ($this->params['act-upon'] as $prod) {\n $prods[] = array('id' => $prod);\n }\n }\n set_time_limit(0);\n $baseProd = new product();", " //$p = new product($pid['id'], false, false);\n foreach ($prods as $pid) {\n $except = array('company', 'crosssellItem', 'optiongroup');\n $p = $baseProd->find('first', 'id=' . $pid['id'], null, null, 0, true, true, $except, true);", " //eDebug($p,true);\n $out .= expString::outputField($p->id);\n $out .= expString::outputField($p->parent_id);\n $out .= expString::outputField($p->child_rank);\n $out .= expString::outputField($p->title);\n $out .= expString::outputField(expString::stripLineEndings($p->body), \",\", true);\n $out .= expString::outputField($p->model);\n $out .= expString::outputField($p->warehouse_location);\n $out .= expString::outputField($p->sef_url);\n// $out .= expString::outputField($p->canonical); FIXME this is NOT in the import sequence\n $out .= expString::outputField($p->meta_title);\n $out .= expString::outputField($p->meta_keywords);\n $out .= expString::outputField($p->meta_description);\n $out .= expString::outputField($p->tax_class_id);\n $out .= expString::outputField($p->quantity);\n $out .= expString::outputField($p->availability_type);\n $out .= expString::outputField($p->base_price);\n $out .= expString::outputField($p->special_price);\n $out .= expString::outputField($p->use_special_price);\n $out .= expString::outputField($p->active_type);\n $out .= expString::outputField($p->product_status_id);", " $rank = 0;\n //eDebug($p);\n for ($x = 0; $x < 12; $x++) {\n $this->catstring = '';\n if (isset($p->storeCategory[$x])) {\n $out .= expString::outputField(storeCategory::buildCategoryString($p->storeCategory[$x]->id, true));\n $rank = $db->selectValue('product_storeCategories', 'rank', 'product_id=' . $p->id . ' AND storecategories_id=' . $p->storeCategory[$x]->id);\n } else $out .= ',';\n }\n $out .= expString::outputField($p->surcharge);\n $out .= expString::outputField($rank); // no longer used\n $out .= expString::outputField($p->feed_title);\n $out .= expString::outputField($p->feed_body);\n $out .= expString::outputField($p->weight);\n $out .= expString::outputField($p->height);\n $out .= expString::outputField($p->width);\n $out .= expString::outputField($p->length);\n //output images\n if (isset($p->expFile['mainimage'][0])) {\n $out .= expString::outputField($p->expFile['mainimage'][0]->id);\n } else $out .= ',';\n for ($x = 0; $x < 3; $x++) {\n if (isset($p->expFile['images'][$x])) {\n $out .= expString::outputField($p->expFile['images'][$x]->id);\n } else $out .= ',';\n }\n $out .= expString::outputField($p->companies_id, chr(13) . chr(10)); //Removed the extra \",\" in the last element", " foreach ($p->childProduct as $cp) {\n //$p = new product($pid['id'], true, false);\n //eDebug($p,true);\n $out .= expString::outputField($cp->id);\n $out .= expString::outputField($cp->parent_id);\n $out .= expString::outputField($cp->child_rank);\n $out .= expString::outputField($cp->title);\n $out .= expString::outputField(expString::stripLineEndings($cp->body));\n $out .= expString::outputField($cp->model);\n $out .= expString::outputField($cp->warehouse_location);\n $out .= expString::outputField($cp->sef_url);\n// $out .= expString::outputField($cp->canonical); FIXME this is NOT in the import sequence\n $out .= expString::outputField($cp->meta_title);\n $out .= expString::outputField($cp->meta_keywords);\n $out .= expString::outputField($cp->meta_description);\n $out .= expString::outputField($cp->tax_class_id);\n $out .= expString::outputField($cp->quantity);\n $out .= expString::outputField($cp->availability_type);\n $out .= expString::outputField($cp->base_price);\n $out .= expString::outputField($cp->special_price);\n $out .= expString::outputField($cp->use_special_price);\n $out .= expString::outputField($cp->active_type);\n $out .= expString::outputField($cp->product_status_id);\n $out .= ',,,,,,,,,,,,'; // for categories\n $out .= expString::outputField($cp->surcharge);\n $out .= ',,,'; //for rank, feed title, feed body\n $out .= expString::outputField($cp->weight);\n $out .= expString::outputField($cp->height);\n $out .= expString::outputField($cp->width);\n $out .= expString::outputField($cp->length);\n $out .= ',,,,,'; // for images\n $out .= expString::outputField($cp->companies_id, chr(13) . chr(10));", " //echo($out);\n }", " }", "// $outFile = 'tmp/product_export_' . time() . '.csv';\n// $outHandle = fopen(BASE . $outFile, 'w');\n// fwrite($outHandle, $out);\n// fclose($outHandle);\n//\n// echo \"<br/><br/>Download the file here: <a href='\" . PATH_RELATIVE . $outFile . \"'>Product Export</a>\";", " $filename = 'product_export_' . time() . '.csv';", " ob_end_clean();\n ob_start(\"ob_gzhandler\");", " // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';", " header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }\n echo $out;\n exit; // Exit, since we are exporting", " /*eDebug(BASE . \"tmp/export.csv\");\n $db->sql($sql);\n eDebug($db->error());*/\n /*OPTIONALLY ENCLOSED BY '\" . '\"' .\n \"' ESCAPED BY '\\\\'\n LINES TERMINATED BY '\" . '\\\\n' .\n \"' */\n }", " /**\n * @deprecated 2.3.3 moved to company\n */\n function showallByManufacturer() {\n expHistory::set('viewable', $this->params);", " $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model' => 'product',\n 'where' => 'companies_id=' . $this->params['id'] . ' AND parent_id=0',\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'default' => 'Product Name',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n )\n ));", " $company = new company($this->params['id']);", " assign_to_template(array(\n 'page' => $page,\n 'company' => $company\n ));\n }", " /**\n * @deprecated 2.3.3 moved to company\n */\n function showallManufacturers() {\n global $db;\n expHistory::set('viewable', $this->params);\n $sql = 'SELECT comp.* FROM ' . $db->prefix . 'companies as comp JOIN ' . $db->prefix . 'product AS prod ON prod.companies_id = comp.id WHERE parent_id=0 GROUP BY comp.title ORDER BY comp.title;';\n $manufacturers = $db->selectObjectsBySql($sql);\n assign_to_template(array(\n 'manufacturers' => $manufacturers\n ));\n }", " function showGiftCards() {\n expHistory::set('viewable', $this->params);\n //Get all giftcards\n $product_type = 'giftcard';\n $giftcard = new $product_type();\n $giftcards = $giftcard->find(\"all\", \"product_type = 'giftcard'\");", " //Grab the global config\n $this->grabConfig();", " //Set the needed config for the view\n $config['custom_message_product'] = $this->config['custom_message_product'];\n $config['minimum_gift_card_purchase'] = $this->config['minimum_gift_card_purchase'];\n $records = expSession::get('params');\n expSession::un_set('params');\n assign_to_template(array(\n 'giftcards' => $giftcards,\n 'config' => $config,\n 'records' => $records\n ));\n }", " function show() {\n global $db, $order, $template, $user;", " expHistory::set('viewable', $this->params);\n// $classname = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n// $product = new $classname($this->params['id'], true, true);", " $id = isset($this->params['title']) ? $this->params['title'] : $this->params['id'];\n $product = new product($id);\n $product_type = new $product->product_type($product->id);\n $product_type->title = expString::parseAndTrim($product_type->title, true);\n $product_type->image_alt_tag = expString::parseAndTrim($product_type->image_alt_tag, true);", " //if we're trying to view a child product directly, then we redirect to it's parent show view\n //bunk URL, no product found\n if (empty($product->id)) {\n redirect_to(array('controller' => 'notfound', 'action' => 'page_not_found', 'title' => $this->params['title']));\n }\n // we do not display child products by themselves\n if (!empty($product->parent_id)) {\n $product = new product($product->parent_id);\n redirect_to(array('controller' => 'store', 'action' => 'show', 'title' => $product->sef_url));\n }\n if ($product->active_type == 1) {\n $product_type->user_message = \"This product is temporarily unavailable for purchase.\";\n } elseif ($product->active_type == 2 && !$user->isAdmin()) {\n flash(\"error\", $product->title . \" \" . gt(\"is currently unavailable.\"));\n expHistory::back();\n } elseif ($product->active_type == 2 && $user->isAdmin()) {\n $product_type->user_message = $product->title . \" is currently marked as unavailable for purchase or display. Normal users will not see this product.\";\n }", " // pull in company attachable files\n if (!empty($product_type->companies_id)) {\n $product_type->company = new company($product_type->companies_id);\n }", " if (!empty($product_type->crosssellItem)) foreach ($product_type->crosssellItem as &$csi) {\n $csi->getAttachableItems();\n }", " $tpl = $product_type->getForm('show');", " if (!empty($tpl)) $template = new controllertemplate($this, $tpl);\n $this->grabConfig(); // grab the global config", " assign_to_template(array(\n 'config' => $this->config,\n 'asset_path' => $this->asset_path,\n// 'product' => $product,\n 'product' => $product_type,\n 'last_category' => !empty($order->lastcat) ? $order->lastcat : null,\n ));\n $this->categoryBreadcrumb();\n }", " function showByTitle() {\n global $order, $template, $user;\n //need to add a check here for child product and redirect to parent if hit directly by ID\n expHistory::set('viewable', $this->params);", " $product = new product(addslashes($this->params['title']));\n $product_type = new $product->product_type($product->id);\n $product_type->title = expString::parseAndTrim($product_type->title, true);\n $product_type->image_alt_tag = expString::parseAndTrim($product_type->image_alt_tag, true);", " //if we're trying to view a child product directly, then we redirect to it's parent show view\n //bunk URL, no product found\n if (empty($product->id)) {\n redirect_to(array('controller' => 'notfound', 'action' => 'page_not_found', 'title' => $this->params['title']));\n }\n if (!empty($product->parent_id)) {\n $product = new product($product->parent_id);\n redirect_to(array('controller' => 'store', 'action' => 'show', 'title' => $product->sef_url));\n }\n if ($product->active_type == 1) {\n $product_type->user_message = \"This product is temporarily unavailable for purchase.\";\n } elseif ($product->active_type == 2 && !$user->isAdmin()) {\n flash(\"error\", $product->title . \" \" . gt(\"is currently unavailable.\"));\n expHistory::back();\n } elseif ($product->active_type == 2 && $user->isAdmin()) {\n $product_type->user_message = $product->title . \" is currently marked as unavailable for purchase or display. Normal users will not see this product.\";\n }\n if (!empty($product_type->crosssellItem)) foreach ($product_type->crosssellItem as &$csi) {\n $csi->getAttachableItems();\n }\n //eDebug($product->crosssellItem);", " $tpl = $product_type->getForm('show');\n //eDebug($product);\n if (!empty($tpl)) $template = new controllertemplate($this, $tpl);\n $this->grabConfig(); // grab the global config", " assign_to_template(array(\n 'config' => $this->config,\n 'product' => $product_type,\n 'last_category' => !empty($order->lastcat) ? $order->lastcat : null,\n ));\n }", " function showByModel() {\n global $order, $template, $db;", " expHistory::set('viewable', $this->params);\n $product = new product();\n $model = $product->find(\"first\", 'model=\"' . $this->params['model'] . '\"');\n //eDebug($model);\n $product_type = new $model->product_type($model->id);\n //eDebug($product_type);\n $tpl = $product_type->getForm('show');\n if (!empty($tpl)) $template = new controllertemplate($this, $tpl);\n //eDebug($template);\n $this->grabConfig(); // grab the global config\n assign_to_template(array(\n 'config' => $this->config,\n 'product' => $product_type,\n 'last_category' => $order->lastcat\n ));\n }", " function showallSubcategories() {\n// global $db;", " expHistory::set('viewable', $this->params);\n// $parent = isset($this->params['cat']) ? $this->params['cat'] : expSession::get('catid');\n $catid = expSession::get('catid');\n $parent = !empty($catid) ? $catid : (!empty($this->params['cat']) ? $this->params['cat'] : 0);\n $category = new storeCategory($parent);\n $categories = $category->getEcomSubcategories();\n $ancestors = $category->pathToNode();\n assign_to_template(array(\n 'categories' => $categories,\n 'ancestors' => $ancestors,\n 'category' => $category\n ));\n }", " function showallFeaturedProducts() {\n expHistory::set('viewable', $this->params);\n $order = !empty($this->params['order']) ? $this->params['order'] : $this->config['orderby'];\n $dir = !empty($this->params['dir']) ? $this->params['dir'] : $this->config['orderby_dir'];\n if (empty($order)) $order = 'title';\n if (empty($dir)) $dir = 'ASC';", " $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => 'SELECT * FROM ' . DB_TABLE_PREFIX . '_product WHERE is_featured=1',\n 'limit' => ecomconfig::getConfig('pagination_default'),\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));", " assign_to_template(array(\n 'page' => $page\n ));\n }", " function showallCategoryFeaturedProducts() {\n expHistory::set('viewable', $this->params);\n $curcat = $this->category;", " $order = !empty($this->params['order']) ? $this->params['order'] : $this->config['orderby'];\n $dir = !empty($this->params['dir']) ? $this->params['dir'] : $this->config['orderby_dir'];\n if (empty($order)) $order = 'title';\n if (empty($dir)) $dir = 'ASC';\n //FIXME bad sql statement needs to be a JOIN\n $sql = 'SELECT * FROM ' . DB_TABLE_PREFIX . '_product as p,' . DB_TABLE_PREFIX . '_product_storeCategories as sc WHERE sc.product_id = p.id and p.is_featured=1 and sc.storecategories_id =' . $curcat->id;\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => ecomconfig::getConfig('pagination_default'),\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));", " assign_to_template(array(\n 'page' => $page\n ));\n }", " function showTopLevel() {\n expHistory::set('viewable', $this->params);\n $category = new storeCategory(null, false, false);\n //$categories = $category->getEcomSubcategories();\n $categories = $category->getTopLevel(null, false, true);\n $ancestors = $this->category->pathToNode();\n $curcat = $this->category;", " assign_to_template(array(\n 'categories' => $categories,\n 'curcat' => $curcat,\n 'topcat' => @$ancestors[0]\n ));\n }", " function showTopLevel_images() {\n global $user;", " expHistory::set('viewable', $this->params);\n $count_sql_start = 'SELECT COUNT(DISTINCT p.id) as c FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql_start = 'SELECT DISTINCT p.* FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql = 'JOIN ' . DB_TABLE_PREFIX . '_product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'WHERE ';\n if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1)'; //' AND ' ;\n //$sql .= 'sc.storecategories_id IN (';\n //$sql .= 'SELECT id FROM '.DB_TABLE_PREFIX.'_storeCategories WHERE rgt BETWEEN '.$this->category->lft.' AND '.$this->category->rgt.')';", " $count_sql = $count_sql_start . $sql;\n $sql = $sql_start . $sql;", " $order = 'sc.rank'; //$this->config['orderby'];\n $dir = 'ASC'; //$this->config['orderby_dir'];", " $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'count_sql' => $count_sql,\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));", " $category = new storeCategory(null, false, false);\n //$categories = $category->getEcomSubcategories();\n $categories = $category->getTopLevel(null, false, true);\n $ancestors = $this->category->pathToNode();\n $curcat = $this->category;", " assign_to_template(array(\n 'page' => $page,\n 'categories' => $categories\n ));\n }", " function showFullTree() { //FIXME we also need a showFullTree_images method like above\n expHistory::set('viewable', $this->params);\n $category = new storeCategory(null, false, false);\n //$categories = $category->getEcomSubcategories();\n $categories = $category->getFullTree();\n $ancestors = $this->category->pathToNode();\n $curcat = $this->category;", " assign_to_template(array(\n 'categories' => $categories,\n 'curcat' => $curcat,\n 'topcat' => @$ancestors[0]\n ));\n }", " function ecomSearch() {", " }", " function billing_config() {", " }", " /**\n * Add all products (products, event registrations, donations, & gift cards) to search index\n *\n * @return int\n */\n function addContentToSearch() {\n global $db, $router;", " $model = new $this->basemodel_name();", " $total = $db->countObjects($model->table);", " $count = 0;\n for ($i = 0; $i < $total; $i += 100) {\n $orderby = 'id LIMIT ' . ($i) . ', 100';\n $content = $db->selectArrays($model->table, 'parent_id=0', $orderby);", " foreach ($content as $cnt) {\n $origid = $cnt['id'];\n $prod = new product($cnt['id']);\n unset($cnt['id']);\n if (ecomconfig::getConfig('ecom_search_results') == '') {\n $cnt['title'] = (isset($prod->expFile['mainimage'][0]) ? '<img src=\"' . PATH_RELATIVE . 'thumb.php?id=' . $prod->expFile['mainimage'][0]->id . '&w=40&h=40&zc=1\" style=\"float:left;margin-right:5px;\" />' : '') . $cnt['title'] . (!empty($cnt['model']) ? ' - SKU#: ' . $cnt['model'] : '');\n }", "// $search_record = new search($cnt, false, false);\n //build the search record and save it.\n $sql = \"original_id=\" . $origid . \" AND ref_module='\" . $this->baseclassname . \"'\";\n $oldindex = $db->selectObject('search', $sql);\n if (!empty($oldindex)) {\n $search_record = new search($oldindex->id, false, false);\n $search_record->update($cnt);\n } else {\n $search_record = new search($cnt, false, false);\n }", " $search_record->posted = empty($cnt['created_at']) ? null : $cnt['created_at'];\n if ($cnt['product_type'] == 'giftcard') {\n $search_record->view_link = str_replace(URL_FULL, '', $router->makeLink(array('controller' => 'store', 'action' => 'showGiftCards')));\n } else {\n// $search_record->view_link = str_replace(URL_FULL, '', $router->makeLink(array('controller' => $this->baseclassname, 'action' => 'show', 'title' => $cnt['sef_url'])));\n $search_record->view_link = str_replace(URL_FULL, '', $router->makeLink(array('controller' => $cnt['product_type'], 'action' => 'show', 'title' => $cnt['sef_url'])));\n }\n// $search_record->ref_module = 'store';\n $search_record->ref_module = $this->baseclassname;\n// $search_record->ref_type = $this->basemodel_name;\n $search_record->ref_type = $cnt['product_type'];\n// $search_record->category = 'Products';\n $prod = new $search_record->ref_type($origid);\n $search_record->category = $prod->product_name;\n if ($search_record->ref_type == 'eventregistration') {\n $search_record->title .= ' - ' . expDateTime::format_date($prod->eventdate);\n }", " $search_record->original_id = $origid;\n //$search_record->location_data = serialize($this->loc);\n $search_record->save();\n $count++;\n }\n }\n return $count;\n }", " function searchByModel() {\n //do nothing...just show the view.\n }", " function edit() {\n global $db;", "// $expDefinableField = new expDefinableField();\n// $definablefields = $expDefinableField->find('all','1','rank');", " //Make sure that the view is the edit.tpl and not any ajax views\n if (isset($this->params['view']) && $this->params['view'] == 'edit') {\n expHistory::set('editable', $this->params);\n }", " // first we need to figure out what type of ecomm product we are dealing with\n if (!empty($this->params['id'])) {\n // if we have an id lets pull the product type from the products table.\n $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n if (empty($product_type)) redirect_to(array('controller' => 'store', 'action' => 'picktype'));\n } else {\n if (empty($this->params['product_type'])) redirect_to(array('controller' => 'store', 'action' => 'picktype'));\n $product_type = $this->params['product_type'];\n }", " if (!empty($this->params['id'])) {\n $record = new $product_type($this->params['id']);\n if (!empty($this->user_input_fields) && !is_array($record->user_input_fields)) $record->user_input_fields = expUnserialize($record->user_input_fields);\n } else {\n $record = new $product_type();\n $record->user_input_fields = array();\n }", "// if (!empty($this->params['parent_id']))", " // get the product options and send them to the form\n $editable_options = array();\n //$og = new optiongroup();\n $mastergroups = $db->selectExpObjects('optiongroup_master', null, 'optiongroup_master');\n //eDebug($mastergroups,true);\n foreach ($mastergroups as $mastergroup) {\n // if this optiongroup_master has already been made into an option group for this product\n // then we will grab that record now..if not, we will make a new one.\n $grouprec = $db->selectArray('optiongroup', 'optiongroup_master_id=' . $mastergroup->id . ' AND product_id=' . $record->id);\n //if ($mastergroup->id == 9) eDebug($grouprec,true);\n //eDebug($grouprec);\n if (empty($grouprec)) {\n $grouprec['optiongroup_master_id'] = $mastergroup->id;\n $grouprec['title'] = $mastergroup->title;\n $group = new optiongroup($grouprec);\n } else {\n $group = new optiongroup($grouprec['id']);\n }", " $editable_options[$group->title] = $group;", " if (empty($group->option)) {\n foreach ($mastergroup->option_master as $optionmaster) {\n $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);\n $editable_options[$group->title]->options[] = $opt;\n }", " } else {\n if (count($group->option) == count($mastergroup->option_master)) {\n $editable_options[$group->title]->options = $group->option;\n } else {\n // check for any new options or deleted since the last time we edited this product\n foreach ($mastergroup->option_master as $optionmaster) {\n $opt_id = $db->selectValue('option', 'id', 'option_master_id=' . $optionmaster->id . \" AND product_id=\" . $record->id);\n if (empty($opt_id)) {\n $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);\n } else {\n $opt = new option($opt_id);\n }", " $editable_options[$group->title]->options[] = $opt;\n }\n }\n }", " //eDebug($editable_options[$group->title]); ", " }\n //die();", " uasort($editable_options, array(\"optiongroup\", \"sortOptiongroups\"));", " // get the shipping options and their methods\n// $shipping = new shipping();\n// foreach (shipping::listAvailableCalculators() as $calcid => $name) {\n foreach (shipping::listCalculators() as $calcid => $name) {\n // must make sure (custom) calculator exists\n if (class_exists($name)) {\n $calc = new $name($calcid);\n $shipping_services[$calcid] = $calc->title;\n $shipping_methods[$calcid] = $calc->availableMethods();\n }\n }", "# eDebug($shipping_services);\n# eDebug($shipping_methods);", " if (!empty($this->params['product_type']) && ($this->params['product_type'] == \"product\" || $this->params['product_type'] == \"childProduct\")) {\n //if new record and it's a child, then well set the child rank to be at the end\n if (empty($record->id) && $record->isChild()) {\n $record->child_rank = $db->max('product', 'child_rank', null, 'parent_id=' . $record->parent_id) + 1;\n }\n //eDebug($record,true);\n }\n $view = '';\n $parent = null;\n if ((isset($this->params['parent_id']) && empty($record->id))) {\n //NEW child product\n $view = 'edit';\n $parent = new $product_type($this->params['parent_id'], false, true);\n $record->parent_id = $this->params['parent_id'];\n } elseif ((!empty($record->id) && $record->parent_id != 0)) {\n //EDIT child product\n $view = 'edit';\n $parent = new $product_type($record->parent_id, false, true);\n } else {\n $view = 'edit';\n }", " $f = new forms();\n $forms_list = array();\n $forms_list[0] = '- '.gt('No User Input Required').' -';\n $forms = $f->find('all', 'is_saved=1');\n if (!empty($forms)) foreach ($forms as $frm) {\n if (!$db->countObjects('eventregistration', 'forms_id='.$frm->id) || (!empty($record->forms_id) && $record->forms_id == $frm->id))\n $forms_list[$frm->id] = $frm->title;\n }", " assign_to_template(array(\n 'record' => $record,\n 'parent' => $parent,\n 'form' => $record->getForm($view),\n 'optiongroups' => $editable_options,\n// 'definablefields' => isset($definablefields) ? $definablefields : '',\n 'forms'=> $forms_list,\n 'shipping_services' => isset($shipping_services) ? $shipping_services : '', // Added implication since the shipping_services default value is a null\n 'shipping_methods' => isset($shipping_methods) ? $shipping_methods : '', // Added implication since the shipping_methods default value is a null\n 'product_types' => isset($this->config['product_types']) ? $this->config['product_types'] : ''\n //'status_display'=>$status_display->getStatusArray()\n ));\n }", " function copyProduct() {\n global $db;", " //expHistory::set('editable', $this->params);\n $f = new forms();\n $forms_list = array();\n $forms_list[0] = '- '.gt('No User Input Required').' -';\n $forms = $f->find('all', 'is_saved=1');\n if (!empty($forms)) foreach ($forms as $frm) {\n $forms_list[$frm->id] = $frm->title;\n }", " // first we need to figure out what type of ecomm product we are dealing with\n if (!empty($this->params['id'])) {\n // if we have an id lets pull the product type from the products table.\n $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n } else {\n if (empty($this->params['product_type'])) redirect_to(array('controller' => 'store', 'action' => 'picktype'));\n $product_type = $this->params['product_type'];\n }", " $record = new $product_type($this->params['id']);\n // get the product options and send them to the form\n $editable_options = array();", " $mastergroups = $db->selectExpObjects('optiongroup_master', null, 'optiongroup_master');\n foreach ($mastergroups as $mastergroup) {\n // if this optiongroup_master has already been made into an option group for this product\n // then we will grab that record now..if not, we will make a new one.\n $grouprec = $db->selectArray('optiongroup', 'optiongroup_master_id=' . $mastergroup->id . ' AND product_id=' . $record->id);\n //eDebug($grouprec);\n if (empty($grouprec)) {\n $grouprec['optiongroup_master_id'] = $mastergroup->id;\n $grouprec['title'] = $mastergroup->title;\n $group = new optiongroup($grouprec);\n } else {\n $group = new optiongroup($grouprec['id']);\n }", " $editable_options[$group->title] = $group;", " if (empty($group->option)) {\n foreach ($mastergroup->option_master as $optionmaster) {\n $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);\n $editable_options[$group->title]->options[] = $opt;\n }\n } else {\n if (count($group->option) == count($mastergroup->option_master)) {\n $editable_options[$group->title]->options = $group->option;\n } else {\n // check for any new options or deleted since the last time we edited this product\n foreach ($mastergroup->option_master as $optionmaster) {\n $opt_id = $db->selectValue('option', 'id', 'option_master_id=' . $optionmaster->id . \" AND product_id=\" . $record->id);\n if (empty($opt_id)) {\n $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);\n } else {\n $opt = new option($opt_id);\n }", " $editable_options[$group->title]->options[] = $opt;\n }\n }\n }\n }", " // get the shipping options and their methods\n// $shipping = new shipping();\n// foreach (shipping::listAvailableCalculators() as $calcid => $name) {\n foreach (shipping::listCalculators() as $calcid => $name) {\n if (class_exists($name)) {\n $calc = new $name($calcid);\n $shipping_services[$calcid] = $calc->title;\n $shipping_methods[$calcid] = $calc->availableMethods();\n }\n }", " $record->original_id = $record->id;\n $record->original_model = $record->model;\n $record->sef_url = NULL;\n $record->previous_id = NULL;\n $record->editor = NULL;", " if ($record->isChild()) {\n $record->child_rank = $db->max('product', 'child_rank', null, 'parent_id=' . $record->parent_id) + 1;\n }", " assign_to_template(array(\n 'copy' => true,\n 'record' => $record,\n 'parent' => new $product_type($record->parent_id, false, true),\n 'form' => $record->getForm($record->parent_id == 0 ? 'edit' : 'child_edit'),\n 'optiongroups' => $editable_options,\n 'forms'=> $forms_list,\n 'shipping_services' => $shipping_services,\n 'shipping_methods' => $shipping_methods\n ));\n }", " function picktype() {\n $prodfiles = storeController::getProductTypes();\n $products = array();\n foreach ($prodfiles as $filepath => $classname) {\n $prodObj = new $classname();\n $products[$classname] = $prodObj->product_name;\n }\n assign_to_template(array(\n 'product_types' => $products\n ));\n }", " function update() {\n// global $db;\n //Get the product type\n $product_type = isset($this->params['product_type']) ? $this->params['product_type'] : 'product';", " $record = new $product_type();", " $record->update($this->params);", " if ($product_type == \"childProduct\" || $product_type == \"product\") {\n $record->addContentToSearch();\n //Create a flash message and redirect to the page accordingly\n if ($record->parent_id != 0) {\n $parent = new $product_type($record->parent_id, false, false);\n if (isset($this->params['original_id'])) {\n flash(\"message\", gt(\"Child product saved.\"));\n } else {\n flash(\"message\", gt(\"Child product copied and saved.\"));\n }\n redirect_to(array('controller' => 'store', 'action' => 'show', 'title' => $parent->sef_url));\n } elseif (isset($this->params['original_id'])) {\n flash(\"message\", gt(\"Product copied and saved. You are now viewing your new product.\"));\n } else {\n flash(\"message\", gt(\"Product saved.\"));\n }\n redirect_to(array('controller' => 'store', 'action' => 'show', 'title' => $record->sef_url));\n } elseif ($product_type == \"giftcard\") {\n flash(\"message\", gt(\"Giftcard saved.\"));\n redirect_to(array('controller' => 'store', 'action' => 'manage'));\n } elseif ($product_type == \"eventregistration\") {\n //FIXME shouldn't event registrations be added to search index?\n// $record->addContentToSearch(); //FIXME there is NO eventregistration::addContentToSearch() method\n flash(\"message\", gt(\"Event saved.\"));\n redirect_to(array('controller' => 'store', 'action' => 'manage'));\n } elseif ($product_type == \"donation\") {\n flash(\"message\", gt(\"Donation saved.\"));\n redirect_to(array('controller' => 'store', 'action' => 'manage'));\n }\n }", " function delete() {\n global $db;", " if (empty($this->params['id'])) return false;\n $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n $product = new $product_type($this->params['id'], true, false);", " //eDebug($product_type); ", " //eDebug($product, true);\n //if (!empty($product->product_type_id)) {\n //$db->delete($product_type, 'id='.$product->product_id);\n //}", " $db->delete('option', 'product_id=' . $product->id . \" AND optiongroup_id IN (SELECT id from \" . $db->prefix . \"optiongroup WHERE product_id=\" . $product->id . \")\");\n $db->delete('optiongroup', 'product_id=' . $product->id);\n //die();\n $db->delete('product_storeCategories', 'product_id=' . $product->id . ' AND product_type=\"' . $product_type . '\"');", " if ($product->product_type == \"product\") {\n if ($product->hasChildren()) {\n $this->deleteChildren();\n }\n }", " $product->delete();", " flash('message', gt('Product deleted successfully.'));\n expHistory::back();\n }", " function quicklinks() {\n global $order;", " $oicount = !empty($order->item_count) ? $order->item_count : 0;\n //eDebug($itemcount);\n assign_to_template(array(\n \"oicount\" => $oicount,\n ));\n }", " public static function getProductTypes() {\n $paths = array(\n BASE . 'framework/modules/ecommerce/products/models',\n );", " $products = array();\n foreach ($paths as $path) {\n if (is_readable($path)) {\n $dh = opendir($path);\n while (($file = readdir($dh)) !== false) {\n if (is_readable($path . '/' . $file) && substr($file, -4) == '.php' && $file != 'childProduct.php') {\n $classname = substr($file, 0, -4);\n $products[$path . '/' . $file] = $classname;\n }\n }\n }\n }", " return $products;\n }", " function metainfo() {\n global $router;", " if (empty($router->params['action'])) return array();", " // figure out what metadata to pass back based on the action we are in.\n $action = $router->params['action'];\n $metainfo = array('title'=>'', 'keywords'=>'', 'description'=>'', 'canonical'=> '', 'noindex' => false, 'nofollow' => false);\n $storename = ecomconfig::getConfig('storename');\n switch ($action) {\n case 'showall': //category page\n $cat = $this->category;\n if (!empty($cat)) {\n $metainfo['title'] = empty($cat->meta_title) ? $cat->title . ' ' . gt('Products') . ' - ' . $storename : $cat->meta_title;\n $metainfo['keywords'] = empty($cat->meta_keywords) ? $cat->title : strip_tags($cat->meta_keywords);\n $metainfo['description'] = empty($cat->meta_description) ? strip_tags($cat->body) : strip_tags($cat->meta_description);\n $metainfo['canonical'] = empty($cat->canonical) ? $router->plainPath() : strip_tags($cat->canonical);\n $metainfo['noindex'] = empty($cat->meta_noindex) ? false : $cat->meta_noindex;\n $metainfo['nofollow'] = empty($cat->meta_nofollow) ? false : $cat->meta_nofollow;\n }\n break;\n case 'show':\n case 'showByTitle':\n $prod = new product(isset($router->params['title']) ? expString::sanitize($router->params['title']) : intval($router->params['id']));\n if (!empty($prod)) {\n $metainfo['title'] = empty($prod->meta_title) ? $prod->title . \" - \" . $storename : $prod->meta_title;\n $metainfo['keywords'] = empty($prod->meta_keywords) ? $prod->title : strip_tags($prod->meta_keywords);\n $metainfo['description'] = empty($prod->meta_description) ? strip_tags($prod->body) : strip_tags($prod->meta_description);\n $metainfo['canonical'] = empty($prod->canonical) ? $router->plainPath() : strip_tags($prod->canonical);\n $metainfo['noindex'] = empty($prod->meta_noindex) ? false : $prod->meta_noindex;\n $metainfo['nofollow'] = empty($prod->meta_nofollow) ? false : $prod->meta_nofollow;\n if (!empty($prod->expFile['mainimage'][0]) && file_exists(BASE.$prod->expFile['mainimage'][0]->directory.$prod->expFile['mainimage'][0]->filename)) {\n $metainfo['rich'] = '<!--\n <PageMap>\n <DataObject type=\"thumbnail\">\n <Attribute name=\"src\" value=\"'.$prod->expFile['mainimage'][0]->url.'\"/>\n <Attribute name=\"width\" value=\"'.$prod->expFile['mainimage'][0]->image_width.'\"/>\n <Attribute name=\"height\" value=\"'.$prod->expFile['mainimage'][0]->image_width.'\"/>\n </DataObject>\n </PageMap>\n -->';\n }\n $metainfo['fb']['type'] = 'product';\n $metainfo['fb']['title'] = substr(empty($prod->meta_fb['title']) ? $prod->title : $prod->meta_fb['title'], 0, 87);\n $metainfo['fb']['description'] = substr(empty($prod->meta_fb['description']) ? $metainfo['description'] : $prod->meta_fb['description'], 0, 199);\n $metainfo['fb']['url'] = empty($prod->meta_fb['url']) ? $metainfo['canonical'] : $prod->meta_fb['url'];\n $metainfo['fb']['image'] = empty($prod->meta_fb['fbimage'][0]) ? '' : $prod->meta_fb['fbimage'][0]->url;\n if (empty($metainfo['fb']['image'])) {\n if (!empty($prod->expFile['mainimage'][0]))\n $metainfo['fb']['image'] = $prod->expFile['mainimage'][0]->url;\n if (empty($metainfo['fb']['image']))\n $metainfo['fb']['image'] = URL_BASE . '/framework/modules/ecommerce/assets/images/no-image.jpg';\n }\n break;\n }\n default:\n $metainfo['title'] = gt(\"Shopping\") . \" - \" . $storename;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n }", " // Remove any quotes if there are any.\n// $metainfo['title'] = expString::parseAndTrim($metainfo['title'], true);\n// $metainfo['description'] = expString::parseAndTrim($metainfo['description'], true);\n// $metainfo['keywords'] = expString::parseAndTrim($metainfo['keywords'], true);\n// $metainfo['canonical'] = expString::parseAndTrim($metainfo['canonical'], true);\n// $metainfo['noindex'] = expString::parseAndTrim($metainfo['noindex'], true);\n// $metainfo['nofollow'] = expString::parseAndTrim($metainfo['nofollow'], true);", " return $metainfo;\n }", " /**\n * Configure the module\n */\n public function configure() {\n if (empty($this->config['enable_ratings_and_reviews'])) {\n $this->remove_configs[] = 'comments';\n }\n parent::configure();\n }", " public function deleteChildren() {\n //eDebug($data[0],true);\n //if($id!=null) $this->params['id'] = $id;", " //eDebug($this->params,true); ", " $product = new product($this->params['id']);\n //$product = $product->find(\"first\", \"previous_id =\" . $previous_id);\n //eDebug($product, true);", " if (empty($product->id)) // || empty($product->previous_id)) ", " {\n flash('error', gt('There was an error deleting the child products.'));\n expHistory::back();\n }\n $childrenToDelete = $product->find('all', 'parent_id=' . $product->id);\n foreach ($childrenToDelete as $ctd) {", " //fwrite($lfh, \"Deleting:\" . $ctd->id . \"\\n\"); ", " $ctd->delete();\n }\n }", " function searchByModelForm() {\n // get the search terms\n $terms = $this->params['search_string'];", " $sql = \"model like '%\" . $terms . \"%'\";", " $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model' => 'product',\n 'where' => $sql,\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'order' => 'title',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));", " assign_to_template(array(\n 'page' => $page,\n 'terms' => $terms\n ));\n }", " /**\n * AJAX search for products by model/sku\n */", " function search_by_model() {\n global $db, $user;", " $sql = \"select DISTINCT(p.id) as id, p.title, model from \" . $db->prefix . \"product as p WHERE \";\n if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';", " //if first character of search is a -, then we do a wild card, else from beginning\n if ($this->params['query'][0] == '-') {\n $sql .= \" p.model LIKE '%\" . $this->params['query'];\n } else {\n $sql .= \" p.model LIKE '\" . $this->params['query'];\n }", " $sql .= \"%' AND p.parent_id=0 GROUP BY p.id \";\n $sql .= \"order by p.model ASC LIMIT 30\";\n $res = $db->selectObjectsBySql($sql);\n //eDebug($sql);\n $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }", " /**\n * AJAX search for products by title, description, or model/sku\n *\n */\n public function search() {\n global $db, $user;", " if (SAVE_SEARCH_QUERIES && INCLUDE_AJAX_SEARCH == 1) { // only to add search query record\n $qry = trim($this->params['query']);\n if (!empty($qry)) {\n if (INCLUDE_ANONYMOUS_SEARCH == 1 || $user->id <> 0) {\n $queryObj = new stdClass();\n $queryObj->user_id = $user->id;\n $queryObj->query = $qry;\n $queryObj->timestamp = time();", " $db->insertObject($queryObj, 'search_queries');\n }\n }\n }\n //$this->params['query'] = str_ireplace('-','\\-',$this->params['query']);\n $terms = explode(\" \", $this->params['query']);\n $search_type = ecomconfig::getConfig('ecom_search_results');", " // look for term in full text search\n $sql = \"select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, match (p.title,p.body) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) as score \";\n $sql .= \" from \" . $db->prefix . \"product as p LEFT JOIN \" .\n $db->prefix . \"content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' LEFT JOIN \" . $db->prefix .\n \"expFiles as f ON cef.expFiles_id = f.id WHERE \";\n if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n if ($search_type == 'products') $sql .= 'product_type = \"product\" AND ';\n $sql .= \" match (p.title,p.body) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) AND p.parent_id=0 GROUP BY p.id \";\n $sql .= \"order by score desc LIMIT 10\";", " $firstObs = $db->selectObjectsBySql($sql);\n foreach ($firstObs as $set) {\n $set->weight = 1;\n unset($set->score);\n $index = !empty($set->model) ? $set->model : $set->sef_url;\n $res[$index] = $set;\n }", " // look for specific term in fields\n $sql = \"select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid from \" . $db->prefix . \"product as p LEFT JOIN \" .\n $db->prefix . \"content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' LEFT JOIN \" . $db->prefix .\n \"expFiles as f ON cef.expFiles_id = f.id WHERE \";\n if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n if ($search_type == 'products') $sql .= 'product_type = \"product\" AND ';\n $sql .= \" (p.model like '%\" . $this->params['query'] . \"%' \";\n $sql .= \" OR p.title like '%\" . $this->params['query'] . \"%') \";\n $sql .= \" AND p.parent_id=0 GROUP BY p.id LIMIT 10\";", " $secondObs = $db->selectObjectsBySql($sql);\n foreach ($secondObs as $set) {\n $set->weight = 2;\n $index = !empty($set->model) ? $set->model : $set->sef_url;\n $res[$index] = $set;\n }", " // look for begins with term in fields\n $sql = \"select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid from \" . $db->prefix . \"product as p LEFT JOIN \" .\n $db->prefix . \"content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' LEFT JOIN \" . $db->prefix .\n \"expFiles as f ON cef.expFiles_id = f.id WHERE \";\n if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n if ($search_type == 'products') $sql .= 'product_type = \"product\" AND ';\n $sql .= \" (p.model like '\" . $this->params['query'] . \"%' \";\n $sql .= \" OR p.title like '\" . $this->params['query'] . \"%') \";\n $sql .= \" AND p.parent_id=0 GROUP BY p.id LIMIT 10\";", " $thirdObs = $db->selectObjectsBySql($sql);\n foreach ($thirdObs as $set) {\n if (strcmp(strtolower(trim($this->params['query'])), strtolower(trim($set->model))) == 0)\n $set->weight = 10;\n else if (strcmp(strtolower(trim($this->params['query'])), strtolower(trim($set->title))) == 0)\n $set->weight = 9;\n else\n $set->weight = 3;", " $index = !empty($set->model) ? $set->model : $set->sef_url;\n $res[$index] = $set;\n }", " function sortSearch($a, $b) {\n return ($a->weight == $b->weight ? 0 : ($a->weight < $b->weight) ? 1 : -1);\n }", " if (count($terms)) {\n foreach ($res as $r) {\n $index = !empty($r->model) ? $r->model : $r->sef_url;\n foreach ($terms as $term) {\n if (stristr($r->title, $term)) $res[$index]->weight = $res[$index]->weight + 1;\n }\n }\n }\n usort($res, 'sortSearch');", " $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }", " /**\n * AJAX search for products by title, description, or model/sku\n *\n */\n public function searchNew() {\n global $db, $user;\n //$this->params['query'] = str_ireplace('-','\\-',$this->params['query']);\n $sql = \"select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, \";\n $sql .= \"match (p.title,p.model,p.body) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) as relevance, \";\n $sql .= \"CASE when p.model like '\" . $this->params['query'] . \"%' then 1 else 0 END as modelmatch, \";\n $sql .= \"CASE when p.title like '%\" . $this->params['query'] . \"%' then 1 else 0 END as titlematch \";\n $sql .= \"from \" . $db->prefix . \"product as p INNER JOIN \" .\n $db->prefix . \"content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' INNER JOIN \" . $db->prefix .\n \"expFiles as f ON cef.expFiles_id = f.id WHERE \";\n if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n $sql .= \" match (p.title,p.model,p.body) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) AND p.parent_id=0 \";\n $sql .= \" HAVING relevance > 0 \";", " //$sql .= \"GROUP BY p.id \"; ", " $sql .= \"order by modelmatch,titlematch,relevance desc LIMIT 10\";", " eDebug($sql);\n $res = $db->selectObjectsBySql($sql);\n eDebug($res, true);\n $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }", " function batch_process() {\n $os = new order_status();\n $oss = $os->find('all',1,'rank');\n $order_status = array();\n $order_status[-1] = '';\n foreach ($oss as $status) {\n $order_status[$status->id] = $status->title;\n }\n assign_to_template(array(\n 'order_status' => $order_status\n ));\n }", " function process_orders() {\n /*\n Testing\n */\n /*echo \"Here?\";\n $inv = 30234;", " $req = 'a29f9shsgh32hsf80s7'; ", " $amt = 101.00;\n for($count=1;$count<=25;$count+=2)", " { ", " $data[2] = $inv + $count;\n $amt += $count*$count;", " $successSet[$count]['message'] = \"Sucessfully imported row \" . $count . \", order: \" . $data[2] . \"<br/>\"; ", " $successSet[$count]['order_id'] = $data[2];\n $successSet[$count]['amount'] = $amt;\n $successSet[$count]['request_id'] = $req;\n $successSet[$count]['reference_id'] = $req;\n $successSet[$count]['authorization_code'] = $req;", " $successSet[$count]['shipping_tracking_number'] = '1ZNF453937547'; ", " $successSet[$count]['carrier'] = 'UPS';\n }\n for($count=2;$count<=25;$count+=2)", " { \n $data[2] = $inv + $count; \n $amt += $count*$count; ", " $errorSet[$count]['error_code'] = '42';\n $errorSet[$count]['message'] = \"No go for some odd reason. Try again.\";\n $errorSet[$count]['order_id'] = $data[2];\n $errorSet[$count]['amount'] = $amt;\n }", " \n assign_to_template(array('errorSet'=>$errorSet, 'successSet'=>$successSet)); ", " return;*/", " ###########", " global $db;\n $template = expTemplate::get_template_for_action(new orderController(), 'setStatus', $this->loc);", " //eDebug($_FILES);", " //eDebug($this->params,true); ", " set_time_limit(0);\n //$file = new expFile($this->params['expFile']['batch_process_upload'][0]);\n if (!empty($_FILES['batch_upload_file']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n redirect_to(array('controller' => 'store', 'action' => 'batch_process'));\n// $this->batch_process();\n }", " $file = new stdClass();\n $file->path = $_FILES['batch_upload_file']['tmp_name'];\n echo \"Validating file...<br/>\";", " $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n // read in the header line\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);\n $count = 1;\n // read in the data lines\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);", " echo \"<br/>CSV File passed validation...<br/><br/>Detecting carrier type....<br/>\";\n //exit();\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");", " // read in the header line\n $data = fgetcsv($handle, 10000, \",\");", " //eDebug($data); ", "// $dataset = array();\n $carrier = '';\n if (trim($data[0]) == 'ShipmentInformationShipmentID') {\n echo \"Detected UPS file...<br/>\";\n $carrier = \"UPS\";\n $carrierTrackingLink = \"http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=\";\n } elseif (trim($data[0]) == 'PIC') {\n echo \"Detected United States Post Service file...<br/>\";\n $carrier = \"USPS\";\n $carrierTrackingLink = \"https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=\";\n }", " //eDebug($carrier);\n $count = 1;\n $errorSet = array();\n $successSet = array();", " $oo = new order();", " // read in the data lines\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;\n $originalOrderId = $data[2];\n $data[2] = intval($data[2]);\n $order = new stdClass();\n $bm = new stdClass();\n $transactionState = null;", " //check for valid order number - if not present or not order, fail and continue with next record\n if (isset($data[2]) && !empty($data[2])) {\n $order = $oo->findBy('invoice_id', $data[2]);\n if (empty($order->id)) {\n $errorSet[$count]['message'] = $originalOrderId . \" is not a valid order in this system.\";\n $errorSet[$count]['order_id'] = $originalOrderId;\n continue;\n }\n } else {\n $errorSet[$count]['message'] = \"Row \" . $count . \" has no order number.\";\n $errorSet[$count]['order_id'] = \"N/A\";\n continue;\n }", " /*we have a valid order, so let's see what we can do: */", " //set status of order to var\n $currentStat = $order->order_status;\n //eDebug($currentStat,true);", " //-- check the order for a closed status - if so, do NOT process or set shipping\n if ($currentStat->treat_as_closed == true) {\n $errorSet[$count]['message'] = \"This is currently a closed order. Not processing.\";\n $errorSet[$count]['order_id'] = $data[2];\n continue;\n }", " //ok, if we made it here we have a valid order that is \"open\"\n //we'll try to capture the transaction if it's in an authorized state, but set shipping regardless\n if (isset($order->billingmethod[0])) {\n $bm = $order->billingmethod[0];\n $transactionState = $bm->transaction_state;\n } else {\n $bm = null;\n $transactionState = '';\n }", " if ($transactionState == 'authorized') {\n //eDebug($order,true);\n $calc = $bm->billingcalculator->calculator;\n $calc->config = $bm->billingcalculator->config;\n if (method_exists($calc, 'delayed_capture')) {\n //$result = $calc->delayed_capture($bm,$bm->billing_cost);\n $result = $calc->delayed_capture($bm, $order->grand_total, $order);\n if ($result->errorCode == 0) {\n //we've succeeded. transaction already created and billing info updated.", " //just need to set the order shipping info, check and see if we send user an email, and set statuses. \n //shipping info: ", " $successSet[$count]['order_id'] = $data[2];\n $successSet[$count]['message'] = \"Sucessfully captured order \" . $data[2] . \" and set shipping information.\";\n $successSet[$count]['amount'] = $order->grand_total;\n $successSet[$count]['request_id'] = $result->request_id;\n $successSet[$count]['reference_id'] = $result->PNREF;\n $successSet[$count]['authorization_code'] = $result->AUTHCODE;\n $successSet[$count]['shipping_tracking_number'] = $data[0];\n $successSet[$count]['carrier'] = $carrier;\n } else {\n //failed capture, so we report the error but still set the shipping information\n //because it's already out the door", " //$failMessage = \"Attempted to delay capture order \" . $data[2] . \" and it failed with the following error: \" . $result->errorCode . \" - \" .$result->message; ", " //if the user seelected to set a different status for failed orders, set it here.\n /*if(isset($this->params['order_status_fail'][0]) && $this->params['order_status_fail'][0] > -1)\n {\n $change = new order_status_changes();\n // save the changes\n $change->from_status_id = $order->order_status_id;\n //$change->comment = $this->params['comment'];\n $change->to_status_id = $this->params['order_status_fail'][0];\n $change->orders_id = $order->id;\n $change->save();", " ", " // update the status of the order\n $order->order_status_id = $this->params['order_status_fail'][0];", " $order->save(); ", " }*/\n $errorSet[$count]['error_code'] = $result->errorCode;\n $errorSet[$count]['message'] = \"Capture failed: \" . $result->message . \"<br/>Setting shipping information.\";\n $errorSet[$count]['order_id'] = $data[2];\n $errorSet[$count]['amount'] = $order->grand_total;\n $errorSet[$count]['shipping_tracking_number'] = $data[0];\n $errorSet[$count]['carrier'] = $carrier;", " //continue; ", " }\n } else {", " //dont suppose we do anything here, as it may be set to approved manually \n //$errorSet[$count] = \"Order \" . $data[2] . \" does not use a billing method with delayed capture ability.\"; ", " $successSet[$count]['message'] = 'No capture processing available for order:' . $data[2] . '. Setting shipping information.';\n $successSet[$count]['order_id'] = $data[2];\n $successSet[$count]['amount'] = $order->grand_total;\n $successSet[$count]['shipping_tracking_number'] = $data[0];\n $successSet[$count]['carrier'] = $carrier;\n }\n } //if we hit this else, it means we have an order that is not in an authorized state\n //so we do not try to process it = still set shipping though. //FIXME what about 'complete'?\n else {\n $successSet[$count]['message'] = 'No processing necessary for order:' . $data[2] . '. Setting shipping information.';\n $successSet[$count]['order_id'] = $data[2];\n $successSet[$count]['amount'] = $order->grand_total;\n $successSet[$count]['shipping_tracking_number'] = $data[0];\n $successSet[$count]['carrier'] = $carrier;\n }", " $order->shipped = time();\n $order->shipping_tracking_number = $data[0];\n $order->save();", " $s = array_pop($order->shippingmethods);\n $sm = new shippingmethod($s->id);\n $sm->carrier = $carrier;\n $sm->save();", " //statuses and email\n if (isset($this->params['order_status_success'][0]) && $this->params['order_status_success'][0] > -1) {\n $change = new order_status_changes();\n // save the changes\n $change->from_status_id = $order->order_status_id;\n //$change->comment = $this->params['comment'];\n $change->to_status_id = $this->params['order_status_success'][0];\n $change->orders_id = $order->id;\n $change->save();", " // update the status of the order\n $order->order_status_id = $this->params['order_status_success'][0];\n $order->save();", " // email the user if we need to\n if (!empty($this->params['email_customer'])) {\n $email_addy = $order->billingmethod[0]->email;\n if (!empty($email_addy)) {\n $from_status = $db->selectValue('order_status', 'title', 'id=' . $change->from_status_id);\n $to_status = $db->selectValue('order_status', 'title', 'id=' . $change->to_status_id);\n// $template->assign(\n assign_to_template(\n array(\n 'comment' => $change->comment,\n 'to_status' => $to_status,\n 'from_status' => $from_status,\n 'order' => $order,\n 'date' => date(\"F j, Y, g:i a\"),\n 'storename' => ecomconfig::getConfig('storename'),\n 'include_shipping' => true,\n 'tracking_link' => $carrierTrackingLink . $order->shipping_tracking_number,\n 'carrier' => $carrier\n )\n );", " $html = $template->render();\n $html .= ecomconfig::getConfig('ecomfooter');", " $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n try {\n $mail = new expMail();\n $mail->quickSend(array(\n 'html_message' => $html,\n 'text_message' => str_replace(\"<br>\", \"\\r\\n\", $template->render()),\n 'to' => array($email_addy => $order->billingmethod[0]->firstname . ' ' . $order->billingmethod[0]->lastname),\n 'from' => $from,\n 'subject' => 'Your Order Has Been Shipped (#' . $order->invoice_id . ') - ' . ecomconfig::getConfig('storename')\n ));\n } catch (Exception $e) {\n //do nothing for now\n eDebug(\"Email error:\");\n eDebug($e);\n }\n }\n //else {\n // $errorSet[$count]['message'] .= \"<br/>Order \" . $data[2] . \" was captured successfully, however the email notification was not successful.\";\n //}\n }\n }\n", " //eDebug($product); ", " }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);", " assign_to_template(array(\n 'errorSet' => $errorSet,\n 'successSet' => $successSet\n ));\n }", " function manage_sales_reps() {", " }", " function showHistory() {\n $h = new expHistory();\n// echo \"<xmp>\";\n echo \"<pre>\";\n print_r($h);\n// echo \"</xmp>\";\n echo \"</pre>\";\n }", " function import_external_addresses() {\n $sources = array('mc' => 'MilitaryClothing.com', 'nt' => 'NameTapes.com', 'am' => 'Amazon');\n assign_to_template(array(\n 'sources' => $sources\n ));\n }", " function process_external_addresses() {\n global $db;\n set_time_limit(0);\n //$file = new expFile($this->params['expFile']['batch_process_upload'][0]);\n eDebug($this->params);\n// eDebug($_FILES,true);\n if (!empty($_FILES['address_csv']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n redirect_to(array('controller' => 'store', 'action' => 'import_external_addresses'));\n// $this->import_external_addresses();\n }", " $file = new stdClass();\n $file->path = $_FILES['address_csv']['tmp_name'];\n echo \"Validating file...<br/>\";", " //replace tabs with commas\n /*if($this->params['type_of_address'][0] == 'am')\n {\n $checkhandle = fopen($file->path, \"w\");\n $oldFile = file_get_contents($file->path);\n $newFile = str_ireplace(chr(9),',',$oldFile);\n fwrite($checkhandle,$newFile);\n fclose($checkhandle);\n }*/", " $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n if ($this->params['type_of_address'][0] == 'am') {\n // read in the header line\n $checkdata = fgetcsv($checkhandle, 10000, \"\\t\");\n $fieldCount = count($checkdata);\n } else {\n // read in the header line\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);\n }", " $count = 1;\n if ($this->params['type_of_address'][0] == 'am') {\n // read in the data lines\n while (($checkdata = fgetcsv($checkhandle, 10000, \"\\t\")) !== FALSE) {\n $count++;\n //eDebug($checkdata);\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n } else {\n // read in the data lines\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n }", " fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);", " echo \"<br/>CSV File passed validation...<br/><br/>Importing....<br/><br/>\";\n //exit();\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");", " // read in the header line and discard it\n $data = fgetcsv($handle, 10000, \",\");", " //eDebug($data); ", "// $dataset = array();", " //mc=1, nt=2, amm=3", " if ($this->params['type_of_address'][0] == 'mc') {\n //militaryclothing\n $db->delete('external_addresses', 'source=1');", " } else if ($this->params['type_of_address'][0] == 'nt') {\n //nametapes\n $db->delete('external_addresses', 'source=2');\n } else if ($this->params['type_of_address'][0] == 'am') {\n //amazon\n $db->delete('external_addresses', 'source=3');\n }", " if ($this->params['type_of_address'][0] == 'am') {\n // read in the data lines\n while (($data = fgetcsv($handle, 10000, \"\\t\")) !== FALSE) {\n //eDebug($data,true);\n $extAddy = new external_address();", " //eDebug($data);\n $extAddy->source = 3;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[15]);\n $extAddy->firstname = $name[0];\n if (isset($name[3])) {\n $extAddy->firstname .= ' ' . $name[1];\n $extAddy->middlename = $name[2];\n $extAddy->lastname = $name[3];\n } else if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[15];\n $extAddy->address1 = $data[16];\n $extAddy->address2 = $data[17];\n $extAddy->city = $data[19];\n $state = new geoRegion();\n $state = $state->findBy('code', trim($data[20]));\n if (empty($state->id)) {\n $state = new geoRegion();\n $state = $state->findBy('name', trim($data[20]));\n }\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[21]);\n $extAddy->phone = $data[6];\n $extAddy->email = $data[4];\n //eDebug($extAddy);\n $extAddy->save();\n }\n } else {\n // read in the data lines\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n eDebug($data);\n $extAddy = new external_address();\n if ($this->params['type_of_address'][0] == 'mc') {\n $extAddy->source = 1;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[3]);\n $extAddy->firstname = $name[0];\n if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[4];\n $extAddy->address1 = $data[5];\n $extAddy->address2 = $data[6];\n $extAddy->city = $data[7];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[8]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[9]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];\n //eDebug($extAddy);\n $extAddy->save();", " //Check if the shipping add is same as the billing add\n if ($data[5] != $data[14]) {\n $extAddy = new external_address();\n $extAddy->source = 1;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[12]);\n $extAddy->firstname = $name[0];\n if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[13];\n $extAddy->address1 = $data[14];\n $extAddy->address2 = $data[15];\n $extAddy->city = $data[16];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[17]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[18]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];\n // eDebug($extAddy, true);\n $extAddy->save();\n }\n }\n if ($this->params['type_of_address'][0] == 'nt') {\n //eDebug($data,true);\n $extAddy->source = 2;\n $extAddy->user_id = 0;\n $extAddy->firstname = $data[16];\n $extAddy->lastname = $data[17];\n $extAddy->organization = $data[15];\n $extAddy->address1 = $data[18];\n $extAddy->address2 = $data[19];\n $extAddy->city = $data[20];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[21]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[22]);\n $extAddy->phone = $data[23];\n $extAddy->email = $data[13];\n //eDebug($extAddy);\n $extAddy->save();\n }\n }\n }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);\n echo \"Done!\";\n }", " function nonUnicodeProducts() {\n global $db, $user;", " $products = $db->selectObjectsIndexedArray('product');\n $affected_fields = array();\n $listings = array();\n $listedProducts = array();\n $count = 0;\n //Get all the columns of the product table\n $columns = $db->getTextColumns('product');\n foreach ($products as $item) {", " foreach ($columns as $column) {\n if ($column != 'body' && $column != 'summary' && $column != 'featured_body') {\n if (!expString::validUTF($item->$column) || strrpos($item->$column, '?')) {\n $affected_fields[] = $column;\n }\n } else {\n if (!expString::validUTF($item->$column)) {\n $affected_fields[] = $column;\n }\n }\n }", " if (isset($affected_fields)) {\n if (count($affected_fields) > 0) {\n //Hard coded fields since this is only for displaying\n $listedProducts[$count]['id'] = $item->id;\n $listedProducts[$count]['title'] = $item->title;\n $listedProducts[$count]['model'] = $item->model;\n $listedProducts[$count]['sef_url'] = $item->sef_url;\n $listedProducts[$count]['nonunicode'] = implode(', ', $affected_fields);\n $count++;\n }\n }\n unset($affected_fields);\n }", " assign_to_template(array(\n 'products' => $listedProducts,\n 'count' => $count\n ));\n }", " function cleanNonUnicodeProducts() {\n global $db, $user;", " $products = $db->selectObjectsIndexedArray('product');\n //Get all the columns of the product table\n $columns = $db->getTextColumns('product');\n foreach ($products as $item) {\n //Since body, summary, featured_body can have a ? intentionally such as a link with get parameter.\n //TO Improved\n foreach ($columns as $column) {\n if ($column != 'body' && $column != 'summary' && $column != 'featured_body') {\n if (!expString::validUTF($item->$column) || strrpos($item->$column, '?')) {\n $item->$column = expString::convertUTF($item->$column);\n }\n } else {\n if (!expString::validUTF($item->$column)) {\n $item->$column = expString::convertUTF($item->$column);\n }\n }\n }", " $db->updateObject($item, 'product');\n }", " redirect_to(array('controller' => 'store', 'action' => 'nonUnicodeProducts'));\n// $this->nonUnicodeProducts();\n }", " //This function is being used in the uploadModelaliases page for showing the form upload\n function uploadModelAliases() {\n global $db;\n set_time_limit(0);", " if (isset($_FILES['modelaliases']['tmp_name'])) {\n if (!empty($_FILES['modelaliases']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n//\t\t\t\tredirect_to(array('controller'=>'store','action'=>'uploadModelAliases'));\n $this->uploadModelAliases();\n }", " $file = new stdClass();\n $file->path = $_FILES['modelaliases']['tmp_name'];\n echo \"Validating file...<br/>\";", " $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n // read in the header line\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);\n $count = 1;", " // read in the data lines\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }", " fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);", " echo \"<br/>CSV File passed validation...<br/><br/>Importing....<br/><br/>\";\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");\n // read in the header line\n $data = fgetcsv($handle, 10000, \",\");", " //clear the db\n $db->delete('model_aliases_tmp');\n // read in the data lines\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {", " $tmp = new stdClass();\n $tmp->field1 = expString::onlyReadables($data[0]);\n $tmp->field2 = expString::onlyReadables($data[1]);\n $db->insertObject($tmp, 'model_aliases_tmp');\n }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);\n redirect_to(array('controller' => 'store', 'action' => 'processModelAliases'));\n echo \"Done!\";\n }", " //check if there are interrupted model alias in the db\n $res = $db->selectObjectsBySql(\"SELECT * FROM \".$db->prefix.\"model_aliases_tmp WHERE is_processed = 0\");\n if (!empty($res)) {\n assign_to_template(array(\n 'continue' => '1'\n ));\n }\n }", " // This function process the uploading of the model aliases in the uploadModelAliases page\n function processModelAliases($index = 0, $error = '') {\n global $db;", " //Going next and delete the previous one\n if (isset($this->params['index'])) {\n $index = $this->params['index'];", " //if go to the next processs\n if (isset($this->params['next'])) {\n $res = $db->selectObjectBySql(\"SELECT * FROM \".$db->prefix.\"model_aliases_tmp LIMIT \" . ($index - 1) . \", 1\");\n //Update the record in the tmp table to mark it as process\n $res->is_processed = 1;\n $db->updateObject($res, 'model_aliases_tmp');\n }\n }", " $product_id = '';\n $autocomplete = '';", " do {\n $count = $db->countObjects('model_aliases_tmp', 'is_processed=0');\n $res = $db->selectObjectBySql(\"SELECT * FROM \".$db->prefix.\"model_aliases_tmp LIMIT {$index}, 1\");\n //Validation\n //Check the field one\n if (!empty($res)) {\n $product_field1 = $db->selectObject(\"product\", \"model='{$res->field1}'\");\n $product_field2 = $db->selectObject(\"product\", \"model='{$res->field2}'\");\n }\n if (!empty($product_field1)) {\n $product_id = $product_field1->id;\n //check the other field if it also being used by another product\n if (!empty($product_field2) && $product_field1->id != $product_field2->id) {\n $error = \"Both {$res->field1} and {$res->field2} are models of a product. <br />\";\n } else {\n //Check the field2 if it is already in the model alias\n $model_alias = $db->selectObject(\"model_aliases\", \"model='{$res->field2}'\");\n if (empty($model_alias) && @$model_alias->product_id != $product_field1->id) {\n //Add the first field\n $tmp = new stdClass();\n $tmp->model = $res->field1;\n $tmp->product_id = $product_field1->id;\n $db->insertObject($tmp, 'model_aliases');\n //Add the second field\n $tmp->model = $res->field2;\n $tmp->product_id = $product_field1->id;\n $db->insertObject($tmp, 'model_aliases');\n //Update the record in the tmp table to mark it as process\n $res->is_processed = 1;\n $db->updateObject($res, 'model_aliases_tmp');", " } else {\n $error = \"{$res->field2} has already a product alias. <br />\";\n }\n }\n } elseif (!empty($product_field2)) {\n $product_id = $product_field2->id;\n $model_alias = $db->selectObject(\"model_aliases\", \"model='{$res->field1}'\");\n if (empty($model_alias) && @$model_alias->product_id != $product_field2->id) {\n //Add the first field\n $tmp = new stdClass();\n $tmp->model = $res->field1;\n $tmp->product_id = $product_field2->id;\n $db->insertObject($tmp, 'model_aliases');\n //Add the second field\n $tmp->model = $res->field2;\n $tmp->product_id = $product_field2->id;\n $db->insertObject($tmp, 'model_aliases');\n //Update the record in the tmp table to mark it as process\n $res->is_processed = 1;\n $db->updateObject($res, 'model_aliases_tmp');\n } else {\n $error = \"{$res->field1} has already a product alias. <br />\";\n }\n } else {\n $model_alias1 = $db->selectObject(\"model_aliases\", \"model='{$res->field1}'\");\n $model_alias2 = $db->selectObject(\"model_aliases\", \"model='{$res->field2}'\");", " if (!empty($model_alias1) || !empty($model_alias2)) {\n $error = \"The {$res->field1} and {$res->field2} are already being used by another product.<br />\";\n } else {\n $error = gt(\"No product match found, please choose a product to be alias in the following models below\") . \":<br />\";\n $error .= $res->field1 . \"<br />\";\n $error .= $res->field2 . \"<br />\";\n $autocomplete = 1;\n }\n }\n $index++;\n } while (empty($error));\n assign_to_template(array(\n 'count' => $count,\n 'alias' => $res,\n 'index' => $index,\n 'product_id' => $product_id,\n 'autocomplete' => $autocomplete,\n 'error' => $error\n ));\n }", " // This function save the uploaded processed model aliases in the uploadModelAliases page\n function saveModelAliases() {\n global $db;", " $index = $this->params['index'];\n $title = expString::escape($this->params['product_title']);\n $product = $db->selectObject(\"product\", \"title='{$title}'\");", " if (!empty($product->id)) {\n $res = $db->selectObjectBySql(\"SELECT * FROM \".$db->prefix.\"model_aliases_tmp LIMIT \" . ($index - 1) . \", 1\");\n //Add the first field\n $tmp = new stdClass();\n $tmp->model = $res->field1;\n $tmp->product_id = $product->id;\n $db->insertObject($tmp, 'model_aliases');\n //Add the second field\n $tmp->model = $res->field2;\n $tmp->product_id = $product->id;\n $db->insertObject($tmp, 'model_aliases');", " //if the model is empty, update the product table so that it will used the field 1 as its primary model\n if (empty($product->model)) {\n $product->model = $res->field1;\n $db->updateObject($product, 'product');\n }", " //Update the record in the tmp table to mark it as process\n $res->is_processed = 1;\n $db->updateObject($res, 'model_aliases_tmp');\n flash(\"message\", gt(\"Product successfully Saved.\"));\n redirect_to(array('controller' => 'store', 'action' => 'processModelAliases', 'index' => $index));\n } else {\n flash(\"error\", gt(\"Product title is invalid.\"));\n redirect_to(array('controller' => 'store', 'action' => 'processModelAliases', 'index' => $index - 1, 'error' => 'Product title is invalid.'));\n }\n }", " // This function delete all the already processed model aliases in the uploadModelAliases page\n function deleteProcessedModelAliases() {\n global $db;", " $db->delete('model_aliases_tmp', 'is_processed=1');\n redirect_to(array('controller' => 'store', 'action' => 'processModelAliases'));\n }", " // This function show the form of model alias to be edit or add in the product edit page\n function edit_model_alias() {\n global $db;", " if (isset($this->params['id'])) {\n $model_alias = $db->selectObject('model_aliases', 'id =' . $this->params['id']);\n assign_to_template(array(\n 'model_alias' => $model_alias\n ));\n } else {\n assign_to_template(array(\n 'product_id' => $this->params['product_id']\n ));\n }\n }", " // This function update or add the model alias in the product edit page\n function update_model_alias() {\n global $db;", " if (empty($this->params['id'])) {\n $obj = new stdClass();\n $obj->model = $this->params['model'];\n $obj->product_id = $this->params['product_id'];\n $db->insertObject($obj, 'model_aliases');", " } else {\n $model_alias = $db->selectObject('model_aliases', 'id =' . $this->params['id']);\n $model_alias->model = $this->params['model'];\n $db->updateObject($model_alias, 'model_aliases');\n }", " expHistory::back();\n }", " // This function delete the model alias in the product edit page\n function delete_model_alias() {\n global $db;", " if (empty($this->params['id'])) return false;\n $db->delete('model_aliases', 'id =' . $this->params['id']);", " expHistory::back();\n }", " function setup_wizard() {", " }", " function import() {\n assign_to_template(array(\n 'type' => $this\n ));\n }", " function importProduct($file=null) {\n if (empty($file->path)) {\n $file = new stdClass();\n $file->path = $_FILES['import_file']['tmp_name'];\n }\n if (empty($file->path)) {\n echo gt('Not a Product Import CSV File');\n return;\n }\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");", " // read in the header line\n $header = fgetcsv($handle, 10000, \",\");\n if (!($header[0] == 'id' || $header[0] == 'model')) {\n echo gt('Not a Product Import CSV File');\n return;\n }", " $count = 1;\n $errorSet = array();\n $product = null;\n /* original order of columns\n 0=id\n 1=parent_id\n 2=child_rank\n 3=title\n 4=body\n 5=model\n 6=warehouse_location\n 7=sef_url\n//FIXME this is where canonical should be\n 8=meta_title\n 9=meta_keywords\n 10=meta_description\n 11=tax_class_id\n 12=quantity\n 13=availability_type\n 14=base_price\n 15=special_price\n 16=use_special_price\n 17=active_type\n 18=product_status_id\n 19=category1\n 20=category2\n 21=category3\n 22=category4\n ..\n 30=category12\n 31=surcharge\n 32=rank category_rank\n 33=feed_title\n 34=feed_body\n 35=weight\n 36=height\n 37=width\n 38=length\n 39=companies_id\n 40=image1 url to mainimage to download\n 41=image2 url to additional image to download\n ..\n 44=image5 url to additional image to download\n*/", " // read in the data lines\n// while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n while (($row = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;\n $createCats = array();\n $createCatsRank = array();\n $data = array_combine($header, $row);", " //eDebug($data, true);\n if ($header[0] == 'id') {\n if (isset($data['id']) && $data['id'] != 0) {\n $product = new product($data['id'], false, false);\n if (empty($product->id)) {\n $errorSet[$count] = gt(\"Is not an existing product ID.\");\n continue;\n }\n } else {\n //$errorSet[$count] = \"Product ID not supplied.\";\n //continue;\n $product = new product();\n //$product->save(false);\n }\n } elseif ($header[0] == 'model') {\n if (!empty($data['model'])) {\n $p = new product();\n $product = $p->find('first','model=\"' . $data['model'] . '\"');\n if (empty($product->id)) {\n $errorSet[$count] = gt(\"Is not an existing product SKU/Model.\");\n continue;\n }\n } else {\n $product = new product();\n }\n }\n if ($product->product_type != 'product') {\n $errorSet[$count] = gt(\"Existing product is wrong product type.\");\n continue;\n }", " // new products must have a title\n if (empty($product->id)) { // new product require mandatory values\n $checkTitle = trim($data['title']);\n if (empty($checkTitle)) {\n $errorSet[$count] = gt(\"No product name (title) supplied.\");\n continue;\n }\n $product->minimum_order_quantity = 1;\n }", " // parse $data columns\n foreach ($data as $key=>$value) {\n $value = trim($value);\n switch ($key) {\n case 'parent_id': // integer\n case 'child_rank':\n case 'tax_class_id':\n case 'quantity':\n case 'availability_type':\n case 'use_special_price':\n case 'active_type':\n case 'product_status_id':\n $product->$key = intval($value);\n break;\n case 'companies_id':\n if (is_numeric($value)) {\n $product->$key = intval($value);\n } elseif (!empty($value)) { // it's a company name, not a company id#\n $co = new company();\n $company = $co->find('first', 'title=' . $value);\n if (empty($company->id)) {\n $params['title'] = $value;\n $company->update();\n }\n $product->$key = $company->id;\n }\n break;\n case 'sef_url':\n $product->$key = stripslashes(stripslashes($value));\n if (!is_bool(expValidator::uniqueness_of('sef_url', $product, array()))) {\n $product->makeSefUrl();\n }\n break;\n case 'title': // string\n case 'model':\n case 'warehouse_location':\n case 'meta_title':\n case 'meta_keywords':\n case 'meta_description':\n case 'feed_title':\n case 'feed_body':\n $product->$key = stripslashes(stripslashes($value));\n break;\n case 'body':\n $product->$key = utf8_encode(stripslashes(expString::parseAndTrimImport(($value), true)));\n break;\n case 'base_price': // float\n case 'special_price':\n case 'surcharge':\n case 'weight':\n case 'height':\n case 'width':\n case 'length':\n $product->$key = floatval($value);\n break;\n case 'image1':\n case 'image2':\n case 'image3':\n case 'image4':\n case 'image5':\n if (!empty($value)) {\n $product->save(false);\n if (is_integer($value)) {\n $_objFile = new expFile ($value);\n } else {\n // import image from url\n $_destFile = basename($value); // get filename from end of url\n $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n $_destFullPath = BASE . $_destDir . $_destFile;\n if (file_exists($_destFullPath)) {\n $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n $_destFullPath = BASE . $_destDir . $_destFile;\n }", " expCore::saveData($value, $_destFullPath); // download the image", " if (file_exists($_destFullPath)) {\n $__oldumask = umask(0);\n chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n umask($__oldumask);", " // Create a new expFile Object\n $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n $_objFile = new expFile ($_fileParams);\n $_objFile->save();\n }\n }\n // attach product images expFile object\n if (!empty($_objFile->id)) {\n if ($key == 'image1') {\n $product->attachItem($_objFile, 'mainimage');\n } else {\n $product->attachItem($_objFile, 'images', false);\n }\n }\n }\n break;\n case 'category1':\n case 'category2':\n case 'category3':\n case 'category4':\n case 'category5':\n case 'category6':\n case 'category7':\n case 'category8':\n case 'category9':\n case 'category10':\n case 'category11':\n case 'category12':\n if ($product->parent_id == 0) {\n// $rank = !empty($data['rank']) ? $data['rank'] : 1;\n $rank = intval(str_replace('category', '', $key));\n// if (!empty($value)) $result = storeCategory::parseCategory($value);\n if (!empty($value)) $result = storeCategory::importCategoryString($value);\n else continue;", "// if (is_numeric($result)) {\n if ($result) {\n $createCats[] = $result;\n $createCatsRank[$result] = $rank;\n } else {\n $errorSet[$count][] = $result;\n continue 2;\n }\n }\n break;\n default:\n if (property_exists('product', $key)) {\n $product->key = $value;\n }\n }\n }", "// $checkTitle = trim($data['title']);\n// if (empty($checkTitle)) {\n// $errorSet[$count] = gt(\"No product name (title) supplied, skipping this record...\");\n// continue;\n// }\n// $product->parent_id = $data[1];\n// $product->child_rank = $data[2];\n// $product->title = stripslashes(stripslashes($data[3]));\n// $product->body = utf8_encode(stripslashes(expString::parseAndTrimImport(($data[4]), true)));\n// //$product->body = utf8_encode(stripslashes(stripslashes(($data[4]))));\n// $product->model = stripslashes(stripslashes($data[5]));\n// $product->warehouse_location = stripslashes(stripslashes($data[6]));\n// $product->sef_url = stripslashes(stripslashes($data[7]));\n////FIXME this is where canonical should be\n// $product->meta_title = stripslashes(stripslashes($data[8]));\n// $product->meta_keywords = stripslashes(stripslashes($data[9]));\n// $product->meta_description = stripslashes(stripslashes($data[10]));\n//\n// $product->tax_class_id = $data[11];\n//\n// $product->quantity = $data[12];\n//\n// $product->availability_type = $data[13];\n//\n// $product->base_price = $data[14];\n// $product->special_price = $data[15];\n// $product->use_special_price = $data[16];\n// $product->active_type = $data[17];\n// $product->product_status_id = $data[18];\n//\n// $product->surcharge = $data[31];\n// $product->feed_title = stripslashes(stripslashes($data[33]));\n// $product->feed_body = stripslashes(stripslashes($data[34]));\n// if (!empty($data[35])) $product->weight = $data[35];\n// if (!empty($data[36])) $product->height = $data[36];\n// if (!empty($data[37])) $product->width = $data[37];\n// if (!empty($data[38])) $product->length = $data[38];\n// if (!empty($data[39])) $product->companies_id = $data[39];\n// if (!empty($data[40])) {\n// // import image from url\n// $_destFile = basename($data[40]); // get filename from end of url\n// $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// if (file_exists($_destFullPath)) {\n// $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// }\n//\n// expCore::saveData($data[40], $_destFullPath); // download the image\n//\n// if (file_exists($_destFullPath)) {\n// $__oldumask = umask(0);\n// chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n// umask($__oldumask);\n//\n// // Create a new expFile Object\n// $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n// $_objFile = new expFile ($_fileParams);\n// $_objFile->save();\n// // attach/replace product main image with new expFile object\n// $product->attachItem($_objFile, 'mainimage');\n// }\n// }\n// for ($i=41; $i<=44; $i++) {\n// if (!empty($data[$i])) {\n// // import image from url\n// $_destFile = basename($data[$i]); // get filename from end of url\n// $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// if (file_exists($_destFullPath)) {\n// $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// }\n//\n// expCore::saveData($data[$i], $_destFullPath); // download the image\n//\n// if (file_exists($_destFullPath)) {\n// $__oldumask = umask(0);\n// chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n// umask($__oldumask);\n//\n// // Create a new expFile Object\n// $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n// $_objFile = new expFile ($_fileParams);\n// $_objFile->save();\n// // attach product additional images with new expFile object\n// $product->attachItem($_objFile, 'images', false);\n// }\n// }\n// }\n//\n// if (empty($product->id)) $product->minimum_order_quantity = 1;\n//\n// if ($product->parent_id == 0) {\n// $createCats = array();\n// $createCatsRank = array();\n// for ($x = 19; $x <= 30; $x++) {\n// if (!empty($data[$x])) $result = storeCategory::parseCategory($data[$x]);\n// else continue;\n//\n// if (is_numeric($result)) {\n// $createCats[] = $result;\n// $createCatsRank[$result] = $data[32];\n// } else {\n// $errorSet[$count][] = $result;\n// continue 2;\n// }\n// }\n// }", " //NOTE: we manipulate existing user input fields to store them properly?\n //eDebug($createCats,true);\n if (!empty($product->user_input_fields) && is_array($product->user_input_fields))\n $product->user_input_fields = serialize($product->user_input_fields);\n //eDebug($product->user_input_fields);", " if (!empty($product->user_input_fields) && !is_array($product->user_input_fields))\n $product->user_input_fields = str_replace(\"'\", \"\\'\", $product->user_input_fields);", " //eDebug($product->user_input_fields,true);\n $product->save(true);\n //eDebug($product->body);", " //sort order and categories\n if ($product->parent_id == 0) {\n $product->saveCategories($createCats, $createCatsRank);\n //eDebug($createCatsRank);\n }\n echo \"Successfully imported/updated row \" . $count . \", product: \" . $product->title . \"<br/>\";\n //eDebug($product);", " }", " if (count($errorSet)) {\n echo \"<br/><hr><br/><div style='color:red'><strong>\".gt('The following records were NOT imported').\":</strong><br/>\";\n foreach ($errorSet as $rownum => $err) {\n echo \"Row: \" . $rownum;\n if (is_array($err)) {\n foreach ($err as $e) {\n echo \" -- \" . $e . \"<br/>\";\n }\n } else echo \" -- \" . $err . \"<br/>\";\n }\n echo \"</div>\";\n }", " fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);", " // update search index\n $this->addContentToSearch();\n }", "}", "?>" ]
[ 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356
Determine whether the {function_name} code is vulnerable or not.
[ "<?php", "##################################################\n#\n# Copyright (c) 2004-2016 OIC Group, Inc.\n#\n# This file is part of Exponent\n#\n# Exponent is free software; you can redistribute\n# it and/or modify it under the terms of the GNU\n# General Public License as published by the Free\n# Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# GPL: http://www.gnu.org/licenses/gpl.txt\n#\n##################################################", "/**\n * @subpackage Controllers\n * @package Modules\n */\n/** @define \"BASE\" \"../../../..\" */", "class storeController extends expController {\n public $basemodel_name = 'product';", "", " public $useractions = array(\n 'showall' => 'Products - All Products and Categories',\n 'showallFeaturedProducts' => 'Products - Only Featured',\n 'showallCategoryFeaturedProducts' => 'Products - Featured Products under current category',\n 'showallManufacturers' => 'Products - By Manufacturer',\n 'showTopLevel' => 'Product Categories Menu - Show Top Level',\n 'showFullTree' => 'Product Categories Menu - Show Full Tree', //FIXME image variant needs a separate method\n 'showallSubcategories' => 'Product Categories Menu - Subcategories of current category',\n// 'upcomingEvents' => 'Event Registration - Upcoming Events',\n// 'eventsCalendar' => 'Event Registration - Calendar View',\n 'ecomSearch' => 'Product Search - Autocomplete',\n 'searchByModel' => 'Product Search - By Model',\n 'quicklinks' => 'Links - User Links',\n 'showGiftCards' => 'Gift Cards UI',\n );", " protected $manage_permissions = array(\n 'batch_process' => 'Batch capture order transactions',\n 'cleanNonUnicodeProducts' => 'Clean all non-unicode charset products',\n 'copyProduct' => \"Copy Product\",\n// 'delete_children' => \"Delete Children\",\n 'reimport' => 'ReImport Products',\n 'findDupes' => 'Fix Duplicate SEF Names',\n// 'manage_sales_reps' => 'Manage Sales Reps',\n// 'import_external_addresses' => 'Import addresses from other sources',\n 'showallImpropercategorized' => 'View products in top level categories that should not be',\n 'showallUncategorized' => 'View all uncategorized products',\n 'nonUnicodeProducts' => 'View all non-unicode charset products',\n 'process_orders' => 'Batch capture order transactions',\n 'processModelAliases' => 'Process uploaded model aliases',\n 'saveModelAliases' => 'Save uploaded model aliases',\n// 'deleteProcessedModelAliases' => 'Delete processed uploaded model aliases',\n// 'delete_model_alias' => 'Process model aliases',\n// 'update_model_alias' => 'Save model aliases',\n// 'edit_model_alias' => 'Delete model aliases',\n// 'import' => 'Import Products',\n// 'importProduct' => 'Import Products',\n// 'export' => 'Export Products',\n 'uploadModelAliases' => 'Upload model aliases',\n );", " // hide the configs we don't need\n public $remove_configs = array(\n 'aggregation',\n 'categories',\n// 'comments',\n 'ealerts',\n 'facebook',\n 'files',\n 'rss',\n 'tags',\n 'twitter',\n ); // all options: ('aggregation','categories','comments','ealerts','facebook','files','module_title','pagination','rss','tags','twitter',)", "", "\n static function displayname() {\n return gt(\"e-Commerce Store Front\");\n }", " static function description() {\n return gt(\"Displays the products and categories in your store\");\n }", " static function author() {\n return \"OIC Group, Inc\";\n }", " static function isSearchable() {\n return true;\n }", " public function searchName() {\n return gt('e-Commerce Item');\n }", " static function canImportData() {\n return true;\n }", " static function canExportData() {\n return true;\n }", " function __construct($src = null, $params = array()) {\n global $db, $router, $section, $user;\n// parent::__construct($src = null, $params);\n if (empty($params)) {\n $params = $router->params;\n }\n parent::__construct($src, $params);", " // we're setting the config here from the module and globally\n $this->grabConfig();", "// if (expTheme::inAction() && !empty($router->url_parts[1]) && ($router->url_parts[0] == \"store\" && $router->url_parts[1] == \"showall\")) {\n if (!empty($params['action']) && ($params['controller'] == \"store\" && $params['action'] == \"showall\") ) {\n// if (isset($router->url_parts[array_search('title', $router->url_parts) + 1]) && is_string($router->url_parts[array_search('title', $router->url_parts) + 1])) {\n if (isset($params['title']) && is_string($params['title'])) {\n// $default_id = $db->selectValue('storeCategories', 'id', \"sef_url='\" . $router->url_parts[array_search('title', $router->url_parts) + 1] . \"'\");\n// $active = $db->selectValue('storeCategories', 'is_active', \"sef_url='\" . $router->url_parts[array_search('title', $router->url_parts) + 1] . \"'\");\n $default_id = $db->selectValue('storeCategories', 'id', \"sef_url='\" . $params['title'] . \"'\");\n $active = $db->selectValue('storeCategories', 'is_active', \"sef_url='\" . $params['title'] . \"'\");\n if (empty($active) && !$user->isAdmin()) {\n redirect_to(array(\"section\" => SITE_DEFAULT_SECTION)); // selected category is NOT active\n }\n } elseif (isset($this->config['category'])) { // the module category to display\n $default_id = $this->config['category'];\n } else {\n $default_id = 0;\n }\n// } elseif (expTheme::inAction() && !empty($router->url_parts[1]) && ($router->url_parts[0] == \"store\" && ($router->url_parts[1] == \"show\" || $router->url_parts[1] == \"showByTitle\"))) {\n } elseif (!empty($params['action']) && ($params['controller'] == \"store\" && ($params['action'] == \"show\" || $params['action'] == \"showByTitle\" || $params['action'] == \"categoryBreadcrumb\"))) {\n// if (isset($router->url_parts[array_search('id', $router->url_parts) + 1]) && ($router->url_parts[array_search('id', $router->url_parts) + 1] != 0)) {\n if (!empty($params['id'])) {\n// $default_id = $db->selectValue('product_storeCategories', 'storecategories_id', \"product_id='\" . $router->url_parts[array_search('id', $router->url_parts) + 1] . \"'\");\n $default_id = $db->selectValue('product_storeCategories', 'storecategories_id', \"product_id='\" . $params['id'] . \"'\");\n } elseif (!empty($params['title'])) {\n// $prod_id = $db->selectValue('product', 'id', \"sef_url='\" . $router->url_parts[array_search('title', $router->url_parts) + 1] . \"'\");\n $prod_id = $db->selectValue('product', 'id', \"sef_url='\" . $params['title'] . \"'\");\n $default_id = $db->selectValue('product_storeCategories', 'storecategories_id', \"product_id='\" . $prod_id . \"'\");\n }\n } elseif (isset($this->config['show_first_category']) || (!expTheme::inAction() && $section == SITE_DEFAULT_SECTION)) {\n if (!empty($this->config['show_first_category'])) {\n $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');\n } else {\n $default_id = null;\n// flash('error','store-show first category empty, but default seciton');\n }\n } elseif (!isset($this->config['show_first_category']) && !expTheme::inAction()) {\n $default_id = null;\n// flash('error','store-don\\'t show first category empty');\n } else {\n $default_id = null;\n }\n// if (empty($default_id)) $default_id = 0;\n if (!is_null($default_id)) expSession::set('catid', $default_id);", " // figure out if we need to show all categories and products or default to showing the first category.\n // elseif (!empty($this->config['category'])) {\n // $default_id = $this->config['category'];\n // } elseif (ecomconfig::getConfig('show_first_category')) {\n // $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');\n // } else {\n // $default_id = 0;\n // }", " $this->parent = expSession::get('catid');\n $this->category = new storeCategory($this->parent);\n if ($this->parent) { // we're setting the config here for the category\n $this->grabConfig($this->category);\n }\n }", " function showall() {\n global $db, $user, $router;", " expHistory::set('viewable', $this->params);", " if (empty($this->category->is_events)) {\n $count_sql_start = 'SELECT COUNT(DISTINCT p.id) as c FROM ' . $db->prefix . 'product p ';", " $sql_start = 'SELECT DISTINCT p.*, IF(base_price > special_price AND use_special_price=1,special_price, base_price) as price FROM ' . $db->prefix . 'product p ';\n $sql = 'JOIN ' . $db->prefix . 'product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'WHERE ';\n if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n $sql .= 'sc.storecategories_id IN (';\n $sql .= 'SELECT id FROM ' . $db->prefix . 'storeCategories WHERE rgt BETWEEN ' . $this->category->lft . ' AND ' . $this->category->rgt . ')';", " $count_sql = $count_sql_start . $sql;\n $sql = $sql_start . $sql;", "// $order = 'title'; // $order = 'sc.rank'; //$this->config['orderby'];\n// $dir = 'ASC'; //$this->config['orderby_dir'];\n $order = !empty($this->params['order']) ? $this->params['order'] : $this->config['orderby'];\n $dir = !empty($this->params['dir']) ? $this->params['dir'] : $this->config['orderby_dir'];\n if (empty($order)) $order = 'title';\n if (empty($dir)) $dir = 'ASC';\n } else { // this is an event category\n $sql_start = 'SELECT DISTINCT p.*, er.event_starttime, er.signup_cutoff FROM ' . $db->prefix . 'product p ';\n $count_sql_start = 'SELECT COUNT(DISTINCT p.id) as c, er.event_starttime, er.signup_cutoff FROM ' . $db->prefix . 'product p ';\n $sql = 'JOIN ' . $db->prefix . 'product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'JOIN ' . $db->prefix . 'eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE sc.storecategories_id IN (';\n $sql .= 'SELECT id FROM ' . $db->prefix . 'storeCategories WHERE rgt BETWEEN ' . $this->category->lft . ' AND ' . $this->category->rgt . ')';\n if ($this->category->hide_closed_events) {\n $sql .= ' AND er.signup_cutoff > ' . time();\n }", " $count_sql = $count_sql_start . $sql;\n $sql = $sql_start . $sql;", " $order = !empty($this->params['order']) ? $this->params['order'] : 'event_starttime';\n $dir = !empty($this->params['dir']) ? $this->params['dir'] : 'ASC';\n }", " if (empty($router->params['title'])) // we need to pass on the category for proper paging\n $router->params['title'] = $this->category->sef_url;\n $limit = !empty($this->config['limit']) ? $this->config['limit'] : (!empty($this->config['pagination_default']) ? $this->config['pagination_default'] : 10);\n if ($this->category->find('count') > 0) { // there are categories\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'count_sql' => $count_sql,\n 'limit' => $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'price'\n ),\n ));\n } else { // there are no categories\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => 'SELECT * FROM ' . $db->prefix . 'product WHERE 1',\n 'limit' => $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'price'\n ),\n ));\n }", " $ancestors = $this->category->pathToNode();\n $categories = ($this->parent == 0) ? $this->category->getTopLevel(null, false, true) : $this->category->getChildren(null, false, true);", " $rerankSQL = \"SELECT DISTINCT p.* FROM \" . $db->prefix . \"product p JOIN \" . $db->prefix . \"product_storeCategories sc ON p.id = sc.product_id WHERE sc.storecategories_id=\" . $this->category->id . \" ORDER BY rank ASC\";\n //eDebug($router);\n $defaultSort = $router->current_url;", " assign_to_template(array(\n 'page' => $page,\n 'defaultSort' => $defaultSort,\n 'ancestors' => $ancestors,\n 'categories' => $categories,\n 'current_category' => $this->category,\n 'rerankSQL' => $rerankSQL\n ));\n $this->categoryBreadcrumb();\n }", " function grabConfig($category = null) {", " // grab the configs for the passed category\n if (is_object($category)) {\n $catConfig = new expConfig(expCore::makeLocation(\"storeCategory\",\"@store-\" . $category->id,\"\"));\n } elseif (empty($this->config)) { // config not set yet\n $global_config = new expConfig(expCore::makeLocation(\"ecomconfig\",\"@globalstoresettings\",\"\"));\n $this->config = $global_config->config;\n return;\n }", " // grab the store general settings\n $config = new expConfig(expCore::makeLocation(\"ecomconfig\",\"@globalstoresettings\",\"\"));", " // $this->config currently holds the module settings - merge together with any cat config settings having priority\n $this->config = empty($catConfig->config) || @$catConfig->config['use_global'] == 1 ? @array_merge($config->config, $this->config) : @array_merge($config->config, $this->config, $catConfig->config);", " //This is needed since in the first installation of ecom the value for this will be empty and we are doing % operation for this value\n //So we need to ensure if the value is = 0, we make it the default\n if (empty($this->config['images_per_row'])) {\n $this->config['images_per_row'] = 3;\n }\n }", " /**\n * @deprecated 2.0.0 moved to eventregistration\n */\n function upcomingEvents() {\n $this->params['controller'] = 'eventregistration';\n redirect_to($this->params);", " //fixme old code\n $sql = 'SELECT DISTINCT p.*, er.event_starttime, er.signup_cutoff FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql .= 'JOIN ' . DB_TABLE_PREFIX . '_eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE 1 AND er.signup_cutoff > ' . time();", " $limit = empty($this->config['event_limit']) ? 10 : $this->config['event_limit'];\n $order = 'eventdate';\n $dir = 'ASC';", " $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));", " assign_to_template(array(\n 'page' => $page\n ));\n }", " /**\n * @deprecated 2.0.0 moved to eventregistration\n */\n function eventsCalendar() {\n $this->params['controller'] = 'eventregistration';\n redirect_to($this->params);", " //fixme old code\n global $db, $user;", " expHistory::set('viewable', $this->params);", " $time = isset($this->params['time']) ? $this->params['time'] : time();\n assign_to_template(array(\n 'time' => $time\n ));", "// $monthly = array();\n// $counts = array();", " $info = getdate($time);\n $nowinfo = getdate(time());\n if ($info['mon'] != $nowinfo['mon']) $nowinfo['mday'] = -10;\n // Grab non-day numbers only (before end of month)\n// $week = 0;\n $currentweek = -1;", " $timefirst = mktime(0, 0, 0, $info['mon'], 1, $info['year']);\n $week = intval(date('W', $timefirst));\n if ($week >= 52 && $info['mon'] == 1) $week = 1;\n $infofirst = getdate($timefirst);", "// if ($infofirst['wday'] == 0) {\n// $monthly[$week] = array(); // initialize for non days\n// $counts[$week] = array();\n// }\n// for ($i = 1 - $infofirst['wday']; $i < 1; $i++) {\n// $monthly[$week][$i] = array();\n// $counts[$week][$i] = -1;\n// }\n// $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n $monthly[$week] = array(); // initialize for non days\n $counts[$week] = array();\n if (($infofirst['wday'] == 0) && (DISPLAY_START_OF_WEEK == 1)) {\n for ($i = -6; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday'] + 7; // day number in grid. if 7+, switch weeks\n } else {\n for ($i = 1 - $infofirst['wday']; $i < (1 - DISPLAY_START_OF_WEEK); $i++) {\n $monthly[$week][$i] = array();\n $counts[$week][$i] = -1;\n }\n $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks\n }\n // Grab day counts\n $endofmonth = date('t', $time);", " for ($i = 1; $i <= $endofmonth; $i++) {\n $start = mktime(0, 0, 0, $info['mon'], $i, $info['year']);\n if ($i == $nowinfo['mday']) $currentweek = $week;", "// $dates = $db->selectObjects(\"eventregistration\", \"`eventdate` = $start\");\n// $dates = $db->selectObjects(\"eventregistration\", \"(eventdate >= \" . expDateTime::startOfDayTimestamp($start) . \" AND eventdate <= \" . expDateTime::endOfDayTimestamp($start) . \")\");\n $er = new eventregistration();\n// $dates = $er->find('all', \"(eventdate >= \" . expDateTime::startOfDayTimestamp($start) . \" AND eventdate <= \" . expDateTime::endOfDayTimestamp($start) . \")\");", " if ($user->isAdmin()) {\n $events = $er->find('all', 'product_type=\"eventregistration\"', \"title ASC\");\n } else {\n $events = $er->find('all', 'product_type=\"eventregistration\" && active_type=0', \"title ASC\");\n }\n $dates = array();", " foreach ($events as $event) {\n // $this->signup_cutoff > time()\n if ($event->eventdate >= expDateTime::startOfDayTimestamp($start) && $event->eventdate <= expDateTime::endOfDayTimestamp($start)) {\n $dates[] = $event;\n }\n // eDebug($event->signup_cutoff, true);\n }", " $monthly[$week][$i] = $this->getEventsForDates($dates);\n $counts[$week][$i] = count($monthly[$week][$i]);\n if ($weekday >= (6 + DISPLAY_START_OF_WEEK)) {\n $week++;\n $monthly[$week] = array(); // allocate an array for the next week\n $counts[$week] = array();\n $weekday = DISPLAY_START_OF_WEEK;\n } else $weekday++;\n }\n // Grab non-day numbers only (after end of month)\n for ($i = 1; $weekday && $i < (8 + DISPLAY_START_OF_WEEK - $weekday); $i++) {\n $monthly[$week][$i + $endofmonth] = array();\n $counts[$week][$i + $endofmonth] = -1;\n }", " $this->params['time'] = $time;\n assign_to_template(array(\n 'currentweek' => $currentweek,\n 'monthly' => $monthly,\n 'counts' => $counts,\n \"prevmonth3\" => strtotime('-3 months', $timefirst),\n \"prevmonth2\" => strtotime('-2 months', $timefirst),\n \"prevmonth\" => strtotime('-1 months', $timefirst),\n \"nextmonth\" => strtotime('+1 months', $timefirst),\n \"nextmonth2\" => strtotime('+2 months', $timefirst),\n \"nextmonth3\" => strtotime('+3 months', $timefirst),\n 'now' => $timefirst,\n \"today\" => expDateTime::startOfDayTimestamp(time()),\n 'params' => $this->params,\n 'daynames' => event::dayNames(),\n ));\n }", " /*\n * Helper function for the Calendar view\n * @deprecated 2.0.0 moved to eventregistration\n */\n function getEventsForDates($edates, $sort_asc = true) {\n global $db;\n $events = array();\n foreach ($edates as $edate) {\n// if (!isset($this->params['cat'])) {\n// if (isset($this->params['title']) && is_string($this->params['title'])) {\n// $default_id = $db->selectValue('storeCategories', 'id', \"sef_url='\" . $this->params['title'] . \"'\");\n// } elseif (!empty($this->config['category'])) {\n// $default_id = $this->config['category'];\n// } elseif (ecomconfig::getConfig('show_first_category')) {\n// $default_id = $db->selectValue('storeCategories', 'id', 'lft=1');\n// } else {\n// $default_id = 0;\n// }\n// }\n//\n// $parent = isset($this->params['cat']) ? intval($this->params['cat']) : $default_id;\n//\n// $category = new storeCategory($parent);", " $sql = 'SELECT DISTINCT p.*, er.event_starttime, er.signup_cutoff FROM ' . $db->prefix . 'product p ';\n// $sql .= 'JOIN ' . $db->prefix . 'product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'JOIN ' . $db->prefix . 'eventregistration er ON p.product_type_id = er.id ';\n $sql .= 'WHERE 1 ';\n// $sql .= ' AND sc.storecategories_id IN (SELECT id FROM exponent_storeCategories WHERE rgt BETWEEN ' . $category->lft . ' AND ' . $category->rgt . ')';\n// if ($category->hide_closed_events) {\n// $sql .= ' AND er.signup_cutoff > ' . time();\n// }\n// $sql .= ' AND er.id = ' . $edate->id;\n $sql .= ' AND er.id = ' . $edate->product_type_id;", " $order = 'event_starttime';\n $dir = 'ASC';", " $o = $db->selectObjectBySql($sql);\n $o->eventdate = $edate->eventdate;\n $o->eventstart = $edate->event_starttime + $edate->eventdate;\n $o->eventend = $edate->event_endtime + $edate->eventdate;\n $o->expFile = $edate->expFile;\n $events[] = $o;\n }\n $events = expSorter::sort(array('array' => $events, 'sortby' => 'eventstart', 'order' => $sort_asc ? 'ASC' : 'DESC'));\n return $events;\n }", " function categoryBreadcrumb() {\n// global $db, $router;", " //eDebug($this->category);", " /*if(isset($router->params['action']))\n {", " $ancestors = $this->category->pathToNode();", " }else if(isset($router->params['section']))\n {\n $current = $db->selectObject('section',' id= '.$router->params['section']);\n $ancestors[] = $current;\n if( $current->parent != -1 || $current->parent != 0 )", " {", " while ($db->selectObject('section',' id= '.$router->params['section']);)\n if ($section->id == $id) {\n $current = $section;\n break;\n }\n }\n }\n eDebug($sections);", " $ancestors = $this->category->pathToNode();", " }*/", " $ancestors = $this->category->pathToNode();\n // eDebug($ancestors);\n assign_to_template(array(\n 'ancestors' => $ancestors\n ));\n }", " function showallUncategorized() {\n expHistory::set('viewable', $this->params);", "// $sql = 'SELECT p.* FROM ' . DB_TABLE_PREFIX . '_product p JOIN ' . DB_TABLE_PREFIX . '_product_storeCategories ';\n// $sql .= 'sc ON p.id = sc.product_id WHERE sc.storecategories_id = 0 AND parent_id=0';\n $sql = 'SELECT p.* FROM ' . DB_TABLE_PREFIX . '_product p LEFT OUTER JOIN ' . DB_TABLE_PREFIX . '_product_storeCategories ';\n $sql .= 'sc ON p.id = sc.product_id WHERE sc.product_id is null AND p.parent_id=0';", " expSession::set('product_export_query', $sql);", " $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));", " assign_to_template(array(\n 'page' => $page,\n 'moduletitle' => 'Uncategorized Products'\n ));\n }", " function manage() {\n expHistory::set('manageable', $this->params);", " if (ECOM_LARGE_DB) {\n $limit = !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : 10;\n } else {\n $limit = 0; // we'll paginate on the page\n }\n $page = new expPaginator(array(\n 'model' => 'product',\n 'where' => 'parent_id=0',\n 'limit' => $limit,\n 'order' => (isset($this->params['order']) ? $this->params['order'] : 'title'),\n 'dir' => (isset($this->params['dir']) ? $this->params['dir'] : 'ASC'),\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Type') => 'product_type',\n gt('Product Name') => 'title',\n gt('Model #') => 'model',\n gt('Price') => 'base_price'\n )\n ));\n assign_to_template(array(\n 'page' => $page\n ));\n }", " function showallImpropercategorized() {\n expHistory::set('viewable', $this->params);", " //FIXME not sure this is the correct sql, not sure what we are trying to pull out\n $sql = 'SELECT DISTINCT(p.id),p.product_type FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql .= 'JOIN ' . DB_TABLE_PREFIX . '_product_storeCategories psc ON p.id = psc.product_id ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_storeCategories sc ON psc.storecategories_id = sc.parent_id ';\n $sql .= 'WHERE p.parent_id=0 AND sc.parent_id != 0';", " expSession::set('product_export_query', $sql);", " $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));", " assign_to_template(array(\n 'page' => $page,\n 'moduletitle' => 'Improperly Categorized Products'\n ));\n }", " function exportMe() {\n redirect_to(array('controller' => 'report', 'action' => 'batch_export', 'applytoall' => true));\n }", " function export() {\n global $db;", " $this->params['applytoall'] = 1; //FIXME we simply do all now", " //eDebug($this->params);\n //$sql = \"SELECT * INTO OUTFILE '\" . BASE . \"tmp/export.csv' FIELDS TERMINATED BY ',' FROM exponent_product WHERE 1 LIMIT 10\";\n// $out = '\"id\",\"parent_id\",\"child_rank\",\"title\",\"body\",\"model\",\"warehouse_location\",\"sef_url\",\"canonical\",\"meta_title\",\"meta_keywords\",\"meta_description\",\"tax_class_id\",\"quantity\",\"availability_type\",\"base_price\",\"special_price\",\"use_special_price\",\"active_type\",\"product_status_id\",\"category1\",\"category2\",\"category3\",\"category4\",\"category5\",\"category6\",\"category7\",\"category8\",\"category9\",\"category10\",\"category11\",\"category12\",\"surcharge\",\"category_rank\",\"feed_title\",\"feed_body\"' . chr(13) . chr(10);\n $out = '\"id\",\"parent_id\",\"child_rank\",\"title\",\"body\",\"model\",\"warehouse_location\",\"sef_url\",\"meta_title\",\"meta_keywords\",\"meta_description\",\"tax_class_id\",\"quantity\",\"availability_type\",\"base_price\",\"special_price\",\"use_special_price\",\"active_type\",\"product_status_id\",\"category1\",\"category2\",\"category3\",\"category4\",\"category5\",\"category6\",\"category7\",\"category8\",\"category9\",\"category10\",\"category11\",\"category12\",\"surcharge\",\"category_rank\",\"feed_title\",\"feed_body\",\"weight\",\"width\",\"height\",\"length\",\"image1\",\"image2\",\"image3\",\"image4\",\"image5\",\"companies_id\"' . chr(13) . chr(10);\n if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {\n $sql = expSession::get('product_export_query');\n if (empty($sql)) $sql = 'SELECT DISTINCT(p.id) from ' . $db->prefix . 'product as p WHERE (product_type=\"product\")';\n //eDebug($sql);\n //expSession::set('product_export_query','');\n $prods = $db->selectArraysBySql($sql);\n //eDebug($prods);\n } else {\n foreach ($this->params['act-upon'] as $prod) {\n $prods[] = array('id' => $prod);\n }\n }\n set_time_limit(0);\n $baseProd = new product();", " //$p = new product($pid['id'], false, false);\n foreach ($prods as $pid) {\n $except = array('company', 'crosssellItem', 'optiongroup');\n $p = $baseProd->find('first', 'id=' . $pid['id'], null, null, 0, true, true, $except, true);", " //eDebug($p,true);\n $out .= expString::outputField($p->id);\n $out .= expString::outputField($p->parent_id);\n $out .= expString::outputField($p->child_rank);\n $out .= expString::outputField($p->title);\n $out .= expString::outputField(expString::stripLineEndings($p->body), \",\", true);\n $out .= expString::outputField($p->model);\n $out .= expString::outputField($p->warehouse_location);\n $out .= expString::outputField($p->sef_url);\n// $out .= expString::outputField($p->canonical); FIXME this is NOT in the import sequence\n $out .= expString::outputField($p->meta_title);\n $out .= expString::outputField($p->meta_keywords);\n $out .= expString::outputField($p->meta_description);\n $out .= expString::outputField($p->tax_class_id);\n $out .= expString::outputField($p->quantity);\n $out .= expString::outputField($p->availability_type);\n $out .= expString::outputField($p->base_price);\n $out .= expString::outputField($p->special_price);\n $out .= expString::outputField($p->use_special_price);\n $out .= expString::outputField($p->active_type);\n $out .= expString::outputField($p->product_status_id);", " $rank = 0;\n //eDebug($p);\n for ($x = 0; $x < 12; $x++) {\n $this->catstring = '';\n if (isset($p->storeCategory[$x])) {\n $out .= expString::outputField(storeCategory::buildCategoryString($p->storeCategory[$x]->id, true));\n $rank = $db->selectValue('product_storeCategories', 'rank', 'product_id=' . $p->id . ' AND storecategories_id=' . $p->storeCategory[$x]->id);\n } else $out .= ',';\n }\n $out .= expString::outputField($p->surcharge);\n $out .= expString::outputField($rank); // no longer used\n $out .= expString::outputField($p->feed_title);\n $out .= expString::outputField($p->feed_body);\n $out .= expString::outputField($p->weight);\n $out .= expString::outputField($p->height);\n $out .= expString::outputField($p->width);\n $out .= expString::outputField($p->length);\n //output images\n if (isset($p->expFile['mainimage'][0])) {\n $out .= expString::outputField($p->expFile['mainimage'][0]->id);\n } else $out .= ',';\n for ($x = 0; $x < 3; $x++) {\n if (isset($p->expFile['images'][$x])) {\n $out .= expString::outputField($p->expFile['images'][$x]->id);\n } else $out .= ',';\n }\n $out .= expString::outputField($p->companies_id, chr(13) . chr(10)); //Removed the extra \",\" in the last element", " foreach ($p->childProduct as $cp) {\n //$p = new product($pid['id'], true, false);\n //eDebug($p,true);\n $out .= expString::outputField($cp->id);\n $out .= expString::outputField($cp->parent_id);\n $out .= expString::outputField($cp->child_rank);\n $out .= expString::outputField($cp->title);\n $out .= expString::outputField(expString::stripLineEndings($cp->body));\n $out .= expString::outputField($cp->model);\n $out .= expString::outputField($cp->warehouse_location);\n $out .= expString::outputField($cp->sef_url);\n// $out .= expString::outputField($cp->canonical); FIXME this is NOT in the import sequence\n $out .= expString::outputField($cp->meta_title);\n $out .= expString::outputField($cp->meta_keywords);\n $out .= expString::outputField($cp->meta_description);\n $out .= expString::outputField($cp->tax_class_id);\n $out .= expString::outputField($cp->quantity);\n $out .= expString::outputField($cp->availability_type);\n $out .= expString::outputField($cp->base_price);\n $out .= expString::outputField($cp->special_price);\n $out .= expString::outputField($cp->use_special_price);\n $out .= expString::outputField($cp->active_type);\n $out .= expString::outputField($cp->product_status_id);\n $out .= ',,,,,,,,,,,,'; // for categories\n $out .= expString::outputField($cp->surcharge);\n $out .= ',,,'; //for rank, feed title, feed body\n $out .= expString::outputField($cp->weight);\n $out .= expString::outputField($cp->height);\n $out .= expString::outputField($cp->width);\n $out .= expString::outputField($cp->length);\n $out .= ',,,,,'; // for images\n $out .= expString::outputField($cp->companies_id, chr(13) . chr(10));", " //echo($out);\n }", " }", "// $outFile = 'tmp/product_export_' . time() . '.csv';\n// $outHandle = fopen(BASE . $outFile, 'w');\n// fwrite($outHandle, $out);\n// fclose($outHandle);\n//\n// echo \"<br/><br/>Download the file here: <a href='\" . PATH_RELATIVE . $outFile . \"'>Product Export</a>\";", " $filename = 'product_export_' . time() . '.csv';", " ob_end_clean();\n ob_start(\"ob_gzhandler\");", " // 'application/octet-stream' is the registered IANA type but\n // MSIE and Opera seems to prefer 'application/octetstream'\n $mime_type = (EXPONENT_USER_BROWSER == 'IE' || EXPONENT_USER_BROWSER == 'OPERA') ? 'application/octetstream' : 'application/octet-stream';", " header('Content-Type: ' . $mime_type);\n header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n // IE need specific headers\n if (EXPONENT_USER_BROWSER == 'IE') {\n header('Content-Disposition: inline; filename=\"' . $filename . '\"');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n header('Pragma: public');\n } else {\n header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n header('Pragma: no-cache');\n }\n echo $out;\n exit; // Exit, since we are exporting", " /*eDebug(BASE . \"tmp/export.csv\");\n $db->sql($sql);\n eDebug($db->error());*/\n /*OPTIONALLY ENCLOSED BY '\" . '\"' .\n \"' ESCAPED BY '\\\\'\n LINES TERMINATED BY '\" . '\\\\n' .\n \"' */\n }", " /**\n * @deprecated 2.3.3 moved to company\n */\n function showallByManufacturer() {\n expHistory::set('viewable', $this->params);", " $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model' => 'product',\n 'where' => 'companies_id=' . $this->params['id'] . ' AND parent_id=0',\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'default' => 'Product Name',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n )\n ));", " $company = new company($this->params['id']);", " assign_to_template(array(\n 'page' => $page,\n 'company' => $company\n ));\n }", " /**\n * @deprecated 2.3.3 moved to company\n */\n function showallManufacturers() {\n global $db;\n expHistory::set('viewable', $this->params);\n $sql = 'SELECT comp.* FROM ' . $db->prefix . 'companies as comp JOIN ' . $db->prefix . 'product AS prod ON prod.companies_id = comp.id WHERE parent_id=0 GROUP BY comp.title ORDER BY comp.title;';\n $manufacturers = $db->selectObjectsBySql($sql);\n assign_to_template(array(\n 'manufacturers' => $manufacturers\n ));\n }", " function showGiftCards() {\n expHistory::set('viewable', $this->params);\n //Get all giftcards\n $product_type = 'giftcard';\n $giftcard = new $product_type();\n $giftcards = $giftcard->find(\"all\", \"product_type = 'giftcard'\");", " //Grab the global config\n $this->grabConfig();", " //Set the needed config for the view\n $config['custom_message_product'] = $this->config['custom_message_product'];\n $config['minimum_gift_card_purchase'] = $this->config['minimum_gift_card_purchase'];\n $records = expSession::get('params');\n expSession::un_set('params');\n assign_to_template(array(\n 'giftcards' => $giftcards,\n 'config' => $config,\n 'records' => $records\n ));\n }", " function show() {\n global $db, $order, $template, $user;", " expHistory::set('viewable', $this->params);\n// $classname = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n// $product = new $classname($this->params['id'], true, true);", " $id = isset($this->params['title']) ? $this->params['title'] : $this->params['id'];\n $product = new product($id);\n $product_type = new $product->product_type($product->id);\n $product_type->title = expString::parseAndTrim($product_type->title, true);\n $product_type->image_alt_tag = expString::parseAndTrim($product_type->image_alt_tag, true);", " //if we're trying to view a child product directly, then we redirect to it's parent show view\n //bunk URL, no product found\n if (empty($product->id)) {\n redirect_to(array('controller' => 'notfound', 'action' => 'page_not_found', 'title' => $this->params['title']));\n }\n // we do not display child products by themselves\n if (!empty($product->parent_id)) {\n $product = new product($product->parent_id);\n redirect_to(array('controller' => 'store', 'action' => 'show', 'title' => $product->sef_url));\n }\n if ($product->active_type == 1) {\n $product_type->user_message = \"This product is temporarily unavailable for purchase.\";\n } elseif ($product->active_type == 2 && !$user->isAdmin()) {\n flash(\"error\", $product->title . \" \" . gt(\"is currently unavailable.\"));\n expHistory::back();\n } elseif ($product->active_type == 2 && $user->isAdmin()) {\n $product_type->user_message = $product->title . \" is currently marked as unavailable for purchase or display. Normal users will not see this product.\";\n }", " // pull in company attachable files\n if (!empty($product_type->companies_id)) {\n $product_type->company = new company($product_type->companies_id);\n }", " if (!empty($product_type->crosssellItem)) foreach ($product_type->crosssellItem as &$csi) {\n $csi->getAttachableItems();\n }", " $tpl = $product_type->getForm('show');", " if (!empty($tpl)) $template = new controllertemplate($this, $tpl);\n $this->grabConfig(); // grab the global config", " assign_to_template(array(\n 'config' => $this->config,\n 'asset_path' => $this->asset_path,\n// 'product' => $product,\n 'product' => $product_type,\n 'last_category' => !empty($order->lastcat) ? $order->lastcat : null,\n ));\n $this->categoryBreadcrumb();\n }", " function showByTitle() {\n global $order, $template, $user;\n //need to add a check here for child product and redirect to parent if hit directly by ID\n expHistory::set('viewable', $this->params);", " $product = new product(addslashes($this->params['title']));\n $product_type = new $product->product_type($product->id);\n $product_type->title = expString::parseAndTrim($product_type->title, true);\n $product_type->image_alt_tag = expString::parseAndTrim($product_type->image_alt_tag, true);", " //if we're trying to view a child product directly, then we redirect to it's parent show view\n //bunk URL, no product found\n if (empty($product->id)) {\n redirect_to(array('controller' => 'notfound', 'action' => 'page_not_found', 'title' => $this->params['title']));\n }\n if (!empty($product->parent_id)) {\n $product = new product($product->parent_id);\n redirect_to(array('controller' => 'store', 'action' => 'show', 'title' => $product->sef_url));\n }\n if ($product->active_type == 1) {\n $product_type->user_message = \"This product is temporarily unavailable for purchase.\";\n } elseif ($product->active_type == 2 && !$user->isAdmin()) {\n flash(\"error\", $product->title . \" \" . gt(\"is currently unavailable.\"));\n expHistory::back();\n } elseif ($product->active_type == 2 && $user->isAdmin()) {\n $product_type->user_message = $product->title . \" is currently marked as unavailable for purchase or display. Normal users will not see this product.\";\n }\n if (!empty($product_type->crosssellItem)) foreach ($product_type->crosssellItem as &$csi) {\n $csi->getAttachableItems();\n }\n //eDebug($product->crosssellItem);", " $tpl = $product_type->getForm('show');\n //eDebug($product);\n if (!empty($tpl)) $template = new controllertemplate($this, $tpl);\n $this->grabConfig(); // grab the global config", " assign_to_template(array(\n 'config' => $this->config,\n 'product' => $product_type,\n 'last_category' => !empty($order->lastcat) ? $order->lastcat : null,\n ));\n }", " function showByModel() {\n global $order, $template, $db;", " expHistory::set('viewable', $this->params);\n $product = new product();\n $model = $product->find(\"first\", 'model=\"' . $this->params['model'] . '\"');\n //eDebug($model);\n $product_type = new $model->product_type($model->id);\n //eDebug($product_type);\n $tpl = $product_type->getForm('show');\n if (!empty($tpl)) $template = new controllertemplate($this, $tpl);\n //eDebug($template);\n $this->grabConfig(); // grab the global config\n assign_to_template(array(\n 'config' => $this->config,\n 'product' => $product_type,\n 'last_category' => $order->lastcat\n ));\n }", " function showallSubcategories() {\n// global $db;", " expHistory::set('viewable', $this->params);\n// $parent = isset($this->params['cat']) ? $this->params['cat'] : expSession::get('catid');\n $catid = expSession::get('catid');\n $parent = !empty($catid) ? $catid : (!empty($this->params['cat']) ? $this->params['cat'] : 0);\n $category = new storeCategory($parent);\n $categories = $category->getEcomSubcategories();\n $ancestors = $category->pathToNode();\n assign_to_template(array(\n 'categories' => $categories,\n 'ancestors' => $ancestors,\n 'category' => $category\n ));\n }", " function showallFeaturedProducts() {\n expHistory::set('viewable', $this->params);\n $order = !empty($this->params['order']) ? $this->params['order'] : $this->config['orderby'];\n $dir = !empty($this->params['dir']) ? $this->params['dir'] : $this->config['orderby_dir'];\n if (empty($order)) $order = 'title';\n if (empty($dir)) $dir = 'ASC';", " $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => 'SELECT * FROM ' . DB_TABLE_PREFIX . '_product WHERE is_featured=1',\n 'limit' => ecomconfig::getConfig('pagination_default'),\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));", " assign_to_template(array(\n 'page' => $page\n ));\n }", " function showallCategoryFeaturedProducts() {\n expHistory::set('viewable', $this->params);\n $curcat = $this->category;", " $order = !empty($this->params['order']) ? $this->params['order'] : $this->config['orderby'];\n $dir = !empty($this->params['dir']) ? $this->params['dir'] : $this->config['orderby_dir'];\n if (empty($order)) $order = 'title';\n if (empty($dir)) $dir = 'ASC';\n //FIXME bad sql statement needs to be a JOIN\n $sql = 'SELECT * FROM ' . DB_TABLE_PREFIX . '_product as p,' . DB_TABLE_PREFIX . '_product_storeCategories as sc WHERE sc.product_id = p.id and p.is_featured=1 and sc.storecategories_id =' . $curcat->id;\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'limit' => ecomconfig::getConfig('pagination_default'),\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));", " assign_to_template(array(\n 'page' => $page\n ));\n }", " function showTopLevel() {\n expHistory::set('viewable', $this->params);\n $category = new storeCategory(null, false, false);\n //$categories = $category->getEcomSubcategories();\n $categories = $category->getTopLevel(null, false, true);\n $ancestors = $this->category->pathToNode();\n $curcat = $this->category;", " assign_to_template(array(\n 'categories' => $categories,\n 'curcat' => $curcat,\n 'topcat' => @$ancestors[0]\n ));\n }", " function showTopLevel_images() {\n global $user;", " expHistory::set('viewable', $this->params);\n $count_sql_start = 'SELECT COUNT(DISTINCT p.id) as c FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql_start = 'SELECT DISTINCT p.* FROM ' . DB_TABLE_PREFIX . '_product p ';\n $sql = 'JOIN ' . DB_TABLE_PREFIX . '_product_storeCategories sc ON p.id = sc.product_id ';\n $sql .= 'WHERE ';\n if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1)'; //' AND ' ;\n //$sql .= 'sc.storecategories_id IN (';\n //$sql .= 'SELECT id FROM '.DB_TABLE_PREFIX.'_storeCategories WHERE rgt BETWEEN '.$this->category->lft.' AND '.$this->category->rgt.')';", " $count_sql = $count_sql_start . $sql;\n $sql = $sql_start . $sql;", " $order = 'sc.rank'; //$this->config['orderby'];\n $dir = 'ASC'; //$this->config['orderby_dir'];", " $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model_field' => 'product_type',\n 'sql' => $sql,\n 'count_sql' => $count_sql,\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'order' => $order,\n 'dir' => $dir,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));", " $category = new storeCategory(null, false, false);\n //$categories = $category->getEcomSubcategories();\n $categories = $category->getTopLevel(null, false, true);\n $ancestors = $this->category->pathToNode();\n $curcat = $this->category;", " assign_to_template(array(\n 'page' => $page,\n 'categories' => $categories\n ));\n }", " function showFullTree() { //FIXME we also need a showFullTree_images method like above\n expHistory::set('viewable', $this->params);\n $category = new storeCategory(null, false, false);\n //$categories = $category->getEcomSubcategories();\n $categories = $category->getFullTree();\n $ancestors = $this->category->pathToNode();\n $curcat = $this->category;", " assign_to_template(array(\n 'categories' => $categories,\n 'curcat' => $curcat,\n 'topcat' => @$ancestors[0]\n ));\n }", " function ecomSearch() {", " }", " function billing_config() {", " }", " /**\n * Add all products (products, event registrations, donations, & gift cards) to search index\n *\n * @return int\n */\n function addContentToSearch() {\n global $db, $router;", " $model = new $this->basemodel_name();", " $total = $db->countObjects($model->table);", " $count = 0;\n for ($i = 0; $i < $total; $i += 100) {\n $orderby = 'id LIMIT ' . ($i) . ', 100';\n $content = $db->selectArrays($model->table, 'parent_id=0', $orderby);", " foreach ($content as $cnt) {\n $origid = $cnt['id'];\n $prod = new product($cnt['id']);\n unset($cnt['id']);\n if (ecomconfig::getConfig('ecom_search_results') == '') {\n $cnt['title'] = (isset($prod->expFile['mainimage'][0]) ? '<img src=\"' . PATH_RELATIVE . 'thumb.php?id=' . $prod->expFile['mainimage'][0]->id . '&w=40&h=40&zc=1\" style=\"float:left;margin-right:5px;\" />' : '') . $cnt['title'] . (!empty($cnt['model']) ? ' - SKU#: ' . $cnt['model'] : '');\n }", "// $search_record = new search($cnt, false, false);\n //build the search record and save it.\n $sql = \"original_id=\" . $origid . \" AND ref_module='\" . $this->baseclassname . \"'\";\n $oldindex = $db->selectObject('search', $sql);\n if (!empty($oldindex)) {\n $search_record = new search($oldindex->id, false, false);\n $search_record->update($cnt);\n } else {\n $search_record = new search($cnt, false, false);\n }", " $search_record->posted = empty($cnt['created_at']) ? null : $cnt['created_at'];\n if ($cnt['product_type'] == 'giftcard') {\n $search_record->view_link = str_replace(URL_FULL, '', $router->makeLink(array('controller' => 'store', 'action' => 'showGiftCards')));\n } else {\n// $search_record->view_link = str_replace(URL_FULL, '', $router->makeLink(array('controller' => $this->baseclassname, 'action' => 'show', 'title' => $cnt['sef_url'])));\n $search_record->view_link = str_replace(URL_FULL, '', $router->makeLink(array('controller' => $cnt['product_type'], 'action' => 'show', 'title' => $cnt['sef_url'])));\n }\n// $search_record->ref_module = 'store';\n $search_record->ref_module = $this->baseclassname;\n// $search_record->ref_type = $this->basemodel_name;\n $search_record->ref_type = $cnt['product_type'];\n// $search_record->category = 'Products';\n $prod = new $search_record->ref_type($origid);\n $search_record->category = $prod->product_name;\n if ($search_record->ref_type == 'eventregistration') {\n $search_record->title .= ' - ' . expDateTime::format_date($prod->eventdate);\n }", " $search_record->original_id = $origid;\n //$search_record->location_data = serialize($this->loc);\n $search_record->save();\n $count++;\n }\n }\n return $count;\n }", " function searchByModel() {\n //do nothing...just show the view.\n }", " function edit() {\n global $db;", "// $expDefinableField = new expDefinableField();\n// $definablefields = $expDefinableField->find('all','1','rank');", " //Make sure that the view is the edit.tpl and not any ajax views\n if (isset($this->params['view']) && $this->params['view'] == 'edit') {\n expHistory::set('editable', $this->params);\n }", " // first we need to figure out what type of ecomm product we are dealing with\n if (!empty($this->params['id'])) {\n // if we have an id lets pull the product type from the products table.\n $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n if (empty($product_type)) redirect_to(array('controller' => 'store', 'action' => 'picktype'));\n } else {\n if (empty($this->params['product_type'])) redirect_to(array('controller' => 'store', 'action' => 'picktype'));\n $product_type = $this->params['product_type'];\n }", " if (!empty($this->params['id'])) {\n $record = new $product_type($this->params['id']);\n if (!empty($this->user_input_fields) && !is_array($record->user_input_fields)) $record->user_input_fields = expUnserialize($record->user_input_fields);\n } else {\n $record = new $product_type();\n $record->user_input_fields = array();\n }", "// if (!empty($this->params['parent_id']))", " // get the product options and send them to the form\n $editable_options = array();\n //$og = new optiongroup();\n $mastergroups = $db->selectExpObjects('optiongroup_master', null, 'optiongroup_master');\n //eDebug($mastergroups,true);\n foreach ($mastergroups as $mastergroup) {\n // if this optiongroup_master has already been made into an option group for this product\n // then we will grab that record now..if not, we will make a new one.\n $grouprec = $db->selectArray('optiongroup', 'optiongroup_master_id=' . $mastergroup->id . ' AND product_id=' . $record->id);\n //if ($mastergroup->id == 9) eDebug($grouprec,true);\n //eDebug($grouprec);\n if (empty($grouprec)) {\n $grouprec['optiongroup_master_id'] = $mastergroup->id;\n $grouprec['title'] = $mastergroup->title;\n $group = new optiongroup($grouprec);\n } else {\n $group = new optiongroup($grouprec['id']);\n }", " $editable_options[$group->title] = $group;", " if (empty($group->option)) {\n foreach ($mastergroup->option_master as $optionmaster) {\n $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);\n $editable_options[$group->title]->options[] = $opt;\n }", " } else {\n if (count($group->option) == count($mastergroup->option_master)) {\n $editable_options[$group->title]->options = $group->option;\n } else {\n // check for any new options or deleted since the last time we edited this product\n foreach ($mastergroup->option_master as $optionmaster) {\n $opt_id = $db->selectValue('option', 'id', 'option_master_id=' . $optionmaster->id . \" AND product_id=\" . $record->id);\n if (empty($opt_id)) {\n $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);\n } else {\n $opt = new option($opt_id);\n }", " $editable_options[$group->title]->options[] = $opt;\n }\n }\n }", " //eDebug($editable_options[$group->title]);", " }\n //die();", " uasort($editable_options, array(\"optiongroup\", \"sortOptiongroups\"));", " // get the shipping options and their methods\n// $shipping = new shipping();\n// foreach (shipping::listAvailableCalculators() as $calcid => $name) {\n foreach (shipping::listCalculators() as $calcid => $name) {\n // must make sure (custom) calculator exists\n if (class_exists($name)) {\n $calc = new $name($calcid);\n $shipping_services[$calcid] = $calc->title;\n $shipping_methods[$calcid] = $calc->availableMethods();\n }\n }", "# eDebug($shipping_services);\n# eDebug($shipping_methods);", " if (!empty($this->params['product_type']) && ($this->params['product_type'] == \"product\" || $this->params['product_type'] == \"childProduct\")) {\n //if new record and it's a child, then well set the child rank to be at the end\n if (empty($record->id) && $record->isChild()) {\n $record->child_rank = $db->max('product', 'child_rank', null, 'parent_id=' . $record->parent_id) + 1;\n }\n //eDebug($record,true);\n }\n $view = '';\n $parent = null;\n if ((isset($this->params['parent_id']) && empty($record->id))) {\n //NEW child product\n $view = 'edit';\n $parent = new $product_type($this->params['parent_id'], false, true);\n $record->parent_id = $this->params['parent_id'];\n } elseif ((!empty($record->id) && $record->parent_id != 0)) {\n //EDIT child product\n $view = 'edit';\n $parent = new $product_type($record->parent_id, false, true);\n } else {\n $view = 'edit';\n }", " $f = new forms();\n $forms_list = array();\n $forms_list[0] = '- '.gt('No User Input Required').' -';\n $forms = $f->find('all', 'is_saved=1');\n if (!empty($forms)) foreach ($forms as $frm) {\n if (!$db->countObjects('eventregistration', 'forms_id='.$frm->id) || (!empty($record->forms_id) && $record->forms_id == $frm->id))\n $forms_list[$frm->id] = $frm->title;\n }", " assign_to_template(array(\n 'record' => $record,\n 'parent' => $parent,\n 'form' => $record->getForm($view),\n 'optiongroups' => $editable_options,\n// 'definablefields' => isset($definablefields) ? $definablefields : '',\n 'forms'=> $forms_list,\n 'shipping_services' => isset($shipping_services) ? $shipping_services : '', // Added implication since the shipping_services default value is a null\n 'shipping_methods' => isset($shipping_methods) ? $shipping_methods : '', // Added implication since the shipping_methods default value is a null\n 'product_types' => isset($this->config['product_types']) ? $this->config['product_types'] : ''\n //'status_display'=>$status_display->getStatusArray()\n ));\n }", " function copyProduct() {\n global $db;", " //expHistory::set('editable', $this->params);\n $f = new forms();\n $forms_list = array();\n $forms_list[0] = '- '.gt('No User Input Required').' -';\n $forms = $f->find('all', 'is_saved=1');\n if (!empty($forms)) foreach ($forms as $frm) {\n $forms_list[$frm->id] = $frm->title;\n }", " // first we need to figure out what type of ecomm product we are dealing with\n if (!empty($this->params['id'])) {\n // if we have an id lets pull the product type from the products table.\n $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n } else {\n if (empty($this->params['product_type'])) redirect_to(array('controller' => 'store', 'action' => 'picktype'));\n $product_type = $this->params['product_type'];\n }", " $record = new $product_type($this->params['id']);\n // get the product options and send them to the form\n $editable_options = array();", " $mastergroups = $db->selectExpObjects('optiongroup_master', null, 'optiongroup_master');\n foreach ($mastergroups as $mastergroup) {\n // if this optiongroup_master has already been made into an option group for this product\n // then we will grab that record now..if not, we will make a new one.\n $grouprec = $db->selectArray('optiongroup', 'optiongroup_master_id=' . $mastergroup->id . ' AND product_id=' . $record->id);\n //eDebug($grouprec);\n if (empty($grouprec)) {\n $grouprec['optiongroup_master_id'] = $mastergroup->id;\n $grouprec['title'] = $mastergroup->title;\n $group = new optiongroup($grouprec);\n } else {\n $group = new optiongroup($grouprec['id']);\n }", " $editable_options[$group->title] = $group;", " if (empty($group->option)) {\n foreach ($mastergroup->option_master as $optionmaster) {\n $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);\n $editable_options[$group->title]->options[] = $opt;\n }\n } else {\n if (count($group->option) == count($mastergroup->option_master)) {\n $editable_options[$group->title]->options = $group->option;\n } else {\n // check for any new options or deleted since the last time we edited this product\n foreach ($mastergroup->option_master as $optionmaster) {\n $opt_id = $db->selectValue('option', 'id', 'option_master_id=' . $optionmaster->id . \" AND product_id=\" . $record->id);\n if (empty($opt_id)) {\n $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);\n } else {\n $opt = new option($opt_id);\n }", " $editable_options[$group->title]->options[] = $opt;\n }\n }\n }\n }", " // get the shipping options and their methods\n// $shipping = new shipping();\n// foreach (shipping::listAvailableCalculators() as $calcid => $name) {\n foreach (shipping::listCalculators() as $calcid => $name) {\n if (class_exists($name)) {\n $calc = new $name($calcid);\n $shipping_services[$calcid] = $calc->title;\n $shipping_methods[$calcid] = $calc->availableMethods();\n }\n }", " $record->original_id = $record->id;\n $record->original_model = $record->model;\n $record->sef_url = NULL;\n $record->previous_id = NULL;\n $record->editor = NULL;", " if ($record->isChild()) {\n $record->child_rank = $db->max('product', 'child_rank', null, 'parent_id=' . $record->parent_id) + 1;\n }", " assign_to_template(array(\n 'copy' => true,\n 'record' => $record,\n 'parent' => new $product_type($record->parent_id, false, true),\n 'form' => $record->getForm($record->parent_id == 0 ? 'edit' : 'child_edit'),\n 'optiongroups' => $editable_options,\n 'forms'=> $forms_list,\n 'shipping_services' => $shipping_services,\n 'shipping_methods' => $shipping_methods\n ));\n }", " function picktype() {\n $prodfiles = storeController::getProductTypes();\n $products = array();\n foreach ($prodfiles as $filepath => $classname) {\n $prodObj = new $classname();\n $products[$classname] = $prodObj->product_name;\n }\n assign_to_template(array(\n 'product_types' => $products\n ));\n }", " function update() {\n// global $db;\n //Get the product type\n $product_type = isset($this->params['product_type']) ? $this->params['product_type'] : 'product';", " $record = new $product_type();", " $record->update($this->params);", " if ($product_type == \"childProduct\" || $product_type == \"product\") {\n $record->addContentToSearch();\n //Create a flash message and redirect to the page accordingly\n if ($record->parent_id != 0) {\n $parent = new $product_type($record->parent_id, false, false);\n if (isset($this->params['original_id'])) {\n flash(\"message\", gt(\"Child product saved.\"));\n } else {\n flash(\"message\", gt(\"Child product copied and saved.\"));\n }\n redirect_to(array('controller' => 'store', 'action' => 'show', 'title' => $parent->sef_url));\n } elseif (isset($this->params['original_id'])) {\n flash(\"message\", gt(\"Product copied and saved. You are now viewing your new product.\"));\n } else {\n flash(\"message\", gt(\"Product saved.\"));\n }\n redirect_to(array('controller' => 'store', 'action' => 'show', 'title' => $record->sef_url));\n } elseif ($product_type == \"giftcard\") {\n flash(\"message\", gt(\"Giftcard saved.\"));\n redirect_to(array('controller' => 'store', 'action' => 'manage'));\n } elseif ($product_type == \"eventregistration\") {\n //FIXME shouldn't event registrations be added to search index?\n// $record->addContentToSearch(); //FIXME there is NO eventregistration::addContentToSearch() method\n flash(\"message\", gt(\"Event saved.\"));\n redirect_to(array('controller' => 'store', 'action' => 'manage'));\n } elseif ($product_type == \"donation\") {\n flash(\"message\", gt(\"Donation saved.\"));\n redirect_to(array('controller' => 'store', 'action' => 'manage'));\n }\n }", " function delete() {\n global $db;", " if (empty($this->params['id'])) return false;\n $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n $product = new $product_type($this->params['id'], true, false);", " //eDebug($product_type);", " //eDebug($product, true);\n //if (!empty($product->product_type_id)) {\n //$db->delete($product_type, 'id='.$product->product_id);\n //}", " $db->delete('option', 'product_id=' . $product->id . \" AND optiongroup_id IN (SELECT id from \" . $db->prefix . \"optiongroup WHERE product_id=\" . $product->id . \")\");\n $db->delete('optiongroup', 'product_id=' . $product->id);\n //die();\n $db->delete('product_storeCategories', 'product_id=' . $product->id . ' AND product_type=\"' . $product_type . '\"');", " if ($product->product_type == \"product\") {\n if ($product->hasChildren()) {\n $this->deleteChildren();\n }\n }", " $product->delete();", " flash('message', gt('Product deleted successfully.'));\n expHistory::back();\n }", " function quicklinks() {\n global $order;", " $oicount = !empty($order->item_count) ? $order->item_count : 0;\n //eDebug($itemcount);\n assign_to_template(array(\n \"oicount\" => $oicount,\n ));\n }", " public static function getProductTypes() {\n $paths = array(\n BASE . 'framework/modules/ecommerce/products/models',\n );", " $products = array();\n foreach ($paths as $path) {\n if (is_readable($path)) {\n $dh = opendir($path);\n while (($file = readdir($dh)) !== false) {\n if (is_readable($path . '/' . $file) && substr($file, -4) == '.php' && $file != 'childProduct.php') {\n $classname = substr($file, 0, -4);\n $products[$path . '/' . $file] = $classname;\n }\n }\n }\n }", " return $products;\n }", " function metainfo() {\n global $router;", " if (empty($router->params['action'])) return array();", " // figure out what metadata to pass back based on the action we are in.\n $action = $router->params['action'];\n $metainfo = array('title'=>'', 'keywords'=>'', 'description'=>'', 'canonical'=> '', 'noindex' => false, 'nofollow' => false);\n $storename = ecomconfig::getConfig('storename');\n switch ($action) {\n case 'showall': //category page\n $cat = $this->category;\n if (!empty($cat)) {\n $metainfo['title'] = empty($cat->meta_title) ? $cat->title . ' ' . gt('Products') . ' - ' . $storename : $cat->meta_title;\n $metainfo['keywords'] = empty($cat->meta_keywords) ? $cat->title : strip_tags($cat->meta_keywords);\n $metainfo['description'] = empty($cat->meta_description) ? strip_tags($cat->body) : strip_tags($cat->meta_description);\n $metainfo['canonical'] = empty($cat->canonical) ? $router->plainPath() : strip_tags($cat->canonical);\n $metainfo['noindex'] = empty($cat->meta_noindex) ? false : $cat->meta_noindex;\n $metainfo['nofollow'] = empty($cat->meta_nofollow) ? false : $cat->meta_nofollow;\n }\n break;\n case 'show':\n case 'showByTitle':\n $prod = new product(isset($router->params['title']) ? expString::sanitize($router->params['title']) : intval($router->params['id']));\n if (!empty($prod)) {\n $metainfo['title'] = empty($prod->meta_title) ? $prod->title . \" - \" . $storename : $prod->meta_title;\n $metainfo['keywords'] = empty($prod->meta_keywords) ? $prod->title : strip_tags($prod->meta_keywords);\n $metainfo['description'] = empty($prod->meta_description) ? strip_tags($prod->body) : strip_tags($prod->meta_description);\n $metainfo['canonical'] = empty($prod->canonical) ? $router->plainPath() : strip_tags($prod->canonical);\n $metainfo['noindex'] = empty($prod->meta_noindex) ? false : $prod->meta_noindex;\n $metainfo['nofollow'] = empty($prod->meta_nofollow) ? false : $prod->meta_nofollow;\n if (!empty($prod->expFile['mainimage'][0]) && file_exists(BASE.$prod->expFile['mainimage'][0]->directory.$prod->expFile['mainimage'][0]->filename)) {\n $metainfo['rich'] = '<!--\n <PageMap>\n <DataObject type=\"thumbnail\">\n <Attribute name=\"src\" value=\"'.$prod->expFile['mainimage'][0]->url.'\"/>\n <Attribute name=\"width\" value=\"'.$prod->expFile['mainimage'][0]->image_width.'\"/>\n <Attribute name=\"height\" value=\"'.$prod->expFile['mainimage'][0]->image_width.'\"/>\n </DataObject>\n </PageMap>\n -->';\n }\n $metainfo['fb']['type'] = 'product';\n $metainfo['fb']['title'] = substr(empty($prod->meta_fb['title']) ? $prod->title : $prod->meta_fb['title'], 0, 87);\n $metainfo['fb']['description'] = substr(empty($prod->meta_fb['description']) ? $metainfo['description'] : $prod->meta_fb['description'], 0, 199);\n $metainfo['fb']['url'] = empty($prod->meta_fb['url']) ? $metainfo['canonical'] : $prod->meta_fb['url'];\n $metainfo['fb']['image'] = empty($prod->meta_fb['fbimage'][0]) ? '' : $prod->meta_fb['fbimage'][0]->url;\n if (empty($metainfo['fb']['image'])) {\n if (!empty($prod->expFile['mainimage'][0]))\n $metainfo['fb']['image'] = $prod->expFile['mainimage'][0]->url;\n if (empty($metainfo['fb']['image']))\n $metainfo['fb']['image'] = URL_BASE . '/framework/modules/ecommerce/assets/images/no-image.jpg';\n }\n break;\n }\n default:\n $metainfo['title'] = gt(\"Shopping\") . \" - \" . $storename;\n $metainfo['keywords'] = SITE_KEYWORDS;\n $metainfo['description'] = SITE_DESCRIPTION;\n }", " // Remove any quotes if there are any.\n// $metainfo['title'] = expString::parseAndTrim($metainfo['title'], true);\n// $metainfo['description'] = expString::parseAndTrim($metainfo['description'], true);\n// $metainfo['keywords'] = expString::parseAndTrim($metainfo['keywords'], true);\n// $metainfo['canonical'] = expString::parseAndTrim($metainfo['canonical'], true);\n// $metainfo['noindex'] = expString::parseAndTrim($metainfo['noindex'], true);\n// $metainfo['nofollow'] = expString::parseAndTrim($metainfo['nofollow'], true);", " return $metainfo;\n }", " /**\n * Configure the module\n */\n public function configure() {\n if (empty($this->config['enable_ratings_and_reviews'])) {\n $this->remove_configs[] = 'comments';\n }\n parent::configure();\n }", " public function deleteChildren() {\n //eDebug($data[0],true);\n //if($id!=null) $this->params['id'] = $id;", " //eDebug($this->params,true);", " $product = new product($this->params['id']);\n //$product = $product->find(\"first\", \"previous_id =\" . $previous_id);\n //eDebug($product, true);", " if (empty($product->id)) // || empty($product->previous_id))", " {\n flash('error', gt('There was an error deleting the child products.'));\n expHistory::back();\n }\n $childrenToDelete = $product->find('all', 'parent_id=' . $product->id);\n foreach ($childrenToDelete as $ctd) {", " //fwrite($lfh, \"Deleting:\" . $ctd->id . \"\\n\");", " $ctd->delete();\n }\n }", " function searchByModelForm() {\n // get the search terms\n $terms = $this->params['search_string'];", " $sql = \"model like '%\" . $terms . \"%'\";", " $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;\n $page = new expPaginator(array(\n 'model' => 'product',\n 'where' => $sql,\n 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,\n 'order' => 'title',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Model #') => 'model',\n gt('Product Name') => 'title',\n gt('Price') => 'base_price'\n ),\n ));", " assign_to_template(array(\n 'page' => $page,\n 'terms' => $terms\n ));\n }", " /**\n * AJAX search for products by model/sku\n */", " function search_by_model() {\n global $db, $user;", " $sql = \"select DISTINCT(p.id) as id, p.title, model from \" . $db->prefix . \"product as p WHERE \";\n if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';", " //if first character of search is a -, then we do a wild card, else from beginning\n if ($this->params['query'][0] == '-') {\n $sql .= \" p.model LIKE '%\" . $this->params['query'];\n } else {\n $sql .= \" p.model LIKE '\" . $this->params['query'];\n }", " $sql .= \"%' AND p.parent_id=0 GROUP BY p.id \";\n $sql .= \"order by p.model ASC LIMIT 30\";\n $res = $db->selectObjectsBySql($sql);\n //eDebug($sql);\n $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }", " /**\n * AJAX search for products by title, description, or model/sku\n *\n */\n public function search() {\n global $db, $user;", " if (SAVE_SEARCH_QUERIES && INCLUDE_AJAX_SEARCH == 1) { // only to add search query record\n $qry = trim($this->params['query']);\n if (!empty($qry)) {\n if (INCLUDE_ANONYMOUS_SEARCH == 1 || $user->id <> 0) {\n $queryObj = new stdClass();\n $queryObj->user_id = $user->id;\n $queryObj->query = $qry;\n $queryObj->timestamp = time();", " $db->insertObject($queryObj, 'search_queries');\n }\n }\n }\n //$this->params['query'] = str_ireplace('-','\\-',$this->params['query']);\n $terms = explode(\" \", $this->params['query']);\n $search_type = ecomconfig::getConfig('ecom_search_results');", " // look for term in full text search\n $sql = \"select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, match (p.title,p.body) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) as score \";\n $sql .= \" from \" . $db->prefix . \"product as p LEFT JOIN \" .\n $db->prefix . \"content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' LEFT JOIN \" . $db->prefix .\n \"expFiles as f ON cef.expFiles_id = f.id WHERE \";\n if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n if ($search_type == 'products') $sql .= 'product_type = \"product\" AND ';\n $sql .= \" match (p.title,p.body) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) AND p.parent_id=0 GROUP BY p.id \";\n $sql .= \"order by score desc LIMIT 10\";", " $firstObs = $db->selectObjectsBySql($sql);\n foreach ($firstObs as $set) {\n $set->weight = 1;\n unset($set->score);\n $index = !empty($set->model) ? $set->model : $set->sef_url;\n $res[$index] = $set;\n }", " // look for specific term in fields\n $sql = \"select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid from \" . $db->prefix . \"product as p LEFT JOIN \" .\n $db->prefix . \"content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' LEFT JOIN \" . $db->prefix .\n \"expFiles as f ON cef.expFiles_id = f.id WHERE \";\n if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n if ($search_type == 'products') $sql .= 'product_type = \"product\" AND ';\n $sql .= \" (p.model like '%\" . $this->params['query'] . \"%' \";\n $sql .= \" OR p.title like '%\" . $this->params['query'] . \"%') \";\n $sql .= \" AND p.parent_id=0 GROUP BY p.id LIMIT 10\";", " $secondObs = $db->selectObjectsBySql($sql);\n foreach ($secondObs as $set) {\n $set->weight = 2;\n $index = !empty($set->model) ? $set->model : $set->sef_url;\n $res[$index] = $set;\n }", " // look for begins with term in fields\n $sql = \"select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid from \" . $db->prefix . \"product as p LEFT JOIN \" .\n $db->prefix . \"content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' LEFT JOIN \" . $db->prefix .\n \"expFiles as f ON cef.expFiles_id = f.id WHERE \";\n if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n if ($search_type == 'products') $sql .= 'product_type = \"product\" AND ';\n $sql .= \" (p.model like '\" . $this->params['query'] . \"%' \";\n $sql .= \" OR p.title like '\" . $this->params['query'] . \"%') \";\n $sql .= \" AND p.parent_id=0 GROUP BY p.id LIMIT 10\";", " $thirdObs = $db->selectObjectsBySql($sql);\n foreach ($thirdObs as $set) {\n if (strcmp(strtolower(trim($this->params['query'])), strtolower(trim($set->model))) == 0)\n $set->weight = 10;\n else if (strcmp(strtolower(trim($this->params['query'])), strtolower(trim($set->title))) == 0)\n $set->weight = 9;\n else\n $set->weight = 3;", " $index = !empty($set->model) ? $set->model : $set->sef_url;\n $res[$index] = $set;\n }", " function sortSearch($a, $b) {\n return ($a->weight == $b->weight ? 0 : ($a->weight < $b->weight) ? 1 : -1);\n }", " if (count($terms)) {\n foreach ($res as $r) {\n $index = !empty($r->model) ? $r->model : $r->sef_url;\n foreach ($terms as $term) {\n if (stristr($r->title, $term)) $res[$index]->weight = $res[$index]->weight + 1;\n }\n }\n }\n usort($res, 'sortSearch');", " $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }", " /**\n * AJAX search for products by title, description, or model/sku\n *\n */\n public function searchNew() {\n global $db, $user;\n //$this->params['query'] = str_ireplace('-','\\-',$this->params['query']);\n $sql = \"select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, \";\n $sql .= \"match (p.title,p.model,p.body) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) as relevance, \";\n $sql .= \"CASE when p.model like '\" . $this->params['query'] . \"%' then 1 else 0 END as modelmatch, \";\n $sql .= \"CASE when p.title like '%\" . $this->params['query'] . \"%' then 1 else 0 END as titlematch \";\n $sql .= \"from \" . $db->prefix . \"product as p INNER JOIN \" .\n $db->prefix . \"content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' INNER JOIN \" . $db->prefix .\n \"expFiles as f ON cef.expFiles_id = f.id WHERE \";\n if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';\n $sql .= \" match (p.title,p.model,p.body) against ('\" . $this->params['query'] . \"*' IN BOOLEAN MODE) AND p.parent_id=0 \";\n $sql .= \" HAVING relevance > 0 \";", " //$sql .= \"GROUP BY p.id \";", " $sql .= \"order by modelmatch,titlematch,relevance desc LIMIT 10\";", " eDebug($sql);\n $res = $db->selectObjectsBySql($sql);\n eDebug($res, true);\n $ar = new expAjaxReply(200, gt('Here\\'s the items you wanted'), $res);\n $ar->send();\n }", " function batch_process() {\n $os = new order_status();\n $oss = $os->find('all',1,'rank');\n $order_status = array();\n $order_status[-1] = '';\n foreach ($oss as $status) {\n $order_status[$status->id] = $status->title;\n }\n assign_to_template(array(\n 'order_status' => $order_status\n ));\n }", " function process_orders() {\n /*\n Testing\n */\n /*echo \"Here?\";\n $inv = 30234;", " $req = 'a29f9shsgh32hsf80s7';", " $amt = 101.00;\n for($count=1;$count<=25;$count+=2)", " {", " $data[2] = $inv + $count;\n $amt += $count*$count;", " $successSet[$count]['message'] = \"Sucessfully imported row \" . $count . \", order: \" . $data[2] . \"<br/>\";", " $successSet[$count]['order_id'] = $data[2];\n $successSet[$count]['amount'] = $amt;\n $successSet[$count]['request_id'] = $req;\n $successSet[$count]['reference_id'] = $req;\n $successSet[$count]['authorization_code'] = $req;", " $successSet[$count]['shipping_tracking_number'] = '1ZNF453937547';", " $successSet[$count]['carrier'] = 'UPS';\n }\n for($count=2;$count<=25;$count+=2)", " {\n $data[2] = $inv + $count;\n $amt += $count*$count;", " $errorSet[$count]['error_code'] = '42';\n $errorSet[$count]['message'] = \"No go for some odd reason. Try again.\";\n $errorSet[$count]['order_id'] = $data[2];\n $errorSet[$count]['amount'] = $amt;\n }", "\n assign_to_template(array('errorSet'=>$errorSet, 'successSet'=>$successSet));", " return;*/", " ###########", " global $db;\n $template = expTemplate::get_template_for_action(new orderController(), 'setStatus', $this->loc);", " //eDebug($_FILES);", " //eDebug($this->params,true);", " set_time_limit(0);\n //$file = new expFile($this->params['expFile']['batch_process_upload'][0]);\n if (!empty($_FILES['batch_upload_file']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n redirect_to(array('controller' => 'store', 'action' => 'batch_process'));\n// $this->batch_process();\n }", " $file = new stdClass();\n $file->path = $_FILES['batch_upload_file']['tmp_name'];\n echo \"Validating file...<br/>\";", " $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n // read in the header line\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);\n $count = 1;\n // read in the data lines\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);", " echo \"<br/>CSV File passed validation...<br/><br/>Detecting carrier type....<br/>\";\n //exit();\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");", " // read in the header line\n $data = fgetcsv($handle, 10000, \",\");", " //eDebug($data);", "// $dataset = array();\n $carrier = '';\n if (trim($data[0]) == 'ShipmentInformationShipmentID') {\n echo \"Detected UPS file...<br/>\";\n $carrier = \"UPS\";\n $carrierTrackingLink = \"http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=\";\n } elseif (trim($data[0]) == 'PIC') {\n echo \"Detected United States Post Service file...<br/>\";\n $carrier = \"USPS\";\n $carrierTrackingLink = \"https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=\";\n }", " //eDebug($carrier);\n $count = 1;\n $errorSet = array();\n $successSet = array();", " $oo = new order();", " // read in the data lines\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;\n $originalOrderId = $data[2];\n $data[2] = intval($data[2]);\n $order = new stdClass();\n $bm = new stdClass();\n $transactionState = null;", " //check for valid order number - if not present or not order, fail and continue with next record\n if (isset($data[2]) && !empty($data[2])) {\n $order = $oo->findBy('invoice_id', $data[2]);\n if (empty($order->id)) {\n $errorSet[$count]['message'] = $originalOrderId . \" is not a valid order in this system.\";\n $errorSet[$count]['order_id'] = $originalOrderId;\n continue;\n }\n } else {\n $errorSet[$count]['message'] = \"Row \" . $count . \" has no order number.\";\n $errorSet[$count]['order_id'] = \"N/A\";\n continue;\n }", " /*we have a valid order, so let's see what we can do: */", " //set status of order to var\n $currentStat = $order->order_status;\n //eDebug($currentStat,true);", " //-- check the order for a closed status - if so, do NOT process or set shipping\n if ($currentStat->treat_as_closed == true) {\n $errorSet[$count]['message'] = \"This is currently a closed order. Not processing.\";\n $errorSet[$count]['order_id'] = $data[2];\n continue;\n }", " //ok, if we made it here we have a valid order that is \"open\"\n //we'll try to capture the transaction if it's in an authorized state, but set shipping regardless\n if (isset($order->billingmethod[0])) {\n $bm = $order->billingmethod[0];\n $transactionState = $bm->transaction_state;\n } else {\n $bm = null;\n $transactionState = '';\n }", " if ($transactionState == 'authorized') {\n //eDebug($order,true);\n $calc = $bm->billingcalculator->calculator;\n $calc->config = $bm->billingcalculator->config;\n if (method_exists($calc, 'delayed_capture')) {\n //$result = $calc->delayed_capture($bm,$bm->billing_cost);\n $result = $calc->delayed_capture($bm, $order->grand_total, $order);\n if ($result->errorCode == 0) {\n //we've succeeded. transaction already created and billing info updated.", " //just need to set the order shipping info, check and see if we send user an email, and set statuses.\n //shipping info:", " $successSet[$count]['order_id'] = $data[2];\n $successSet[$count]['message'] = \"Sucessfully captured order \" . $data[2] . \" and set shipping information.\";\n $successSet[$count]['amount'] = $order->grand_total;\n $successSet[$count]['request_id'] = $result->request_id;\n $successSet[$count]['reference_id'] = $result->PNREF;\n $successSet[$count]['authorization_code'] = $result->AUTHCODE;\n $successSet[$count]['shipping_tracking_number'] = $data[0];\n $successSet[$count]['carrier'] = $carrier;\n } else {\n //failed capture, so we report the error but still set the shipping information\n //because it's already out the door", " //$failMessage = \"Attempted to delay capture order \" . $data[2] . \" and it failed with the following error: \" . $result->errorCode . \" - \" .$result->message;", " //if the user seelected to set a different status for failed orders, set it here.\n /*if(isset($this->params['order_status_fail'][0]) && $this->params['order_status_fail'][0] > -1)\n {\n $change = new order_status_changes();\n // save the changes\n $change->from_status_id = $order->order_status_id;\n //$change->comment = $this->params['comment'];\n $change->to_status_id = $this->params['order_status_fail'][0];\n $change->orders_id = $order->id;\n $change->save();", "", " // update the status of the order\n $order->order_status_id = $this->params['order_status_fail'][0];", " $order->save();", " }*/\n $errorSet[$count]['error_code'] = $result->errorCode;\n $errorSet[$count]['message'] = \"Capture failed: \" . $result->message . \"<br/>Setting shipping information.\";\n $errorSet[$count]['order_id'] = $data[2];\n $errorSet[$count]['amount'] = $order->grand_total;\n $errorSet[$count]['shipping_tracking_number'] = $data[0];\n $errorSet[$count]['carrier'] = $carrier;", " //continue;", " }\n } else {", " //dont suppose we do anything here, as it may be set to approved manually\n //$errorSet[$count] = \"Order \" . $data[2] . \" does not use a billing method with delayed capture ability.\";", " $successSet[$count]['message'] = 'No capture processing available for order:' . $data[2] . '. Setting shipping information.';\n $successSet[$count]['order_id'] = $data[2];\n $successSet[$count]['amount'] = $order->grand_total;\n $successSet[$count]['shipping_tracking_number'] = $data[0];\n $successSet[$count]['carrier'] = $carrier;\n }\n } //if we hit this else, it means we have an order that is not in an authorized state\n //so we do not try to process it = still set shipping though. //FIXME what about 'complete'?\n else {\n $successSet[$count]['message'] = 'No processing necessary for order:' . $data[2] . '. Setting shipping information.';\n $successSet[$count]['order_id'] = $data[2];\n $successSet[$count]['amount'] = $order->grand_total;\n $successSet[$count]['shipping_tracking_number'] = $data[0];\n $successSet[$count]['carrier'] = $carrier;\n }", " $order->shipped = time();\n $order->shipping_tracking_number = $data[0];\n $order->save();", " $s = array_pop($order->shippingmethods);\n $sm = new shippingmethod($s->id);\n $sm->carrier = $carrier;\n $sm->save();", " //statuses and email\n if (isset($this->params['order_status_success'][0]) && $this->params['order_status_success'][0] > -1) {\n $change = new order_status_changes();\n // save the changes\n $change->from_status_id = $order->order_status_id;\n //$change->comment = $this->params['comment'];\n $change->to_status_id = $this->params['order_status_success'][0];\n $change->orders_id = $order->id;\n $change->save();", " // update the status of the order\n $order->order_status_id = $this->params['order_status_success'][0];\n $order->save();", " // email the user if we need to\n if (!empty($this->params['email_customer'])) {\n $email_addy = $order->billingmethod[0]->email;\n if (!empty($email_addy)) {\n $from_status = $db->selectValue('order_status', 'title', 'id=' . $change->from_status_id);\n $to_status = $db->selectValue('order_status', 'title', 'id=' . $change->to_status_id);\n// $template->assign(\n assign_to_template(\n array(\n 'comment' => $change->comment,\n 'to_status' => $to_status,\n 'from_status' => $from_status,\n 'order' => $order,\n 'date' => date(\"F j, Y, g:i a\"),\n 'storename' => ecomconfig::getConfig('storename'),\n 'include_shipping' => true,\n 'tracking_link' => $carrierTrackingLink . $order->shipping_tracking_number,\n 'carrier' => $carrier\n )\n );", " $html = $template->render();\n $html .= ecomconfig::getConfig('ecomfooter');", " $from = array(ecomconfig::getConfig('from_address') => ecomconfig::getConfig('from_name'));\n if (empty($from[0])) $from = SMTP_FROMADDRESS;\n try {\n $mail = new expMail();\n $mail->quickSend(array(\n 'html_message' => $html,\n 'text_message' => str_replace(\"<br>\", \"\\r\\n\", $template->render()),\n 'to' => array($email_addy => $order->billingmethod[0]->firstname . ' ' . $order->billingmethod[0]->lastname),\n 'from' => $from,\n 'subject' => 'Your Order Has Been Shipped (#' . $order->invoice_id . ') - ' . ecomconfig::getConfig('storename')\n ));\n } catch (Exception $e) {\n //do nothing for now\n eDebug(\"Email error:\");\n eDebug($e);\n }\n }\n //else {\n // $errorSet[$count]['message'] .= \"<br/>Order \" . $data[2] . \" was captured successfully, however the email notification was not successful.\";\n //}\n }\n }\n", " //eDebug($product);", " }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);", " assign_to_template(array(\n 'errorSet' => $errorSet,\n 'successSet' => $successSet\n ));\n }", " function manage_sales_reps() {", " }", " function showHistory() {\n $h = new expHistory();\n// echo \"<xmp>\";\n echo \"<pre>\";\n print_r($h);\n// echo \"</xmp>\";\n echo \"</pre>\";\n }", " function import_external_addresses() {\n $sources = array('mc' => 'MilitaryClothing.com', 'nt' => 'NameTapes.com', 'am' => 'Amazon');\n assign_to_template(array(\n 'sources' => $sources\n ));\n }", " function process_external_addresses() {\n global $db;\n set_time_limit(0);\n //$file = new expFile($this->params['expFile']['batch_process_upload'][0]);\n eDebug($this->params);\n// eDebug($_FILES,true);\n if (!empty($_FILES['address_csv']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n redirect_to(array('controller' => 'store', 'action' => 'import_external_addresses'));\n// $this->import_external_addresses();\n }", " $file = new stdClass();\n $file->path = $_FILES['address_csv']['tmp_name'];\n echo \"Validating file...<br/>\";", " //replace tabs with commas\n /*if($this->params['type_of_address'][0] == 'am')\n {\n $checkhandle = fopen($file->path, \"w\");\n $oldFile = file_get_contents($file->path);\n $newFile = str_ireplace(chr(9),',',$oldFile);\n fwrite($checkhandle,$newFile);\n fclose($checkhandle);\n }*/", " $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n if ($this->params['type_of_address'][0] == 'am') {\n // read in the header line\n $checkdata = fgetcsv($checkhandle, 10000, \"\\t\");\n $fieldCount = count($checkdata);\n } else {\n // read in the header line\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);\n }", " $count = 1;\n if ($this->params['type_of_address'][0] == 'am') {\n // read in the data lines\n while (($checkdata = fgetcsv($checkhandle, 10000, \"\\t\")) !== FALSE) {\n $count++;\n //eDebug($checkdata);\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n } else {\n // read in the data lines\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }\n }", " fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);", " echo \"<br/>CSV File passed validation...<br/><br/>Importing....<br/><br/>\";\n //exit();\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");", " // read in the header line and discard it\n $data = fgetcsv($handle, 10000, \",\");", " //eDebug($data);", "// $dataset = array();", " //mc=1, nt=2, amm=3", " if ($this->params['type_of_address'][0] == 'mc') {\n //militaryclothing\n $db->delete('external_addresses', 'source=1');", " } else if ($this->params['type_of_address'][0] == 'nt') {\n //nametapes\n $db->delete('external_addresses', 'source=2');\n } else if ($this->params['type_of_address'][0] == 'am') {\n //amazon\n $db->delete('external_addresses', 'source=3');\n }", " if ($this->params['type_of_address'][0] == 'am') {\n // read in the data lines\n while (($data = fgetcsv($handle, 10000, \"\\t\")) !== FALSE) {\n //eDebug($data,true);\n $extAddy = new external_address();", " //eDebug($data);\n $extAddy->source = 3;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[15]);\n $extAddy->firstname = $name[0];\n if (isset($name[3])) {\n $extAddy->firstname .= ' ' . $name[1];\n $extAddy->middlename = $name[2];\n $extAddy->lastname = $name[3];\n } else if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[15];\n $extAddy->address1 = $data[16];\n $extAddy->address2 = $data[17];\n $extAddy->city = $data[19];\n $state = new geoRegion();\n $state = $state->findBy('code', trim($data[20]));\n if (empty($state->id)) {\n $state = new geoRegion();\n $state = $state->findBy('name', trim($data[20]));\n }\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[21]);\n $extAddy->phone = $data[6];\n $extAddy->email = $data[4];\n //eDebug($extAddy);\n $extAddy->save();\n }\n } else {\n // read in the data lines\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n eDebug($data);\n $extAddy = new external_address();\n if ($this->params['type_of_address'][0] == 'mc') {\n $extAddy->source = 1;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[3]);\n $extAddy->firstname = $name[0];\n if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[4];\n $extAddy->address1 = $data[5];\n $extAddy->address2 = $data[6];\n $extAddy->city = $data[7];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[8]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[9]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];\n //eDebug($extAddy);\n $extAddy->save();", " //Check if the shipping add is same as the billing add\n if ($data[5] != $data[14]) {\n $extAddy = new external_address();\n $extAddy->source = 1;\n $extAddy->user_id = 0;\n $name = explode(' ', $data[12]);\n $extAddy->firstname = $name[0];\n if (isset($name[2])) {\n $extAddy->middlename = $name[1];\n $extAddy->lastname = $name[2];\n } else {\n $extAddy->lastname = $name[1];\n }\n $extAddy->organization = $data[13];\n $extAddy->address1 = $data[14];\n $extAddy->address2 = $data[15];\n $extAddy->city = $data[16];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[17]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[18]);\n $extAddy->phone = $data[20];\n $extAddy->email = $data[21];\n // eDebug($extAddy, true);\n $extAddy->save();\n }\n }\n if ($this->params['type_of_address'][0] == 'nt') {\n //eDebug($data,true);\n $extAddy->source = 2;\n $extAddy->user_id = 0;\n $extAddy->firstname = $data[16];\n $extAddy->lastname = $data[17];\n $extAddy->organization = $data[15];\n $extAddy->address1 = $data[18];\n $extAddy->address2 = $data[19];\n $extAddy->city = $data[20];\n $state = new geoRegion();\n $state = $state->findBy('code', $data[21]);\n $extAddy->state = $state->id;\n $extAddy->zip = str_ireplace(\"'\", '', $data[22]);\n $extAddy->phone = $data[23];\n $extAddy->email = $data[13];\n //eDebug($extAddy);\n $extAddy->save();\n }\n }\n }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);\n echo \"Done!\";\n }", " function nonUnicodeProducts() {\n global $db, $user;", " $products = $db->selectObjectsIndexedArray('product');\n $affected_fields = array();\n $listings = array();\n $listedProducts = array();\n $count = 0;\n //Get all the columns of the product table\n $columns = $db->getTextColumns('product');\n foreach ($products as $item) {", " foreach ($columns as $column) {\n if ($column != 'body' && $column != 'summary' && $column != 'featured_body') {\n if (!expString::validUTF($item->$column) || strrpos($item->$column, '?')) {\n $affected_fields[] = $column;\n }\n } else {\n if (!expString::validUTF($item->$column)) {\n $affected_fields[] = $column;\n }\n }\n }", " if (isset($affected_fields)) {\n if (count($affected_fields) > 0) {\n //Hard coded fields since this is only for displaying\n $listedProducts[$count]['id'] = $item->id;\n $listedProducts[$count]['title'] = $item->title;\n $listedProducts[$count]['model'] = $item->model;\n $listedProducts[$count]['sef_url'] = $item->sef_url;\n $listedProducts[$count]['nonunicode'] = implode(', ', $affected_fields);\n $count++;\n }\n }\n unset($affected_fields);\n }", " assign_to_template(array(\n 'products' => $listedProducts,\n 'count' => $count\n ));\n }", " function cleanNonUnicodeProducts() {\n global $db, $user;", " $products = $db->selectObjectsIndexedArray('product');\n //Get all the columns of the product table\n $columns = $db->getTextColumns('product');\n foreach ($products as $item) {\n //Since body, summary, featured_body can have a ? intentionally such as a link with get parameter.\n //TO Improved\n foreach ($columns as $column) {\n if ($column != 'body' && $column != 'summary' && $column != 'featured_body') {\n if (!expString::validUTF($item->$column) || strrpos($item->$column, '?')) {\n $item->$column = expString::convertUTF($item->$column);\n }\n } else {\n if (!expString::validUTF($item->$column)) {\n $item->$column = expString::convertUTF($item->$column);\n }\n }\n }", " $db->updateObject($item, 'product');\n }", " redirect_to(array('controller' => 'store', 'action' => 'nonUnicodeProducts'));\n// $this->nonUnicodeProducts();\n }", " //This function is being used in the uploadModelaliases page for showing the form upload\n function uploadModelAliases() {\n global $db;\n set_time_limit(0);", " if (isset($_FILES['modelaliases']['tmp_name'])) {\n if (!empty($_FILES['modelaliases']['error'])) {\n flash('error', gt('There was an error uploading your file. Please try again.'));\n//\t\t\t\tredirect_to(array('controller'=>'store','action'=>'uploadModelAliases'));\n $this->uploadModelAliases();\n }", " $file = new stdClass();\n $file->path = $_FILES['modelaliases']['tmp_name'];\n echo \"Validating file...<br/>\";", " $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $checkhandle = fopen($file->path, \"r\");\n // read in the header line\n $checkdata = fgetcsv($checkhandle, 10000, \",\");\n $fieldCount = count($checkdata);\n $count = 1;", " // read in the data lines\n while (($checkdata = fgetcsv($checkhandle, 10000, \",\")) !== FALSE) {\n $count++;\n if (count($checkdata) != $fieldCount) {\n echo \"Line \" . $count . \" of your CSV import file does not contain the correct number of columns.<br/>\";\n echo \"Found \" . $fieldCount . \" header fields, but only \" . count($checkdata) . \" field in row \" . $count . \" Please check your file and try again.\";\n exit();\n }\n }", " fclose($checkhandle);\n ini_set('auto_detect_line_endings',$line_end);", " echo \"<br/>CSV File passed validation...<br/><br/>Importing....<br/><br/>\";\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");\n // read in the header line\n $data = fgetcsv($handle, 10000, \",\");", " //clear the db\n $db->delete('model_aliases_tmp');\n // read in the data lines\n while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {", " $tmp = new stdClass();\n $tmp->field1 = expString::onlyReadables($data[0]);\n $tmp->field2 = expString::onlyReadables($data[1]);\n $db->insertObject($tmp, 'model_aliases_tmp');\n }\n fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);\n redirect_to(array('controller' => 'store', 'action' => 'processModelAliases'));\n echo \"Done!\";\n }", " //check if there are interrupted model alias in the db\n $res = $db->selectObjectsBySql(\"SELECT * FROM \".$db->prefix.\"model_aliases_tmp WHERE is_processed = 0\");\n if (!empty($res)) {\n assign_to_template(array(\n 'continue' => '1'\n ));\n }\n }", " // This function process the uploading of the model aliases in the uploadModelAliases page\n function processModelAliases($index = 0, $error = '') {\n global $db;", " //Going next and delete the previous one\n if (isset($this->params['index'])) {\n $index = $this->params['index'];", " //if go to the next processs\n if (isset($this->params['next'])) {\n $res = $db->selectObjectBySql(\"SELECT * FROM \".$db->prefix.\"model_aliases_tmp LIMIT \" . ($index - 1) . \", 1\");\n //Update the record in the tmp table to mark it as process\n $res->is_processed = 1;\n $db->updateObject($res, 'model_aliases_tmp');\n }\n }", " $product_id = '';\n $autocomplete = '';", " do {\n $count = $db->countObjects('model_aliases_tmp', 'is_processed=0');\n $res = $db->selectObjectBySql(\"SELECT * FROM \".$db->prefix.\"model_aliases_tmp LIMIT {$index}, 1\");\n //Validation\n //Check the field one\n if (!empty($res)) {\n $product_field1 = $db->selectObject(\"product\", \"model='{$res->field1}'\");\n $product_field2 = $db->selectObject(\"product\", \"model='{$res->field2}'\");\n }\n if (!empty($product_field1)) {\n $product_id = $product_field1->id;\n //check the other field if it also being used by another product\n if (!empty($product_field2) && $product_field1->id != $product_field2->id) {\n $error = \"Both {$res->field1} and {$res->field2} are models of a product. <br />\";\n } else {\n //Check the field2 if it is already in the model alias\n $model_alias = $db->selectObject(\"model_aliases\", \"model='{$res->field2}'\");\n if (empty($model_alias) && @$model_alias->product_id != $product_field1->id) {\n //Add the first field\n $tmp = new stdClass();\n $tmp->model = $res->field1;\n $tmp->product_id = $product_field1->id;\n $db->insertObject($tmp, 'model_aliases');\n //Add the second field\n $tmp->model = $res->field2;\n $tmp->product_id = $product_field1->id;\n $db->insertObject($tmp, 'model_aliases');\n //Update the record in the tmp table to mark it as process\n $res->is_processed = 1;\n $db->updateObject($res, 'model_aliases_tmp');", " } else {\n $error = \"{$res->field2} has already a product alias. <br />\";\n }\n }\n } elseif (!empty($product_field2)) {\n $product_id = $product_field2->id;\n $model_alias = $db->selectObject(\"model_aliases\", \"model='{$res->field1}'\");\n if (empty($model_alias) && @$model_alias->product_id != $product_field2->id) {\n //Add the first field\n $tmp = new stdClass();\n $tmp->model = $res->field1;\n $tmp->product_id = $product_field2->id;\n $db->insertObject($tmp, 'model_aliases');\n //Add the second field\n $tmp->model = $res->field2;\n $tmp->product_id = $product_field2->id;\n $db->insertObject($tmp, 'model_aliases');\n //Update the record in the tmp table to mark it as process\n $res->is_processed = 1;\n $db->updateObject($res, 'model_aliases_tmp');\n } else {\n $error = \"{$res->field1} has already a product alias. <br />\";\n }\n } else {\n $model_alias1 = $db->selectObject(\"model_aliases\", \"model='{$res->field1}'\");\n $model_alias2 = $db->selectObject(\"model_aliases\", \"model='{$res->field2}'\");", " if (!empty($model_alias1) || !empty($model_alias2)) {\n $error = \"The {$res->field1} and {$res->field2} are already being used by another product.<br />\";\n } else {\n $error = gt(\"No product match found, please choose a product to be alias in the following models below\") . \":<br />\";\n $error .= $res->field1 . \"<br />\";\n $error .= $res->field2 . \"<br />\";\n $autocomplete = 1;\n }\n }\n $index++;\n } while (empty($error));\n assign_to_template(array(\n 'count' => $count,\n 'alias' => $res,\n 'index' => $index,\n 'product_id' => $product_id,\n 'autocomplete' => $autocomplete,\n 'error' => $error\n ));\n }", " // This function save the uploaded processed model aliases in the uploadModelAliases page\n function saveModelAliases() {\n global $db;", " $index = $this->params['index'];\n $title = expString::escape($this->params['product_title']);\n $product = $db->selectObject(\"product\", \"title='{$title}'\");", " if (!empty($product->id)) {\n $res = $db->selectObjectBySql(\"SELECT * FROM \".$db->prefix.\"model_aliases_tmp LIMIT \" . ($index - 1) . \", 1\");\n //Add the first field\n $tmp = new stdClass();\n $tmp->model = $res->field1;\n $tmp->product_id = $product->id;\n $db->insertObject($tmp, 'model_aliases');\n //Add the second field\n $tmp->model = $res->field2;\n $tmp->product_id = $product->id;\n $db->insertObject($tmp, 'model_aliases');", " //if the model is empty, update the product table so that it will used the field 1 as its primary model\n if (empty($product->model)) {\n $product->model = $res->field1;\n $db->updateObject($product, 'product');\n }", " //Update the record in the tmp table to mark it as process\n $res->is_processed = 1;\n $db->updateObject($res, 'model_aliases_tmp');\n flash(\"message\", gt(\"Product successfully Saved.\"));\n redirect_to(array('controller' => 'store', 'action' => 'processModelAliases', 'index' => $index));\n } else {\n flash(\"error\", gt(\"Product title is invalid.\"));\n redirect_to(array('controller' => 'store', 'action' => 'processModelAliases', 'index' => $index - 1, 'error' => 'Product title is invalid.'));\n }\n }", " // This function delete all the already processed model aliases in the uploadModelAliases page\n function deleteProcessedModelAliases() {\n global $db;", " $db->delete('model_aliases_tmp', 'is_processed=1');\n redirect_to(array('controller' => 'store', 'action' => 'processModelAliases'));\n }", " // This function show the form of model alias to be edit or add in the product edit page\n function edit_model_alias() {\n global $db;", " if (isset($this->params['id'])) {\n $model_alias = $db->selectObject('model_aliases', 'id =' . $this->params['id']);\n assign_to_template(array(\n 'model_alias' => $model_alias\n ));\n } else {\n assign_to_template(array(\n 'product_id' => $this->params['product_id']\n ));\n }\n }", " // This function update or add the model alias in the product edit page\n function update_model_alias() {\n global $db;", " if (empty($this->params['id'])) {\n $obj = new stdClass();\n $obj->model = $this->params['model'];\n $obj->product_id = $this->params['product_id'];\n $db->insertObject($obj, 'model_aliases');", " } else {\n $model_alias = $db->selectObject('model_aliases', 'id =' . $this->params['id']);\n $model_alias->model = $this->params['model'];\n $db->updateObject($model_alias, 'model_aliases');\n }", " expHistory::back();\n }", " // This function delete the model alias in the product edit page\n function delete_model_alias() {\n global $db;", " if (empty($this->params['id'])) return false;\n $db->delete('model_aliases', 'id =' . $this->params['id']);", " expHistory::back();\n }", " function setup_wizard() {", " }", " function import() {\n assign_to_template(array(\n 'type' => $this\n ));\n }", " function importProduct($file=null) {\n if (empty($file->path)) {\n $file = new stdClass();\n $file->path = $_FILES['import_file']['tmp_name'];\n }\n if (empty($file->path)) {\n echo gt('Not a Product Import CSV File');\n return;\n }\n $line_end = ini_get('auto_detect_line_endings');\n ini_set('auto_detect_line_endings',TRUE);\n $handle = fopen($file->path, \"r\");", " // read in the header line\n $header = fgetcsv($handle, 10000, \",\");\n if (!($header[0] == 'id' || $header[0] == 'model')) {\n echo gt('Not a Product Import CSV File');\n return;\n }", " $count = 1;\n $errorSet = array();\n $product = null;\n /* original order of columns\n 0=id\n 1=parent_id\n 2=child_rank\n 3=title\n 4=body\n 5=model\n 6=warehouse_location\n 7=sef_url\n//FIXME this is where canonical should be\n 8=meta_title\n 9=meta_keywords\n 10=meta_description\n 11=tax_class_id\n 12=quantity\n 13=availability_type\n 14=base_price\n 15=special_price\n 16=use_special_price\n 17=active_type\n 18=product_status_id\n 19=category1\n 20=category2\n 21=category3\n 22=category4\n ..\n 30=category12\n 31=surcharge\n 32=rank category_rank\n 33=feed_title\n 34=feed_body\n 35=weight\n 36=height\n 37=width\n 38=length\n 39=companies_id\n 40=image1 url to mainimage to download\n 41=image2 url to additional image to download\n ..\n 44=image5 url to additional image to download\n*/", " // read in the data lines\n// while (($data = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n while (($row = fgetcsv($handle, 10000, \",\")) !== FALSE) {\n $count++;\n $createCats = array();\n $createCatsRank = array();\n $data = array_combine($header, $row);", " //eDebug($data, true);\n if ($header[0] == 'id') {\n if (isset($data['id']) && $data['id'] != 0) {\n $product = new product($data['id'], false, false);\n if (empty($product->id)) {\n $errorSet[$count] = gt(\"Is not an existing product ID.\");\n continue;\n }\n } else {\n //$errorSet[$count] = \"Product ID not supplied.\";\n //continue;\n $product = new product();\n //$product->save(false);\n }\n } elseif ($header[0] == 'model') {\n if (!empty($data['model'])) {\n $p = new product();\n $product = $p->find('first','model=\"' . $data['model'] . '\"');\n if (empty($product->id)) {\n $errorSet[$count] = gt(\"Is not an existing product SKU/Model.\");\n continue;\n }\n } else {\n $product = new product();\n }\n }\n if ($product->product_type != 'product') {\n $errorSet[$count] = gt(\"Existing product is wrong product type.\");\n continue;\n }", " // new products must have a title\n if (empty($product->id)) { // new product require mandatory values\n $checkTitle = trim($data['title']);\n if (empty($checkTitle)) {\n $errorSet[$count] = gt(\"No product name (title) supplied.\");\n continue;\n }\n $product->minimum_order_quantity = 1;\n }", " // parse $data columns\n foreach ($data as $key=>$value) {\n $value = trim($value);\n switch ($key) {\n case 'parent_id': // integer\n case 'child_rank':\n case 'tax_class_id':\n case 'quantity':\n case 'availability_type':\n case 'use_special_price':\n case 'active_type':\n case 'product_status_id':\n $product->$key = intval($value);\n break;\n case 'companies_id':\n if (is_numeric($value)) {\n $product->$key = intval($value);\n } elseif (!empty($value)) { // it's a company name, not a company id#\n $co = new company();\n $company = $co->find('first', 'title=' . $value);\n if (empty($company->id)) {\n $params['title'] = $value;\n $company->update();\n }\n $product->$key = $company->id;\n }\n break;\n case 'sef_url':\n $product->$key = stripslashes(stripslashes($value));\n if (!is_bool(expValidator::uniqueness_of('sef_url', $product, array()))) {\n $product->makeSefUrl();\n }\n break;\n case 'title': // string\n case 'model':\n case 'warehouse_location':\n case 'meta_title':\n case 'meta_keywords':\n case 'meta_description':\n case 'feed_title':\n case 'feed_body':\n $product->$key = stripslashes(stripslashes($value));\n break;\n case 'body':\n $product->$key = utf8_encode(stripslashes(expString::parseAndTrimImport(($value), true)));\n break;\n case 'base_price': // float\n case 'special_price':\n case 'surcharge':\n case 'weight':\n case 'height':\n case 'width':\n case 'length':\n $product->$key = floatval($value);\n break;\n case 'image1':\n case 'image2':\n case 'image3':\n case 'image4':\n case 'image5':\n if (!empty($value)) {\n $product->save(false);\n if (is_integer($value)) {\n $_objFile = new expFile ($value);\n } else {\n // import image from url\n $_destFile = basename($value); // get filename from end of url\n $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n $_destFullPath = BASE . $_destDir . $_destFile;\n if (file_exists($_destFullPath)) {\n $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n $_destFullPath = BASE . $_destDir . $_destFile;\n }", " expCore::saveData($value, $_destFullPath); // download the image", " if (file_exists($_destFullPath)) {\n $__oldumask = umask(0);\n chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n umask($__oldumask);", " // Create a new expFile Object\n $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n $_objFile = new expFile ($_fileParams);\n $_objFile->save();\n }\n }\n // attach product images expFile object\n if (!empty($_objFile->id)) {\n if ($key == 'image1') {\n $product->attachItem($_objFile, 'mainimage');\n } else {\n $product->attachItem($_objFile, 'images', false);\n }\n }\n }\n break;\n case 'category1':\n case 'category2':\n case 'category3':\n case 'category4':\n case 'category5':\n case 'category6':\n case 'category7':\n case 'category8':\n case 'category9':\n case 'category10':\n case 'category11':\n case 'category12':\n if ($product->parent_id == 0) {\n// $rank = !empty($data['rank']) ? $data['rank'] : 1;\n $rank = intval(str_replace('category', '', $key));\n// if (!empty($value)) $result = storeCategory::parseCategory($value);\n if (!empty($value)) $result = storeCategory::importCategoryString($value);\n else continue;", "// if (is_numeric($result)) {\n if ($result) {\n $createCats[] = $result;\n $createCatsRank[$result] = $rank;\n } else {\n $errorSet[$count][] = $result;\n continue 2;\n }\n }\n break;\n default:\n if (property_exists('product', $key)) {\n $product->key = $value;\n }\n }\n }", "// $checkTitle = trim($data['title']);\n// if (empty($checkTitle)) {\n// $errorSet[$count] = gt(\"No product name (title) supplied, skipping this record...\");\n// continue;\n// }\n// $product->parent_id = $data[1];\n// $product->child_rank = $data[2];\n// $product->title = stripslashes(stripslashes($data[3]));\n// $product->body = utf8_encode(stripslashes(expString::parseAndTrimImport(($data[4]), true)));\n// //$product->body = utf8_encode(stripslashes(stripslashes(($data[4]))));\n// $product->model = stripslashes(stripslashes($data[5]));\n// $product->warehouse_location = stripslashes(stripslashes($data[6]));\n// $product->sef_url = stripslashes(stripslashes($data[7]));\n////FIXME this is where canonical should be\n// $product->meta_title = stripslashes(stripslashes($data[8]));\n// $product->meta_keywords = stripslashes(stripslashes($data[9]));\n// $product->meta_description = stripslashes(stripslashes($data[10]));\n//\n// $product->tax_class_id = $data[11];\n//\n// $product->quantity = $data[12];\n//\n// $product->availability_type = $data[13];\n//\n// $product->base_price = $data[14];\n// $product->special_price = $data[15];\n// $product->use_special_price = $data[16];\n// $product->active_type = $data[17];\n// $product->product_status_id = $data[18];\n//\n// $product->surcharge = $data[31];\n// $product->feed_title = stripslashes(stripslashes($data[33]));\n// $product->feed_body = stripslashes(stripslashes($data[34]));\n// if (!empty($data[35])) $product->weight = $data[35];\n// if (!empty($data[36])) $product->height = $data[36];\n// if (!empty($data[37])) $product->width = $data[37];\n// if (!empty($data[38])) $product->length = $data[38];\n// if (!empty($data[39])) $product->companies_id = $data[39];\n// if (!empty($data[40])) {\n// // import image from url\n// $_destFile = basename($data[40]); // get filename from end of url\n// $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// if (file_exists($_destFullPath)) {\n// $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// }\n//\n// expCore::saveData($data[40], $_destFullPath); // download the image\n//\n// if (file_exists($_destFullPath)) {\n// $__oldumask = umask(0);\n// chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n// umask($__oldumask);\n//\n// // Create a new expFile Object\n// $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n// $_objFile = new expFile ($_fileParams);\n// $_objFile->save();\n// // attach/replace product main image with new expFile object\n// $product->attachItem($_objFile, 'mainimage');\n// }\n// }\n// for ($i=41; $i<=44; $i++) {\n// if (!empty($data[$i])) {\n// // import image from url\n// $_destFile = basename($data[$i]); // get filename from end of url\n// $_destDir = UPLOAD_DIRECTORY_RELATIVE;\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// if (file_exists($_destFullPath)) {\n// $_destFile = expFile::resolveDuplicateFilename($_destFullPath);\n// $_destFullPath = BASE . $_destDir . $_destFile;\n// }\n//\n// expCore::saveData($data[$i], $_destFullPath); // download the image\n//\n// if (file_exists($_destFullPath)) {\n// $__oldumask = umask(0);\n// chmod($_destFullPath, octdec(FILE_DEFAULT_MODE_STR + 0));\n// umask($__oldumask);\n//\n// // Create a new expFile Object\n// $_fileParams = array('filename' => $_destFile, 'directory' => $_destDir);\n// $_objFile = new expFile ($_fileParams);\n// $_objFile->save();\n// // attach product additional images with new expFile object\n// $product->attachItem($_objFile, 'images', false);\n// }\n// }\n// }\n//\n// if (empty($product->id)) $product->minimum_order_quantity = 1;\n//\n// if ($product->parent_id == 0) {\n// $createCats = array();\n// $createCatsRank = array();\n// for ($x = 19; $x <= 30; $x++) {\n// if (!empty($data[$x])) $result = storeCategory::parseCategory($data[$x]);\n// else continue;\n//\n// if (is_numeric($result)) {\n// $createCats[] = $result;\n// $createCatsRank[$result] = $data[32];\n// } else {\n// $errorSet[$count][] = $result;\n// continue 2;\n// }\n// }\n// }", " //NOTE: we manipulate existing user input fields to store them properly?\n //eDebug($createCats,true);\n if (!empty($product->user_input_fields) && is_array($product->user_input_fields))\n $product->user_input_fields = serialize($product->user_input_fields);\n //eDebug($product->user_input_fields);", " if (!empty($product->user_input_fields) && !is_array($product->user_input_fields))\n $product->user_input_fields = str_replace(\"'\", \"\\'\", $product->user_input_fields);", " //eDebug($product->user_input_fields,true);\n $product->save(true);\n //eDebug($product->body);", " //sort order and categories\n if ($product->parent_id == 0) {\n $product->saveCategories($createCats, $createCatsRank);\n //eDebug($createCatsRank);\n }\n echo \"Successfully imported/updated row \" . $count . \", product: \" . $product->title . \"<br/>\";\n //eDebug($product);", " }", " if (count($errorSet)) {\n echo \"<br/><hr><br/><div style='color:red'><strong>\".gt('The following records were NOT imported').\":</strong><br/>\";\n foreach ($errorSet as $rownum => $err) {\n echo \"Row: \" . $rownum;\n if (is_array($err)) {\n foreach ($err as $e) {\n echo \" -- \" . $e . \"<br/>\";\n }\n } else echo \" -- \" . $err . \"<br/>\";\n }\n echo \"</div>\";\n }", " fclose($handle);\n ini_set('auto_detect_line_endings',$line_end);", " // update search index\n $this->addContentToSearch();\n }", "}", "?>" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
PreciseBugs
{"buggy_code_end_loc": [1156, 821, 538, 1298, 1110, 656, 639, 481, 1974, 221, 1264, 168, 235, 25, 598, 133, 55, 383, 63, 58, 352, 125, 394, 59, 2152, 117, 137, 259, 537, 2235, 33, 72, 1773, 250, 679, 739, 285, 1941, 540, 62, 528, 25, 1290, 256, 199, 122, 41, 99, 2020, 355, 147, 129, 1499], "buggy_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 24, 31, 25, 27, 50, 27, 27, 25, 44, 26, 25, 29, 34, 25, 24, 24, 25, 25, 27, 26, 68, 1, 54, 26, 428, 41, 29, 44, 55, 24, 24, 1, 28, 30, 25, 29, 25, 25, 29, 146, 128, 27], "filenames": ["framework/core/controllers/expController.php", "framework/core/expFramework.php", "framework/core/models/expRecord.php", "framework/core/subsystems/database/mysqli.php", "framework/core/subsystems/expDatabase.php", "framework/core/subsystems/expPaginator.php", "framework/core/subsystems/expSettings.php", "framework/core/subsystems/expString.php", "framework/core/subsystems/expTheme.php", "framework/modules/addressbook/controllers/addressController.php", "framework/modules/administration/controllers/administrationController.php", "framework/modules/banners/controllers/bannerController.php", "framework/modules/blog/controllers/blogController.php", "framework/modules/core/controllers/expCatController.php", "framework/modules/core/controllers/expCommentController.php", "framework/modules/core/controllers/expDefinableFieldController.php", "framework/modules/core/controllers/expHTMLEditorController.php", "framework/modules/core/controllers/expSimpleNoteController.php", "framework/modules/core/controllers/expTagController.php", "framework/modules/eaas/controllers/eaasController.php", "framework/modules/ealerts/controllers/ealertController.php", "framework/modules/ecommerce/controllers/billingController.php", "framework/modules/ecommerce/controllers/ecomconfigController.php", "framework/modules/ecommerce/controllers/eventregistrationController.php", "framework/modules/ecommerce/controllers/orderController.php", "framework/modules/ecommerce/controllers/order_statusController.php", "framework/modules/ecommerce/controllers/purchaseOrderController.php", "framework/modules/ecommerce/controllers/shippingController.php", "framework/modules/ecommerce/controllers/storeCategoryController.php", "framework/modules/ecommerce/controllers/storeController.php", "framework/modules/ecommerce/controllers/taxController.php", "framework/modules/ecommerce/products/models/donation.php", "framework/modules/events/controllers/eventController.php", "framework/modules/events/models/event.php", "framework/modules/file/controllers/fileController.php", "framework/modules/file/models/expFile.php", "framework/modules/filedownloads/controllers/filedownloadController.php", "framework/modules/forms/controllers/formsController.php", "framework/modules/help/controllers/helpController.php", "framework/modules/help/models/help_version.php", "framework/modules/importexport/controllers/importexportController.php", "framework/modules/migration/controllers/migrationController.php", "framework/modules/navigation/controllers/navigationController.php", "framework/modules/news/controllers/newsController.php", "framework/modules/photoalbum/controllers/photosController.php", "framework/modules/pixidou/controllers/pixidouController.php", "framework/modules/portfolio/controllers/portfolioController.php", "framework/modules/recyclebin/controllers/recyclebinController.php", "framework/modules/report/controllers/reportController.php", "framework/modules/search/controllers/searchController.php", "framework/modules/simplepoll/controllers/simplePollController.php", "framework/modules/users/controllers/loginController.php", "framework/modules/users/controllers/usersController.php"], "fixing_code_end_loc": [1183, 823, 543, 1298, 1110, 664, 643, 481, 1977, 221, 1263, 171, 234, 29, 599, 133, 59, 383, 69, 52, 358, 126, 397, 57, 2154, 120, 130, 262, 538, 2232, 25, 72, 1774, 255, 685, 741, 285, 1949, 541, 62, 535, 25, 1306, 259, 202, 121, 40, 102, 2025, 356, 147, 129, 1513], "fixing_code_start_loc": [44, 288, 107, 354, 1102, 26, 194, 37, 244, 25, 27, 25, 32, 26, 27, 50, 27, 27, 26, 43, 26, 25, 29, 33, 25, 25, 25, 25, 25, 26, 25, 68, 1, 55, 25, 428, 41, 30, 44, 55, 25, 24, 1, 29, 31, 24, 30, 25, 25, 29, 146, 128, 27], "message": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:exponentcms:exponent_cms:*:*:*:*:*:*:*:*", "matchCriteriaId": "C723D5FF-CEE4-461B-911F-E760A7BF1805", "versionEndExcluding": null, "versionEndIncluding": "2.3.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "SQL injection vulnerability in framework/modules/filedownloads/controllers/filedownloadController.php in Exponent CMS 2.3.9 and earlier allows remote attackers to execute arbitrary SQL commands via the fileid parameter."}, {"lang": "es", "value": "Vulnerabilidad de inyecci\u00f3n SQL en framework/modules/filedownloads/controllers/filedownloadController.php en Exponent CMS 2.3.9 y versiones anteriores permite a atacantes remotos ejecutar comandos SQL arbitrarios a trav\u00e9s del par\u00e1metro fileid."}], "evaluatorComment": null, "id": "CVE-2016-9087", "lastModified": "2017-04-04T01:59:01.853", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-03-07T16:59:01.603", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/139484/Exponent-CMS-2.3.9-SQL-Injection.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Patch", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2016/Nov/12"}, {"source": "cve@mitre.org", "tags": null, "url": "http://www.securityfocus.com/bid/97271"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-89"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/exponentcms/exponent-cms/commit/fdafb5ec97838e4edbd685f587f28d3174ebb3db"}, "type": "CWE-89"}
356