{"id":1101,"url":"https://patchwork.libcamera.org/api/patches/1101/?format=json","web_url":"https://patchwork.libcamera.org/patch/1101/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190424110044.12608-3-giulio.benetti@micronovasrl.com>","date":"2019-04-24T11:00:44","name":"[libcamera-devel,2/2] libcamera: utils: call secure_getenv() if it exists or workaround with issetugid()","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"774f5991f53297f3a091403cb9a2b61a3d4ccb34","submitter":{"id":16,"url":"https://patchwork.libcamera.org/api/people/16/?format=json","name":"Giulio Benetti","email":"giulio.benetti@micronovasrl.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1101/mbox/","series":[{"id":268,"url":"https://patchwork.libcamera.org/api/series/268/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=268","date":"2019-04-24T11:00:42","name":"improve secure_getenv()","version":1,"mbox":"https://patchwork.libcamera.org/series/268/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1101/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1101/checks/","tags":{},"headers":{"Return-Path":"<giulio.benetti@micronovasrl.com>","Received":["from mail.micronovasrl.com (mail.micronovasrl.com [212.103.203.10])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AB60D60DB4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Apr 2019 13:00:50 +0200 (CEST)","from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1])\n\tby mail.micronovasrl.com (Postfix) with ESMTP id 6D117B0067F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Apr 2019 13:00:50 +0200 (CEST)","from mail.micronovasrl.com ([127.0.0.1])\n\tby mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1])\n\t(amavisd-new, port 10026)\n\twith ESMTP id 4Hs571bixqfm for <libcamera-devel@lists.libcamera.org>; \n\tWed, 24 Apr 2019 13:00:49 +0200 (CEST)","from ubuntu.localdomain (88-149-228-83.v4.ngi.it [88.149.228.83])\n\tby mail.micronovasrl.com (Postfix) with ESMTPSA id 4DBBDB012B0;\n\tWed, 24 Apr 2019 13:00:48 +0200 (CEST)"],"Authentication-Results":"mail.micronovasrl.com (amavisd-new); dkim=pass\n\treason=\"pass (just generated, assumed good)\" header.d=micronovasrl.com","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=micronovasrl.com;\n\th=references:in-reply-to:x-mailer:message-id:date:date:subject\n\t:subject:to:from:from; s=dkim; t=1556103649; x=1556967650; bh=eC\n\ti0PmmxRnwvayQeTpK0vjXVfUPpY/yaZ000/qT3i1Y=; b=lUVzpDAlD3iYgb4wK0\n\tHZCKbMC3z/sDGyQxONIJwFOXZzAfdHA+Ggjpdk6Ba1K9gGpYLF9nFlvlk4kxLIZA\n\tQqPY+Qeo+Igr6NnfPJzn06UnTAqlSwodbSDgAt36/ERHjOnKMUNLVuSRtyjxM1MK\n\t6sol446Ze9QWAe+3a+Gx/F5ts=","X-Virus-Scanned":"Debian amavisd-new at mail.micronovasrl.com","X-Spam-Flag":"NO","X-Spam-Score":"-2.9","X-Spam-Level":"","X-Spam-Status":"No, score=-2.9 tagged_above=-10 required=4.5\n\ttests=[ALL_TRUSTED=-1, BAYES_00=-1.9]\n\tautolearn=unavailable autolearn_force=no","From":"Giulio Benetti <giulio.benetti@micronovasrl.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 24 Apr 2019 13:00:44 +0200","Message-Id":"<20190424110044.12608-3-giulio.benetti@micronovasrl.com>","X-Mailer":"git-send-email 2.17.1","In-Reply-To":"<20190424110044.12608-1-giulio.benetti@micronovasrl.com>","References":"<364aa322-85ca-2c17-984e-1e807bd832ca@micronovasrl.com>\n\t<20190424110044.12608-1-giulio.benetti@micronovasrl.com>","Subject":"[libcamera-devel] [PATCH 2/2] libcamera: utils: call\n\tsecure_getenv() if it exists or workaround with issetugid()","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, 24 Apr 2019 11:00:51 -0000"},"content":"When secure_getenv() is not available, need to have a workaround.\n\nCheck if secure_getenv() is present, otherwise call issetugid() on its\nplace.\n\nSigned-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>\n---\n src/libcamera/utils.cpp | 8 ++++++--\n 1 file changed, 6 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp\nindex 66123b1..529dd4a 100644\n--- a/src/libcamera/utils.cpp\n+++ b/src/libcamera/utils.cpp\n@@ -8,7 +8,7 @@\n #include \"utils.h\"\n \n #include <string.h>\n-#include <sys/auxv.h>\n+#include <unistd.h>\n \n /**\n  * \\file utils.h\n@@ -57,10 +57,14 @@ const char *basename(const char *path)\n  */\n char *secure_getenv(const char *name)\n {\n-\tif (getauxval(AT_SECURE))\n+#if HAVE_SECURE_GETENV\n+\treturn secure_getenv(name);\n+#else\n+\tif (issetugid())\n \t\treturn NULL;\n \n \treturn getenv(name);\n+#endif\n }\n \n /**\n","prefixes":["libcamera-devel","2/2"]}