From 79c443842187a8a77fb51c38d12d4be34ad95c15 Mon Sep 17 00:00:00 2001 From: Robbie Vanbrabant Date: Sun, 19 Jan 2014 16:51:36 +0000 Subject: [PATCH] Build on Ubuntu 12.04, fix some crash problems --- .hgignore | 5 +++++ 1pass.lua | 41 ++++++++++++++++++++++++++++++----------- CMakeLists.txt | 2 +- build.sh | 11 +++++++++++ 4 files changed, 47 insertions(+), 12 deletions(-) create mode 100755 build.sh diff --git a/.hgignore b/.hgignore index e90b1b0..7c8fcbd 100644 --- a/.hgignore +++ b/.hgignore @@ -1,3 +1,8 @@ syntax:glob cmake-build 1Password +CMakeFiles +CMakeCache.txt +Makefile +1pass +cmake_install.cmake diff --git a/1pass.lua b/1pass.lua index befc026..51b2da1 100644 --- a/1pass.lua +++ b/1pass.lua @@ -127,6 +127,7 @@ local function build_secret_menuitem_webform(menu, info, secure) local username = nil local password = nil local email = nil + for i,v in ipairs(secure.fields) do --print(info.name .. ": " .. v.type .. ", " .. v.value) local ignored = false @@ -220,7 +221,17 @@ local function build_secret_menuitems(info, menu) return end - local plaintext = decryptBase64UsingKey(metadata.encrypted, loadKey(metadata.securityLevel, password)) + local securityLevel = metadata.securityLevel + if securityLevel == nil then + securityLevel = metadata.openContents.securityLevel + end + print("title: " .. metadata.title) + if securityLevel == nil then + --print("can't find security level, assuming SL5" .. metadata.title) + securityLevel = "SL5" + end + + local plaintext = decryptBase64UsingKey(metadata.encrypted, loadKey(securityLevel, password)) if plaintext == nil then return end @@ -230,6 +241,10 @@ local function build_secret_menuitems(info, menu) return end --dumptable("secure " .. info.name, secure) + if secure.fields == nil then + print("no secure fields, don't know how to handle this item") + return + end local menuitem = appendGuiMenuItem(menu, info.name) @@ -309,17 +324,21 @@ print("keyhookPressed: running==" .. tostring(keyhookRunning)) for orderi,type in ipairs(passwordTypeOrdering) do local bucket = items[type] - local realname = passwordTypeNameMap[type] - if realname == nil then - realname = type - end - local menuitem = appendGuiMenuItem(topmenu, realname) - local submenu = makeGuiMenu() - table.sort(bucket, function(a, b) return a.name < b.name end) - for i,v in pairs(bucket) do - build_secret_menuitems(v, submenu) + if bucket ~= nil then + local realname = passwordTypeNameMap[type] + if realname == nil then + realname = type + end + local menuitem = appendGuiMenuItem(topmenu, realname) + local submenu = makeGuiMenu() + table.sort(bucket, function(a, b) return a.name < b.name end) + for i,v in pairs(bucket) do + build_secret_menuitems(v, submenu) + end + setGuiMenuItemSubmenu(menuitem, submenu) + else + print("no bucket found") end - setGuiMenuItemSubmenu(menuitem, submenu) end popupGuiMenu(topmenu) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ce59c2..412e71c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.10) +cmake_minimum_required(VERSION 2.8.7) project(1pass) include(FindPkgConfig) diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..72f6edd --- /dev/null +++ b/build.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# Need to install the following on Ubuntu 12.04: +# - cmake +# - libgtk2.0-dev +# - libxtst-dev +# +# If you find other deps, add them here + +cmake -DCMAKE_BUILD_TYPE=Release . +make