summaryrefslogtreecommitdiffstats
path: root/login-utils/checktty.c
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:26:54 +0100
committerKarel Zak2006-12-07 00:26:54 +0100
commit48d7b13a1eab85fab91c8d6c5ddf298f733c74f5 (patch)
tree8813d36590ee3361bd75f57a12fd2032e9296ddb /login-utils/checktty.c
parentImported from util-linux-2.12r tarball. (diff)
downloadkernel-qcow2-util-linux-48d7b13a1eab85fab91c8d6c5ddf298f733c74f5.tar.gz
kernel-qcow2-util-linux-48d7b13a1eab85fab91c8d6c5ddf298f733c74f5.tar.xz
kernel-qcow2-util-linux-48d7b13a1eab85fab91c8d6c5ddf298f733c74f5.zip
Imported from util-linux-2.13-pre1 tarball.
Diffstat (limited to 'login-utils/checktty.c')
-rw-r--r--login-utils/checktty.c40
1 files changed, 2 insertions, 38 deletions
diff --git a/login-utils/checktty.c b/login-utils/checktty.c
index 8171f44d2..9c3ce46d0 100644
--- a/login-utils/checktty.c
+++ b/login-utils/checktty.c
@@ -23,33 +23,13 @@
#include <sys/syslog.h>
#include "nls.h"
-#ifdef __linux__
-# include <sys/sysmacros.h>
-# include <linux/major.h>
-#endif
+#include <sys/sysmacros.h>
+#include <linux/major.h>
#include "pathnames.h"
#include "login.h"
#include "xstrncpy.h"
-#ifdef TESTING
-char hostaddress[4];
-char *hostname;
-
-void
-badlogin(const char *s)
-{
- printf("badlogin: %s\n", s);
-}
-
-void
-sleepexit(int x)
-{
- printf("sleepexit %d\n", x);
- exit(1);
-}
-#endif
-
static gid_t mygroups[NGROUPS];
static int num_groups;
@@ -145,7 +125,6 @@ isapty(const char *tty)
return 0;
sprintf(devname, "/dev/%s", tty);
-#if defined(__linux__)
if((stat(devname, &stb) >= 0) && S_ISCHR(stb.st_mode)) {
int majordev = major(stb.st_rdev);
@@ -167,7 +146,6 @@ isapty(const char *tty)
#endif
}
-#endif
return 0;
}
@@ -349,11 +327,7 @@ checktty(const char *user, const char *tty, struct passwd *pwd)
int found_match = 0;
/* no /etc/usertty, default to allow access */
-#ifdef TESTING
- if (!(f = fopen("usertty", "r"))) return;
-#else
if (!(f = fopen(_PATH_USERTTY, "r"))) return;
-#endif
if (pwd == NULL) {
fclose(f);
@@ -439,13 +413,3 @@ checktty(const char *user, const char *tty, struct passwd *pwd)
on all tty's */
free_all(); /* JDS */
}
-
-#ifdef TESTING
-main(int argc, char *argv[])
-{
- struct passwd *pw;
-
- pw = getpwnam(argv[1]);
- checktty(argv[1], argv[2], pw);
-}
-#endif