Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sed for POSIX compliance. #583

Closed
wants to merge 565 commits into from
Closed

Conversation

frossi-git
Copy link

Current version of the sed command fails on macOS (tested version 11.0.1).
The proposed change makes the command POSIX compliant

Signed-off-by: Filippo Rossi filippo.rossi@mailbox.org

Bob Copeland and others added 30 commits September 16, 2016 15:47
"Name" in the template file could be interpreted as either the
name of the account itself, or of the (person's) name in the
template.  The result of this confusion is that editing the
Name in the SSN template didn't work; it would be assigned
to account fullname instead (which we later throw away when
editing secure notes).

Use line-number to disambiguate the case: account name should
always be on the first line, everything thereafter is part of
a note.

Also move the strdup to where it is used so the lifetime of the
string copy is clearer.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
Signed-off-by: Filippo Cucchetto filippocucchetto@gmail.com
Signed-off-by: Filippo Cucchetto filippocucchetto@gmail.com
Signed-off-by: Filippo Cucchetto filippocucchetto@gmail.com
A user reported that using Server secure note type resulted
in some odd stuff showing up in the plugin vault.  This note
type has a "Username" and "Password" field, but we already
use that to map to account->username and account->password.

When collapsing, the contents of those fields gets copied
back into the note, along with any fields in the fields list.
Unfortunately, we *also* copied in the empty duplicate
Username/Password fields from the fields, resulting in a
note with extra fields that confused the plugin.

Fix this by not creating the duplicate fields in the fields
list in the first place; then only the version in the account
will get copied into the note.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
Similarly to account_is_group, add a function that documents the
special url format denoting secure note types rather than open-coding
the comparison.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
It was reported that editing a secure note to rename it doesn't work,
while it does work for accounts.  The reason is we only apply name
changes only if the user had specified `--name`.  But this is a
historical limitation, e.g. when using the "any" edit type it makes
sense to retain username edits, so just do it always since we
always have a copy of the original account name in any case.

Fixes lastpass#106.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
I stumbled across a segfault doing 'lpass ls -l' -- it's possible for
an account not to have an mtime at all, so don't crash in this case.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
There is more than one implementation now for a simple string
buffer object (string + allocated size + used length), so
standardize on the implementation in blob.c.

Add append_char (used by import) and append_str (to be used later)
to round out the common operations we will need.

This also fixes an off-by-one in append_char.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
We occasionally get requests to add new fields to ls output
or somehow customize what stuff gets shown to make things
better for humans or for screen scrapers.

Rather than trying to accomodate everyone's use case, add
a new format library like printf, so that you can (eventually)
do things like

    ./lpass ls --format='%N %i %u'

or
    ./lpass show --format='%fN'

...or whatever.  I haven't really settled on the right format
strings to use so this is still a WIP, but currently it can
handle generating the existing (non-color) ls format.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
The format string only needs to be created once instead of in
a loop, and using xasprintf simplifies things a bit, so do that.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
This drops a bit of code duplication by using the same format
string for both color-less and tree mode output.  The only
difference in the format string between the two is whether the
fullname or short acpcount name is used; we can go ahead and
embed the terminal color codes which will simply get stripped
in terminal_printf.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
This adds the ability to supply a custom format string to ls.
This might be useful for certain scripting tasks; e.g. you can
save a sed/awk pipeline when grabbing an id by doing:

    lpass ls --format=%i account-name

Signed-off-by: Bob Copeland <copeland@lastpass.com>
This adds some infrastructure useful for cmd-show:

 - You can use '/' after % to include a slash only if the expansion
   of the rest of the placeholder is non-empty
 - group and shared folder name gained their own placeholders

Thus showing a path-like representation of a name can be done
like "%/S%/g%Nf".

Also, format_field function was added which formats a name/value pair
("%fn", "%fv" resp.).  It also takes an account so that it can format
any of the existing account fields as needed.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
This adds the ability to specify the field format used with command-show
using "--format", and the title format with "--title-format".

Just as a fairly contrived example, you can get almost-json like this:

echo "{"; \
./lpass show --title-format='    "title": "%/S%/g%Ns",' \
    --format='    "%fn": "%fv",' foo; \
echo "}"

Signed-off-by: Bob Copeland <copeland@lastpass.com>
Group the placeholders by type of object being printed (so "%aX" for
account).  This reduces pollution of the top-level namespace a bit
so that we can use more natural characters.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
This uses the new format string infrastructure to display
just fieldnames in a subshell so that the fields in a specific
account can be tab-completed.  In order for lpass to know which
account is being queried, you have to specify account name first,
like:

    lpass show foo --field [tab]

There's a slight annoyance that title cannot go away completely,
so post-process with egrep to drop those.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
$(wildcard) does not guarantee a sorted list, which causes
also a non-deterministic order while linking the binary.
To support reproducible building, the list is explicitely sorted.

Signed-off-by: Reiner Herrmann <reiner@reiner-h.de>
Builds with CMake would link against the wrong (apple-supplied)
version of openssl; make sure we use the one installed by brew.

Pass -DOPENSSL_INCLUDE_DIR to use something else.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
Add the install-doc target to install the manpage which was present
in the original Makefile but missing here.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
"cmake ." in order to get a Makefile for make.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
Signed-off-by: Bob Copeland <copeland@lastpass.com>
This is needed on some Linux platforms for error-free build.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
If we can determine the destination directory, install
bash completions file.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
CMake complains when building in cygwin unless you tell it
whether or not your project needs win32.  So tell it.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
Signed-off-by: Bob Copeland <copeland@lastpass.com>
Signed-off-by: Bob Copeland <copeland@lastpass.com>
For some use cases we may need to ask the user for one of several
options, not just yes or no.  Add a function that implements this,
taking the charset of options as a string and returning the selected
option.

Rewrite ask_yes_no to use the new function.

Signed-off-by: Bob Copeland <copeland@lastpass.com>
waterkip and others added 21 commits March 26, 2019 10:16
When the local blob version and the remote version are the same skip
downloading a new blob and just continue with the current blob.
This could potentially shave 300ms (or more, I've seen close to 2
seconds in my browser) when the blob hasn't been updated on the remote
side.

There is still a small performance hit on `login_check.php` but I
cannot think of logical ways why we would increase the timeout, the 5
seconds that is place now make sense to me as you want to display
things. Maybe there should be a post action on any command that has
`--sync=auto` so subsequent calls have a blob in sync and would cause
slowness of the CLI app.

Fixes: lastpass#475
Signed-off-by: Wesley Schwengle <wesley@schwengle.net>
Signed-off-by: Wesley Schwengle <wesley@schwengle.net>
…_display_time

Decrease the time for the cli app to do things by @waterkip
`lpass status` asks the agent to see if we are logged in or not. The
code for the logout bit checks the session and if a session has gone
stale it want to refresh it. Implement a similar logic as in
cmd-status.c where we ask the agent if we have a session, if we do,
proceed as always, else, wipe all the session data that we can find.
This removes the if-logic in session kill, to delete all config files
even if they for whatever reason do not exist. Since we want to kill it,
it seems logical to ignore these missing files.

Fixes: lastpass#477

Signed-off-by: Wesley Schwengle <wesley@schwengle.net>
…hould_not_require_a_login

Fix bug where logout requires login by @waterkip
PKG_CONFIG_PATH shouldn't be reset, only appended to or prepended to, so
that the user can still use non-default paths if they need to.
Additionally, package managers other than Homebrew (such as Nix) still
need to be able to provide their own versions of packages, and aren't
going to use Homebrew's default path to do so.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Fix non-default PKG_CONFIG_PATH on macOS by @alyssais
Signed-off-by: Wesley Schwengle <wesley@schwengle.net>
Change credits to Wesley Schwengle for 1.3.3 release
Refactor agent.c for socket initialisation by @waterkip
add lastpass attachment export script by @mindrunner
wl-copy appears to have become the de-facto standard command line
program for copying to the clipboard on Wayland, with multiple
implementations of the same interface[1][2].

I think it makes sense for wl-copy to be preferred over xclip if both
are installed, since Wayland should generally be preferred over X11.

[1]: https://github.com/bugaevc/wl-clipboard
[2]: https://github.com/YaLTeR/wl-clipboard-rs

Signed-off-by: Alyssa Ross <hi@alyssa.is>
MS Authenticator is currently incompatible with this tool (lastpass#442). I noticed that MFA errors are mapped in an array of `multifactor_type`, which I've updated with the appropriate error codes for MS Authenticator (tested running through a debugger).

Signed-off-by: John Hammerlund johnhammerlund@gmail.com
Add MFA support for Microsoft Authenticator
Signed-off-by: Filippo Rossi <filippo.rossi@mailbox.org>
@frossi-git
Copy link
Author

Fixes #582

@0xdevalias
Copy link

@0xdevalias
Copy link

@mateusmartins-lp It's good 'open source courtesy' to give context when closing an issue/PR, not just closing it with no explanation.

@0xdevalias
Copy link

@mateusmartins-lp It's good 'open source courtesy' to give context when closing an issue/PR, not just closing it with no explanation.

Hello @0xdevalias. The Pull Requests were closed unintentionally. By tomorrow I will be sure to leave a message on how to proceed. My sincere apologies for the inconvenience.

Originally posted by @mateusmartins-lp in #553 (comment)

@mateusmartins-lp
Copy link
Contributor

Regrettably, your PR submission was unintentionally closed during an operation, before we could complete our review and respond accordingly. Unable to revert it to 'Open' status, we invite you to resubmit your contribution at your earliest convenience. We apologize for this mishap. Rest assured, we value all contributions and remain dedicated to providing transparency and closure to the community. Thank you for your understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet