Show a patch.

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

{
    "id": 830,
    "url": "https://patchwork.libcamera.org/api/patches/830/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/830/",
    "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": "<20190401110315.4148-5-kieran.bingham@ideasonboard.com>",
    "date": "2019-04-01T11:03:15",
    "name": "[libcamera-devel,v2,4/4] libcamera: utils: Use internal secure_getenv() implementation",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "06f7d25086ce54949a57b3ba2e1dbc14de0602ae",
    "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/830/mbox/",
    "series": [
        {
            "id": 226,
            "url": "https://patchwork.libcamera.org/api/series/226/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=226",
            "date": "2019-04-01T11:03:11",
            "name": "Cleanup and non-GNU C library support",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/226/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/830/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/830/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 CFCCD600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Apr 2019 13:03:36 +0200 (CEST)",
            "from Q.imgcgcw.net (unknown [147.50.13.10])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 238522F9;\n\tMon,  1 Apr 2019 13:03:34 +0200 (CEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1554116616;\n\tbh=ic93TZh7q69lCHqqi0QIAHSQ0J8uhG2yvBq35DmBByI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=aCUbwdYYDyjGwC6Zh6Wi9M631J7xXVkizaMDoN9EZ4HwCi9VikHUXx2dTnB4ihlDt\n\tFnA0G8u7Tr8wS5w8r+gNQg5dSClHvWYaO3ZFu0uHA3krwMqWqvdB43IkNHt11Z9oSQ\n\t43r243SK/qq7nZdbxj9PzI6tpvYSiGcY1HY1v0YA=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "LibCamera Devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Mon,  1 Apr 2019 18:03:15 +0700",
        "Message-Id": "<20190401110315.4148-5-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.19.1",
        "In-Reply-To": "<20190401110315.4148-1-kieran.bingham@ideasonboard.com>",
        "References": "<20190401110315.4148-1-kieran.bingham@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 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": "Mon, 01 Apr 2019 11:03:37 -0000"
    },
    "content": "The secure_getenv() call is not provided by all toolchains. Support\nthis feature by implementing our own version.\n\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       | 20 ++++++++++++++++++++\n 3 files changed, 24 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 70936e36c5d5..c49e65136514 100644\n--- a/src/libcamera/utils.cpp\n+++ b/src/libcamera/utils.cpp\n@@ -6,6 +6,7 @@\n  */\n \n #include <string.h>\n+#include <sys/auxv.h>\n \n #include \"utils.h\"\n \n@@ -35,6 +36,25 @@ const char *basename(const char *path)\n        return base ? base + 1 : path;\n }\n \n+/**\n+ * \\brief Get an environment variable\n+ *\n+ * The environment list is searched to find the variable 'name', and returns a\n+ * pointer to the corresponding string.\n+ * If 'secure execution' is required then this function always returns NULL to\n+ * avoid vulnerabilities that could occur if the set-user-ID or set-group-ID\n+ * programs accidentally trusted the environment.\n+ *\n+ * \\returns A pointer to the value in the environment or NULL if the match fails\n+ * or a secure environment is required.\n+ */\n+char *secure_getenv(const char *name)\n+{\n+       if (getauxval(AT_SECURE))\n+               return NULL;\n+       else\n+               return getenv(name);\n+}\n \n /**\n  * \\fn libcamera::utils::make_unique(Args &&... args)\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "4/4"
    ]
}