From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id WF+3LDmScWYEOgEAe85BDQ:P1 (envelope-from ) for ; Tue, 18 Jun 2024 13:57:14 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id WF+3LDmScWYEOgEAe85BDQ (envelope-from ) for ; Tue, 18 Jun 2024 15:57:13 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=r5eisrFH; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1718719033; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=dQsC2LpYkb+eoGaxMr7T10H6bJJjT/uxbFd1VpIstTQ=; b=D3hq2Eg/sJfQEf5ByRoaoTlu4YdmIHxNan20Q9OZoJj07Xg/1djyDrlsjuEB0kmwuhavO6 3ZRA3fLvAzXP5P4rS6AfTbDCOhp7XNnYsBjR7SstoGWs8Xxq8xizzjRzZQ85+vAD0ECif0 wP6NwUd+JBMi7uzGt0erYzRP8qdh+5bP84poa2bh1MkkUT4h7ojxfnPb8ixJ7tZUVolqp+ +GbUkgTRTOMztWxB7s1KdzJhNp6HCgT4dcrzLfcMNagGRV90pe+Th/e1smWMgncvan9cYx DyvV2SIbwg8ZNGpmsOvnzdj6p6RLZysn52blvrvPGdHFWakPEP23D5JQv7XDtg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=r5eisrFH; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1718719033; a=rsa-sha256; cv=none; b=ALgVR9riqnMZc5Tv8iB1r64Xvw/DIdTzNw3hhzxwoyft4WhQzS1uxiZvFhkCNtmRAcnpoo Q/HfYTno/abgCxc4z1lVz4cZbraP8dSmnNkDirLIqFsCzf0tgpoJyx8Nwl2xzE/3vSfdDn mITb6kVontCleeFpX5n94AN43wXs/JczbecV0AneNzh306wg3lsUlDf6lBB5HXuLo8UooS npMfnlKi3T7AZMdmLIML+zUS2LXeGfrBspTAdFDH2XcrlFyTjYQV8Ips8eJqO7MYFqRM6p w+ZKFC2YSw1I0+6crWPbUWh+QgRq6S512aC568iFe/lfMuJoibMhiTB6JCkvUw== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5363699AA for ; Tue, 18 Jun 2024 15:57:13 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJZKX-0001lE-PG; Tue, 18 Jun 2024 09:57:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sJZKV-0001km-RS for guix-patches@gnu.org; Tue, 18 Jun 2024 09:56:59 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sJZKV-0002FN-Ip for guix-patches@gnu.org; Tue, 18 Jun 2024 09:56:59 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sJZKX-0004CQ-QM for guix-patches@gnu.org; Tue, 18 Jun 2024 09:57:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71594] [PATCH] file-systems: Allow specifying CIFS credentials in a file. Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 18 Jun 2024 13:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71594 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: vicvbcun Cc: 71594@debbugs.gnu.org Received: via spool by 71594-submit@debbugs.gnu.org id=B71594.171871897216124 (code B ref 71594); Tue, 18 Jun 2024 13:57:01 +0000 Received: (at 71594) by debbugs.gnu.org; 18 Jun 2024 13:56:12 +0000 Received: from localhost ([127.0.0.1]:43801 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sJZJj-0004C0-QI for submit@debbugs.gnu.org; Tue, 18 Jun 2024 09:56:12 -0400 Received: from mail-108-mta111.mxroute.com ([136.175.108.111]:40639) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sJZJe-0004Bu-Hg for 71594@debbugs.gnu.org; Tue, 18 Jun 2024 09:56:10 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta111.mxroute.com (ZoneMTA) with ESMTPSA id 1902ba20c0f00017a3.001 for <71594@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Tue, 18 Jun 2024 13:55:58 +0000 X-Zone-Loop: f33369070b287e64363f3995f290ab5871db19acb2ad X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=dQsC2LpYkb+eoGaxMr7T10H6bJJjT/uxbFd1VpIstTQ=; b=r5eisrFHDnJx71fl2CJr95IgdI NUVwRgQGHZy0RjzkDE+eSl5/0ClhIiqJhwqAS654+gqjSkWyGxgw5NVFnevxIx2xN1bnkWjycXpGZ +0QMKPhzGhjQZgpeto6nRxjHifj+YQHC4uBTrX5zVkN8OmL6n3WgyKsT9Bqo3zrn8nwD4cPAl2ECS gEWz2mxRzbs4yfLhS8B0MUB/Clokt8g5y2B2HJji9K29GVqUyaLusjFxStsRck6YHP9aV851igP7d A0o8aYczdFm/oBsxbLoQ7DshtDBqleOHoLvTyhLL1zFQX4gTETWiYGRb+Dbn5OBakvIw9vYfgowCo TUSF07Rw==; From: Richard Sent In-Reply-To: <434a45cea2afc5e4de5af5b15bc732b7587a979a.1718550930.git.guix@ikherbers.com> (vicvbcun's message of "Sun, 16 Jun 2024 17:59:38 +0200") References: <434a45cea2afc5e4de5af5b15bc732b7587a979a.1718550930.git.guix@ikherbers.com> Date: Tue, 18 Jun 2024 09:55:42 -0400 Message-ID: <877cem1hk1.fsf@freakingpenguin.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Authenticated-Id: richard@freakingpenguin.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -6.36 X-Migadu-Queue-Id: 5363699AA X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -6.36 X-TUID: dBGWKWYFNwrO > + (define (read-credential-file file) > + ;; Read password, user and domain options from file > + (with-input-from-file file > + (lambda () > + (let loop > + ((next-line (read-line)) > + (lines '())) > + (if (not (eof-object? next-line)) > + (loop (read-line) > + (cond > + ((string-match "^[[:space:]]*pass" next-line) > + ;; mount.cifs escapes commas in the password by do= ubling > + ;; them > + (cons (string-replace-substring (string-trim next-= line) "," ",,") > + lines)) > + ((string-match "^[[:space:]]*(user|dom)" next-line) > + (cons (string-trim next-line) lines)) > + ;; Ignore all other lines. > + (else > + lines))) > + lines))))) I'd personally rename this to read-cifs-credential-file or cifs-read-credential-file if it's only used with cifs. You may be able to make this more compact by following a structure similar to authorized-shell-directory? in (guix scripts shell). I believe CIFS will add a password2 mount option in 6.9.4 [1]. We should check if mount.cifs supports putting that option in the credentials file and match their behavior. If that's too much an ask (Guix's mount.cifs may not be new enough), I think a comment or proactive bug report is appropriate. > + (credential-file (and=3D> (string-match "(^|,)(credentials|cred)=3D([^,= ]+)(,|$)" options) Line's a bit long, can we add a newline before options? > + (string-join (read-credential-file credential-file) "," 'prefix) Ditto with ",". Otherwise looks good to me. Thanks, with this I think we handle every mount option the same way as mount.cifs. =F0=9F=98=84 [1]: https://sambaxp.org/fileadmin/user_upload/sambaxp2024-Slides/sxp24-Fre= nch-accessing_remote.pdf, slide 25 --=20 Take it easy, Richard Sent Making my computer weirder one commit at a time.