Skip to content

Commit

Permalink
Import lastpass-cli version 1.2.1 as security/lastpass-cli.
Browse files Browse the repository at this point in the history
LastPass is a password management service that stores encrypted passwords
in private accounts.  LastPass is standard with a web interface, but also
includes plugins for many web browsers and apps for many smartphones.

This package provides the lpass command, a command line interface to the
LastPass.com API.
  • Loading branch information
jperkin committed Aug 16, 2017
1 parent 8a8927f commit 62022f1
Show file tree
Hide file tree
Showing 12 changed files with 261 additions and 0 deletions.
6 changes: 6 additions & 0 deletions security/lastpass-cli/DESCR
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
LastPass is a password management service that stores encrypted passwords
in private accounts. LastPass is standard with a web interface, but also
includes plugins for many web browsers and apps for many smartphones.

This package provides the lpass command, a command line interface to the
LastPass.com API.
24 changes: 24 additions & 0 deletions security/lastpass-cli/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# $NetBSD: Makefile,v 1.1 2017/08/16 15:18:24 jperkin Exp $

DISTNAME= lastpass-cli-1.2.1
CATEGORIES= security
MASTER_SITES= ${MASTER_SITE_GITHUB:=lastpass/}
GITHUB_TAG= v${PKGVERSION_NOREV}

MAINTAINER= [email protected]
HOMEPAGE= https://github.com/lastpass/lastpass-cli/
COMMENT= Command line interface to LastPass.com
LICENSE= gnu-gpl-v2

DEPENDS+= asciidoc>=0:../../textproc/asciidoc

USE_CMAKE= yes
USE_LANGUAGES= c c++
USE_TOOLS= pkg-config

INSTALL_TARGET= install install-doc

.include "../../security/openssl/buildlink3.mk"
.include "../../textproc/libxml2/buildlink3.mk"
.include "../../www/curl/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
3 changes: 3 additions & 0 deletions security/lastpass-cli/PLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@comment $NetBSD: PLIST,v 1.1 2017/08/16 15:18:24 jperkin Exp $
bin/lpass
man/man1/lpass.1
14 changes: 14 additions & 0 deletions security/lastpass-cli/distinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$NetBSD: distinfo,v 1.1 2017/08/16 15:18:24 jperkin Exp $

SHA1 (lastpass-cli-1.2.1.tar.gz) = 78f05426ac14417004735d85554f5641c567234e
RMD160 (lastpass-cli-1.2.1.tar.gz) = 86752841a6df70856411bbb3b516669583500838
SHA512 (lastpass-cli-1.2.1.tar.gz) = c7c9f20dbc083873b815834320828a30a1c488571efbfc5aea47c3bd2073819d713810c785855d4c0c208e1b95aa0e5fc550a0b6b5c0f787eca1f54589e18e62
Size (lastpass-cli-1.2.1.tar.gz) = 108780 bytes
SHA1 (patch-CMakeLists.txt) = d5498e06f9fed58186caf3b2ed60c2d30ec43caa
SHA1 (patch-agent.c) = 2e04b136da6116f80d1a1bfa9b831ccba3e3f215
SHA1 (patch-clipboard.c) = 1c0d7c7cf2f80f21e900257e82736f57b1a8fc0e
SHA1 (patch-cmake__extras_install__doc.cmake) = a0d80f60501ac283d66402ef036d6934ea644f17
SHA1 (patch-http.c) = 6027b06014d5f3c290f55a8086a493d30bdf9023
SHA1 (patch-password.c) = 9d7daba95ebf62b243ccf8696add8afc24c8bb3e
SHA1 (patch-process.c) = 565a9d8ea4d08194c15e0e7898b1dd273b1b6f2f
SHA1 (patch-upload-queue.c) = 45279b48d53f6f9683d3e14c58c4f5ec4c5e89ba
32 changes: 32 additions & 0 deletions security/lastpass-cli/patches/patch-CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
$NetBSD: patch-CMakeLists.txt,v 1.1 2017/08/16 15:18:24 jperkin Exp $

Link against libsocket on SunOS.
Remove non-portable compiler warning flags.

--- CMakeLists.txt.orig 2017-06-28 12:50:49.000000000 +0000
+++ CMakeLists.txt
@@ -45,10 +45,13 @@ file(GLOB PROJECT_SOURCES *.c)

set(PROJECT_DEFINITIONS "_GNU_SOURCE")

-set(PROJECT_FLAGS "-std=gnu99 -pedantic -Wall -Wextra -Wno-language-extension-token")
+set(PROJECT_FLAGS "-std=gnu99 -pedantic -Wall -Wextra")
if(APPLE)
set(PROJECT_FLAGS "${PROJECT_FLAGS} -Wno-deprecated-declarations")
endif()
+if (CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ set(PROJECT_FLAGS "${PROJECT_FLAGS} -D_XOPEN_SOURCE=600 -D__EXTENSIONS__")
+endif (CMAKE_SYSTEM_NAME MATCHES "SunOS")

# Main lpass executable
add_executable(${PROJECT_NAME} ${PROJECT_HEADERS} ${PROJECT_SOURCES})
@@ -62,6 +65,9 @@ target_link_libraries(${PROJECT_NAME} ${
if (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
target_link_libraries(${PROJECT_NAME} "-lkvm")
endif (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
+if (CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ target_link_libraries(${PROJECT_NAME} "-lsocket")
+endif (CMAKE_SYSTEM_NAME MATCHES "SunOS")

add_custom_command(OUTPUT lpass.1 DEPENDS ${CMAKE_SOURCE_DIR}/lpass.1.txt
COMMAND a2x -D ./ --no-xmllint -f manpage ${CMAKE_SOURCE_DIR}/lpass.1.txt)
40 changes: 40 additions & 0 deletions security/lastpass-cli/patches/patch-agent.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
$NetBSD: patch-agent.c,v 1.1 2017/08/16 15:18:24 jperkin Exp $

Use getpeerucred on SunOS.

--- agent.c.orig 2017-06-28 12:50:49.000000000 +0000
+++ agent.c
@@ -49,6 +49,12 @@
#include <sys/mman.h>
#include <errno.h>
#include <signal.h>
+#ifdef __sun
+#define _STRUCTURED_PROC 1
+#include <ucred.h>
+#include <sys/procfs.h>
+#include <sys/ucred.h>
+#endif
#if (defined(__unix__) || defined(unix)) && !defined(USG)
#include <sys/param.h>
#endif
@@ -123,6 +129,20 @@ static int agent_socket_get_cred(int fd,
socklen_t credlen = sizeof(struct ucred);
return getsockopt(fd, SOL_SOCKET, SO_PEERCRED, cred, &credlen);
}
+#elif defined(__sun)
+static int agent_socket_get_cred(int fd, struct ucred *cred)
+{
+ ucred_t *uc;
+
+ if (getpeerucred(fd, &uc) < 0)
+ return -1;
+
+ cred->uid = ucred_geteuid(uc);
+ cred->gid = ucred_getegid(uc);
+ cred->pid = ucred_getpid(uc);
+
+ return 0;
+}
#elif defined(__APPLE__) && defined(__MACH__) || defined(BSD)
static int agent_socket_get_cred(int fd, struct ucred *cred)
{
30 changes: 30 additions & 0 deletions security/lastpass-cli/patches/patch-clipboard.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
$NetBSD: patch-clipboard.c,v 1.1 2017/08/16 15:18:24 jperkin Exp $

Avoid "Missing sentinel in function call" warnings.

--- clipboard.c.orig 2017-06-28 12:50:49.000000000 +0000
+++ clipboard.c
@@ -64,7 +64,7 @@ void exec_command(char *command) {
shell = "/bin/sh";
}

- execlp(shell, shell, "-c", command, NULL);
+ execlp(shell, shell, "-c", command, (char *)0);
}

void clipboard_open(void)
@@ -91,10 +91,10 @@ void clipboard_open(void)
exec_command(clipboard_command);
die("Unable to copy contents to clipboard. Please make sure you have `xclip`, `xsel`, `pbcopy`, or `putclip` installed.");
} else {
- execlp("xclip", "xclip", "-selection", "clipboard", "-in", NULL);
- execlp("xsel", "xsel", "--clipboard", "--input", NULL);
- execlp("pbcopy", "pbcopy", NULL);
- execlp("putclip", "putclip", "--dos", NULL);
+ execlp("xclip", "xclip", "-selection", "clipboard", "-in", (char *)0);
+ execlp("xsel", "xsel", "--clipboard", "--input", (char *)0);
+ execlp("pbcopy", "pbcopy", (char *)0);
+ execlp("putclip", "putclip", "--dos", (char *)0);
die("Unable to copy contents to clipboard. Please make sure you have `xclip`, `xsel`, `pbcopy`, or `putclip` installed.");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$NetBSD: patch-cmake__extras_install__doc.cmake,v 1.1 2017/08/16 15:18:24 jperkin Exp $

Remove incompatible -v flag for bsdinstall.

--- cmake_extras/install_doc.cmake.orig 2017-06-28 12:50:49.000000000 +0000
+++ cmake_extras/install_doc.cmake
@@ -1,2 +1,2 @@
-execute_process(COMMAND install -v -d $ENV{DESTDIR}${MANDIR}/man1)
-execute_process(COMMAND install -m 0644 -v ${CMAKE_BINARY_DIR}/lpass.1 $ENV{DESTDIR}${MANDIR}/man1/lpass.1)
+execute_process(COMMAND install -d $ENV{DESTDIR}${MANDIR}/man1)
+execute_process(COMMAND install -m 0644 ${CMAKE_BINARY_DIR}/lpass.1 $ENV{DESTDIR}${MANDIR}/man1/lpass.1)
17 changes: 17 additions & 0 deletions security/lastpass-cli/patches/patch-http.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$NetBSD: patch-http.c,v 1.1 2017/08/16 15:18:24 jperkin Exp $

Support sig_t on SunOS.

--- http.c.orig 2017-06-28 12:50:49.000000000 +0000
+++ http.c
@@ -52,6 +52,10 @@ struct mem_chunk {
size_t len;
};

+#ifdef __sun
+typedef void (*sig_t)();
+#endif
+
#ifndef TEST_BUILD
static bool interrupted = false;
static sig_t previous_handler = SIG_DFL;
24 changes: 24 additions & 0 deletions security/lastpass-cli/patches/patch-password.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$NetBSD: patch-password.c,v 1.1 2017/08/16 15:18:24 jperkin Exp $

Avoid "Missing sentinel in function call" warnings.

--- password.c.orig 2017-06-28 12:50:49.000000000 +0000
+++ password.c
@@ -73,7 +73,7 @@ static char *password_prompt_askpass(con
close(read_fds[1]);
close(write_fds[0]);
close(write_fds[1]);
- execlp(askpass, "lpass-askpass", prompt, NULL);
+ execlp(askpass, "lpass-askpass", prompt, (char *)0);
_exit(76);
}
close(read_fds[1]);
@@ -266,7 +266,7 @@ char *password_prompt(const char *prompt
close(read_fds[1]);
close(write_fds[0]);
close(write_fds[1]);
- execlp("pinentry", "pinentry", NULL);
+ execlp("pinentry", "pinentry", (char *)0);
_exit(76);
}
close(read_fds[1]);
20 changes: 20 additions & 0 deletions security/lastpass-cli/patches/patch-process.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
$NetBSD: patch-process.c,v 1.1 2017/08/16 15:18:24 jperkin Exp $

Support pid_to_cmd on SunOS.

--- process.c.orig 2017-06-28 12:50:49.000000000 +0000
+++ process.c
@@ -83,6 +83,13 @@ static int pid_to_cmd(pid_t pid, char *c
xasprintf(&proc, "/proc/%lu/exe", (unsigned long)pid);
return readlink(proc, cmd, cmd_size - 1);
}
+#elif defined(__sun)
+static int pid_to_cmd(pid_t pid, char *cmd, size_t cmd_size)
+{
+ _cleanup_free_ char *proc;
+ xasprintf(&proc, "/proc/%lu/path/a.out", (unsigned long)pid);
+ return readlink(proc, cmd, cmd_size - 1);
+}
#elif defined(__APPLE__) && defined(__MACH__)
static int pid_to_cmd(pid_t pid, char *cmd, size_t cmd_size)
{
40 changes: 40 additions & 0 deletions security/lastpass-cli/patches/patch-upload-queue.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
$NetBSD: patch-upload-queue.c,v 1.1 2017/08/16 15:18:24 jperkin Exp $

SunOS compatibility.

--- upload-queue.c.orig 2017-06-28 12:50:49.000000000 +0000
+++ upload-queue.c
@@ -110,8 +110,12 @@ static void upload_queue_cleanup_failure

while ((entry = readdir(dir))) {
_cleanup_free_ char *fn = NULL;
-
+#ifdef __sun
+ stat(entry->d_name, &sbuf);
+ if (sbuf.st_mode != S_IFREG)
+#else
if (entry->d_type != DT_REG && entry->d_type != DT_UNKNOWN)
+#endif
continue;

for (p = entry->d_name; *p; ++p) {
@@ -172,11 +176,19 @@ static char *upload_queue_next_entry(uns
char *result, *p;
DIR *dir = opendir(base_path);
struct dirent *entry;
+#ifdef __sun
+ struct stat s;
+#endif

if (!dir)
return NULL;
while ((entry = readdir(dir))) {
+#ifdef __sun
+ stat(entry->d_name, &s);
+ if (s.st_mode != S_IFREG)
+#else
if (entry->d_type != DT_REG && entry->d_type != DT_UNKNOWN)
+#endif
continue;

for (p = entry->d_name; *p; ++p) {

0 comments on commit 62022f1

Please sign in to comment.