Skip to content

Commit

Permalink
Build on Ubuntu 12.04, fix some crash problems
Browse files Browse the repository at this point in the history
  • Loading branch information
robbiev committed Jan 19, 2014
1 parent 8e3ffc9 commit 79c4438
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .hgignore
@@ -1,3 +1,8 @@
syntax:glob
cmake-build
1Password
CMakeFiles
CMakeCache.txt
Makefile
1pass
cmake_install.cmake
41 changes: 30 additions & 11 deletions 1pass.lua
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 2.8.7)
project(1pass)

include(FindPkgConfig)
Expand Down
11 changes: 11 additions & 0 deletions 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

0 comments on commit 79c4438

Please sign in to comment.