From patchwork Sun Mar 11 11:20:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 884233 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:c0c::23a; helo=mail-wr0-x23a.google.com; envelope-from=swupdate+bncbcxploxj6ikrbevcstkqkgqe6nvjhda@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="QRQu9BXb"; dkim-atps=neutral Received: from mail-wr0-x23a.google.com (mail-wr0-x23a.google.com [IPv6:2a00:1450:400c:c0c::23a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zzdw5470pzB3R5 for ; Sun, 11 Mar 2018 22:20:53 +1100 (AEDT) Received: by mail-wr0-x23a.google.com with SMTP id k44sf1613130wrc.3 for ; Sun, 11 Mar 2018 04:20:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1520767250; cv=pass; d=google.com; s=arc-20160816; b=UHC5ICSY7eh//O2+SyDl2iVnPqqDN1Rq2SimU7Cvr7eRob4UOJQ/kh4djhjpQPg80Q YGlnCsBHAeq8N3DZnwwtRJf3/Ax6pwcQOcsZDR0JYE6/RoTRBxqvQAMpl3uUtsXsEUmi 5VUOOkR1PPrSRH6aeAbpeDCCNpINBxlKBPWSJBNOw8csuzjiuHJxSJdLJOVY8GLPZ2R9 /RB88gF18fml1jD7q6zTLcyqEYZ+ILimqsJ5loWp6xEp5v2l4fR3cvjmYiC0WfBk77N9 1TVP3yPxp3gnjBxDpozGpQw0+sJTsyNMkqivWBni5wBr/MYFGHqPYrJxSa5jKhoU9PP5 FAWQ== 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=yHwFpn6/6NllVFEWbd+iY0BgxFPm/agNEfmjjQWH/QI=; b=iqsJzjTRsAUE04QV8PYnyUGO4ArusAHDb1M6Y8YHnrg0r12HXtu+uPkeq/P/t8TDp0 pS4XZIh/lbI+wDYwAcA9bC+v0M24VcsniC2uEz0An4pjRcknIebiVbmoxJqcYDlU0/Up 4/VSm2o9aAJ+DlFK60Po8OpLGnhAogdP0CLhi+Kux3CCFS/3j8P81vqBFDcfx4CjMi16 tLDeQSfYyvwYn2kLqd8u4fUEHkRP9wOcrI7pH6HDPExEw9U5yFLTFSPo6O/l8RIUfRI7 4id498IwZ2hQg/hlm8D6QFgpVdcXyBjsAdG5Xgy821Tbzl2Es0cTRLAMn0/spHfcM233 z94g== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 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=yHwFpn6/6NllVFEWbd+iY0BgxFPm/agNEfmjjQWH/QI=; b=QRQu9BXbdoz3WYtjArodSUJKrzqDED7mxX1y0t2GRLUaIdK6JqF7oSk/AzBynKeKhX DqJB1pfxoJYKP1TM4MASj1qQhuSN9A//ifuHEbB8kI8HhAU0sBo+4EwTumtU37BWtw1I qJ+TZtf78gumo1kkLbE8PWO3+y0rTxGzhWX1ECMcTIFECV5orkQf6hAzgb1OEOMfKf6s Jn7GOH/+5dzzkmFLRw2Hw6MLO3OuH8YcBM0V1KZ1lEz9zndMaEvZb5QxaGxZtplvAXT2 cEkuBq3KMkyhSr7S0nZXbqlAXjKCTyvGViQYjSg3W4Uix3YA4AZHriCELLCLg4Qhn1AU eRNw== 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=yHwFpn6/6NllVFEWbd+iY0BgxFPm/agNEfmjjQWH/QI=; b=OQqHHWKv8jMUxuln1ctwzssQPJ1azfdNzMde8Rjpjrlsif6pW1siSW8w7NqvQVUlaI escAi+BYKVnJ/rD8AJI9M1J/FmJT+8svtCiOXSorQ1OA2ndFXDtguIkpnqveEIb+Z0uB 9zhgq0d9LIjVp0Wd7V8v6vFG2Yb9shAW1RjlZckmhKzCkjvCdUckYgDMsyOqshyRPHUe 0bHvsrgD9JagYpoULZBSztByY6XplO+HkM3/ym36lE5BfjyUGC/ODeNKfgmFymY3Kjb6 3R5BgADKiN8R9LE0eRal5Tt7tQyfwzTtJ/Y2V5h2c/XsvzYyHGY06j3MJfqNCffO7alg aYvg== Sender: swupdate@googlegroups.com X-Gm-Message-State: AElRT7Ghg2LhRoaYW6hD/abFMnNtelhNdcEmG94RIPdu9ihOXladwmJE naqxTWXzQ3Q0wZBy7uATQnc= X-Google-Smtp-Source: AG47ELtvsKH0B/0wZllvEvS3WMu1UNGoaCY99fdyw3WYLi3OXyvEK3X6WFAStGC3pMfK7Cz0xjpp5w== X-Received: by 10.28.122.4 with SMTP id v4mr42044wmc.6.1520767250926; Sun, 11 Mar 2018 04:20:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.28.0.78 with SMTP id 75ls1109933wma.4.gmail; Sun, 11 Mar 2018 04:20:50 -0700 (PDT) X-Received: by 10.28.239.16 with SMTP id n16mr331498wmh.23.1520767250464; Sun, 11 Mar 2018 04:20:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520767250; cv=none; d=google.com; s=arc-20160816; b=ruOBmkhu+1d7Vtfm4ZyXc8LQqSueTpcg9N1nMgxPh6h2w8GTAvwsXEkNtqIGO02Y8z Dqdq0felUUxE2aH8sRZCjaUh/bBWf1vU/4Bin5vUo+u6WbNMLKnRFUus2NTtFFEXEa9j IN6x6lHsryEXiPijVndh+0dmmaYReOVmBioxgdAg6QTZN7vceMBGxNj0qf/BqiegSiqh JH7x3MJwrXtqZY+EjlSK4N4CR+jNIiFojK/EsSoIdim6uh9Jp60DUFAWCMwwd6tidCjH Xr3Z/y7Uxxg3x8yt8tYWQBo4oD68Qluv+lAEWPc8cH424p4DcMIOiiZizb7gc2jhXbnX IAtA== 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=Na/0tlp9ZejOsTevZssGJ7rzPB6556FIhHN8QjaIrXM=; b=gFpJcJUxRbrqJrv7dsEI7UfTM3G1NEsvZJQ3zSgHVRZ31jxvko3bOesC73wUVfBj33 EvZe2WTnojx+TO9/NeSu0CNOH/2wx/yLt4Uwwy4ZZQR+86S0rVnZ80LNshZ7ABd6dYG2 c5kgWsB5fbjcYc0qXT/HoXYfkfiLJS7DGlhMai496IxPhZJka7ocSQ9DKJOBq668Lk7N Cl4MP0q4jmpdUCjOVrb3MDXRjIV/AKaagZMtDNv7TNG4QRQsv98lK5fBd6HouMn/D55E jAjR+WRsJPqPW1lqS3v+LTZbW9l+e3asTgp0zUxJdPZPcuutmLirHuyn9fyc9HXV7Efc tkqg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 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.10]) by gmr-mx.google.com with ESMTPS id a33si172467wrc.5.2018.03.11.04.20.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Mar 2018 04:20:50 -0700 (PDT) Received-SPF: neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.10; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3zzdw21RQhz1qtG5; Sun, 11 Mar 2018 12:20:50 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 3zzdw21Fh2z1sQwy; Sun, 11 Mar 2018 12:20:50 +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 dViIOmstDekN; Sun, 11 Mar 2018 12:20:49 +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; Sun, 11 Mar 2018 12:20:49 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 229DA454055D; Sun, 11 Mar 2018 12:20:49 +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 d859a-uqg5nf; Sun, 11 Mar 2018 12:20:46 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id CB6A44540419; Sun, 11 Mar 2018 12:20:46 +0100 (CET) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH] webserver: set type for "api" to int Date: Sun, 11 Mar 2018 12:20:45 +0100 Message-Id: <1520767245-21091-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.10 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: , api can be just set to 1 or 2. Use an integer instead of a string to define it in configuration file. Signed-off-by: Stefano Babic --- mongoose/mongoose_interface.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c index 87f556f..65e7a08 100644 --- a/mongoose/mongoose_interface.c +++ b/mongoose/mongoose_interface.c @@ -33,7 +33,7 @@ #define MG_ROOT "." enum MONGOOSE_API_VERSION { - MONGOOSE_API_V1, + MONGOOSE_API_V1 = 1, MONGOOSE_API_V2 }; @@ -471,12 +471,18 @@ static int mongoose_settings(void *elem, void __attribute__ ((__unused__)) *dat opts->ssl_key = strdup(tmp); } #endif - GET_FIELD_STRING_RESET(LIBCFG_PARSER, elem, "api", tmp); - if (strlen(tmp)) { - opts->api_version = (!strcmp(tmp, "1")) ? - MONGOOSE_API_V1 : - MONGOOSE_API_V2; + /* + * Get API Version + */ + get_field(LIBCFG_PARSER, elem, "api", &opts->api_version); + switch(opts->api_version) { + case MONGOOSE_API_V1: + case MONGOOSE_API_V2: + break; + default: + opts->api_version = MONGOOSE_API_V2; } + GET_FIELD_STRING_RESET(LIBCFG_PARSER, elem, "global-auth-file", tmp); if (strlen(tmp)) { opts->global_auth_file = strdup(tmp);