From patchwork Fri Mar 9 13:37:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 883639 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::238; helo=mail-lf0-x238.google.com; envelope-from=swupdate+bncbcxploxj6ikrbjm4rlkqkgqeui6wkvq@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="h+JAinGD"; dkim-atps=neutral Received: from mail-lf0-x238.google.com (mail-lf0-x238.google.com [IPv6:2a00:1450:4010:c07::238]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zyT2y1Wn5z9sc2 for ; Sat, 10 Mar 2018 00:37:45 +1100 (AEDT) Received: by mail-lf0-x238.google.com with SMTP id l14-v6sf2955951lfl.20 for ; Fri, 09 Mar 2018 05:37:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1520602662; cv=pass; d=google.com; s=arc-20160816; b=u3sDG8921UayfH49J+2KqB3TvTvTEr5Dtoyt+DKE5TnkB/WtRnDSPxfh88kfxClHwt OJaLXcwTHW8TPphXBTShHgJlMjUvQLZsy8sJJE+Dik/AEJjXj7xGzwyoHWIegtcJjkF0 jRyi7IZddSutFdzMOrcIL8airFEyxfu611SRoehbQJZabxC+fVDPyzwVp1oEx0HbODDr lRGe//Ni05+G7YpszhxqWlBmefRJBh5LJa6UGbLMmtgWY/SuJkwSUSPoSPqd7ozjv4os tJ9buQD6RlrTCgQx8D2pnbNeZIj+nfk1aT1Q/R9WX6l1qvblg/MxE8hgPEQ4TzNg7nJc b3BA== 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=dFTD/gu4fmUNsD+HBNTBcsYWxPDaWbQyO3P2ZmiTBbw=; b=Vf94jFoc2Z85JEIu6i32Y6ocH29xA5VzKIFOgLkLrq4Xop9boE+kp/4rDLz6813Ptm pBPEqBQSnPYFzBYTbCcJnWhKeSM1l5APWV8+g4p8GTwJ1jrnYmULaYV0WaTYvK1sxVaR /cQV/ujd7yfsqSuB8VgG8cs+9vRYb4BefSk7FhasIN65R87JBiadq6/vuC8hY+LhqJSn cY9Ohx9NUm2f/vjltmT422Azrwxq/kdB0AAg4sjmA6QGCRkqIqJY+p2B2W0reEHtmTYM kr6xEdCRxoHqQA7lHMHbVhK53OsbnKxQ13avpWIy5FOZXLdN2Eg1ag1XzAapcJIs/JWC LArw== 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=dFTD/gu4fmUNsD+HBNTBcsYWxPDaWbQyO3P2ZmiTBbw=; b=h+JAinGDq68YAvoKA4BcuXRGfmtkkohJ1VLOf4oz/S2IPN1/WdgazBqqQiJz93hRyw QqT4DqmSxcryLaSDnSm997mfBrgh4sQTRqedswvzEm6sbc9KRcixZyTiZFNZBUyGtdUL Jf+5dePrHXvbuU6mXQhzkh06JqXgxTDpWNpmAHjvnCTvoHfSxK/xBeZX9FvwlxM5qaah bcWQ1pkrVJnwIHrA5soMZ40KHsI7kc9nqTcPDcTZBG15B2LuTY3M5ADDY9uQQjWC/hzw QkzeO9bcBfNSOJ6yWzy5QVIBFewLD/SSjZ6jwikFVtDEhC6ahPJ/V9Kli9oZpy0m0bsb 6Uxw== 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=dFTD/gu4fmUNsD+HBNTBcsYWxPDaWbQyO3P2ZmiTBbw=; b=lUgrKO/XeqkKi/+g8qxYFXFbUTff+Gprh0N4O5e0Ck2qLcbpB7Ig37aBmU6L6bu2GF 99HdyKNDDR0Ge3s0u1cQ4XYpq5g1I5feR0SbXif1BrQ8vIhJjNh0OyxFBBoSKcjpXsw7 X9wPmKy7CSxEpiD8nUdhRgaa2UrfKmQskrbHnVFr4Bb2vpYViIkKJO7vRWg9mwfO9R13 duXH32VrOQO0XO9uS5CxciHgvkOtBGWCvkAyU5bmKUTIRWaa3dNsHhC4GPgG3Bco1HjF pa+ujMJnqfA5MxhEy5HMPDyCtHQqTruAaaobpjcHK1jPVkiKo8SmNmX1YM8nHqtZuiQE RAXQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: AElRT7HchwNsZdtOn1j0gKXIFkFjDBu6yf6A1MQR8duq3CrvvcvCIj2U 3aeLYMGCC9Myy7pj8GLldHc= X-Google-Smtp-Source: AG47ELuRRXLWciwqXEpEHO0Pf4nZ0C0oIYXUcu0lScGjtz/pUKGfcaFdz7px86snLYR0uj9VFBSHJw== X-Received: by 10.25.26.20 with SMTP id a20mr107369lfa.1.1520602661943; Fri, 09 Mar 2018 05:37:41 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a19:be15:: with SMTP id o21-v6ls877450lff.8.gmail; Fri, 09 Mar 2018 05:37:40 -0800 (PST) X-Received: by 10.25.158.145 with SMTP id h139mr2225939lfe.30.1520602660315; Fri, 09 Mar 2018 05:37:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520602660; cv=none; d=google.com; s=arc-20160816; b=Nw0mNunyGerIGuVZFQAaKC5yu58pntjqmOXO4BCqxNhpeH2C0sJsvcYtcLpXIdGBtC mTZhi2bhsp4gpB+09KEVN3e8BrzHkUBphfjKHI4frG2XBxDlMTtxgz3VvnKHCqAC5gAN iEBXJmSge/eJq+lDyNbg/xL+UlCiuAq8w5jQkvDxwa0ZauV+30truc+d6Iys+LCm0ret 24L0iS8s/9X/K2w0573z2Dx4i0Q3hQeFxb4OKCGbNtXkobjegbCGkaebwfxEcCwlePip IOStl9kWGOfCnWrGIb0nVzHa8+xDYAD7vcTellJLSAYRr5nP7Y7iO4eCCt4yq8zmqc5j Tuyw== 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=jHYVHe/NLXx+pqFs1x6zWs3Ul9M3igsK6Lv2hNbZeGQ=; b=cTMBNwIQDcf9GzcyOr+9pgMGa6X8R1b1ifYRHv0ruQyz1BwCxC3jZ9lL41FzPgC4iD IZhHmIV688Pm90w9HE80hIryZH0KfOzoamRfn90eLMWPPaXiBNtUZclwVzbtEbWiSjeI piFbewZ5L9zy7aK5eLDtGxOhql/3hPThEvc4FqXu/HfxXDwki7wuuSgdvirOOViGB9oZ s4haPQWPaN6G9FYZgfTOPkqG/AOu/nBxenBG3lY3k+oY9hul2auvWUy/YHtCgLDjmND/ ty1LeF9DDC+nfg4NyYDzMQ/x+53W2rxnFfztUr+AlIu+qyRmhvejxTJONGSOI+zSdqd7 Q1YA== 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 m18-v6si40161lfj.0.2018.03.09.05.37.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 05:37:40 -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 3zyT2q54Htz1qwC2; Fri, 9 Mar 2018 14:37:39 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 3zyT2q4tqDz1qql5; Fri, 9 Mar 2018 14:37:39 +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 ff1ReMTAYeE3; Fri, 9 Mar 2018 14:37:38 +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; Fri, 9 Mar 2018 14:37:38 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id D2461454041A; Fri, 9 Mar 2018 14:37:37 +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 S3EMNqzDY-ZH; Fri, 9 Mar 2018 14:37:35 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 753624540417; Fri, 9 Mar 2018 14:37:35 +0100 (CET) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH] mongoose: reintroduce global-auth-file and auth-domain Date: Fri, 9 Mar 2018 14:37:32 +0100 Message-Id: <1520602652-13884-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 two options were removed after upgrading the Webserver. Some users need them. Reported-by: Lars Lockenvitz Signed-off-by: Stefano Babic --- mongoose/mongoose_interface.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c index 99f5a5d..e98a7c6 100644 --- a/mongoose/mongoose_interface.c +++ b/mongoose/mongoose_interface.c @@ -41,6 +41,8 @@ struct mongoose_options { char *root; char *listing; char *port; + char *global_auth_file; + char *auth_domain; #if MG_ENABLE_SSL char *ssl_cert; char *ssl_key; @@ -477,6 +479,14 @@ static int mongoose_settings(void *elem, void __attribute__ ((__unused__)) *dat MONGOOSE_API_V1 : MONGOOSE_API_V2; } + GET_FIELD_STRING_RESET(LIBCFG_PARSER, elem, "global-auth-file", tmp); + if (strlen(tmp)) { + opts->global_auth_file = strdup(tmp); + } + GET_FIELD_STRING_RESET(LIBCFG_PARSER, elem, "auth-domain", tmp); + if (strlen(tmp)) { + opts->auth_domain = strdup(tmp); + } return 0; } @@ -491,6 +501,8 @@ static struct option long_options[] = { #endif {"document-root", required_argument, NULL, 'r'}, {"api-version", required_argument, NULL, 'a'}, + {"auth-domain", required_argument, NULL, '0'}, + {"global-auth-file", required_argument, NULL, '1'}, {NULL, 0, NULL, 0} }; @@ -507,7 +519,9 @@ void mongoose_print_help(void) "\t -K, --ssl-key : key corresponding to the ssl certificate\n" #endif "\t -r, --document-root : path to document root directory (default: %s)\n" - "\t -a, --api-version [1|2] : set Web protocol API to v1 (legacy) or v2 (default v2)\n", + "\t -a, --api-version [1|2] : set Web protocol API to v1 (legacy) or v2 (default v2)\n" + "\t --auth-domain : set authentication domain if any (default: none)\n" + "\t --global-auth-file : set authentication file if any (default: none)\n", MG_LISTING, MG_PORT, MG_ROOT); } @@ -535,6 +549,14 @@ int start_mongoose(const char *cfgfname, int argc, char *argv[]) while ((choice = getopt_long(argc, argv, "lp:sC:K:r:a:", long_options, NULL)) != -1) { switch (choice) { + case '0': + free(opts.auth_domain); + opts.auth_domain = strdup(optarg); + break; + case '1': + free(opts.global_auth_file); + opts.global_auth_file = strdup(optarg); + break; case 'l': opts.listing = (char *)"yes"; break; @@ -575,6 +597,8 @@ int start_mongoose(const char *cfgfname, int argc, char *argv[]) s_http_server_opts.enable_directory_listing = opts.listing ? opts.listing : MG_LISTING; s_http_port = opts.port ? opts.port : MG_PORT; + s_http_server_opts.global_auth_file = opts.global_auth_file; + s_http_server_opts.auth_domain = opts.auth_domain; memset(&bind_opts, 0, sizeof(bind_opts)); bind_opts.error_string = &err_str;