Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Nov 2003 23:05:59 -0800 (PST)
From:      Nate Lawson <nate@root.org>
To:        David Schultz <das@FreeBSD.org>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sbin/nologin Makefile nologin.c nologin.sh
Message-ID:  <20031116230357.K59017@root.org>
In-Reply-To: <20031117064021.6223416A4E3@hub.freebsd.org>
References:  <20031117064021.6223416A4E3@hub.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 16 Nov 2003, David Schultz wrote:
>   Modified files:
>     sbin/nologin         Makefile
>   Added files:
>     sbin/nologin         nologin.c
>   Removed files:
>     sbin/nologin         nologin.sh
>   Log:
>   Reimplement nologin(8) as a C program.  This allows us to statically
>   link it at low cost and avoid environment poisoning attacks associated
>   with LD_LIBRARY_PATH.
>
>   Suggested by:   rwatson
>
>   Revision  Changes    Path
>   1.9       +9 -2      src/sbin/nologin/Makefile
>   1.1       +21 -0     src/sbin/nologin/nologin.c (new)
>   1.5       +0 -39     src/sbin/nologin/nologin.sh (dead)
>
> --- /dev/null	Sun Nov 16 22:40:21 2003
> +++ src/sbin/nologin/nologin.c	Sun Nov 16 22:39:38 2003
> @@ -0,0 +1,21 @@
> +/*-
> + * This program is in the public domain.  I couldn't bring myself to
> + * declare Copyright on a variant of Hello World.
> + */
> +
> +#include <sys/cdefs.h>
> +__FBSDID("$FreeBSD: /repoman/r/ncvs/src/sbin/nologin/nologin.c,v 1.1 2003/11/17 06:39:38 das Exp $");
> +
> +#include <sys/types.h>
> +#include <sys/uio.h>
> +#include <unistd.h>
> +
> +#define	MESSAGE	"This account is currently not available.\n"
> +
> +int
> +main(int argc, char *argv[])
> +{
> +
> +	write(STDOUT_FILENO, MESSAGE, sizeof(MESSAGE));
> +	_exit(1);
> +}

Shouldn't that be strlen(MESSAGE) since sizeof includes the terminating
'\0'?

I couldn't help pointing out a bug in a variant of Hello World.  ;-)

-Nate



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031116230357.K59017>