Package: libpam-foreground
Version: 0.2
Tags: patch
Version 0.3 of this package in Ubuntu contain a suid program
check-foreground-console for making it easier to check if a user is in
the foreground on the console form scripts. I suspect it would be
useful to have this program in Debian as well, at the very least to
reduce the divergence with the Ubuntu version.
Here is the patch from Ubuntu to add the script.
diff -urN libpam-foreground-0.2/check-foreground-console.c
libpam-foreground-0.2-debian/check-foreground-console.c
--- libpam-foreground-0.2/check-foreground-console.c 1970-01-01
01:00:00.000000000 +0100
+++ libpam-foreground-0.2-debian/check-foreground-console.c 2007-07-07
09:27:10.000000000 +0200
@@ -0,0 +1,50 @@
+/*
+ * check-foreground-console: A tool to check if the current console is owned
+ * by the calling user.
+ *
+ * Copyright 2006 Daniel Silverstone <[EMAIL PROTECTED]>
+ *
+ * Licence: GPL v2 (but not later)
+ */
+
+#define CONSOLEDIR "/var/run/console"
+#define FILEPATTERN "%s/%s:%d"
+#define DIEIF(X) if ((X)) return 2;
+
+#include <limits.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <linux/vt.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <pwd.h>
+#include <string.h>
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+ char buffer[PATH_MAX];
+ char *username;
+ int fgvt;
+ int fd;
+ struct vt_stat vtstat;
+ struct passwd *userinfo;
+
+ fd = open("/dev/console", O_RDWR);
+ DIEIF((fd < 1));
+ DIEIF((ioctl(fd, VT_GETSTATE, &vtstat)));
+ close(fd);
+ fgvt = vtstat.v_active;
+ DIEIF((fgvt > 99));
+
+ userinfo = getpwuid(getuid());
+ username = userinfo->pw_name;
+
+ /* All gathered together */
+ snprintf(buffer, PATH_MAX, FILEPATTERN, CONSOLEDIR, username, fgvt);
+
+ return ((open(buffer, O_RDONLY)) == -1);
+
+}
diff -urN libpam-foreground-0.2/debian/rules
libpam-foreground-0.2-debian/debian/rules
--- libpam-foreground-0.2/debian/rules 2007-07-06 23:36:56.000000000 +0200
+++ libpam-foreground-0.2-debian/debian/rules 2007-07-07 09:27:10.000000000
+0200
@@ -45,7 +45,11 @@
# Add here commands to install the package into
debian/libpam-foreground.
mkdir -p debian/libpam-foreground/lib/security
+ mkdir -p debian/libpam-foreground/bin
cp pam_foreground.so debian/libpam-foreground/lib/security
+ cp check-foreground-console debian/libpam-foreground/bin/
+ chown root:root debian/libpam-foreground/bin/check-foreground-console
+ chmod u=rwxs,g=rx,o=rx
debian/libpam-foreground/bin/check-foreground-console
# Build architecture-independent files here.
@@ -73,7 +77,7 @@
dh_link
dh_strip
dh_compress
- dh_fixperms
+ dh_fixperms -Xcheck-foreground-console
# dh_perl
# dh_python
# dh_makeshlibs
diff -urN libpam-foreground-0.2/Makefile libpam-foreground-0.2-debian/Makefile
--- libpam-foreground-0.2/Makefile 2007-07-06 23:59:44.000000000 +0200
+++ libpam-foreground-0.2-debian/Makefile 2007-07-07 09:27:10.000000000
+0200
@@ -1,7 +1,11 @@
+all: pam_foreground.so check-foreground-console
+
+check-foreground-console: check-foreground-console.c
+ gcc -O0 -g -Wall -o check-foreground-console check-foreground-console.c
+
pam_foreground.so: pam_foreground.c
gcc -fPIC -O2 -Wall -c pam_foreground.c
ld -x --shared -o pam_foreground.so pam_foreground.o -lpam -lc
clean:
- - rm *.o *.so
+ - rm *.o *.so check-foreground-console
-default: pam_foreground.so
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]