--- falselogin-0.3.orig/falselogin.c +++ falselogin-0.3/falselogin.c @@ -37,7 +37,6 @@ #define MAIL_LEN 50 // Function definitions -int readArgs (char *argv[]); int countMail (char userName[]); int main (int argc, char *argv[]) { @@ -49,6 +48,7 @@ struct utsname u_name; // this holds the u_name size_t max_buf = MAXLEN_BUF; // maximum buffer length int ok = 0; // lame control (see passwd filling) + long wait = 0; // seconds (negative to wait for ENTER) temp = malloc(MAXLEN_BUF); // initial allocation (could happen later) // thou shalt not cast @@ -58,7 +58,7 @@ // (it might be a better way) while (!ok) { pwd = getpwent (); - if (pwd->pw_uid == getuid ()) + if (pwd && pwd->pw_uid == getuid ()) ok = 1; } @@ -101,6 +101,16 @@ // buffer which is 1024 bytes long, so only 1023 // characters will be allowed. + // Search for a wait parameter + + if ( !strncmp(temp, "wait=", 5) ) { + if ( !strncmp(temp+5, "enter", 5) ) + wait = -1; + else if ( atol(temp+5) > 0 ) + wait = atol(temp+5); + continue; + } + // Substitutions using passwd and uname structs if (strstr (temp, "%user%") != NULL) @@ -158,7 +168,14 @@ // Now we can check the arguments if (argc > 2) { - if (readArgs(argv) == 255) { + // Supersedes the eventual wait value in the conf file + if ( !strncmp(argv[1], "--wait", 6) || !strncmp(argv[1], "-w", 2) ) { + if ( !strncmp(argv[2], "enter", 5) ) + wait = -1; + else if ( atol(argv[2]) > 0 ) + wait = atol(argv[2]); + } + else { printf("Unknown arguments were given\n"); } } @@ -167,6 +184,13 @@ exit(EXIT_FAILURE); } + // Wait for some time or the user to press ENTER. + // If no wait where specified it doesn't wait (0 sec). + if (wait >= 0) + sleep(wait); + else + while (getchar() != '\n'); + // Bye-bye if we don't have arguments exit(EXIT_SUCCESS); } @@ -190,16 +214,3 @@ return total; } - -int readArgs (char *argv[]) { - if ( !strncmp(argv[1], "--wait", 6) || !strncmp(argv[1], "-w", 2) ) { - if ( !strncmp(argv[2], "enter", 5) ) - while (getchar() != '\n'); - else if ( atol(argv[2]) > 0 ) - sleep(atol(argv[2])); - } - else { - return 255; - } - return 1; -} --- falselogin-0.3.orig/Makefile +++ falselogin-0.3/Makefile @@ -6,7 +6,7 @@ all: falselogin install: falselogin - $(INS) -D -o root -g root -m 0755 -s falselogin $(DESTDIR)/usr/bin/falselogin + $(INS) -D -o root -g root -m 0755 falselogin $(DESTDIR)/usr/bin/falselogin $(INS) -D -o root -g root -m 0644 falselogin.conf $(DESTDIR)/etc/falselogin.conf clean: --- falselogin-0.3.orig/falselogin.conf +++ falselogin-0.3/falselogin.conf @@ -1,11 +1,15 @@ # /etc/falselogin.conf -# This is the configuration file of /bin/falselogin -# See the man for details +# This is the configuration file for falselogin +# See the man page for details # -Welcome at %host% (Debian %debian_version% %sysname% %release%)! +# Uncomment this line if you would like to specify +# a specific wait time without the --wait option: +# wait=5 + +Welcome to %host% (Debian %debian_version% %sysname% %release%)! You have %mail% messages in your mailbox. -Sorry %user% but our server does not accept shell logins. +Sorry %user% our server does not accept shell logins. So long and thanks for all the fish. --- falselogin-0.3.orig/debian/compat +++ falselogin-0.3/debian/compat @@ -0,0 +1 @@ +5 --- falselogin-0.3.orig/debian/upstream.pl +++ falselogin-0.3/debian/upstream.pl @@ -0,0 +1,48 @@ +#!/usr/bin/perl + +# upstream.pl +# creates a new upstream version of a Debian package +# +# Usage: perl upstream.pl +# Please note that if you specify a version number that is the same of this debianized source tree, your +# old orig.tar.gz will get overwritten! + +use strict; +use warnings; + +my $newversion = $ARGV[0]; + +my $pwd = `pwd`; +my $basepwd = `basename $pwd`; + +# If you don't want to specify a version number, it will +# increment by 0.1 +my $increment = 0.1; + +# Let's get the package name +# and the version number +my ($package, $version) = ($1, $2) if $basepwd =~ /([\w\d\_]+)-([\d\.]+)/; +die "Seems like you're not standing in a Debianized source tree.\n" unless (defined ($package) && defined($version)); + +# Let's create a new orig +# working directory +$newversion = $version + $increment unless (defined($newversion) && $newversion ne ''); +my $neworig = "$package_" . $newversion; +print "Creating new orig files for the new upstream version: $neworig\n"; +system ("mkdir $neworig.orig"); + +# Let's copy all the upstream +# files in there +my @files = split("\n", `ls`); +foreach my $file (@files) { + system("cp -R $file $neworig.orig/") unless ($file =~ /^debian$/ || $file =~ /^$neworig.orig$/); +} + +# Now we'll compress the new +# file and delete the temporary +# directory +system("tar czf ../$neworig.orig.tar.gz $neworig.orig/"); +system("rm -rf $neworig.orig/"); + +print "Created a new orig file in ../$neworig.orig.tar.gz\n"; +print "Done! Now you should debian/rules binary again so the .diff.gz is recreated!\n"; --- falselogin-0.3.orig/debian/rules +++ falselogin-0.3/debian/rules @@ -0,0 +1,59 @@ +#!/usr/bin/make -f + +C_ARGS=-W -Wall -g +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + C_ARGS += -O0 +else + C_ARGS += -O2 +endif + +build: build-stamp +build-stamp: + dh_testdir + + $(MAKE) C_ARGS="$(C_ARGS)" + + touch build-stamp + +upstream: clean + perl debian/upstream.pl + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + $(MAKE) install DESTDIR=$(CURDIR)/debian/falselogin + +# Build architecture-independent files here. +binary-indep: build install + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs changelog + dh_installdocs + dh_installman debian/falselogin.1 + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- falselogin-0.3.orig/debian/changelog +++ falselogin-0.3/debian/changelog @@ -0,0 +1,114 @@ +falselogin (0.3-4) unstable; urgency=low + + * New maintainer. + * Adding NULL pointer validation when gets an user account entry from system. + Patch by Petter Reinholdtsen (Closes: #473268) + + -- Kevin Zambrano Thu, 24 Jul 2008 18:16:23 -0430 + +falselogin (0.3-3) unstable; urgency=low + + * Adding a wait option to the configuration file, patch by Cesare + Leonardi (Closes: #448356) + * Removing strip option from Makefile (Closes: #436830) + * New comments in the configuration file. + * Changing maintainer email. + + -- Jose Parrella Wed, 19 Mar 2008 21:21:02 -0430 + +falselogin (0.3-2) unstable; urgency=low + + * Poor grammar in default configuration file (Closes: #386238) + * Uploaded through sponsor Dominic Hargreaves . + + -- Jose Parrella Wed, 6 Sep 2006 20:31:03 -0400 + +falselogin (0.3-1) unstable; urgency=low + + * New maintainer. + Closes: #358516. + * Uploaded through sponsor Thaddeus H. Black . + * Removed Build-depends on Etch/Sid debhelper. + * In falselogin.c: + - Solved segfault when arguments of --wait are not completely + specified. Closes: #369418. + - Solved segfault when no mailbox is found for user. + - Changed %mail% usage so now it will be substituted only by + the number of mails, allowing the user to i18n the mail message. + - Moved mail counting to a separate function so now it will be + called if it's really needed in the conffile. + - Moved calls to other functions into control structures so they + will now be invoked if they're really needed. + - Switched to strgsub in order to avoid possible buffer overruns. + - Switched to getline to avoid undesirable line-handling issues. + * Added debian/upstream.pl which produces new upstream orig files. + * Updated manpage reflecting new behaviours. + * Conforms to Standards version 3.7.2. (no changes) + + -- Jose Parrella Wed, 23 Aug 2006 00:14:27 -0400 + +falselogin (0.2-5) unstable; urgency=low + + * QA upload. + * Package is orphaned (#358516); set maintainer to Debian QA Group. + * falselogin.c: + - Use a larger buffer for the Debian version. Closes: #175530. + - Handle an empty /etc/debian_version. + * Makefile: Make the clean target idempotent. + * Switch to debhelper, finishing the /usr/doc transition. + Closes: #359408. + * debian/copyright: Add full copyright statement. Closes: #302958. + * debian/rules: Add support for DEB_BUILD_OPTIONS=noopt. + * debian/changelog: Remove obsolete Emacs local variables. + * debian/log: Remove cruft. + * Conforms to Standards version 3.6.2. + + -- Matej Vela Thu, 6 Apr 2006 08:44:04 +0200 + +falselogin (0.2-4) unstable; urgency=low + + * Document changelog entries properly (Closes Bug#81880) + + -- Tibor Koleszar Tue, 6 Mar 2001 12:25:24 +0200 + +falselogin (0.2-3) unstable; urgency=low + + * Added "Build-Depends" into control file. (Closes Bug#81734, Bug#82008, Bug#84587) + + -- Tibor Koleszar Tue, 6 Mar 2001 12:11:02 +0200 + +falselogin (0.2-2) unstable; urgency=low + + * Fixed typographical error in man page (Closes Bug#74107) + + -- Tibor Koleszar Tue, 2 Jan 2001 15:17:26 +0200 + +falselogin (0.2-1) unstable; urgency=low + + * Fixed build problems (Closes Bug#54439) + + -- Tibor Koleszar Sat, 8 Jan 2000 20:30:06 +0200 + +falselogin (0.1e-1) unstable; urgency=low + + * Fixed copyright file (Closes Bug#44164) + + -- Tibor Koleszar Wed, 8 Sep 1999 18:19:05 +0200 + +falselogin (0.1d-1) unstable; urgency=low + + * added --wait, check the manual. + + -- Tibor Koleszar Mon, 8 Mar 1999 09:33:17 +0100 + +falselogin (0.1c-1) unstable; urgency=low + + * dpkg will not overwrite configuration file at install. + + -- Tibor Koleszar Wed, 3 Feb 1999 23:49:59 +0100 + +falselogin (0.1-1) unstable; urgency=low + + * Initial Release. + + -- Tibor Koleszar Thu, 28 Jan 1999 18:10:47 +0100 --- falselogin-0.3.orig/debian/copyright +++ falselogin-0.3/debian/copyright @@ -0,0 +1,23 @@ +This package was debianized by Tibor Koleszar on +Wed, 8 Sep 1999 18:19:05 +0200. + +Tibor Koleszar is also the upstream author. + +Copyright (C) 1999-2001 Tibor Koleszar + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General Public License +can be found in `/usr/share/common-licenses/GPL'. --- falselogin-0.3.orig/debian/control +++ falselogin-0.3/debian/control @@ -0,0 +1,14 @@ +Source: falselogin +Section: utils +Priority: optional +Maintainer: Kevin Zambrano +Standards-Version: 3.8.0 +Build-Depends: debhelper (>= 5), publib-dev (>= 0.38-2) + +Package: falselogin +Architecture: any +Depends: ${shlibs:Depends} +Description: false login shell + Strange kind of 'shell' which don't let the user to + log in. Before the next login prompt falselogin gives + some info to the user. --- falselogin-0.3.orig/debian/README.debian +++ falselogin-0.3/debian/README.debian @@ -0,0 +1,6 @@ +falselogin for Debian +---------------------- + +With falselogin you can deny the user to log in the system but gives him/her some info. + +Tibor Koleszar , Wed, 8 Sep 1999 18:19:05 +0200 --- falselogin-0.3.orig/debian/falselogin.1 +++ falselogin-0.3/debian/falselogin.1 @@ -0,0 +1,53 @@ +.TH FALSELOGIN 1 +.SH NAME +falselogin \- a false login shell +.SH SYNOPSIS +.B /usr/bin/falselogin +.br +.SH "DESCRIPTION" +.B falselogin +is a small application which can deny the user to log in the system displaying a custom message. +.SH CONFIGURATION +The configuration file for +.B falselogin +is /etc/falselogin.conf. Everything you write into this file +will be written at login except for some special +strings which will be substituted when they appear in the configuration +file. They are: +.TP +.B %mail% string +Number of mail messages in the user's mailbox. +.TP +.B %user% string +Username. +.TP +.B %sysname% string +Sysname from uname. (eg: Linux) +.TP +.B %nodename%, %host% strings +The hostname. (eg: master) +.TP +.B %release% string +Linux kernel version number (eg: 2.0.36) +.TP +.B %version% string +Linux version number (eg: #8 Sun Dec 20 12:02:31 CET 1998) +.TP +.B %machine% string +Machine type (eg: i686) +.TP +.B %debian_version% string +Debian version from /etc/debian_version +.SH PARAMETERS +.TP +.B --wait, -w waitfor +If +.B waitfor +is a number, falselogin will sleep +.B waitfor +seconds before exiting; if +.B waitfor +matches the word 'enter' then falselogin will wait for the user to input the 'enter' key +.SH AUTHOR +This manual page was written by Tibor Koleszar , +for the Debian GNU/Linux system.