cvs commit: src/sbin/nologin Makefile nologin.c nologin.sh

Nate Lawson nate at root.org
Sun Nov 16 23:07:28 PST 2003


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


More information about the cvs-src mailing list