From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x138.google.com (mail-lf1-x138.google.com [IPv6:2a00:1450:4864:20::138]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 02280097 for ; Sun, 22 Sep 2019 13:12:53 +0000 (UTC) Received: by mail-lf1-x138.google.com with SMTP id r3sf1310383lfn.13 for ; Sun, 22 Sep 2019 06:12:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1569157973; cv=pass; d=google.com; s=arc-20160816; b=dHiK02vw+LIjTxQuk1ro6jsNRk+1/Alopx9nxxaI/QRJ2pahglj8DW5p9Z2sz+mRne mTIeNznrlx87UzWBth7TqFxbPt5zcrevnf4zw2n1XjSg1nSp9mUzGFOEqSsBOE8ceJfQ 5d8vhGdZPaFTu7VfE1JI3pwE38PxR57xtpVDoh7w9X1W3WGZonCGuLrcBgDyxxykwio5 bPM+nNcBdTLdw2yiz1Iz63U4Udeejok8eDbJzU7EHIgKt7SZBDR4oAfvKzFp5WZHKy9Z DY659VHZ7WGOKA0+OgTfDECjEoMsViHISKWl3xIxelZyY3KVX7jeKgd7M4yLTOhH4gfM ijbw== 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:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=IJYnljk2rCrrEaTA7vUHTsQyfsGz7IG0u1b3P9o9mWs=; b=pD9mtc4fHVX19iyTGGq26kAwsj8tXRoZ+lilEBm03yBVvqzbcCIlr3JEfBcn9V1KhA n/WY5mLfxOk+FPx9g5MRqe8yl9sCztJ6wIvLJrIGKKMPYKinEybkGrGrB9svSitQM8e7 EPoE4Nmkzkj4qwmqDqOEMXMRHt79DGM7Nbpf2LtK67DRWNBhf9NmHxzzKns/5TVrtRyf EwmUuINcvTsydZfTBILc4vMkBQhaKd768IKi8iLiGfMMOikVoGHffVv1BQOpxNSF0utf 54UlWFXqeBbH72Q3OdpnRi2xU+tIW2WFQDnrPB9RI++px8fT9FxxgI9F0qbXDOYTHjiJ tYDA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@fifth.space header.s=dkim header.b=MPuoWpT5; spf=pass (google.com: domain of quinq@fifth.space designates 45.32.148.28 as permitted sender) smtp.mailfrom=quinq@fifth.space DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=IJYnljk2rCrrEaTA7vUHTsQyfsGz7IG0u1b3P9o9mWs=; b=YWaNbyhXJC+OWDlk12wh7RL5TnGw1Kid+ubHPJnjzuBAkKAIDLccDbyE7XMtNZG9pn GtWOd3nGGKr6R7//wwVpNAqT8bE7WK/mG2g8rnF+4ZEnJ3AT9k1r4+tu+ILYu5A8ji76 8TNNBQvxV7Y+y7vMhDzcvDBnpFGqM50RMiwrIYnRwBY7v+awQ79Gr/l9qTYc8Q1g2L0A q8HzVjiABb/NNlolu4u6sBmg9BVMsHzsR4gRaskzNBzpc+DMBhb7LQvEEs6Bpz0ENL0Q c6nXw5b+MDWhHVpgGl22tY79xsoTC+9KyUSulVayMkhgcnPYX5sjWkXD6zP1SM69KeY3 ruiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version: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=IJYnljk2rCrrEaTA7vUHTsQyfsGz7IG0u1b3P9o9mWs=; b=lgPQ1uvjzA/6PAyulg1CHELdfT85jQjJEjvbsCrgnAxR1QV7+mU2AqVri5S/9tRxAu UUEKtjrPOxup0wlHwwOFddj9fLGSSNwhhbb4B/1qpkQ2c1oV2iFvLeWF+PbTGCG7KBTq IyzavWc6jSkLkHZXZDJKMHwpwYG5mgNl1M5T9GozDBdH8GwcVTG8tO0fFw3uhuWN5qpE GB1gQLIh88BTy3tSwDiYwxYCdWqYxd5iU31+PrWGS+NUTZldlLUE4Py79LkXdn9nS+M3 WAf/+OOjlfDsGQMdM/BHYXPLye95JGKxWBhJgtJ+2w+9dc9Cf+hCK9ZKIVHTNvz2PDe2 O07w== Sender: voidlinux@googlegroups.com X-Gm-Message-State: APjAAAWUNNzpNpGVNw6exlqOeN2kP7Oy48LrQy+MeBb7jmPFK9jW+fls Wvfbe7zh+eqP6AydU1C2yrE= X-Google-Smtp-Source: APXvYqzPLyaZ6kIsJdjXJoPyur0pRWrhWDtY2Nln/O2/mcXHxJ9vcruLL/ogVApiPkVcqNF782Bpxg== X-Received: by 2002:a05:6512:202:: with SMTP id a2mr13774707lfo.175.1569157973536; Sun, 22 Sep 2019 06:12:53 -0700 (PDT) X-BeenThere: voidlinux@googlegroups.com Received: by 2002:ac2:559c:: with SMTP id v28ls1142427lfg.10.gmail; Sun, 22 Sep 2019 06:12:52 -0700 (PDT) X-Received: by 2002:ac2:4d04:: with SMTP id r4mr13841604lfi.57.1569157972971; Sun, 22 Sep 2019 06:12:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569157972; cv=none; d=google.com; s=arc-20160816; b=raoo6ku0H5SeHIwKaG7hGEM4p9t9bEF2+WqxLxcCphC9hb0WPXt53nk6/jmULG1Jvt eSNvM6l/iq2kj9TKNydD93zMVIWDDMypTO9pl9CqDIJzkrJpKPTIAawaxdkEbDRoWLbs lek1/CAXYr2zw77dWMbfwd2e83ujOvGWCkBCjlMhWqz5InF2sMurT5S/6/lVSXCIPW9N 16QNiOz1zvdl/rJD9qfo1nF0UgOU6/QboMgQ3byoQXMaZghEqjSFBbmNbiDC8CcKNUsO ftaLAPFz0lhDNBdg4Z60rL4va4NGT1LXAQP42FlsU0CwOoHT8PstV9ALN08ZQEI/ipnD k9CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:domainkey-signature :dkim-signature; bh=DjHjAiLHrsJITrs/3x+TO40XZFq/zlR2gmIVRFSTiEk=; b=cwqn/9GumMOUcqY3UDoH51JnhEIwQd7tr9CkBTYQuJDCD3r508Qc37OxhUnR/7n8so b7cb5VJK85MQ3TKyrfino6k3eWFogAgviIBz4N/tr3w6XB49VZ+3TXeAyjfPwYJVvm5q fV/gpADzXjwtihvkF2+miMkT8nQeGRqLbnXwb9yjqFAD/bMYWY5TOJgsev8oEdESPGnK aYyAhTQSld7GSLKZW7q6wjJGdLO9xhQBf4egwCk2L5I3YSNZUFfDxrWJ23RA7PLyy5QM X7+1R3XCr2OEzymLhBgT05gIhJvWeGNiqUWgOHnS5PuQo4Br6CRK+2jNJSmtfbNyfZlQ hKUA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@fifth.space header.s=dkim header.b=MPuoWpT5; spf=pass (google.com: domain of quinq@fifth.space designates 45.32.148.28 as permitted sender) smtp.mailfrom=quinq@fifth.space Received: from fifth.space (fifth.space. [45.32.148.28]) by gmr-mx.google.com with ESMTPS id y6si479643lji.0.2019.09.22.06.12.52 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Sep 2019 06:12:52 -0700 (PDT) Received-SPF: pass (google.com: domain of quinq@fifth.space designates 45.32.148.28 as permitted sender) client-ip=45.32.148.28; Received: from fifth.space (localhost [127.0.0.1]) by fifth.space (OpenSMTPD) with ESMTP id 45b402c6 for ; Sun, 22 Sep 2019 15:12:51 +0200 (CEST) Received: from localhost (fifth.space [local]) by fifth.space (OpenSMTPD) with ESMTPA id 588d1fdf; Sun, 22 Sep 2019 15:12:50 +0200 (CEST) From: Quentin Rameau To: Void Linux Cc: Quentin Rameau Subject: [PATCH 2/2] chsh: replace getpw unsafe functions with xgetpw Date: Sun, 22 Sep 2019 15:12:37 +0200 Message-Id: <20190922131237.93849-3-quinq@fifth.space> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190922131237.93849-1-quinq@fifth.space> References: <20190922131237.93849-1-quinq@fifth.space> MIME-Version: 1.0 X-Original-Sender: quinq@fifth.space X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@fifth.space header.s=dkim header.b=MPuoWpT5; spf=pass (google.com: domain of quinq@fifth.space designates 45.32.148.28 as permitted sender) smtp.mailfrom=quinq@fifth.space Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list voidlinux@googlegroups.com; contact voidlinux+owners@googlegroups.com List-ID: X-Google-Group-Id: 289663804196 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , --- login-utils/chsh.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/login-utils/chsh.c b/login-utils/chsh.c index 9b2761157..a9ebec86f 100644 --- a/login-utils/chsh.c +++ b/login-utils/chsh.c @@ -38,6 +38,7 @@ #include "islocal.h" #include "nls.h" #include "pathnames.h" +#include "pwdutils.h" #include "setpwnam.h" #include "strutils.h" #include "xalloc.h" @@ -253,7 +254,7 @@ static void check_shell(const char *shell) int main(int argc, char **argv) { - char *oldshell; + char *oldshell, *pwbuf; int nullshell = 0; const uid_t uid = getuid(); struct sinfo info = { NULL }; @@ -267,12 +268,12 @@ int main(int argc, char **argv) parse_argv(argc, argv, &info); if (!info.username) { - pw = getpwuid(uid); + pw = xgetpwuid(uid, &pwbuf); if (!pw) errx(EXIT_FAILURE, _("you (user %d) don't exist."), uid); } else { - pw = getpwnam(info.username); + pw = xgetpwnam(info.username, &pwbuf); if (!pw) errx(EXIT_FAILURE, _("user \"%s\" does not exist."), info.username); -- 2.21.0 -- You received this message because you are subscribed to the Google Groups "voidlinux" group. To unsubscribe from this group and stop receiving emails from it, send an email to voidlinux+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/voidlinux/20190922131237.93849-3-quinq%40fifth.space.