Show a patch.

GET /api/patches/885/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 885,
    "url": "https://patchwork.libcamera.org/api/patches/885/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/885/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20190403041058.20921-5-kieran.bingham@ideasonboard.com>",
    "date": "2019-04-03T04:10:58",
    "name": "[libcamera-devel,v3,4/4] libcamera: utils: Use internal secure_getenv() implementation",
    "commit_ref": "88646061e0729863116c9e2d7bfd461b47e450a4",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "276a1d226050e14e0662d5463a86d0714c8aafe0",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/885/mbox/",
    "series": [
        {
            "id": 234,
            "url": "https://patchwork.libcamera.org/api/series/234/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=234",
            "date": "2019-04-03T04:10:54",
            "name": "Cleanup and non-GNU C library support",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/234/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/885/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/885/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<kieran.bingham@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C609B610BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Apr 2019 06:11:17 +0200 (CEST)",
            "from Q.imgcgcw.net (unknown [147.50.13.10])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 00F822F9;\n\tWed,  3 Apr 2019 06:11:15 +0200 (CEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1554264677;\n\tbh=+rnmzBA+pt89KB6IdNF1/OXYQQcy4jXoIQSW3hqa31Y=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=bGxf1yzMM/Cu87fV/oRyPHX1EgZuXibc7h7klN4rU5LRmdKiO5nZfyNYlCPapHap4\n\tbHqvLbAYZzvNs8Ry2KewbwE4cdKgApWByRlUM4febUAl/WRBoebx5ddgst7XxaCZJj\n\tkw1+G4o8mMHxNqFpS0Upxkw17arZbhM+hrWRG5mU=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "LibCamera Devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Wed,  3 Apr 2019 11:10:58 +0700",
        "Message-Id": "<20190403041058.20921-5-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.19.1",
        "In-Reply-To": "<20190403041058.20921-1-kieran.bingham@ideasonboard.com>",
        "References": "<20190403041058.20921-1-kieran.bingham@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 4/4] libcamera: utils: Use internal\n\tsecure_getenv() implementation",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "Precedence": "list",
        "List-Id": "<libcamera-devel.lists.libcamera.org>",
        "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>",
        "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>",
        "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>",
        "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "X-List-Received-Date": "Wed, 03 Apr 2019 04:11:18 -0000"
    },
    "content": "The secure_getenv() call is not provided by all C libraries. Support\nthis feature by implementing our own version.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/include/utils.h |  2 ++\n src/libcamera/log.cpp         |  4 ++--\n src/libcamera/utils.cpp       | 22 ++++++++++++++++++++++\n 3 files changed, 26 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h\nindex 1b2a62c0fda7..79038a96feab 100644\n--- a/src/libcamera/include/utils.h\n+++ b/src/libcamera/include/utils.h\n@@ -24,6 +24,8 @@ std::unique_ptr<T> make_unique(Args&&... args)\n \treturn std::unique_ptr<T>(new T(std::forward<Args>(args)...));\n }\n \n+char *secure_getenv(const char *name);\n+\n } /* namespace utils */\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp\nindex eb444c31857d..71cfbc422ba0 100644\n--- a/src/libcamera/log.cpp\n+++ b/src/libcamera/log.cpp\n@@ -122,7 +122,7 @@ Logger::Logger()\n  */\n void Logger::parseLogFile()\n {\n-\tconst char *file = secure_getenv(\"LIBCAMERA_LOG_FILE\");\n+\tconst char *file = utils::secure_getenv(\"LIBCAMERA_LOG_FILE\");\n \tif (!file)\n \t\treturn;\n \n@@ -140,7 +140,7 @@ void Logger::parseLogFile()\n  */\n void Logger::parseLogLevels()\n {\n-\tconst char *debug = secure_getenv(\"LIBCAMERA_LOG_LEVELS\");\n+\tconst char *debug = utils::secure_getenv(\"LIBCAMERA_LOG_LEVELS\");\n \tif (!debug)\n \t\treturn;\n \ndiff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp\nindex fae28cee556a..cd0fd7614cc7 100644\n--- a/src/libcamera/utils.cpp\n+++ b/src/libcamera/utils.cpp\n@@ -41,6 +41,28 @@ const char *basename(const char *path)\n        return base ? base + 1 : path;\n }\n \n+/**\n+ * \\brief Get an environment variable\n+ * \\param[in] name The name of the variable to return\n+ *\n+ * The environment list is searched to find the variable 'name', and the\n+ * corresponding string is returned.\n+ *\n+ * If 'secure execution' is required then this function always returns NULL to\n+ * avoid vulnerabilities that could occur if set-user-ID or set-group-ID\n+ * programs accidentally trust the environment.\n+ *\n+ * \\returns A pointer to the value in the environment or NULL if the requested\n+ * environment variable doesn't exist or if secure execution is required.\n+ */\n+char *secure_getenv(const char *name)\n+{\n+\tif (getauxval(AT_SECURE))\n+\t\treturn NULL;\n+\n+\treturn getenv(name);\n+}\n+\n /**\n  * \\fn libcamera::utils::make_unique(Args &&... args)\n  * \\brief Constructs an object of type T and wraps it in a std::unique_ptr.\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "4/4"
    ]
}