Author: jsuchome
Date: Fri Oct 5 11:34:11 2007
New Revision: 41266
URL: http://svn.opensuse.org/viewcvs/yast?rev=41266&view=rev
Log:
backporting for SLE10... (fate 302658)
Added:
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/MAINTAINER
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/Makefile.cvs
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/RPMNAME
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/VERSION
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/Makefile.am
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/conf/
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/conf/Makefile.am
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/conf/thinkfinger.scr
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/doc/
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/doc/Makefile.am
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/doc/autodocs/
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/doc/autodocs/Makefile.am
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/Makefile.am
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.cc
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.h
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/Y2CCThinkFingerAgent.cc
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/testsuite/
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/testsuite/Makefile.am
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/configure.in.in
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/doc/
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/doc/Makefile.am
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/doc/autodocs/
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/doc/autodocs/Makefile.am
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/package/
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/package/yast2-fingerprint-reader.changes
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/FingerprintReader.ycp (with props)
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/Makefile.am
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/UsersPluginFingerprintReader.pm
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/dialogs.ycp (with props)
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/fingerprint-reader (with props)
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/fingerprint-reader.desktop
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/fingerprint-reader.ycp (with props)
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/helps.ycp (with props)
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/users_plugin_fingerprint_reader.ycp (with props)
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/wizards.ycp (with props)
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/testsuite/
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/testsuite/Makefile.am
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/testsuite/tests/
branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/yast2-fingerprint-reader.spec.in
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/MAINTAINER
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/MAINTAINER?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/MAINTAINER (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/MAINTAINER Fri Oct 5 11:34:11 2007
@@ -0,0 +1 @@
+Jiri Suchomel
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/Makefile.cvs
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/Makefile.cvs?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/Makefile.cvs (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/Makefile.cvs Fri Oct 5 11:34:11 2007
@@ -0,0 +1,22 @@
+#
+# Makefile.cvs
+#
+PREFIX = /usr
+
+LIB = $(shell y2tool get-lib)
+
+configure: all
+ ./configure --prefix=$(PREFIX) --libdir=$(PREFIX)/$(LIB)
+
+all:
+ y2tool y2autoconf
+ y2tool y2automake
+ autoreconf --force --install
+
+install: configure
+ make
+ make install
+
+reconf: all
+ ./config.status --recheck
+ ./config.status
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/RPMNAME
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/RPMNAME?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/RPMNAME (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/RPMNAME Fri Oct 5 11:34:11 2007
@@ -0,0 +1 @@
+yast2-fingerprint-reader
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/VERSION?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/VERSION (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/VERSION Fri Oct 5 11:34:11 2007
@@ -0,0 +1 @@
+2.13.0
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/Makefile.am?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/Makefile.am (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/Makefile.am Fri Oct 5 11:34:11 2007
@@ -0,0 +1 @@
+SUBDIRS = conf doc src testsuite
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/conf/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/conf/Makefile.am?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/conf/Makefile.am (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/conf/Makefile.am Fri Oct 5 11:34:11 2007
@@ -0,0 +1,7 @@
+#
+# Makefile.am for .../agent-thinkfinger/conf
+#
+
+scrconf_DATA = thinkfinger.scr
+
+EXTRA_DIST = $(scrconf_DATA)
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/conf/thinkfinger.scr
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/conf/thinkfinger.scr?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/conf/thinkfinger.scr (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/conf/thinkfinger.scr Fri Oct 5 11:34:11 2007
@@ -0,0 +1,16 @@
+/**
+ * File: thinkfinger.scr
+ * Summary: ThinkFinger agent
+ * Author: Jiri Suchomel
+ * Access: read / write / execute
+ *
+ * Example: FIXME
+ *
+ * $Id$
+ *
+ */
+.thinkfinger
+
+`ag_thinkfinger(
+ `ThinkFingerAgent()
+)
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/doc/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/doc/Makefile.am?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/doc/Makefile.am (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/doc/Makefile.am Fri Oct 5 11:34:11 2007
@@ -0,0 +1 @@
+SUBDIRS = autodocs
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/doc/autodocs/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/doc/autodocs/Makefile.am?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/doc/autodocs/Makefile.am (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/doc/autodocs/Makefile.am Fri Oct 5 11:34:11 2007
@@ -0,0 +1,13 @@
+#
+# Makefile.am for .../agent-thinkfinger/doc/autodocs
+#
+
+htmldir = $(docdir)/autodocs
+
+html_DATA = index.html $(wildcard *.html *.png) doxygen.css @RPMNAME@.tag
+CLEANFILES = $(html_DATA) doxygen.log doxygen.conf installdox
+
+doxygen.css @RPMNAME@.tag: index.html
+
+index.html: $(srcdir)/../../src/*.h
+ @ybindir@/ydoxygen PROJECT_NAME=@RPMNAME@
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/Makefile.am?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/Makefile.am (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/Makefile.am Fri Oct 5 11:34:11 2007
@@ -0,0 +1,24 @@
+
+# Makefile.am for .../agent-thinkfinger/src
+#
+
+AM_CXXFLAGS = -DY2LOG=\"agent-thinkfinger\" -Wall
+
+plugin_LTLIBRARIES = libpy2ag_thinkfinger.la
+noinst_LTLIBRARIES = liby2ag_thinkfinger.la
+
+liby2ag_thinkfinger_la_SOURCES = \
+ ThinkFingerAgent.cc \
+ ThinkFingerAgent.h
+liby2ag_thinkfinger_la_LDFLAGS = -version-info 2:0
+liby2ag_thinkfinger_la_LIBADD = @AGENT_LIBADD@ -lthinkfinger -L$(libdir)
+
+
+libpy2ag_thinkfinger_la_SOURCES = \
+ $(liby2ag_thinkfinger_la_SOURCES) \
+ Y2CCThinkFingerAgent.cc
+libpy2ag_thinkfinger_la_LDFLAGS = -version-info 2:0
+libpy2ag_thinkfinger_la_LIBADD = @AGENT_LIBADD@ -lthinkfinger -L$(libdir)
+
+
+INCLUDES = -I$(includedir)
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.cc?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.cc (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.cc Fri Oct 5 11:34:11 2007
@@ -0,0 +1,307 @@
+/* ThinkFingerAgent.cc
+ *
+ * An agent for ThinkFinger library (access to fingerprint reader)
+ *
+ * Authors: Jiri Suchomel
+ *
+ * $Id$
+ */
+
+#include "ThinkFingerAgent.h"
+
+#define PC(n) (path->component_str(n))
+
+#define INIT_FAILED 500
+#define SET_FILE_FAILED 600
+#define SET_CALLBACK_FAILED 700
+
+// structure to be passed to callback
+typedef struct {
+ int write_fd;
+} s_tfdata;
+
+/**
+ * callback function to be called from libthinkfinger_acquire
+ * @param state current device status
+ * @param data void pointer to user data
+ */
+static void callback (libthinkfinger_state state, void *data)
+{
+ s_tfdata *tfdata = (s_tfdata *) data;
+ if (write (tfdata->write_fd, &state, sizeof (libthinkfinger_state)) == -1)
+ y2error("write to pipe failed: %d (%m)", errno);
+}
+
+/**
+ * Constructor
+ */
+ThinkFingerAgent::ThinkFingerAgent() : SCRAgent()
+{
+ child_pid = -1;
+}
+
+/**
+ * Destructor
+ */
+ThinkFingerAgent::~ThinkFingerAgent()
+{
+}
+
+// return the only instance of the class
+ThinkFingerAPI& ThinkFingerAPI::instance()
+{
+ static ThinkFingerAPI _instance; // The singleton
+ return _instance;
+}
+
+// handler for SIGTERM signal (it is necessary to kill the process when
+// user his Cancel)
+void ThinkFingerAPI::catch_sigterm (int sig_num)
+{
+ instance().finalize ();
+ exit (256);
+}
+
+// de-initialize finger print reader (must be called at the end!)
+void ThinkFingerAPI::finalize ()
+{
+ if (instance().tf != NULL)
+ {
+ libthinkfinger_free (instance().tf);
+ instance().tf = NULL;
+ }
+}
+
+ThinkFingerAPI::ThinkFingerAPI()
+{
+ tf = NULL;
+}
+
+ThinkFingerAPI::~ThinkFingerAPI ()
+{
+}
+
+/**
+ * wrapper for libthinkfinger_acquire function;
+ * - we need to take care of the errors and signals
+ * @param file descriptor of the pipe
+ * @param path to the target bir file
+ */
+int ThinkFingerAPI::acquire (int write_fd, string bir_path)
+{
+ signal (15, catch_sigterm);
+
+ int retval = 255;
+ s_tfdata tfdata;
+ tfdata.write_fd = write_fd;
+
+ libthinkfinger_init_status init_status;
+ instance().tf = libthinkfinger_new (&init_status);
+ if (init_status != TF_INIT_SUCCESS) {
+ y2error ("libthinkfinger_new failed");
+ instance().finalize ();
+ retval = INIT_FAILED;
+ write (write_fd, &retval, sizeof(libthinkfinger_state));
+ return retval;
+ }
+
+ if (libthinkfinger_set_file (instance().tf, bir_path.c_str ()) < 0)
+ {
+ y2error ("libthinkfinger_set_file failed");
+ instance().finalize ();
+ retval = SET_FILE_FAILED;
+ write (write_fd, &retval, sizeof(libthinkfinger_state));
+ return retval;
+ }
+ if (libthinkfinger_set_callback (instance().tf, callback, &tfdata) < 0)
+ {
+ y2error ("libthinkfinger_set_callback failed");
+ instance().finalize ();
+ retval = SET_CALLBACK_FAILED;
+ write (write_fd, &retval, sizeof(libthinkfinger_state));
+ return retval;
+ }
+ retval = libthinkfinger_acquire (ThinkFingerAPI::instance().tf);
+ y2milestone ("acquire done with state %d", retval);
+ instance().finalize ();
+ signal (15, SIG_DFL);
+ return retval;
+}
+
+/**
+ * Dir
+ */
+YCPList ThinkFingerAgent::Dir(const YCPPath& path)
+{
+ y2error("Wrong path '%s' in Dir().", path->toString().c_str());
+ return YCPNull();
+}
+
+/**
+ * Read
+ */
+YCPValue ThinkFingerAgent::Read(const YCPPath &path, const YCPValue& arg, const YCPValue& opt) {
+
+ y2debug ("Path in Read(): %s", path->toString().c_str());
+ YCPValue ret = YCPVoid();
+
+ if (path->length() == 0) {
+ ret = YCPString("0");
+ }
+ else if (path->length() == 1) {
+
+ if (PC(0) == "error") {
+ // return the last error message
+ ret = YCPString ("error_message");
+ }
+ else if (PC(0) == "state") {
+ YCPMap retmap;
+ if (!child_pid)
+ {
+ y2error ("ThinkFinger not initialized yet!");
+ return ret;
+ }
+ int state;
+ size_t size = sizeof (libthinkfinger_state);
+ int retval = read (data_pipe[0], &state, size);
+ if (retval == -1)
+ {
+ if (errno != EINTR && errno != EAGAIN)
+ y2error ("error reading from pipe: %d (%m)", errno);
+ }
+ else if (retval == size) {
+ if (state == INIT_FAILED ||
+ state == SET_FILE_FAILED || state == SET_CALLBACK_FAILED)
+ {
+ y2warning ("some initialization failed (%d)...", state);
+ return ret;
+ }
+ retmap->add (YCPString ("state"), YCPInteger (state));
+ }
+ return retmap;
+ }
+ // wait for child exit
+ else if (PC(0) == "exit_status" ) {
+y2internal ("waiting for child exit...");
+ int status;
+ int retval = 255;
+//FIXME in case of
+//Warning: usb_bulk_read expected to read 0x40 (read 0x34 bytes).
+//child doesn't exit...
+ wait (&status);
+ if (WIFSIGNALED (status))
+ y2milestone ("child process was killed");
+ else if (WIFEXITED (status))
+ {
+ retval = WEXITSTATUS (status);
+y2milestone ("retval is %d", retval);
+ }
+ ret = YCPInteger (retval);
+ close (data_pipe[0]); // close FD for reading
+ }
+ else {
+ y2error ("Unknown path in Read(): %s", path->toString().c_str());
+ }
+ }
+ else {
+ y2error ("Unknown path in Read(): %s", path->toString().c_str());
+ }
+ return ret;
+}
+
+
+/**
+ * Write - nothing to do
+ */
+YCPBoolean ThinkFingerAgent::Write(const YCPPath &path, const YCPValue& value,
+ const YCPValue& arg)
+{
+ return YCPBoolean(false);
+}
+
+/**
+ * Execute(.thinkfinger.add-user) is action to acquire fingerprint
+ */
+YCPValue ThinkFingerAgent::Execute(const YCPPath &path, const YCPValue& val, const YCPValue& arg)
+{
+ y2milestone ("Path in Execute(): %s", path->toString().c_str());
+ YCPValue ret = YCPBoolean(false);
+
+ if (path->length() == 1) {
+
+ if (PC(0) == "cancel") {
+y2internal ("killing child process with pid %d", child_pid);
+ if (child_pid)
+ kill (child_pid, 15);
+ child_pid = -1;
+ ret = YCPBoolean (true);
+ }
+ /**
+ * parameter is whole path to target bir file, e.g.
+ * /tmp/YaST-123-456/hh.bir
+ */
+ else if (PC(0) == "add-user") {
+ string path;
+ if (!val.isNull())
+ {
+ path = val->asString()->value();
+ }
+ else
+ {
+ y2error ("path to bir file is missing");
+ return ret;
+ }
+ if (pipe (data_pipe) == -1) {
+ y2error ("pipe creation failed");
+ return ret;
+ }
+
+ long arg;
+ arg = fcntl (data_pipe[0], F_GETFL);
+ if (fcntl (data_pipe[0], F_SETFL, arg | O_NONBLOCK ) < 0)
+ {
+ y2error ("Couldn't set O_NONBLOCK: errno=%d: %m", errno);
+ close (data_pipe[0]);
+ close (data_pipe[1]);
+ return ret;
+ }
+ child_pid = fork ();
+ if (child_pid == -1)
+ {
+ y2error ("fork failed");
+ return ret;
+ }
+ else if (child_pid == 0)
+ {
+ close (data_pipe[0]); // close the read-only FD
+ int state =
+ ThinkFingerAPI::instance().acquire (data_pipe[1], path);
+ y2milestone ("acquire done with state %d", state);
+ close (data_pipe[1]);
+ exit (state);
+ }
+ else // parent -> return
+ {
+ close (data_pipe[1]); // close FD for writing
+ ret = YCPBoolean(true);
+ }
+ }
+ }
+ return ret;
+}
+
+/**
+ * otherCommand
+ */
+YCPValue ThinkFingerAgent::otherCommand(const YCPTerm& term)
+{
+ string sym = term->name();
+
+ if (sym == "ThinkFingerAgent") {
+
+ return YCPVoid();
+ }
+
+ return YCPNull();
+}
+
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.h?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.h (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.h Fri Oct 5 11:34:11 2007
@@ -0,0 +1,118 @@
+/* ThinkFingerAgent.h
+ *
+ * ThinkFinger agent implementation
+ *
+ * Authors: Jiri Suchomel
+ *
+ * $Id: ThinkFingerAgent.h 26456 2005-12-07 16:11:23Z jsuchome $
+ */
+
+#ifndef _ThinkFingerAgent_h
+#define _ThinkFingerAgent_h
+
+#include
+#include
+
+using namespace std;
+
+#include
+#include
+#include
+#include
+
+#include <string>
+
+/**
+ * The real interface to thinkfinger library
+ * - extra (singleton) class is used to contain signal handler function
+ */
+class ThinkFingerAPI
+{
+
+private:
+ ThinkFingerAPI ();
+
+ virtual ~ThinkFingerAPI();
+
+public:
+
+ static ThinkFingerAPI & instance();
+
+ static void catch_sigterm (int);
+
+ int acquire (int, string);
+
+ int test_int;
+
+ libthinkfinger *tf;
+
+ void finalize ();
+
+};
+
+/**
+ * @short An interface class between YaST2 and ThinkFinger Agent
+ */
+class ThinkFingerAgent : public SCRAgent
+{
+
+public:
+
+ /**
+ * Default constructor.
+ */
+ ThinkFingerAgent ();
+
+
+ /**
+ * Destructor.
+ */
+ virtual ~ThinkFingerAgent();
+
+ /**
+ * Provides SCR Read ().
+ * @param path Path that should be read.
+ * @param arg Additional parameter.
+ */
+ virtual YCPValue Read(const YCPPath &path,
+ const YCPValue& arg = YCPNull(),
+ const YCPValue& opt = YCPNull());
+
+ /**
+ * Provides SCR Write ().
+ */
+ virtual YCPBoolean Write(const YCPPath &path,
+ const YCPValue& val,
+ const YCPValue& arg = YCPNull());
+
+ /**
+ * Provides SCR Execute ().
+ */
+ virtual YCPValue Execute(const YCPPath &path,
+ const YCPValue& val = YCPNull(),
+ const YCPValue& arg = YCPNull());
+
+ /**
+ * Provides SCR Dir ().
+ */
+ virtual YCPList Dir(const YCPPath& path);
+
+ /**
+ * Used for mounting the agent.
+ */
+ virtual YCPValue otherCommand(const YCPTerm& term);
+
+
+ /**
+ * array with pipe file descriptors
+ */
+ int data_pipe[2];
+
+ /**
+ * pid of the child process after fork
+ */
+ pid_t child_pid;
+
+};
+
+#endif /* _ThinkFingerAgent_h */
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/Y2CCThinkFingerAgent.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/Y2CCThinkFingerAgent.cc?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/Y2CCThinkFingerAgent.cc (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/src/Y2CCThinkFingerAgent.cc Fri Oct 5 11:34:11 2007
@@ -0,0 +1,15 @@
+/* Y2CCThinkFingerAgent.cc
+ *
+ * Authors: Jiri Suchomel
+ *
+ * $Id$
+ */
+
+#include
+#include
+
+#include "ThinkFingerAgent.h"
+
+typedef Y2AgentComp <ThinkFingerAgent> Y2ThinkFingerAgentComp;
+
+Y2CCAgentComp <Y2ThinkFingerAgentComp> g_y2ccag_thinkfinger ("ag_thinkfinger");
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/testsuite/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/testsuite/Makefile.am?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/testsuite/Makefile.am (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/agent-thinkfinger/testsuite/Makefile.am Fri Oct 5 11:34:11 2007
@@ -0,0 +1,8 @@
+#
+# Makefile.am for .../agent-thinkfinger/testsuite
+#
+
+AUTOMAKE_OPTIONS = dejagnu
+
+clean-local:
+ rm -f tmp.err.* tmp.out.* site.exp site.bak
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/configure.in.in
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/configure.in.in?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/configure.in.in (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/configure.in.in Fri Oct 5 11:34:11 2007
@@ -0,0 +1,14 @@
+## YCP module configure.in.in
+
+## Initialize
+@YAST2-INIT-COMMON@
+@YAST2-INIT-YCP@
+@YAST2-INIT-PROGRAM@
+
+## some common checks
+@YAST2-CHECKS-COMMON@
+@YAST2-CHECKS-YCP@
+@YAST2-CHECKS-PROGRAM@
+
+## and generate the output...
+@YAST2-OUTPUT@
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/doc/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/doc/Makefile.am?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/doc/Makefile.am (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/doc/Makefile.am Fri Oct 5 11:34:11 2007
@@ -0,0 +1,10 @@
+# Makefile.am for fingerprint-reader/doc
+
+SUBDIRS = autodocs
+
+htmldir = $(docdir)
+
+doc_DATA =
+html_DATA =
+
+EXTRA_DIST = $(doc_DATA) $(html_DATA)
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/doc/autodocs/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/doc/autodocs/Makefile.am?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/doc/autodocs/Makefile.am (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/doc/autodocs/Makefile.am Fri Oct 5 11:34:11 2007
@@ -0,0 +1,3 @@
+# Makefile.am for fingerprint-reader/doc/autodocs
+
+include $(top_srcdir)/autodocs-ycp.ami
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/package/yast2-fingerprint-reader.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/package/yast2-fingerprint-reader.changes?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/package/yast2-fingerprint-reader.changes (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/package/yast2-fingerprint-reader.changes Fri Oct 5 11:34:11 2007
@@ -0,0 +1,6 @@
+-------------------------------------------------------------------
+Tue Oct 2 13:48:59 CEST 2007 - jsuchome@suse.cz
+
+- Backport 2.15.2 version for SLE10 (F302658)
+- 2.13.0
+
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/FingerprintReader.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/FingerprintReader.ycp?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/FingerprintReader.ycp (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/FingerprintReader.ycp Fri Oct 5 11:34:11 2007
@@ -0,0 +1,267 @@
+/* ------------------------------------------------------------------------------
+ * Copyright (c) 2006 Novell, Inc. All Rights Reserved.
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of version 2 of the GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * 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, contact Novell, Inc.
+ *
+ * To contact Novell about this file by physical or electronic mail, you may find
+ * current contact information at www.novell.com.
+ * ------------------------------------------------------------------------------
+ */
+
+/**
+ * File: modules/FingerprintReader.ycp
+ * Package: Configuration of fingerprint-reader
+ * Summary: FingerprintReader settings, input and output functions
+ * Authors: Jiri Suchomel
+ *
+ * $Id$
+ *
+ * Representation of the configuration of fingerprint-reader.
+ * Input and output routines.
+ */
+
+{
+
+module "FingerprintReader";
+textdomain "fingerprint-reader";
+
+import "Arch";
+import "FileUtils";
+import "Pam";
+import "Popup";
+import "Progress";
+import "Report";
+import "Summary";
+
+/**
+ * Data was modified?
+ */
+global boolean modified = false;
+
+/**
+ * Required packages for this module to operate
+ */
+global list<string> required_packages = ["pam_thinkfinger"];
+
+// packages to install for specific architectures (see e.g. #224510)
+global map arch_packages = $[
+ "pam_thinkfinger" : $[
+ "ia64" : [ "pam_thinkfinger-x86" ],
+ "ppc64" : [ "pam_thinkfinger-64bit" ],
+ "s390_64" : [ "pam_thinkfinger-32bit" ],
+ "x86_64" : [ "pam_thinkfinger-32bit" ],
+ ],
+];
+
+/**
+ * Write only, used during autoinstallation.
+ * Don't run services and SuSEconfig, it's all done at one place.
+ */
+global boolean write_only = false;
+
+/**
+ * if Fingerprint Reader authentication is enabled
+ */
+global boolean use_pam = false;
+
+/**
+ * Directory with fingerprint files that should be imported
+ */
+global string import_dir = "";
+
+/**
+ * Directory for storing fingerprint files
+ */
+string bir_dir = "/etc/pam_thinkfinger";
+
+/**
+ * Get the list of fingerprint readers
+ */
+global list ReadFingerprintReaderDevices () {
+
+ list devices = (list) SCR::Read (.probe.fingerprint);
+ if (devices == nil)
+ devices = [];
+ return devices;
+}
+
+/**
+ * Read all fingerprint-reader settings
+ * @return true on success
+ */
+global boolean Read() {
+
+ list devices = ReadFingerprintReaderDevices ();
+
+ if (devices == [])
+ {
+ // error popup: no config of non-existent device
+ Report::Error (_("Fingerprint reader device is not available on this system."));
+ return false;
+ }
+
+ use_pam = Pam::Enabled ("thinkfinger");
+
+ modified = false;
+ return true;
+}
+
+/**
+ * Write all fingerprint-reader settings
+ * @return true on success
+ */
+global boolean Write() {
+
+ if (!modified)
+ return true;
+
+ // FingerprintReader read dialog captio
+ string caption = _("Saving Fingerprint Reader Configuration");
+
+ integer sl = 100;
+ sleep(sl);
+
+ // We do not set help text here, because it was set outside
+ Progress::New(caption, " ", 2, [
+ // Progress stage
+ _("Write the PAM settings"),
+ // Progress stage
+ _("Import fingerprint files"),
+ ], [
+ // Progress step
+ _("Writing the PAM settings..."),
+ // Progress step
+ _("Importing fingerprint files..."),
+ // Progress finished
+ _("Finished")
+ ],
+ ""
+ );
+
+ Progress::NextStage();
+
+ boolean pam_ret = use_pam ?
+ Pam::Add ("thinkfinger") : Pam::Remove ("thinkfinger");
+ if (!pam_ret)
+ // Error message
+ Report::Error (_("Cannot write PAM settings."));
+
+ sleep(sl);
+
+ Progress::NextStage();
+ if (use_pam && import_dir != "")
+ {
+ if (!FileUtils::Exists (bir_dir))
+ {
+ SCR::Execute (.target.mkdir, bir_dir);
+ }
+ map out = (map) SCR::Execute (.target.bash_output,
+ sformat ("/bin/cp %1/*.bir %2/", import_dir, bir_dir));
+ if (out["stderr"]:"" != "")
+ {
+ // error popup
+ Popup::ErrorDetails (_("Importing fingerprint files failed."),
+ out["stderr"]:"");
+ }
+ }
+
+ Progress::NextStage();
+ sleep(sl);
+
+ return true;
+}
+
+/**
+ * Get all fingerprint-reader settings from the first parameter
+ * (For use by autoinstallation.)
+ * @param settings The YCP structure to be imported.
+ * @return boolean True on success
+ */
+global boolean Import (map settings) {
+
+ use_pam = settings["use_pam"]:use_pam;
+ import_dir = settings["import_dir"]:import_dir;
+ return true;
+}
+
+/**
+ * Dump the fingerprint-reader settings to a single map
+ * (For use by autoinstallation.)
+ * @return map Dumped settings (later acceptable by Import ())
+ */
+global map Export () {
+ return $[
+ "use_pam" : use_pam,
+ "import_dir" : import_dir
+ ];
+}
+
+/**
+ * Create a textual summary and a list of unconfigured cards
+ * @return summary of the current configuration
+ */
+global list Summary() {
+
+ // summary header
+ string summary = Summary::AddHeader(summary, _("PAM Login"));
+
+ summary = Summary::AddLine (summary, (use_pam) ?
+ // summary item
+ _("Use Fingerprint Authentication") :
+ // summary item
+ _("Do Not Use Fingerprint Authentication"));
+ return [ summary, [] ];
+}
+
+/**
+ * Create a short textual summary
+ * @return summary of the current configuration
+ */
+global define string ShortSummary() {
+
+ return sformat (
+ // summary text (yes/no follows)
+ _("<b>Fingerprint Authentication Enabled</b>: %1<br>"), use_pam ?
+ // summary value
+ _("Yes") :
+ // summary value
+ _("No"));
+}
+
+/**
+ * Return list of architecture specific packages (derived from package list
+ * given as parameter) merged with the packages in parameter
+ */
+global define list<string> UpdatedArchPackages (list<string> packages) {
+
+ list<string> ret = packages;
+ string arch = Arch::architecture ();
+
+ foreach (string package, packages, {
+ ret = (list<string>) union (ret, arch_packages[package,arch]:[]);
+ });
+ return ret;
+}
+
+/**
+ * Return packages needed to be installed and removed during
+ * Autoinstallation to insure module has all needed software
+ * installed.
+ * @return map with 2 lists.
+ */
+global map AutoPackages() {
+ return $[ "install": required_packages, "remove":[] ];
+}
+
+/* EOF */
+}
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/Makefile.am?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/Makefile.am (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/Makefile.am Fri Oct 5 11:34:11 2007
@@ -0,0 +1,28 @@
+# Makefile.am for fingerprint-reader/src
+
+yncludedir = @yncludedir@/fingerprint-reader
+
+client_DATA = \
+ fingerprint-reader.ycp \
+ users_plugin_fingerprint_reader.ycp
+
+ynclude_DATA = \
+ wizards.ycp \
+ dialogs.ycp \
+ helps.ycp
+
+desktop_DATA = \
+ fingerprint-reader.desktop
+
+module_DATA = \
+ FingerprintReader.ycp \
+ UsersPluginFingerprintReader.pm
+
+# create a symlink for local build, #145327
+fingerprint-reader:
+ ln -sf . $@
+ycpchook = fingerprint-reader
+
+EXTRA_DIST = $(client_DATA) $(ynclude_DATA) $(module_DATA) $(desktop_DATA)
+
+include $(top_srcdir)/Makefile.am.common
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/UsersPluginFingerprintReader.pm
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/UsersPluginFingerprintReader.pm?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/UsersPluginFingerprintReader.pm (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/UsersPluginFingerprintReader.pm Fri Oct 5 11:34:11 2007
@@ -0,0 +1,358 @@
+#! /usr/bin/perl -w
+#
+# This is the API part of UsersPluginFingerprintReader plugin -
+# configuration of user's fingerprints on specific device
+#
+
+package UsersPluginFingerprintReader;
+
+use strict;
+
+use YaST::YCP qw(:LOGGING);
+use YaPI;
+use Data::Dumper;
+
+textdomain("fingerprint-reader");
+
+our %TYPEINFO;
+
+##--------------------------------------
+##--------------------- global imports
+
+YaST::YCP::Import ("Directory");
+YaST::YCP::Import ("FileUtils");
+YaST::YCP::Import ("FingerprintReader");
+YaST::YCP::Import ("Pam");
+YaST::YCP::Import ("SCR");
+YaST::YCP::Import ("Users");
+
+##--------------------------------------
+##--------------------- global variables
+
+# error message, returned when some plugin function fails
+my $error = "";
+
+my $fingerprint_reader_available = undef;
+
+# path to store fingerprints
+my $bir_path = "/etc/pam_thinkfinger";
+
+my $name = "UsersPluginFingerprintReader";
+
+##----------------------------------------
+##--------------------- internal functions
+
+# internal function:
+# check if given key (second parameter) is contained in a list (1st parameter)
+# if 3rd parameter is true (>0), ignore case
+sub contains {
+ my ($list, $key, $ignorecase) = @_;
+ if (!defined $list || ref ($list) ne "ARRAY" || @{$list} == 0) {
+ return 0;
+ }
+ if ($ignorecase) {
+ if ( grep /^\Q$key\E$/i, @{$list} ) {
+ return 1;
+ }
+ } else {
+ if ( grep /^\Q$key\E$/, @{$list} ) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+# helper, check if Fingerprint Reader was already configured
+sub fingerprint_reader_configured {
+
+ return Pam->Enabled ("thinkfinger");
+}
+
+# helper function: check if Fingerprint Reader (the device) is available
+sub is_fingerprint_reader_available {
+
+ if (not defined $fingerprint_reader_available) {
+ my @devices = @{FingerprintReader->ReadFingerprintReaderDevices ()};
+ $fingerprint_reader_available = (@devices > 0);
+ }
+ return $fingerprint_reader_available;
+}
+
+# check if given user has fingerprint authentication configured
+sub fingerprint_present {
+
+ my ($data) = @_;
+ my $username = $data->{"uid"};
+ return 0 if !$username;
+ my $org_username = $data->{"org_user"}{"uid"} || $username;
+ my $org_bir_file = "$bir_path/$org_username.bir";
+ return (FileUtils->Exists ($org_bir_file));
+}
+
+# check if bir file name corresponds with username
+sub adapt_fingerprint_info {
+
+ my ($config, $data) = @_;
+ my $username = $data->{"uid"};
+ my $org_username = $data->{"org_user"}{"uid"} || $username;
+ my $bir_file = $data->{"bir_file"};
+ return $data if !defined $username;
+ if (!defined $bir_file && $username ne $org_username) {
+ # When user was only renamed, but new fingerprint was not generated,
+ # there's no 'bir_file' entry in the map ->
+ # backup his original bir file to tmpdir so it won't get lost and can
+ # be correctly renamed in Write.
+ my $org_bir_file = "$bir_path/$org_username.bir";
+ if (FileUtils->Exists ($org_bir_file)) {
+ my $tmpdir = Directory->tmpdir ();
+ SCR->Execute (".target.bash", "/bin/cp $org_bir_file $tmpdir/$username.bir");
+ $data->{"bir_file"} = $username;
+ }
+ }
+ if ($bir_file && $bir_file ne $username) {
+ $data->{"bir_file"} = $username;
+ }
+ return $data;
+}
+
+# update the object data when removing plugin
+sub remove_plugin_data {
+
+ my ($config, $data) = @_;
+ $data->{"bir_file"} = "";
+ $data->{"plugin_modified"} = 1;
+ return $data;
+}
+
+##------------------------------------------
+##--------------------- global API functions
+
+# All functions have 2 "any" parameters: these mean:
+# 1st: configuration map (hash) - e.g. saying if we work with user or group
+# 2nd: data map (hash) of user/group to work with
+# for details, see UsersPluginLDAPAll.pm
+
+# return names of provided functions
+BEGIN { $TYPEINFO{Interface} = ["function", ["list", "string"], "any", "any"];}
+sub Interface {
+
+ my $self = shift;
+ my @interface = (
+ "GUIClient",
+ "Name",
+ "Summary",
+ "Restriction",
+ "Interface",
+ "PluginPresent",
+ "PluginRemovable",
+ "Error",
+ "AddBefore",
+ "Add",
+ "EditBefore",
+ "Edit",
+ "Delete",
+ "Write"
+ );
+ return \@interface;
+}
+
+# return error message, generated by plugin
+BEGIN { $TYPEINFO{Error} = ["function", "string", "any", "any"];}
+sub Error {
+
+ my $self = shift;
+ return $error;
+}
+
+
+# return plugin name, used for GUI (translated)
+BEGIN { $TYPEINFO{Name} = ["function", "string", "any", "any"];}
+sub Name {
+
+ my $self = shift;
+ # plugin name
+ return __("Fingerprint configuration");
+}
+
+##------------------------------------
+# return plugin summary (to be shown in table with all plugins)
+BEGIN { $TYPEINFO{Summary} = ["function", "string", "any", "any"];}
+sub Summary {
+
+ my $self = shift;
+ # plugin summary (table item)
+ my $ret = __("Set the user's fingerprint");
+ return $ret;
+}
+
+##------------------------------------
+# checks the current data map of user (2nd parameter) and returns
+# true if given user has our plugin
+BEGIN { $TYPEINFO{PluginPresent} = ["function", "boolean", "any", "any"];}
+sub PluginPresent {
+
+ my ($self, $config, $data) = @_;
+ return 0 if not fingerprint_reader_configured ();
+
+ if (contains ($data->{'plugins'}, $name, 1) || fingerprint_present ($data))
+ {
+ y2milestone ("$name plugin present");
+ return 1;
+ }
+ return 0;
+}
+
+##------------------------------------
+# Is it possible to remove this plugin from user?
+BEGIN { $TYPEINFO{PluginRemovable} = ["function", "boolean", "any", "any"];}
+sub PluginRemovable {
+ # doesn't have sense to remove
+ return YaST::YCP::Boolean (1);
+}
+
+
+##------------------------------------
+# return name of YCP client defining YCP GUI
+BEGIN { $TYPEINFO{GUIClient} = ["function", "string", "any", "any"];}
+sub GUIClient {
+
+ return "users_plugin_fingerprint_reader";
+}
+
+##------------------------------------
+# Type of objects this plugin is restricted to.
+# It defines:
+# 1. type of objects which it should be applied to (ldap/nis/local/system)
+# 2. type of objects at all (user)
+# If this function doesn't exist, plugin is applied for all users of all types
+BEGIN { $TYPEINFO{Restriction} = ["function",
+ ["map", "string", "any"], "any", "any"];}
+sub Restriction {
+
+ my $self = shift;
+ # do the check here, so the plugin is not shown when there is no hw for it
+ return {} if not is_fingerprint_reader_available ();
+ return {
+ "local" => 1,
+ "system" => 1,
+ # only for users
+ "user" => 1,
+ };
+}
+
+# this will be called at the beggining of Users::Add
+# Could be called multiple times for one user
+BEGIN { $TYPEINFO{AddBefore} = ["function",
+ ["map", "string", "any"],
+ "any", "any"];
+}
+sub AddBefore {
+
+ my ($self, $config, $data) = @_;
+
+ if (!fingerprint_reader_configured ()) {
+ # error popup
+ $error = __("Fingerprint reader is not configured. Run 'yast2-fingerprint-reader' to configure it");
+ return undef;
+ }
+ return $data;
+}
+
+# This will be called at the end of Users::Add* :
+# modify the object map with fingerprint-reader data
+BEGIN { $TYPEINFO{Add} = ["function", ["map", "string", "any"], "any", "any"];}
+sub Add {
+
+ my ($self, $config, $data) = @_;
+ if (contains ($data->{'plugins_to_remove'}, $name, 1)) {
+ y2milestone ("removing plugin $name...");
+ return remove_plugin_data ($config, $data);
+ }
+ return adapt_fingerprint_info ($config, $data);
+}
+
+# this will be called at the beggining of Users::Edit
+BEGIN { $TYPEINFO{EditBefore} = ["function",
+ ["map", "string", "any"],
+ "any", "any"];
+}
+sub EditBefore {
+
+ my ($self, $config, $data) = @_;
+
+ if (!fingerprint_reader_configured ()) {
+ # error popup
+ $error = __("Fingerprint reader is not configured. Run 'yast2-fingerprint-reader' to configure it");
+ return undef;
+ }
+ return $data;
+}
+
+# This will be called at the end of Users::Edit* :
+# modify the object map with fingerprint-reader data
+BEGIN { $TYPEINFO{Edit} = ["function",
+ ["map", "string", "any"],
+ "any", "any"];
+}
+sub Edit {
+
+ my ($self, $config, $data) = @_;
+ # "plugins_to_remove" is list of plugins which are set for removal
+ if (contains ($data->{'plugins_to_remove'}, $name, 1)) {
+ y2milestone ("removing plugin $name...");
+ return remove_plugin_data ($config, $data);
+ }
+ return adapt_fingerprint_info ($config, $data);
+}
+
+
+# What should be done after user is finally written (this is called only once):
+# - remove org_username.bir file,
+# but only when there is no other (new) user of that name
+# - move temporary bir file to correct location
+BEGIN { $TYPEINFO{Write} = ["function", "boolean", "any", "any"];}
+sub Write {
+
+ my ($self, $config, $data) = @_;
+
+ my $username = $data->{"uid"};
+ my $org_username = $data->{"org_user"}{"uid"} || $username;
+ my $bir_file = $data->{"bir_file"};
+ my $org_bir_file = "$bir_path/$org_username.bir";
+
+ if (($config->{"modified"} || "") eq "deleted") {
+ # check if some new user doesn't have the name of the deleted one
+ my $u = Users->GetUserByName ($org_username, "");
+ if (!defined $u->{"bir_file"}) {
+ $bir_file = "";
+ }
+ }
+ return if (!$username || ! defined $bir_file);
+ if ($username ne $org_username) {
+ # check if there was old bir-file
+ my $u = Users->GetUserByName ($org_username, "");
+ # do not delete birfile when some new user was added with the name
+ # of this one's original name
+ if (!defined $u->{"bir_file"} && FileUtils->Exists ($org_bir_file)) {
+ y2milestone ("removing old file $org_bir_file owned by $username");
+ SCR->Execute (".target.bash", "/bin/rm $org_bir_file");
+ }
+ }
+ elsif ($bir_file eq "" && FileUtils->Exists ($org_bir_file)) {
+ # disable fingerprint authentication for this user
+ # (now $org_username is same as $username)
+ y2milestone ("removing file $org_bir_file for user $username");
+ SCR->Execute (".target.bash", "/bin/rm $org_bir_file");
+ }
+ if ($bir_file) {
+ my $bir_file_path = Directory->tmpdir ();
+ $bir_file_path = "$bir_file_path/$bir_file.bir";
+ y2milestone ("moving $bir_file_path to $bir_path/");
+ SCR->Execute (".target.bash", "/bin/mv $bir_file_path $bir_path/");
+ }
+ return YaST::YCP::Boolean (1);
+}
+
+
+42
+# EOF
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/dialogs.ycp?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/dialogs.ycp (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/dialogs.ycp Fri Oct 5 11:34:11 2007
@@ -0,0 +1,188 @@
+/* ------------------------------------------------------------------------------
+ * Copyright (c) 2006 Novell, Inc. All Rights Reserved.
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of version 2 of the GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * 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, contact Novell, Inc.
+ *
+ * To contact Novell about this file by physical or electronic mail, you may find
+ * current contact information at www.novell.com.
+ * ------------------------------------------------------------------------------
+ */
+
+/**
+ * File: include/fingerprint-reader/dialogs.ycp
+ * Package: Configuration of fingerprint-reader
+ * Summary: Dialogs definitions
+ * Authors: Jiri Suchomel
+ *
+ * $Id$
+ */
+
+{
+
+textdomain "fingerprint-reader";
+
+import "Confirm";
+import "FileUtils";
+import "FingerprintReader";
+import "Label";
+import "Package";
+import "Popup";
+import "Stage";
+import "Wizard";
+
+include "fingerprint-reader/helps.ycp";
+
+boolean ReallyAbort() {
+ return !FingerprintReader::modified || Popup::ReallyAbort(true);
+}
+
+/**
+ * Read settings dialog
+ * @return `abort if aborted and `next otherwise
+ */
+symbol ReadDialog() {
+ Wizard::RestoreHelp(HELPS["read"]:"");
+ if (!Confirm::MustBeRoot()) return `abort;
+ boolean ret = FingerprintReader::Read();
+ return ret ? `next : `abort;
+}
+
+/**
+ * Write settings dialog
+ * @return `abort if aborted and `next otherwise
+ */
+symbol WriteDialog() {
+ Wizard::RestoreHelp(HELPS["write"]:"");
+ boolean ret = FingerprintReader::Write();
+ return ret ? `next : `abort;
+}
+
+/**
+ * Main configuration dialog
+ * @return dialog result
+ */
+any FingerprintReaderDialog() {
+
+ // FingerprintReader summary dialog caption
+ string caption = _("Fingerprint Reader Configuration");
+
+ boolean use_pam = FingerprintReader::use_pam;
+ // help text
+ string help_text = _("<p>
+<b><big>Fingerprint Authentication</big></b><br>
+The Fingerprint Reader Configuration updates your PAM settings to enable authentication with fingerprints.</p>") +
+
+ // help text, cont.
+ _("<p>To <b>import fingerprint files</b> from different installations, choose the directory where the files are located.</p>");
+
+ term con = `HBox (`HSpacing (3), `VBox (
+ // frame label
+ `Frame (_("User Authentication"), `HBox(`HSpacing (0.5), `VBox(
+ `VSpacing (0.5),
+ `RadioButtonGroup (`id(`rd),
+ `Left (`HVSquash(`VBox (
+ `Left (`RadioButton (`id(`pamno), `opt (`notify),
+ // radio button label
+ _("Do No&t Use Fingerprint Reader"), !use_pam)),
+ `Left (`RadioButton (`id(`pamyes), `opt (`notify),
+ // radio button label
+ _("&Use Fingerprint Reader"), use_pam))
+ )))
+ ),
+ `VSpacing (0.5)
+ ), `HSpacing (0.5))),
+ `VSpacing (),
+ `HBox (
+ // textentry label
+ `TextEntry (`id(`import_dir),_("Directory with fingerprint files")),
+ `VBox (
+ `Label (""),
+ `PushButton (`id (`browse), Label::BrowseButton ())
+ )
+ )
+ ), `HSpacing(3));
+
+ Wizard::SetContentsButtons (caption, con, help_text,
+ Stage::cont () ? Label::BackButton () : Label::CancelButton (),
+ Stage::cont () ? Label::NextButton () : Label::FinishButton ()
+ );
+ Wizard::SetTitleIcon ("yast-fingerprint");
+ if (!Stage::cont ())
+ Wizard::HideAbortButton ();
+
+ UI::ChangeWidget (`id (`import_dir), `Enabled, use_pam);
+ UI::ChangeWidget (`id (`browse), `Enabled, use_pam);
+
+ any ret = nil;
+ while (true) {
+
+ ret = UI::UserInput();
+ string import_dir = (string)UI::QueryWidget (`id (`import_dir), `Value);
+
+ if (ret == `pamyes || ret == `pamno)
+ {
+ use_pam = (ret == `pamyes);
+ UI::ChangeWidget (`id (`import_dir), `Enabled, use_pam);
+ UI::ChangeWidget (`id (`browse), `Enabled, use_pam);
+ }
+
+ if (ret == `abort || ret == `cancel || ret == `back) {
+ if(ReallyAbort()) break;
+ else continue;
+ }
+ else if (ret == `browse) {
+ string dir = UI::AskForExistingDirectory (import_dir, "");
+ if (dir != nil)
+ {
+ if ((findlastof (dir, "/") + 1) == size(dir))
+ dir = substring (dir, 0, size(dir)-1);
+ UI::ChangeWidget (`id(`home), `Value, dir);
+ }
+ }
+ else if (ret == `next) {
+ if (use_pam && import_dir != "" &&
+ !FileUtils::IsDirectory (import_dir))
+ {
+ // error popup
+ Report::Error (_("The path to fingerprint files
+does not point to the valid directory."));
+ UI::SetFocus (`id (`import_dir));
+ continue;
+ }
+ if (use_pam &&
+ !Package::InstallAll (FingerprintReader::UpdatedArchPackages (
+ FingerprintReader::required_packages))
+ )
+ {
+ use_pam = false;
+ UI::ChangeWidget (`id (`rd), `Value, `pamno);
+ UI::ChangeWidget (`id (`import_dir), `Enabled, use_pam);
+ UI::ChangeWidget (`id (`browse), `Enabled, use_pam);
+ continue;
+ }
+ if (use_pam != FingerprintReader::use_pam ||
+ (use_pam && import_dir != ""))
+ {
+ FingerprintReader::modified = true;
+ FingerprintReader::use_pam = use_pam;
+ FingerprintReader::import_dir = import_dir;
+ }
+ break;
+ }
+ }
+ return ret;
+}
+
+
+/* EOF */
+}
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/fingerprint-reader
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/fingerprint-reader?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/fingerprint-reader (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/fingerprint-reader Fri Oct 5 11:34:11 2007
@@ -0,0 +1 @@
+link .
\ No newline at end of file
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/fingerprint-reader.desktop
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/fingerprint-reader.desktop?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/fingerprint-reader.desktop (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/fingerprint-reader.desktop Fri Oct 5 11:34:11 2007
@@ -0,0 +1,24 @@
+[Desktop Entry]
+Type=Application
+Categories=Qt;X-SuSE-YaST;X-SuSE-YaST-Misc;
+
+X-KDE-ModuleType=Library
+X-KDE-RootOnly=true
+X-KDE-HasReadOnlyMode=true
+X-KDE-Library=yast2
+X-SuSE-YaST-Call=fingerprint-reader
+
+X-SuSE-YaST-Group=Hardware
+X-SuSE-YaST-Argument=
+X-SuSE-YaST-RootOnly=true
+X-SuSE-YaST-AutoInst=
+X-SuSE-YaST-Geometry=
+X-SuSE-YaST-SortKey=
+X-SuSE-YaST-AutoInstResource=fingerprint-reader
+
+Icon=yast-fingerprint
+Exec=/sbin/yast2 fingerprint-reader
+
+Name=Fingerprint Reader
+GenericName=Set up fingerprint authentication
+X-KDE-SubstituteUID=true
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/fingerprint-reader.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/fingerprint-reader.ycp?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/fingerprint-reader.ycp (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/fingerprint-reader.ycp Fri Oct 5 11:34:11 2007
@@ -0,0 +1,93 @@
+/* ------------------------------------------------------------------------------
+ * Copyright (c) 2006 Novell, Inc. All Rights Reserved.
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of version 2 of the GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * 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, contact Novell, Inc.
+ *
+ * To contact Novell about this file by physical or electronic mail, you may find
+ * current contact information at www.novell.com.
+ * ------------------------------------------------------------------------------
+ */
+
+/**
+ * File: clients/fingerprint-reader.ycp
+ * Package: Configuration of fingerprint-reader
+ * Summary: Main file
+ * Authors: Jiri Suchomel
+ *
+ * $Id$
+ *
+ * Main file for fingerprint-reader configuration. Uses all other files.
+ */
+
+{
+
+/***
+ * <h3>Configuration of fingerprint-reader</h3>
+ */
+
+textdomain "fingerprint-reader";
+
+/* The main () */
+y2milestone ("----------------------------------------");
+y2milestone ("FingerprintReader module started");
+
+import "Progress";
+import "Report";
+import "Summary";
+
+import "CommandLine";
+include "fingerprint-reader/wizards.ycp";
+
+map cmdline_description = $[
+ "id" : "fingerprint-reader",
+ /* Command line help text for the Xfingerprint-reader module */
+ "help" : _("Configuration of fingerprint-reader"),
+ "guihandler" : FingerprintReaderSequence,
+ "initialize" : FingerprintReader::Read,
+ "finish" : FingerprintReader::Write,
+ "actions" : $[
+ // FIXME TODO: fill the functionality description here
+ ],
+ "options" : $[
+ // FIXME TODO: fill the option descriptions here
+ ],
+ "mappings" : $[
+ // FIXME TODO: fill the mappings of actions and options here
+ ]
+];
+
+/* is this proposal or not? */
+boolean propose = false;
+list args = WFM::Args();
+if(size(args) > 0) {
+ if(is(WFM::Args(0), path) && WFM::Args(0) == .propose) {
+ y2milestone("Using PROPOSE mode");
+ propose = true;
+ }
+}
+
+/* main ui function */
+any ret = nil;
+
+if(propose) ret = FingerprintReaderAutoSequence();
+else ret = CommandLine::Run(cmdline_description);
+y2debug("ret=%1", ret);
+
+/* Finish */
+y2milestone("FingerprintReader module finished");
+y2milestone("----------------------------------------");
+
+return ret;
+
+/* EOF */
+}
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/helps.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/helps.ycp?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/helps.ycp (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/helps.ycp Fri Oct 5 11:34:11 2007
@@ -0,0 +1,64 @@
+/* ------------------------------------------------------------------------------
+ * Copyright (c) 2006 Novell, Inc. All Rights Reserved.
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of version 2 of the GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * 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, contact Novell, Inc.
+ *
+ * To contact Novell about this file by physical or electronic mail, you may find
+ * current contact information at www.novell.com.
+ * ------------------------------------------------------------------------------
+ */
+
+/**
+ * File: include/fingerprint-reader/helps.ycp
+ * Package: Configuration of fingerprint-reader
+ * Summary: Help texts of all the dialogs
+ * Authors: Jiri Suchomel
+ *
+ * $Id$
+ */
+
+{
+
+textdomain "fingerprint-reader";
+
+/**
+ * All helps are here
+ */
+map HELPS = $[
+
+ /* Read dialog help 1/2 */
+ "read" : _("<p><b><big>Initializing Fingerprint Reader Configuration</big></b><br>
+Please wait...<br></p>
+") +
+
+ /* Read dialog help 2/2 */
+ _("<p><b><big>Aborting Initialization:</big></b><br>
+Safely abort the configuration utility by pressing <b>Abort</b> now.</p>
+"),
+
+ /* Write dialog help 1/2 */
+ "write" : _("<p><b><big>Saving Fingerprint Reader Configuration</big></b><br>
+Please wait...<br></p>
+") +
+
+ /* Write dialog help 2/2 */
+_("<p><b><big>Aborting Saving:</big></b><br>
+Abort the save procedure by pressing <b>Abort</b>.
+An additional dialog informs whether it is safe to do so.
+</p>
+"),
+
+];
+
+/* EOF */
+}
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/users_plugin_fingerprint_reader.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/users_plugin_fingerprint_reader.ycp?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/users_plugin_fingerprint_reader.ycp (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/users_plugin_fingerprint_reader.ycp Fri Oct 5 11:34:11 2007
@@ -0,0 +1,229 @@
+/**
+ * File:
+ * include/users/users_plugin_fingerprint_reader.ycp
+ *
+ * Package:
+ * Configuration of Fingerprint Reader
+ *
+ * Summary:
+ * GUI part of plugin (UsersPluginFingerprintReader) used to manage
+ * user fingerprints on the appropriate hardware
+ *
+ * Authors:
+ * Jiri Suchomel
+ *
+ * $Id$
+ */
+
+{
+ textdomain "fingerprint-reader";
+
+ import "Directory";
+ import "Label";
+ import "Users";
+ import "UsersPluginFingerprintReader";
+ import "Wizard";
+
+ any ret = nil;
+ string func = "";
+ map config = $[];
+ map data = $[];
+
+ /* Check arguments */
+ if(size(WFM::Args()) > 0 && is(WFM::Args(0), string)) {
+ func = (string) WFM::Args(0);
+ if(size(WFM::Args()) > 1 && is(WFM::Args(1), map))
+ config = (map)WFM::Args(1);
+ if(size(WFM::Args()) > 2 && is(WFM::Args(2), map))
+ data = (map)WFM::Args(2);
+ }
+ y2milestone("----------------------------------------");
+ y2milestone("users plugin started: FingerprintReader");
+
+ y2debug ("func=%1, config=%2, data=%3", func,config,data);
+
+ if (func == "Summary") {
+ ret = UsersPluginFingerprintReader::Summary (config, $[]);
+ }
+ else if (func == "Name") {
+ ret = UsersPluginFingerprintReader::Name (config, $[]);
+ }
+ else if (func == "Dialog") {
+
+ string caption = UsersPluginFingerprintReader::Name (config, $[]);
+ // help text for fingerprint reader plugin
+ string help_text = _("<p>Swipe your finger on the fingerprint reader. Three successful attempts
+are needed to save the new fingerprint.</p>");
+ string username = data["uid"]:"";
+ if (username == "")
+ {
+ y2error ("user name is empty!");
+ return `back;
+ }
+ string bir_path = Directory::tmpdir + "/" + username + ".bir";
+
+ term contents = `HBox (`HSpacing (1.5), `VBox(
+ `VSpacing(0.5),
+ `ReplacePoint (`id (`rp),
+ // status label
+ `Label (`id (`label), _("Initializing fingerprint reader..."))
+ ),
+ `ReplacePoint (`id (`rpstatus), `VSpacing ()),
+ `PushButton (`id (`cancel), Label::CancelButton ()),
+ `VSpacing (0.5)
+ ),
+ `HSpacing (1.5)
+ );
+
+ Wizard::CreateDialog ();
+ Wizard::SetTitleIcon ("yast-fingerprint");
+
+ // dialog caption
+ Wizard::SetContentsButtons(caption, contents, help_text,
+ Label::BackButton(), Label::AcceptButton());
+
+ Wizard::HideAbortButton ();
+ Wizard::DisableNextButton ();
+ Wizard::DisableBackButton ();
+
+ boolean exit = false;
+ any ui = nil;
+ integer exit_status = 256;
+ integer swipe_success = 0;
+ integer swipe_failed = 0;
+
+ // helper function, form the string for UI from actuall data
+ void replace_swipe_string () {
+
+ UI::ReplaceWidget (`id (`rpstatus), `Label (
+ // status message (%1, %2 are numbers)
+ sformat (_("Successful swipes: %1, failed swipes: %2"),
+ swipe_success, swipe_failed)
+ ));
+ }
+ if (SCR::Execute (.thinkfinger.add-user, bir_path) != true)
+ {
+ ui = `cancel;
+ // status message
+ UI::ReplaceWidget (`id (`rp),
+ `Label (_("Initialization of fingerprint reader failed.")));
+ }
+ while (ui != `cancel)
+ {
+ map statemap = (map) SCR::Read (.thinkfinger.state);
+ if (statemap != nil && statemap != $[])
+ {
+ integer state = statemap["state"]:0;
+ switch (state) {
+ case 8: { // TF_STATE_ACQUIRE_SUCCESS
+ UI::ReplaceWidget (`id (`rp),
+ // status label
+ `Label (_("Storing data...")));
+ UI::ReplaceWidget (`id (`rpstatus), `VSpacing ());
+ exit = true;
+ break;
+ }
+ case 7: { // TF_STATE_ENROLL_SUCCESS
+ UI::ReplaceWidget (`id (`rp),
+ // status label
+ `Label (_("Storing data...")));
+ UI::ReplaceWidget (`id (`rpstatus), `VSpacing ());
+ exit = true;
+ break;
+ }
+ case 9: { // TF_STATE_ACQUIRE_FAILED
+ UI::ReplaceWidget (`id (`rp),
+ `Label (_("Acquiring fingerprint failed.")));
+ exit = true;
+ break;
+ }
+ case 2: { // TF_STATE_SWIPE_0
+ UI::ReplaceWidget (`id (`rp),
+ `Label (_("Please swipe your finger...")));
+ break;
+ }
+ case 5: { // TF_STATE_SWIPE_SUCCESS
+ swipe_success = swipe_success + 1;
+ replace_swipe_string ();
+ break;
+ }
+ case 6: { // TF_STATE_SWIPE_AFILED
+ swipe_failed = swipe_failed + 1;
+ replace_swipe_string ();
+ break;
+ }
+ }
+ }
+ else if (statemap == nil)
+ {
+y2internal ("statemap is nil - error?");
+ exit_status = (integer) SCR::Read (.thinkfinger.exit_status);
+ break;
+ }
+ if (exit)
+ {
+ exit_status = (integer) SCR::Read (.thinkfinger.exit_status);
+ break;//must be before check for cancel
+ }
+
+ ui = UI::PollInput ();
+
+ if (ui == `cancel || ui == `back)
+ {
+ SCR::Execute (.thinkfinger.cancel);
+ y2internal ("exit status after cancel: %1", SCR::Read (.thinkfinger.exit_status));
+ break;
+ }
+ sleep (100);
+ }
+ y2milestone ("agent exit status: %1", exit_status);
+ // 9 is failed acquire, 253 is USB error, 254 communication error
+ // FIXME what's the meaning of TF_STATE_ENROLL_SUCCESS (7)?
+ if (exit_status == 7 || exit_status == 8)
+ {
+ // status label
+ UI::ReplaceWidget (`id (`rp), `Label (_("Fingerprint acquired successfully.")));
+ UI::ReplaceWidget (`id (`rpstatus), `Label (""));
+ // new id was already saved
+ Wizard::DisableBackButton ();
+ Wizard::EnableNextButton ();
+ }
+ else
+ {
+ // error message, part 1
+ string error = _("Could not acquire fingerprint.");
+ string details = "";
+ if (exit_status == 253)
+ // error message, part 2
+ details = _("USB error occured.");
+ else if (exit_status == 254)
+ // error message, part 2
+ details = _("Communication with fingerprint reader failed.");
+ if (exit_status != 256)
+ {
+ UI::ReplaceWidget (`id (`rp), `Label (error));
+ if (details != "")
+ UI::ReplaceWidget (`id (`rpstatus), `Label (details));
+ }
+ Wizard::EnableBackButton ();
+ }
+ UI::ChangeWidget (`id (`cancel), `Enabled, false);
+ ret = UI::UserInput ();
+ if (ret == `next)
+ {
+ // modified data to add to user
+ map tmp_data = $[
+ "bir_file" : username,
+ "plugin_modified" : 1
+ ];
+ if (data["what"]:"" == "edit_user")
+ Users::EditUser (tmp_data);
+ else if (data["what"]:"" == "add_user")
+ Users::AddUser (tmp_data);
+ }
+ Wizard::CloseDialog ();
+ }
+ y2milestone("users plugin finished with %1", ret);
+ y2milestone("----------------------------------------");
+ return ret;
+}
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/wizards.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/wizards.ycp?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/wizards.ycp (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/src/wizards.ycp Fri Oct 5 11:34:11 2007
@@ -0,0 +1,121 @@
+/* ------------------------------------------------------------------------------
+ * Copyright (c) 2006 Novell, Inc. All Rights Reserved.
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of version 2 of the GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * 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, contact Novell, Inc.
+ *
+ * To contact Novell about this file by physical or electronic mail, you may find
+ * current contact information at www.novell.com.
+ * ------------------------------------------------------------------------------
+ */
+
+/**
+ * File: include/fingerprint-reader/wizards.ycp
+ * Package: Configuration of fingerprint-reader
+ * Summary: Wizards definitions
+ * Authors: Jiri Suchomel
+ *
+ * $Id$
+ */
+
+{
+
+textdomain "fingerprint-reader";
+
+import "Sequencer";
+import "Wizard";
+
+include "fingerprint-reader/dialogs.ycp";
+
+/**
+ * Main workflow of the fingerprint-reader configuration
+ * @return sequence result
+ */
+any MainSequence() {
+
+ map aliases = $[
+ "summary" : ``( FingerprintReaderDialog () ),
+ ];
+
+ map sequence = $[
+ "ws_start" : "summary",
+ "summary" : $[
+ `abort : `abort,
+ `next : `next,
+ ],
+ ];
+
+ any ret = Sequencer::Run(aliases, sequence);
+
+ return ret;
+}
+
+/**
+ * Whole configuration of fingerprint-reader
+ * @return sequence result
+ */
+any FingerprintReaderSequence() {
+
+ map aliases = $[
+ "read" : [ ``( ReadDialog() ), true ],
+ "main" : ``( MainSequence() ),
+ "write" : [ ``( WriteDialog() ), true ]
+ ];
+
+ map sequence = $[
+ "ws_start" : "read",
+ "read" : $[
+ `abort : `abort,
+ `next : "main"
+ ],
+ "main" : $[
+ `abort : `abort,
+ `next : "write"
+ ],
+ "write" : $[
+ `abort : `abort,
+ `next : `next
+ ]
+ ];
+
+ Wizard::CreateDialog();
+
+ any ret = Sequencer::Run(aliases, sequence);
+
+ UI::CloseDialog();
+ return ret;
+}
+
+/**
+ * Whole configuration of fingerprint-reader but without reading and writing.
+ * For use with autoinstallation.
+ * @return sequence result
+ */
+any FingerprintReaderAutoSequence() {
+
+ /* Initialization dialog caption */
+ string caption = _("Fingerprint Reader Configuration");
+ /* Initialization dialog contents */
+ term contents = `Label(_("Initializing..."));
+
+ Wizard::CreateDialog();
+ Wizard::SetContentsButtons(caption, contents, "",
+ Label::BackButton(), Label::NextButton());
+
+ any ret = MainSequence();
+
+ UI::CloseDialog();
+ return ret;
+}
+
+/* EOF */
+}
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/testsuite/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/testsuite/Makefile.am?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/testsuite/Makefile.am (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/testsuite/Makefile.am Fri Oct 5 11:34:11 2007
@@ -0,0 +1,21 @@
+#
+# Makefile.am for .../testsuite
+#
+# Do not edit this file (Makefile.am) as it will be overwritten!
+#
+
+AUTOMAKE_OPTIONS = dejagnu
+EXTRA_DIST = $(wildcard tests/*.out) $(wildcard tests/*.err) $(wildcard tests/*.ycp) $(wildcard tests/*.yh)
+
+testsuite_prepare = @ydatadir@/testsuite/Makefile.testsuite
+
+all-local: $(testsuite_prepare)
+ make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir)
+
+clean-local: $(testsuite_prepare)
+ make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) clean
+
+check-local: $(testsuite_prepare)
+ make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) check
+
+# EOF
Added: branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/yast2-fingerprint-reader.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/yast2-fingerprint-reader.spec.in?rev=41266&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/yast2-fingerprint-reader.spec.in (added)
+++ branches/SuSE-SLE-10-SP1-Branch/fingerprint-reader/yast2-fingerprint-reader.spec.in Fri Oct 5 11:34:11 2007
@@ -0,0 +1,34 @@
+@HEADER-COMMENT@
+
+@HEADER@
+Requires: yast2 yast2-pam
+BuildRequires: libthinkfinger libusb-devel
+BuildRequires: doxygen gcc-c++ yast2-core-devel perl-XML-Writer update-desktop-files yast2 yast2-devtools yast2-testsuite yast2-pam
+
+Conflicts: yast2-hardware-detection < 2.15.7
+
+Summary: Configuration of fingerprint reader
+
+%description
+-
+
+@PREP@
+
+@BUILD@
+
+@INSTALL@
+
+@CLEAN@
+
+%files
+%defattr(-,root,root)
+%dir @yncludedir@/fingerprint-reader
+@yncludedir@/fingerprint-reader/*
+@clientdir@/fingerprint-reader.ycp
+@clientdir@/users_plugin_fingerprint_reader.ycp
+@moduledir@/FingerprintReader.*
+@moduledir@/UsersPluginFingerprintReader.pm
+@desktopdir@/fingerprint-reader.desktop
+@scrconfdir@/*.scr
+@plugindir@/libpy2ag_thinkfinger.*
+%doc @docdir@
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org