Re: [elinks-dev] pwmd patch

2007-06-11 Thread Kalle Olavi Niemitalo
Ben Kibbey [EMAIL PROTECTED] writes:

 +++ b/src/formhist/formhist.c

 @@ -355,7 +374,21 @@ get_form_history_value(unsigned char *url, unsigned char 
 *name)

 +  * FIXME If theres a pwmd error a message box pops up.
 +  * src/viewer/text/form.c seems to call this repeatedly until
 +  * it's satisfied with a value.
 +  */

I think I fixed that in commit 0df5b7fdf5f819f03f33b5eb972c4880b35904d1.

 +++ b/src/formhist/pwmd.c

 +static void
 +show_error(int ret, int error)
 +{
 +unsigned char *buf;
 +struct terminal *term = terminals.prev;

Do not assume that terminals.prev is visible to the user, nor
that it is connected to the stdin/stdout of the elinks process.
Some of your other functions have similar assumptions.

Besides, your current libpwmd seems to block while waiting for
the user to type the password.  That would prevent ELinks from
serving slave terminals.

One solution might be to make ELinks fork a subprocess for the
libpwmd calls.  The stdin and stdout of this subprocess would be
pipes that the master ELinks process would forward to the slave
ELinks process serving the appropriate terminal.  But that might
require more extensive changes to ELinks than you have here;
all form-history operations might have to be made asynchronous
with completion callbacks.


pgpIxEx4A1zpJ.pgp
Description: PGP signature
___
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev


[elinks-dev] pwmd patch

2007-01-28 Thread Ben Kibbey
Here's a patch to use pwmd for form history. pwmd is a daemon that
listens on a local socket and waits for commands from clients to
manipulate data. The data is an encrypted XML file. The password to
open/save the file is gotten with gpg-agent. Read
src/formhist/README.pwmd for more info.

-- 
Benjamin J. Kibbey [EMAIL PROTECTED]/jabber/freenode
3019 F5FC AA33 5BC7 BE9F 09D2 393E DBD2 40D5 FA7E
commit df755b42e5d58413a43c8243e68fbdc9b6842824
Author: Ben Kibbey [EMAIL PROTECTED]
Date:   Sun Jan 28 08:28:14 2007 -0500

Only #include what is needed in pwmd.[ch].

elinks-git-18771fd+libpwmd-2.0.x-3.diff

commit 131a990d372ddf25a4a6103440cd5a6c05eab390
Author: Ben Kibbey [EMAIL PROTECTED]
Date:   Sun Jan 28 08:16:30 2007 -0500

Include pwmd.h where needed to silence prototype warnings.

A couple more variable renamings to avoid confusion with libpwmd
names.

Cleaner 'struct string' usage.

Fixed a couple memory leaks from pwmd_command().

commit 74369b109e3ab3257e45a19012bd88002a0ce37f
Author: Ben Kibbey [EMAIL PROTECTED]
Date:   Sun Jan 28 05:13:05 2007 -0500

Don't abort configure if libpwmd is not found or if formhist was
disabled. Also use pkg-config to configure libpwmd.

commit 3589f40931ce0954894adf298708e8952b00795a
Author: Ben Kibbey [EMAIL PROTECTED]
Date:   Sat Jan 27 20:54:06 2007 -0500

Use N_() to set internationalization strings.

commit 04601083f58d4b5abfe423406e0e6ddcf01fa534
Author: Ben Kibbey [EMAIL PROTECTED]
Date:   Sat Jan 27 20:41:24 2007 -0500

Don't do save_pwmd_formhist() in anonymous mode.

commit daaa0835464cb41cc444c9e26de1099e0fcf1823
Author: Ben Kibbey [EMAIL PROTECTED]
Date:   Sat Jan 27 20:32:40 2007 -0500

Renamed some functions to be less confusing with libpwmd function
names.

commit 29a4b2606577f61fb4c3e8be061c2b586c6d5040
Author: Ben Kibbey [EMAIL PROTECTED]
Date:   Sat Jan 27 20:23:00 2007 -0500

Better configuration option description strings.
diff --git a/Makefile.config.in b/Makefile.config.in
index 98afd5b..d7ff8ec 100644
--- a/Makefile.config.in
+++ b/Makefile.config.in
@@ -132,6 +132,7 @@ CONFIG_INTERLINK = @CONFIG_INTERLINK@
 CONFIG_IPV6 = @CONFIG_IPV6@
 CONFIG_JW = @CONFIG_JW@
 CONFIG_LEDS = @CONFIG_LEDS@
+CONFIG_PWMD = @CONFIG_PWMD@
 CONFIG_LZMA = @CONFIG_LZMA@
 CONFIG_MAILCAP = @CONFIG_MAILCAP@
 CONFIG_MANUAL = @CONFIG_MANUAL@
diff --git a/configure.in b/configure.in
index 4ee940a..920f858 100644
--- a/configure.in
+++ b/configure.in
@@ -483,6 +483,7 @@ EL_ARG_ENABLE(CONFIG_LZMA, lzma, [lzma],
 	  [  --enable-lzma   enable lzma encoding support])
 
 dnl ===
+
 dnl Check for GSSAPI, optional even if installed.
 dnl ===
 
@@ -1192,6 +1193,37 @@ EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
 	  [  --disable-formhist  disable form history support])
 
+
+CONFIG_PWMD=no
+AC_ARG_ENABLE(pwmd,
+	  [  --enable-pwmd   enable Password Manager Daemon support],
+	  [if test $enableval != no; then enableval=yes; fi
+	   CONFIG_PWMD=$enableval;])
+
+if test x$CONFIG_PWMD = xyes; then
+	if test x$CONFIG_FORMHIST = xyes; then
+		PKG_CHECK_EXISTS([libpwmd], have_libpwmd=1,
+ AC_MSG_WARN([Could not find libpwmd pkg-config module. Disabling pwmd support.]))
+
+		if test $have_libpwmd = 1; then
+			PKG_CHECK_MODULES([libpwmd], [libpwmd = 2.0.0], have_libpwmd=1)
+
+			if test $have_libpwmd = 1; then
+EL_CONFIG(CONFIG_PWMD, [pwmd])
+LIBS=$LIBS $libpwmd_LIBS
+CFLAGS=$CFLAGS $libpwmd_CFLAGS
+			else
+AC_MSG_WARN($libpwmd_PKG_ERRORS)
+			fi
+		fi
+	else
+		AC_MSG_WARN([--enable-pwmd requires --enable-formhist. Disabling pwmd support.])
+		CONFIG_PWMD=no
+	fi
+fi
+
+EL_LOG_CONFIG(CONFIG_PWMD, [Password Manager Daemon], $CONFIG_PWMD)
+
 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
 	  [  --disable-globhist  disable global history support])
 
diff --git a/features.conf b/features.conf
index 0a756f7..ab9fe20 100644
--- a/features.conf
+++ b/features.conf
@@ -115,6 +115,15 @@ CONFIG_COOKIES=yes
 CONFIG_FORMHIST=yes
 
 
+### libPWMD Support
+#
+# Storage and retrieval of form data from the Password Manager Daemon.
+#
+# Default: disabled
+
+CONFIG_PWMD=no
+
+
 ### Global History
 #
 # This device records each and every page you visit (to a configurable limit).
diff --git a/src/config/actions-main.inc b/src/config/actions-main.inc
index 9626c9d..cd9a55a 100644
--- a/src/config/actions-main.inc
+++ b/src/config/actions-main.inc
@@ -24,6 +24,7 @@ ACTION_(MAIN, file-menu, FILE_MENU, N__(Open the File menu), 0),
 ACTION_(MAIN, find-next, FIND_NEXT, N__(Find the next occurrence of the current search text), ACTION_REQUIRE_VIEW_STATE | ACTION_REQUIRE_LOCATION),
 ACTION_(MAIN, find-next-back, FIND_NEXT_BACK, N__(Find the previous occurrence of the current search