From patchwork Tue Jan 2 15:24:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 854582 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:400c:c09::23e; helo=mail-wm0-x23e.google.com; envelope-from=swupdate+bncbcxploxj6ikrbjgiv3jakgqen2d2cbq@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="PAaoNXM4"; dkim-atps=neutral Received: from mail-wm0-x23e.google.com (mail-wm0-x23e.google.com [IPv6:2a00:1450:400c:c09::23e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3z9yXR1x7dz9sRW for ; Wed, 3 Jan 2018 02:24:23 +1100 (AEDT) Received: by mail-wm0-x23e.google.com with SMTP id e70sf14585042wmc.6 for ; Tue, 02 Jan 2018 07:24:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1514906660; cv=pass; d=google.com; s=arc-20160816; b=D9HlfRPKc+JC0KVmm4KUq/oAg8VBhLex+H1QO96DD2W1FdpXqB0VcADkRT9x0vk3WO ptMs76Rwe3JNQpHlbJ9Rd0QKIH7L5SnNPJx47xBgOw4cfo/orlVQTGan6snx4Hn59LZ1 lZhOL4nlMK9PdTBK+tPIhfNg5RQuubx8yAK7uLp1Vbl8NacPcyUneYn17lpSOBxl4Vz9 ryQtrHTIirdYcExOSj0Idb8k3UbUvoHlI4lFnA4ArOGajcXsbqW5naRJi9XxE2Et87tV 4A8Am9ruibKu3BDtLgPDMlcqDCrNOTsfKvvjDTNlBmkU5fjuyZQDBwSU4A9kPdXes7g+ X9Cg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:message-id:date:subject:cc:to:from :arc-authentication-results:arc-message-signature:mime-version :sender:dkim-signature:arc-authentication-results; bh=hztvRMsLSpWTc/elqHiQLTCR87zuPqtMpSChDPqM5BU=; b=h1zFP4CAWA+jZuv6wk7/W760GnJ+2HY42+g8kfToknhIKRbawE4eCwer6nK9uduOUU 6FQ1BEcKYPB4hQ0uzjI9OZdWrvaZwACPkvbWPaxSQsGLUMtxzenqiOXzMuhjXKru0Mnu onaMmpz90t5Jgw6kSeLJc1/iPolmGS1DnasbErgKhJnIn2C1J9QeT61HsEI+TQ3tcvRU NvU5Dz77kfQUN/bEblxMwljwcUMFLriDdeRaSYwumDgsSYFbmfAECc71fepYjANzgNZi pgeR0DPyi+jFrF2OGZBv2L1QfmoOTd2VC06AzZTxGmWGxW5psou55TwvYw6c6YlROp2O ZwFw== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=hztvRMsLSpWTc/elqHiQLTCR87zuPqtMpSChDPqM5BU=; b=PAaoNXM4lSpR/4WW3Fz4BLbR297+5BuQymO5X3QodmwCn6sUpyFdmc7ZCVvLJSAG84 9cJjrV2U7jKzqK6i7+H+lE5o+gJ+9MnRQVQBzXbOxNyBVEz5moP3TpQYmoQq7ayGEghi ykSLjV4OmwHfKY4wTC/Vm5SztU3puL9qRibSmVy1NAGuZVtG9AN22FmrJmZCp/IHZtrl P4BGiFcZOn4Lk+RijAQD9NGWTtCEVGub+SFDhf0Caeh0rctpJBcTOjGeB29ifP8SEPDs CjpSZxlv4MznIVVebu++vFHmOxfoWwAg4LaS25HUIEzUAYuvpOM6n8TXkANXUuKeS9m2 6LfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=hztvRMsLSpWTc/elqHiQLTCR87zuPqtMpSChDPqM5BU=; b=LEzhqE/CP84R9kV5PgbzQYDQ/KklxqlZakneU+JT34pAYssygysd2PTFDYvz6/HQ15 ++C9uh6h41JEdLeYUGqsKsabpLjyQDIGKtd/COlTxmW/EMzRykxnIar61mwRC6l+W6vd ovLUXWnFqjU7IyAUlBNxUU8MzqPJa2T9fIIaG5Q+BCcO7Hscy6PBbJKbZ2qnpy/HLQOd Td3Gc7ksc1tkfq+9F7Dql+/OdSHsy2JvMEj1JGgz0Oph+l1lfcwFxkj9iWrBzBcXeyue mgPyB2jcHhmmSKmr/kllgSCIidbOeXTIA7cLtvDbLEc5eg4LcHhRPuVg7XMYn8MUsBOF zHZQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: AKGB3mLqJ7WgrQOH2Ygko2fcC1Y87TO/27V9qONhcAP48lib+0YPpAvH n7Gk9CsxgPguLiciCq4RiiI= X-Google-Smtp-Source: ACJfBouP9ImE1oFkc8JnyG5NPSDNIQ6gQBWq2XUKMlV1+kEFZsOm4LDyRZXjDPNAwAqydziCkttNxQ== X-Received: by 10.28.147.75 with SMTP id v72mr406900wmd.2.1514906660689; Tue, 02 Jan 2018 07:24:20 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.223.156.134 with SMTP id d6ls9303401wre.10.gmail; Tue, 02 Jan 2018 07:24:20 -0800 (PST) X-Received: by 10.28.245.7 with SMTP id t7mr3895278wmh.0.1514906660255; Tue, 02 Jan 2018 07:24:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514906660; cv=none; d=google.com; s=arc-20160816; b=eZ/ObOjQ7LJ/2FbMcGQiU2Dp46O6NcOoyDbaqtu1H6KQ3uIDtgadAfdha6MG6ujaAP xt/ZDrFyn8pJmYgpkXsgWj6Mgo1Ly7zI0tfRdORaT5ZFYOXUl7XFEpuVfl7nfEnu7+tL PXkejB6IgV0OFoeKjKJSbYNM66TNrYIUpgH1hQCi7+uH2zpSxap26/ILPa7atVHED2YU pctcvm2EFRO5rvGoQHfhaYsKYYAeLilX6BuHPjdQ9GRnBFMtDt8GoRdfOy63HXYxj9+U adPJgD6KScWBj/FLsapVemfh5Y62PUEYALpQggF4L9s+l8AqzfmNyPMiaWSD2H9kT/6V eDfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=B6e+y0kEKAyoqK/zkkSq/yvGJ/MugkwS3j32M6D9xhA=; b=wW3I4PRW49TTQPJXvkmxs19Bq8NtN8i39o5eYJHSuQHqXNAv6e7VnJheq8QpjMmDpJ nGCXlfZl1pdneZaWHjVMt6EKoXSnLF5Bb/+tf4p9YqK9F1SO7Z8+4JP1wjswlQAtB2bo fQ4K6x8qQVIXVDL2y1GTCJEIAxXVSspaD7BaDt6/GPfS/ui8JG+JtsgmaGqp3YoxiMvf BYHzNs1guVwFCOKp3naBHGtR430yac2U6cz1/gCQXve42s/4JU33WPLUHi22qwVnP7WU 43gmrbwSWIf39xePPCM0DmKN0tNOjKn59ENx7ddVXmGDQMhzK+kyuZOrtQ+xiss8Jutt nMhg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id e50si1386370wre.3.2018.01.02.07.24.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jan 2018 07:24:20 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.9; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3z9yXN0YT2z1qrjc; Tue, 2 Jan 2018 16:24:20 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 3z9yXN0QNwz26T2D; Tue, 2 Jan 2018 16:24:20 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id sXnN3o5Xz2ja; Tue, 2 Jan 2018 16:24:19 +0100 (CET) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Tue, 2 Jan 2018 16:24:19 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 34503454050A; Tue, 2 Jan 2018 16:24:19 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iD2PC43Blwsq; Tue, 2 Jan 2018 16:24:17 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id EED55454027F; Tue, 2 Jan 2018 16:24:16 +0100 (CET) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 1/2] Simply rename extract_script to extract_scripts Date: Tue, 2 Jan 2018 16:24:12 +0100 Message-Id: <1514906653-28174-1-git-send-email-sbabic@denx.de> X-Mailer: git-send-email 2.7.4 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , The function extracts all scripts in the list. Signed-off-by: Stefano Babic --- corelib/installer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/corelib/installer.c b/corelib/installer.c index 4890e83..02461f7 100644 --- a/corelib/installer.c +++ b/corelib/installer.c @@ -145,7 +145,7 @@ int check_if_required(struct imglist *list, struct filehdr *pfdh, * Extract all scripts from a list from the image * and save them on the filesystem to be executed later */ -static int extract_script(int fd, struct imglist *head, const char *dest) +static int extract_scripts(int fd, struct imglist *head, const char *dest) { struct img_type *script; int fdout; @@ -166,7 +166,7 @@ static int extract_script(int fd, struct imglist *head, const char *dest) return fdout; ret = extract_next_file(fd, fdout, script->offset, 0, - script->is_encrypted, script->sha256); + script->is_encrypted, script->sha256); close(fdout); if (ret < 0) @@ -260,7 +260,7 @@ int install_images(struct swupdate_cfg *sw, int fdsw, int fromfile) /* Extract all scripts, preinstall scripts must be run now */ if (fromfile) { const char* tmpdir_scripts = get_tmpdirscripts(); - ret = extract_script(fdsw, &sw->scripts, tmpdir_scripts); + ret = extract_scripts(fdsw, &sw->scripts, tmpdir_scripts); if (ret) { ERROR("extracting script to %s failed", tmpdir_scripts); return ret; From patchwork Tue Jan 2 15:24:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 854583 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4010:c07::23c; helo=mail-lf0-x23c.google.com; envelope-from=swupdate+bncbcxploxj6ikrbjwiv3jakgqeefvifzi@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="GmrmjXy8"; dkim-atps=neutral Received: from mail-lf0-x23c.google.com (mail-lf0-x23c.google.com [IPv6:2a00:1450:4010:c07::23c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3z9yXV2l28z9t3H for ; Wed, 3 Jan 2018 02:24:26 +1100 (AEDT) Received: by mail-lf0-x23c.google.com with SMTP id f20sf2210958lff.20 for ; Tue, 02 Jan 2018 07:24:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1514906663; cv=pass; d=google.com; s=arc-20160816; b=xFgx+kwnBOyVgN1VPKZsZU0dgpWx3kFhrFLyJOfwdntH2sjqqIp8RUspeE8ee6UKaH j/arkGowd1Q4FujqSKaJG5tIDg7aZO6skrR2NiyR/LWe+YuQ8rGQNf/qnJm8hSEeh3jK vaiGhHiWGGCgLSXfcEDGL6luDWgPwjNYlCvrDxeoNjlWgjy/4X2d6PU72qepGAfGlHdW z0K+P6k7yAVBumuFuzIT8JkjgZ8XnSHf73cJNRTPIUsojxjugFxWMk2EsnEi7jHfioVm YvhDR6irWartozDdUHwduoGgF2+RnX2aQDswg6OiT2FK1ZffbhhmeDuiHQkB0PB+yMz6 YaDA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:arc-authentication-results :arc-message-signature:mime-version:sender:dkim-signature :arc-authentication-results; bh=tTVmeU1EEJmjEVCynXNKodBIGuyApUZjR8jbJAUgqLI=; b=vPfC6vz3iep+tCUS2f1NA+B6cvjpJEZT71wagVIge03SuLwkfXywBTlQg8T3Qt+Tr7 +rOmkT2gixVO2Xe2GPAiJOd670VkER4ZPi9CxfTa/7xcuDO3CF42XQ+tosZcTcJ73eo+ r78OzF6iQVnDpdKyI/CQaJrbRweELOijQVG58vHK8Owv+0SstyTZAfdz36kdeQtmOU8S XZH05ftkDeRLSnG8a9ic6h64oVfSpH7N63jFmUItHE3O4EcjGfSr3i9KabWpxcikLsyI sm0AAVU+hjJyAJ8O1KcsVuOqnq3gzwzRdQLTsZq2I5oF0Wvvj7Rx1sFPRJTgyHbKsb5B 0HOQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=tTVmeU1EEJmjEVCynXNKodBIGuyApUZjR8jbJAUgqLI=; b=GmrmjXy8ewqHqouVRqBw8izJvF/cdXiHdlwCTNRZgaqmtVWWAvBMzPCQgc+WuJTUT4 jPxkFDn9BVzpUu410WTEGdCTTfhF8AR0CZMFj4rdI4K02vEc0wVVFVr/+EeWNzxNPdWe ih1Vovec/yQkopDtme8SDmJingOuWGQKPubUTjqOqdELZHRmShbHPjXy7JgjCdc+VxQf lfU1zuoqGKieB/X6/yeQ25ObWTrDGJD7encV54bJdxy9VnKEEf7NZiMnpXdfbomSrpOm HqhRVImNcFX+sHI4K7EtRQ6INM3yyruTTQHcHKlgIbzIn9qt8zjdfPO3xWY4//YF6j2v bACA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=tTVmeU1EEJmjEVCynXNKodBIGuyApUZjR8jbJAUgqLI=; b=rkLPqcVif/FarRVPf0PQNrnjRsJApH9lJUpYXM0ohwQpthLmwuw2EtqXMSdbHYOhdH snFOC32L+BMKXTBcfL4TAaiyhRfoAzkn/IebH3Fnis8r7fxtt/FF7EoPzRWfvVUGTj88 ZrjIOkfBBBRPQCk86A4MewJ2BOwSK7NMR0PbtGQqxA+15dRRuYCQgnq6AQDHWayrvN/w CEFtBq34NV5kms2e0VKs/O370iJh+8OVrGZxddZrbIccTDz51tGjSJtIsVXGfXW96OmX QvapRDHAnyeeKl4ZYGVCo9qMAN4GOmhvzd91WtCTaiy3h4PSK0ceTiAaqbKdHtFCaI2F o2og== Sender: swupdate@googlegroups.com X-Gm-Message-State: AKGB3mJsNCeO54wQPFtTgH8DCmBkhvBLW4gnyyvvmiqDKB7uCS0dwdV0 1pzDvh0keomOo7VgFVCekQU= X-Google-Smtp-Source: ACJfBouYoc1XHBHdu++iYuML1Vc4OKJ66i6UYBfazb3v0EJurCIDavEEn8kYAKZuQcEfitIBaLWlGg== X-Received: by 10.25.140.82 with SMTP id i18mr60509lfj.0.1514906663175; Tue, 02 Jan 2018 07:24:23 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.46.109.2 with SMTP id i2ls3382597ljc.14.gmail; Tue, 02 Jan 2018 07:24:22 -0800 (PST) X-Received: by 10.46.17.133 with SMTP id 5mr2919201ljr.34.1514906662410; Tue, 02 Jan 2018 07:24:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514906662; cv=none; d=google.com; s=arc-20160816; b=akuKOSkUbPAvhLaPKS0RZBYFWBWESJ7WNuefxnojXWaZjQ7kD5IFshkjTBry4RrTsB NAnncxWwdIz4Ms0k5xJ5OBXzl3NIONvr3Zlr5bicqhRp752gzcBnsoxp80QXdhpWT0SH z64PQRR0NhKh4IiBzGOHGhjhJ3u0DkOpV6cRTr3YRE6Ac9syj04HDHtFpnNuKQPs00JE zTGP3Sv1d5DT2667YaVFdY41XZri7R+i8aVyEdHNYFkK4IMMAP/wf5kMabLBhKWfZnVe lYF4SRYDXcq4g3TOUcNdXSFqdNoOKj5A3U09kAEAiIPRqQhXK24awNM1dlNsQNrb1F4O Yt+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Cs+EUk7C2abaGS83LCGyJGMKjgSEhwmuAU1zjT2xC3Y=; b=qm7ni+ax2cjQQlXmwYuShDe8bbQO/g3gfZ5/clcQ85LjrnCIcQZVTW0bP3DvMeZcsq JwT5dZjlUv2aUrZeUoSB2IxAikj2EKXkQ6/8paae1a3t39d43KoSQTVEYZjlEzhjxOHW 8eU9nN6TGnTWuwPduDudsn9OGyARHwhntUo5gib1adxcm1qeFIEZbA/H7ENcyfhRmylb lO1WXIUNM2JND4M5uUVFhEUxdRazs2EPq8Vy0u+BsS9wIK3agtaSxYz+VNR2OQSbBVwo eZrWOUY1mAwYx6qw8Q60R8gE7ZqCcbHajPXdfu4vj8H5zeP4OwRHh30mVUBjNggtdxZm 6CtA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id b78si2441455ljf.3.2018.01.02.07.24.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jan 2018 07:24:22 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.9; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3z9yXP59lcz1qrjc; Tue, 2 Jan 2018 16:24:21 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 3z9yXP52PBz26T2D; Tue, 2 Jan 2018 16:24:21 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id auwM3vfufNWy; Tue, 2 Jan 2018 16:24:20 +0100 (CET) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Tue, 2 Jan 2018 16:24:20 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 7C117454027F; Tue, 2 Jan 2018 16:24:20 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IhSOukyMKUjb; Tue, 2 Jan 2018 16:24:18 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id ED97D45403CF; Tue, 2 Jan 2018 16:24:17 +0100 (CET) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 2/2] Allow to encrypt scripts Date: Tue, 2 Jan 2018 16:24:13 +0100 Message-Id: <1514906653-28174-2-git-send-email-sbabic@denx.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514906653-28174-1-git-send-email-sbabic@denx.de> References: <1514906653-28174-1-git-send-email-sbabic@denx.de> X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Scripts cannot be up now encrypted, because SWUpdate tries to run it without decrypting. It works for local install because the script is extracted and copied before beeing executed, but not when the script is simply extracted from stream. Factorize script extraction and decrypt scripts before passing them to the handler. Signed-off-by: Stefano Babic --- corelib/installer.c | 56 +++++++++++++++++++++++++++++++++++++--------- corelib/stream_interface.c | 2 +- 2 files changed, 46 insertions(+), 12 deletions(-) diff --git a/corelib/installer.c b/corelib/installer.c index 02461f7..fc3011e 100644 --- a/corelib/installer.c +++ b/corelib/installer.c @@ -145,11 +145,12 @@ int check_if_required(struct imglist *list, struct filehdr *pfdh, * Extract all scripts from a list from the image * and save them on the filesystem to be executed later */ -static int extract_scripts(int fd, struct imglist *head, const char *dest) +static int extract_scripts(int fd, struct imglist *head, int fromfile) { struct img_type *script; int fdout; int ret = 0; + const char* tmpdir_scripts = get_tmpdirscripts(); LIST_FOREACH(script, head, next) { if (script->provided == 0) { @@ -159,14 +160,44 @@ static int extract_scripts(int fd, struct imglist *head, const char *dest) } snprintf(script->extract_file, sizeof(script->extract_file), "%s%s", - dest, script->fname); + tmpdir_scripts , script->fname); fdout = openfileoutput(script->extract_file); if (fdout < 0) return fdout; - ret = extract_next_file(fd, fdout, script->offset, 0, - script->is_encrypted, script->sha256); + if (fromfile) + ret = extract_next_file(fd, fdout, script->offset, 0, + script->is_encrypted, script->sha256); + else { + int fdin; + char *tmpfile; + unsigned long offset = 0; + uint32_t checksum; + + if (asprintf(&tmpfile, "%s%s", get_tmpdir(), script->fname) == + ENOMEM_ASPRINTF) { + ERROR("Path too long: %s%s", get_tmpdir(), script->fname); + close(fdout); + return -ENOMEM; + } + + fdin = open(tmpfile, O_RDONLY); + free(tmpfile); + if (fdin < 0) { + ERROR("Extracted script not found in %s: %s %d\n", + get_tmpdir(), script->extract_file, errno); + return -ENOENT; + } + + ret = copyfile(fdin, &fdout, script->size, &offset, 0, 0, + script->compressed, + &checksum, + script->sha256, + script->is_encrypted, + NULL); + close(fdin); + } close(fdout); if (ret < 0) @@ -258,13 +289,11 @@ int install_images(struct swupdate_cfg *sw, int fdsw, int fromfile) const char* TMPDIR = get_tmpdir(); /* Extract all scripts, preinstall scripts must be run now */ - if (fromfile) { - const char* tmpdir_scripts = get_tmpdirscripts(); - ret = extract_scripts(fdsw, &sw->scripts, tmpdir_scripts); - if (ret) { - ERROR("extracting script to %s failed", tmpdir_scripts); - return ret; - } + const char* tmpdir_scripts = get_tmpdirscripts(); + ret = extract_scripts(fdsw, &sw->scripts, fromfile); + if (ret) { + ERROR("extracting script to %s failed", tmpdir_scripts); + return ret; } /* Scripts must be run before installing images */ @@ -422,6 +451,11 @@ void cleanup_files(struct swupdate_cfg *software) { if (img->fname[0]) { if (snprintf(fn, sizeof(fn), "%s%s", get_tmpdirscripts(), img->fname) >= (int)sizeof(fn)) { + ERROR("Path too long: %s%s", get_tmpdirscripts(), img->fname); + } + remove_sw_file(fn); + if (snprintf(fn, sizeof(fn), "%s%s", get_tmpdir(), + img->fname) >= (int)sizeof(fn)) { ERROR("Path too long: %s%s", TMPDIR, img->fname); } remove_sw_file(fn); diff --git a/corelib/stream_interface.c b/corelib/stream_interface.c index f0e1f3b..a200d7e 100644 --- a/corelib/stream_interface.c +++ b/corelib/stream_interface.c @@ -197,7 +197,7 @@ static int extract_files(int fd, struct swupdate_cfg *software) */ skip = check_if_required(&software->scripts, &fdh, NULL, - get_tmpdirscripts(), + get_tmpdir(), &img); } TRACE("Found file:\n\tfilename %s\n\tsize %u %s",