commit:     1f0a89892e0258cb8db643b3b0bb2396dcf9d92f
Author:     Tiziano Müller <dev-zero <AT> gentoo <DOT> org>
AuthorDate: Fri Jan  8 14:08:52 2016 +0000
Commit:     Tiziano Müller <dev-zero <AT> gentoo <DOT> org>
CommitDate: Fri Jan  8 14:08:52 2016 +0000
URL:        https://gitweb.gentoo.org/dev/dev-zero.git/commit/?id=1f0a8989

app-misc/pwsafe: add rev-bump with fcaps to allow mlock as non-root

 app-misc/pwsafe/Manifest                           |   1 +
 .../files/pwsafe-0.2.0-XChangeProperty.patch       |  22 +++++
 app-misc/pwsafe/files/pwsafe-0.2.0-cvs-1.57.patch  |  48 +++++++++
 .../pwsafe/files/pwsafe-0.2.0-fake-readline.patch  | 107 +++++++++++++++++++++
 .../pwsafe-0.2.0-man-page-option-syntax.patch      |  30 ++++++
 app-misc/pwsafe/files/pwsafe-0.2.0-printf.patch    |  43 +++++++++
 app-misc/pwsafe/metadata.xml                       |  23 +++++
 app-misc/pwsafe/pwsafe-0.2.0-r3.ebuild             |  49 ++++++++++
 8 files changed, 323 insertions(+)

diff --git a/app-misc/pwsafe/Manifest b/app-misc/pwsafe/Manifest
new file mode 100644
index 0000000..2dc6178
--- /dev/null
+++ b/app-misc/pwsafe/Manifest
@@ -0,0 +1 @@
+DIST pwsafe-0.2.0.tar.gz 127433 SHA256 
61e91dc5114fe014a49afabd574eda5ff49b36c81a6d492c03fcb10ba6af47b7 SHA512 
e8d3684f523f83def6317ef5561a02d1493685cfbda18707644bf335b7f45b1a548aae17a735838d9f6df345ddb17934607162a6e99348df625b34a9ad5f4cf3
 WHIRLPOOL 
c80ef8c398e5cb68920b11815e0aa042adf2ddaa78c75157e346566b210f5aba000f71c4a2172d6cf2c5a9707fe82af8a1379dbf9bb3ac2f71b6e12aebbbb975

diff --git a/app-misc/pwsafe/files/pwsafe-0.2.0-XChangeProperty.patch 
b/app-misc/pwsafe/files/pwsafe-0.2.0-XChangeProperty.patch
new file mode 100644
index 0000000..3fadfc2
--- /dev/null
+++ b/app-misc/pwsafe/files/pwsafe-0.2.0-XChangeProperty.patch
@@ -0,0 +1,22 @@
+This patch came from <https://bugzilla.redhat.com/show_bug.cgi?id=667541>.
+
+Index: pwsafe.cpp
+===================================================================
+RCS file: /cvsroot/pwsafe/pwsafe/pwsafe.cpp,v
+retrieving revision 1.57
+diff -u -r1.57 pwsafe.cpp
+--- pwsafe.cpp 12 Aug 2007 12:33:06 -0000      1.57
++++ pwsafe.cpp 5 Jan 2011 22:16:43 -0000
+@@ -1820,10 +1820,10 @@
+             if (xev.xselectionrequest.target == XA_TARGETS(xdisplay)) {
+               // tell them what we can supply
+               const Atom targets[] = { XA_TARGETS(xdisplay), 
XA_TIMESTAMP(xdisplay), XA_TEXT(xdisplay), XA_STRING };
+-              XChangeProperty(xdisplay, xev.xselectionrequest.requestor, 
prop, XA_TARGETS(xdisplay), 32, PropModeReplace, reinterpret_cast<const 
unsigned char*>(&targets), sizeof(targets)/sizeof(targets[0]));
++              XChangeProperty(xdisplay, xev.xselectionrequest.requestor, 
prop, XA_ATOM, 32, PropModeReplace, reinterpret_cast<const unsigned 
char*>(&targets), sizeof(targets)/sizeof(targets[0]));
+             }
+             else if (xev.xselectionrequest.target == XA_TIMESTAMP(xdisplay)) {
+-              XChangeProperty(xdisplay, xev.xselectionrequest.requestor, 
prop, XA_TIMESTAMP(xdisplay), 32, PropModeReplace, reinterpret_cast<const 
unsigned char*>(&timestamp), 1);
++              XChangeProperty(xdisplay, xev.xselectionrequest.requestor, 
prop, XA_INTEGER, 32, PropModeReplace, reinterpret_cast<const unsigned 
char*>(&timestamp), 1);
+             }
+             else if (xev.xselectionrequest.target == XA_TEXT(xdisplay) ||
+                 xev.xselectionrequest.target == XA_STRING) {

diff --git a/app-misc/pwsafe/files/pwsafe-0.2.0-cvs-1.57.patch 
b/app-misc/pwsafe/files/pwsafe-0.2.0-cvs-1.57.patch
new file mode 100644
index 0000000..7f62eb5
--- /dev/null
+++ b/app-misc/pwsafe/files/pwsafe-0.2.0-cvs-1.57.patch
@@ -0,0 +1,48 @@
+Index: pwsafe.cpp
+===================================================================
+RCS file: /cvsroot/pwsafe/pwsafe/pwsafe.cpp,v
+retrieving revision 1.56
+retrieving revision 1.57
+diff -u -r1.56 -r1.57
+--- pwsafe.cpp 30 Sep 2005 10:30:56 -0000      1.56
++++ pwsafe.cpp 12 Aug 2007 12:33:06 -0000      1.57
+@@ -3346,6 +3346,12 @@
+     }
+ 
+     bufpos += rc;
++    buf[bufpos] = '\0';
++
++    if (rc == 0) {
++      // EOF (ctrl-D)
++      break;
++    }
+ 
+     if (bufpos == buflen && !strchr(buf,'\n')) {
+       // we needed a bigger buffer
+@@ -3354,6 +3360,7 @@
+         fprintf(stderr, "Error: %s out of memory\n", program_name);
+         memset(buf,0,buflen);
+         free(buf);
++        throw FailEx();
+       }
+ 
+       memcpy(new_buf, buf, bufpos);
+@@ -3364,9 +3371,15 @@
+     }
+   }
+ 
+-  int len = strchr(buf,'\n') - buf;
+-  saved.assign(buf+len+1, bufpos-(len+1));
+-  buf[len] = '\0';
++  char* lf = strchr(buf,'\n');
++  if (lf) {
++    // save the rest of the input for later
++    saved.assign(lf+1);
++    *lf = '\0';
++  } else {
++    saved.assign("",0);
++  }
++
+   return buf;
+ }
+ #endif // WITH_READLINE

diff --git a/app-misc/pwsafe/files/pwsafe-0.2.0-fake-readline.patch 
b/app-misc/pwsafe/files/pwsafe-0.2.0-fake-readline.patch
new file mode 100644
index 0000000..4e0f4ad
--- /dev/null
+++ b/app-misc/pwsafe/files/pwsafe-0.2.0-fake-readline.patch
@@ -0,0 +1,107 @@
+Index: pwsafe.cpp
+===================================================================
+RCS file: /cvsroot/pwsafe/pwsafe/pwsafe.cpp,v
+retrieving revision 1.57
+diff -u -r1.57 pwsafe.cpp
+--- pwsafe.cpp 12 Aug 2007 12:33:06 -0000      1.57
++++ pwsafe.cpp 30 Mar 2011 07:22:11 -0000
+@@ -3325,61 +3325,48 @@
+ static char* readline(const char* prompt) {
+   printf("%s", prompt);
+   fflush(stdout);
+-  
+-  static secstring saved;
+-  int buflen = saved.length() + 100;
+-  int bufpos = saved.length();
+-  char* buf = reinterpret_cast<char*>(malloc(buflen+1));
+-  if (!buf)
+-    throw FailEx();
+-  memcpy(buf, saved.data(), saved.length());
+-  buf[saved.length()] = '\0';
+-
+-  while (!strchr(buf,'\n')) {
+-    const int rc = ::read(STDIN_FILENO, buf+bufpos, buflen);
+-
+-    if (rc == -1) {
+-      fprintf(stderr, "Error: %s read(STDIN) failed: %s\n", program_name, 
strerror(errno));
+-      memset(buf,0,buflen);
+-      free(buf);
+-      throw FailEx();
+-    }
+-
+-    bufpos += rc;
+-    buf[bufpos] = '\0';
+-
+-    if (rc == 0) {
+-      // EOF (ctrl-D)
+-      break;
+-    }
+-
+-    if (bufpos == buflen && !strchr(buf,'\n')) {
+-      // we needed a bigger buffer
+-      char* new_buf = reinterpret_cast<char*>(malloc(2*buflen+1));
+-      if (!new_buf) {
+-        fprintf(stderr, "Error: %s out of memory\n", program_name);
+-        memset(buf,0,buflen);
+-        free(buf);
+-        throw FailEx();
+-      }
+ 
+-      memcpy(new_buf, buf, bufpos);
+-      memset(buf, 0, buflen);
+-      free(buf);
+-      buf = new_buf;
+-      buflen *= 2;
+-    }
+-  }
++  size_t buflen = 100;
++  size_t bufpos = 0;
++  char* buf = static_cast<char*>(malloc(buflen+1));
++  if (!buf)
++      throw FailEx();
+ 
+-  char* lf = strchr(buf,'\n');
+-  if (lf) {
+-    // save the rest of the input for later
+-    saved.assign(lf+1);
+-    *lf = '\0';
+-  } else {
+-    saved.assign("",0);
++  for (;;) {
++      const ssize_t rc = ::read(STDIN_FILENO, buf+bufpos, 1);
++      if (rc == -1) {
++        fprintf(stderr, "Error: %s read(STDIN) failed: %s\n", program_name, 
strerror(errno));
++        memset(buf,0,bufpos);
++        free(buf);
++        throw FailEx();
++      } else if (rc == 0) {
++        // EOF (ctrl-D)
++        break;
++      } else if (buf[bufpos] == '\n') {
++        // end of line
++        break;
++      }
++
++      ++bufpos;
++
++      if (bufpos == buflen) {
++        // we need a bigger buffer
++        char* new_buf = static_cast<char*>(malloc(2*buflen+1));
++        if (!new_buf) {
++              fprintf(stderr, "Error: %s out of memory\n", program_name);
++              memset(buf,0,bufpos);
++              free(buf);
++              throw FailEx();
++        }
++        memcpy(new_buf, buf, bufpos);
++        memset(buf, 0, bufpos);
++        free(buf);
++        buf = new_buf;
++        buflen *= 2;
++      }
+   }
+ 
++  buf[bufpos] = '\0';
+   return buf;
+ }
+ #endif // WITH_READLINE

diff --git a/app-misc/pwsafe/files/pwsafe-0.2.0-man-page-option-syntax.patch 
b/app-misc/pwsafe/files/pwsafe-0.2.0-man-page-option-syntax.patch
new file mode 100644
index 0000000..a83d3a8
--- /dev/null
+++ b/app-misc/pwsafe/files/pwsafe-0.2.0-man-page-option-syntax.patch
@@ -0,0 +1,30 @@
+Index: pwsafe.1.in
+===================================================================
+RCS file: /cvsroot/pwsafe/pwsafe/pwsafe.1.in,v
+retrieving revision 1.8
+diff -u -r1.8 pwsafe.1.in
+--- pwsafe.1.in        18 Mar 2006 14:17:41 -0000      1.8
++++ pwsafe.1.in        30 Mar 2011 07:42:23 -0000
+@@ -52,18 +52,18 @@
+ .B  \-\-passwd
+ Change the database's passphrase.
+ .TP 
+-.B  \-\-list[=REGEX]
++.B  \-\-list [REGEX]
+ List all [matching] entries in database.
+ .BR 
+ If \-u or \-p is given then REGEX must match only one entry, and only the 
requested field(s) are emitted.
+ .TP 
+-.B  \-a, \-\-add[=NAME]
++.B  \-a, \-\-add [NAME]
+ Add an entry to database.
+ .TP 
+-.B  \-e, \-\-edit=REGEX
++.B  \-e, \-\-edit REGEX
+ Edit an entry.
+ .TP 
+-.B  \-\-delete=NAME
++.B  \-\-delete NAME
+ Delete an entry from database.
+ .TP 
+ If no command is given, an interactive mode is entered.

diff --git a/app-misc/pwsafe/files/pwsafe-0.2.0-printf.patch 
b/app-misc/pwsafe/files/pwsafe-0.2.0-printf.patch
new file mode 100644
index 0000000..409f3a7
--- /dev/null
+++ b/app-misc/pwsafe/files/pwsafe-0.2.0-printf.patch
@@ -0,0 +1,43 @@
+Index: pwsafe.cpp
+===================================================================
+RCS file: /cvsroot/pwsafe/pwsafe/pwsafe.cpp,v
+retrieving revision 1.57
+diff -u -r1.57 pwsafe.cpp
+--- pwsafe.cpp 12 Aug 2007 12:33:06 -0000      1.57
++++ pwsafe.cpp 30 Mar 2011 05:44:07 -0000
+@@ -1619,7 +1619,7 @@
+     snprintf(ent_buf, sizeof(ent_buf), "%d", entropy_needed);
+     ent_buf[sizeof(ent_buf)-1] = '\0';
+     char len_buf[24];
+-    snprintf(len_buf, sizeof(len_buf), "%d", pw.length());
++    snprintf(len_buf, sizeof(len_buf), "%lu", static_cast<unsigned 
long>(pw.length()));
+     len_buf[sizeof(len_buf)-1] = '\0';
+     switch (tolower(get1char("Use "+pw+"\ntype "+type_name+", length 
"+len_buf+", "+ent_buf+" bits of entropy [y/N/ /+/-/q/?] ? ", 'n'))) {
+       case 'y':
+@@ -2380,7 +2380,7 @@
+     version = VERSION_1_7;
+   }
+  
+-  if (arg_verbose > 1) printf("read in %u entries\n", entries.size());
++  if (arg_verbose > 1) printf("read in %lu entries\n", static_cast<unsigned 
long>(entries.size()));
+ 
+   opened = true;
+   return true;
+@@ -2601,7 +2601,7 @@
+       for (matches_t::const_iterator i=matches.begin(); i!=matches.end() && 
count < 3; ++i, ++count)
+         printf("%s%s", (count?", ":""), (*i)->groupname().c_str());
+       if (count != matches.size())
+-        printf(", ... (%u more) ", matches.size()-3);
++        printf(", ... (%lu more) ", static_cast<unsigned 
long>(matches.size()-3));
+       printf(".\n");
+       throw FailEx();
+     }
+@@ -2637,7 +2637,7 @@
+             // print out the UUID too
+             fprintf(outfile, "%s\n", formatuuid(e.uuid).c_str());
+           if (!e.extras.empty())
+-            fprintf(outfile, "and %u unknown extra fields\n", 
e.extras.size());
++            fprintf(outfile, "and %lu unknown extra fields\n", 
static_cast<unsigned long>(e.extras.size()));
+         }
+       } else
+         // just print out the name

diff --git a/app-misc/pwsafe/metadata.xml b/app-misc/pwsafe/metadata.xml
new file mode 100644
index 0000000..bc5ec52
--- /dev/null
+++ b/app-misc/pwsafe/metadata.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+  <herd>proxy-maintainers</herd>
+  <maintainer>
+       <email>ch...@chead.ca</email>
+       <name>Christopher Head</name>   
+       <description>Proxy maintainer, assign bugs</description>
+  </maintainer>
+  <longdescription lang="en">
+    pwsafe is a commandline password database utility compatible with
+    Counterpane's Password Safe. It is compatible with Counterpane Password
+    Safe 1.9.x and 2.0 databases. It can interact with X11 selection and
+    clipboard.
+  </longdescription>
+  <upstream>
+    <maintainer>
+      <email>nd...@nsd.dyndns.org</email>
+      <name>Nicolas Dade</name>
+    </maintainer>
+    <remote-id type="sourceforge">pwsafe</remote-id>
+  </upstream>
+</pkgmetadata>

diff --git a/app-misc/pwsafe/pwsafe-0.2.0-r3.ebuild 
b/app-misc/pwsafe/pwsafe-0.2.0-r3.ebuild
new file mode 100644
index 0000000..12a80a8
--- /dev/null
+++ b/app-misc/pwsafe/pwsafe-0.2.0-r3.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit base eutils fcaps
+
+DESCRIPTION="A Password Safe compatible command-line password manager"
+HOMEPAGE="http://nsd.dyndns.org/pwsafe/";
+SRC_URI="http://nsd.dyndns.org/pwsafe/releases/${P}.tar.gz";
+PATCHES=(
+                       "${FILESDIR}/${P}-cvs-1.57.patch"
+                       "${FILESDIR}/${P}-printf.patch"
+                       "${FILESDIR}/${P}-fake-readline.patch"
+                       "${FILESDIR}/${P}-man-page-option-syntax.patch"
+                       "${FILESDIR}/${P}-XChangeProperty.patch"
+               )
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE="X readline"
+
+DEPEND="sys-libs/ncurses
+       dev-libs/openssl
+       readline? ( sys-libs/readline )
+       X? ( x11-libs/libSM
+               x11-libs/libICE
+               x11-libs/libXmu
+               x11-libs/libX11 )"
+RDEPEND="${DEPEND}"
+
+src_configure() {
+       econf \
+               $(use_with X x) \
+               $(use_with readline)
+}
+
+src_install() {
+       doman pwsafe.1
+       dobin pwsafe
+       dodoc README NEWS
+}
+
+pkg_postinst() {
+       fcaps cap_ipc_lock usr/bin/pwsafe
+}

Reply via email to