QtPass 2.0.0
Developer documentation
Loading...
Searching...
No Matches
RealPass Class Reference

Implementation of Pass that wraps the 'pass' command-line tool. More...

#include <realpass.h>

Inheritance diagram for RealPass:
Collaboration diagram for RealPass:

Classes

struct  LinkCommit
struct  PassMoveTarget
 What pass mv/pass cp is handed and what it then does with it. More...
struct  InsertRecord

Public Member Functions

 RealPass ()
 Construct a RealPass instance.
 ~RealPass () override
 Destructor; lets the search workers wind down.
void GitInit () override
 Initialize Git repository in password store.
void GitPull () override
 Pull changes from remote.
void GitPull_b (int timeoutMs) override
 Run pass git pull and wait for it, at most timeoutMs.
void GitPush () override
 Push changes to remote.
void Show (QString file) override
 Show decrypted password.
void Insert (QString file, QString newValue, bool overwrite) override
 Insert new password.
void Remove (QString file, bool isDir) override
 Remove an entry or folder with pass rm.
auto entriesInitWouldWiden (const QString &dir, const QList< UserInfo > &users) -> QStringList override
 Entries a pass init of dir with users would hand to someone who cannot read them now (an entry copied in from a folder they are not on), less whom the change adds. pass re-encrypts every entry itself, so the caller asks before it runs. None by default; the pass backend tells.
auto entriesMoveWouldWiden (const QString &src, const QString &dest) -> QStringList override
 Entries already in the place a pass mv or pass cp of src to dest re-encrypts (the whole destination folder) that would gain a reader they do not have. What is moved or copied itself is the user's own and not counted. None by default.
auto recipientArgument (const QString &line) const -> QString override
 As written: pass hands each line to gpg itself, so the probe must reach what pass will.
void Init (QString path, const QList< UserInfo > &users) override
 Initialize password store.
void Move (const QString src, const QString dest, const bool force) override
 Move password file or directory.
void Copy (const QString src, const QString dest, const bool force) override
 Copy password file or directory.
void Grep (QString pattern, bool caseInsensitive) override
 Search all password content by GPG-decrypting each real .gpg file, as ImitatePass does.
void CancelGrep () override
 Stop the running search (NativeGrep::cancel()).
Public Member Functions inherited from Pass
 Pass ()
 Construct a Pass instance.
void init (const AppSettings &settings)
 Initialize the Pass instance with a settings snapshot.
auto insertsPending () const -> int
 How many inserts have started queueing but not yet reported.
virtual auto readersAnEditWouldAdd (const QString &file) -> EditReaders
 Who saving over an existing entry would let read it who may not now.
auto entryReaders (const QString &path) -> QStringList
 The long key IDs an entry is encrypted to, as gpg lists them without anyone's secret key (ENC_TO).
auto reportedInsert () const -> QString
 The entry whose insert is reporting now: set while finishedInsert() or insertFailed() goes out, empty otherwise.
virtual auto generatePassword (unsigned int length, const QString &charset) -> QString
 Generate random password.
void GenerateGPGKeys (QString batch)
 Generate GPG keys using batch script.
auto listKeys (QStringList keystrings, bool secret=false) -> QList< UserInfo >
 List GPG keys matching patterns.
virtual auto encryptionReaches (const QStringList &recipients) -> std::optional< QStringList >
 The keys a gpg encryption to recipients reaches: a throwaway encryption outside the store, read back for whom it went to.
auto keyLinesHeldTwice (const QStringList &lines) -> std::optional< QHash< QString, QStringList > >
 The key ID and fingerprint lines of a recipient list that more than one key block holds, with those blocks.
auto exportPublicKeys (const QString &gpg, const QStringList &keys, QString *out, QString *err) -> int
 gpg --armor --export of keys, in the store's environment: the keyring keyLinesHeldTwice() reads.
auto listKeys (const QString &keystring="", bool secret=false) -> QList< UserInfo >
 List GPG keys.
void updateEnv ()
 Update environment for subprocesses.
auto recipientsForEditing (const QString &dir, const QString &passStore) -> RecipientsForEditing
 The recipients a dialog may preselect for editing the list of dir.
auto initIfUnchanged (const QString &path, const QList< UserInfo > &users, const QString &dir, const QString &passStore, const RecipientsForEditing &read) -> bool
 Init(), but only while the list of dir still reads as the caller read it with recipientsForEditing().
auto isIdle () const -> bool
 Whether no gpg, git or pass of this backend runs or waits.
auto stopRunning () -> bool
 Stop the queued command that is running now (Executor::stopRunning()); it then ends as a failed run.
auto runningSerial () const -> quint64
 Which run is going (Executor::runningSerial()).
auto runningProcess () const -> Enums::PROCESS
 What kind of command is running now.
auto isPushing () const -> bool
 Whether a Git push of this backend is queued or running.
auto autoPushHeld () const -> bool
 Whether automatic pushes of the current store are held because its last re-encryption did not finish cleanly.
void GitPushAutomatic ()
 GitPush() for an automatic push, the one after a change. A backend that has to make the push later drops it then if the store is held by that time (autoPushHeld()); a push by hand (GitPush()) still goes.

Static Public Member Functions

static auto reencryptFailed (const QString &out, const QString &err) -> bool
 Whether a pass init, mv or cp that exited 0 left entries as they were: pass carries on past an entry gpg could not re-encrypt.
static auto reencryptFailed (const QString &out, const QHash< QString, qint64 > &status) -> bool
 reencryptFailed() on status records already counted, as the Executor counts them over the whole of stderr (Executor::lastStatusCounts()): the stderr text it hands on is capped, and a large store's END_ENCRYPTION lines would not all be in it.
Static Public Member Functions inherited from Pass
static bool gpgSupportsEd25519 (const QString &gpgExecutable={})
 Check if GPG supports Ed25519 encryption.
static QString getDefaultKeyTemplate (const QString &gpgExecutable={})
 Get default key template for new GPG keys.
static auto exactRecipientArg (const QString &line) -> QString
 A bare mail address in gpg's exact form, <address>; any other line as written.
static auto keyLinesHeldTwiceIn (const QStringList &lines, const QString &listing) -> QHash< QString, QStringList >
 keyLinesHeldTwice() on a listing already made.
static auto describeKeyLinesHeldTwice (const std::optional< QHash< QString, QStringList > > &held) -> QString
 A message naming each line keyLinesHeldTwice() found and what the user can do about it.
static auto pullTimedOut (int timeoutMs) -> QString
 The status-bar text for a blocking pull stopped at its deadline.
static auto maxOutputArgs () -> QStringList
 The gpg options that enforce kMaxPlaintextBytes.
static auto resolveGpgconfCommand (const QString &gpgPath) -> ResolvedGpgconfCommand
 Resolve the gpgconf command to kill agents.
static auto getGpgIdPath (const QString &for_file, const QString &passStore) -> QString
 Get .gpg-id file path for a password file.
static auto skippedGpgId (const QString &forFile, const QString &passStore, QString *recordError=nullptr, SkippedWalks *walks=nullptr) -> std::optional< QString >
 The folder list getGpgIdPath() passed over on its way up to the one it returns, if it passed one over that a signed store must not.
static auto linkedGpgId (const QString &forFile, const QString &passStore, LinkedWalks *walks=nullptr) -> std::optional< QString >
 The link or junction under the name .gpg-id that getGpgIdPath() skips on its way up from forFile, if it skips one before the list it returns.
static auto getRecipientList (const QString &for_file, const QString &passStore) -> QStringList
 Get list of recipients for a password file.
static auto parseRecipients (const QByteArray &contents, const QString &sourceName) -> QStringList
 Parse the contents of a .gpg-id: one recipient per line, # starts a comment, unusable lines are logged and skipped.
static auto passReadsDifferently (const QByteArray &contents) -> QString
 Why pass would read a .gpg-id differently from parseRecipients(), if it would.
static auto loggableArgs (const QStringList &args) -> QStringList
 The arguments as they may appear in the debug log: the value of --passphrase and friends, and otpauth URIs, are replaced.

Protected Member Functions

void finished (int id, int exitCode, const QString &out, const QString &err) override
 Finish a process; a linked-folder removal commit (GIT_COMMIT, which RealPass uses for nothing else) is judged by finishLinkCommit().
Protected Member Functions inherited from Pass
virtual auto fullKeyListing (QString *listing) -> int
 The whole public keyring as keyLinesHeldTwice() reads it.
auto refuseKeyLinesHeldTwice (const QStringList &lines) -> bool
 Refuse, with critical(), a recipient list with a line that more than one key block holds (keyLinesHeldTwice()).
auto storeEnvironment () const -> QProcessEnvironment
 The environment QtPass runs the store's processes in.
auto withCurrentGitPin (QProcessEnvironment base) const -> QProcessEnvironment
 base with GIT_DIR and GIT_WORK_TREE as the store is now (Util::gitStoreVariables()), not as it was at updateEnv(): a .git that appeared or changed hands since then is judged when Git runs.
auto pushIsAutomatic () const -> bool
 Whether the GitPush() running now is an automatic one.
void holdAutoPush (const QString &scope)
 Hold automatic pushes of the store that holds scope (autoPushHeld()): its re-encryption did not finish cleanly.
void releaseAutoPush (const QString &folder)
 Release the holds a clean re-encryption of folder covers: those for folder itself and everything under it. Holds for other folders stay.
auto refuseSkippedGpgId (const QString &file, bool signing, const QString &except=QString(), SkippedWalks *walks=nullptr) -> bool
 With signing on, refuse to encrypt file when the lookup passed over its folder's own list (skippedGpgId()): the parent's list is not what was signed for it.
auto verifySignedList (const GpgIdSigner &signer, const QString &gpgIdFile, QByteArray *contents, QString *why) const -> bool
 Whether gpgIdFile is a signed list QtPass accepts: its signature verifies (GpgIdSigner::verifyFile()), and it is current and bound to the folder it lies in (GpgIdGeneration::accept()), so an older authentic list put back, or one signed for another folder, is refused.
void queueShow (const QString &file)
 Remember what a Show() asked for, so its completion can say so.
void queueInsert (const QString &entry=QString())
 Count one insert that has started queueing but not yet reported.
auto refuseLinkedPath (const QString &path, LinkScope scope=LinkScope::EntryAndParents, PathSpelling spelling=PathSpelling::Configured) -> bool
 Refuse an operation on something that is, or lies behind, a symbolic link or NTFS junction inside the store.
auto refuseFolderOutsideStore (const QString &folder, QString *relative=nullptr) -> bool
 Refuse recipients for a folder outside the store, as pass refuses a path with .. in it.
auto refuseUnfinishedGitOperation () -> bool
 Refuse to change the store while git is mid-rebase, -merge, -cherry-pick or -revert.
auto unfinishedGitOperationReason () -> QString
 The unfinished git operation in progress in the store, if any.
auto refusePendingPull () -> bool
 Refuse a store change while a Git pull is still queued or running.
auto refuseChangedList () -> bool
 Refuse an Init() under initIfUnchanged() when the folder's list no longer reads as the caller read it.
auto refuseBusyForExpectedList () -> bool
 Refuse an Init() under initIfUnchanged() while the executor has work queued or running, for a backend whose external tool writes the list only when its process runs.
void executeWrapper (PROCESS id, const QString &app, const QStringList &args, bool readStdout=true, bool readStderr=true)
 Execute external wrapper command.
auto generateRandomPassword (const QString &charset, unsigned int length) -> QString
 Generate random password from charset.
auto boundedRandom (quint32 bound) -> quint32
 Generate random number in range.
void setEnvVar (const QString &name, const QString &value)
 Set or remove an environment variable.
void pinStoreGitAttributes ()
 Pin byte-for-byte Git attributes for the store's encrypted files.
void executeWrapper (PROCESS id, const QString &app, const QStringList &args, QString input, bool readStdout, bool readStderr)
 Execute wrapper with input.
virtual void beforeExecute (PROCESS id)
 Hook invoked just before a wrapped command is dispatched.

Private Member Functions

void reportReencryptFailure (Enums::PROCESS pid, const QString &out, const QString &err)
 Report a pass init, mv or cp that exited 0 having left entries encrypted to the previous recipients: a critical message and processErrorExit() instead of the completion signal, so the store is not pushed as it now is (a later push still sends what pass committed).
void finishRecipientRun (Enums::PROCESS pid, int exitCode, const QString &out, const QString &err)
 Finish a pass init, mv or cp: hold the automatic push for a run that left entries to the previous recipients or failed after its commit, release the holds a clean init covers, report what Git did not record, then send any deferred push and hand the completion on.
void removeLinkedFolder (const QString &full)
 Remove a linked folder for Remove(): unlink it here, so that pass rm -rf cannot follow it, and have pass's git forget and commit it. Reports a failure, or ends with finishedRemove() or the queued commit.
void sendDeferredPush ()
 Once the last queued init, move or copy has completed, make the push asked for meanwhile (GitPush()). An automatic one is dropped while a re-encryption in this store is held, and the status line says why; one asked for by hand goes.
void finishLinkCommit (const LinkCommit &commit, const QString &out, const QString &err)
 Judge a queued linked-folder removal commit by what is left staged in the store it ran in: pass git exits 0 whatever git did.
void executePass (PROCESS id, const QStringList &args, QString input=QString(), bool readStdout=true, bool readStderr=true)
 Execute pass command with arguments.
void passMoveOrCopy (PROCESS id, const QString &subcommand, const QString &src, const QString &dest, bool force)
 Shared implementation of Move and Copy via pass mv/pass cp.
auto passMoveTarget (const QString &src, const QString &dest) const -> PassMoveTarget
 Name src and dest for pass mv/pass cp, and work out where pass 1.7.4 then puts the source.
auto stopsAtOccupiedTarget (PROCESS id, const QString &src, const QFileInfo &srcFileInfo, const QString &dest, const QString &occupied, bool force) -> bool
 Whether a move or copy stops at what already lies where pass writes: a file dest the user declined to overwrite, the source itself under its own name (nothing to do), or anything else there, which is refused with a message.
auto refuseMoveOrCopyRisks (PROCESS id, const QString &src, const QFileInfo &srcFileInfo, const PassMoveTarget &target) -> bool
 Whether a move or copy is refused for what pass would do along the way: re-encrypt to an unverified list, follow a link inside a copied folder, commit over unfinished or unrecorded Git work, move ignored files, or encrypt to a key line two key blocks hold.
auto linesPassEncryptsTo (const QString &src, const PassMoveTarget &target, bool srcIsDir, bool intoFolder) -> QStringList
 The recipient lines pass re-encrypts to when it moves or copies src as target says: the destination's list, the lists in a moved folder, and those in a folder it writes into.
auto passName (const QString &path, bool stripGpg) const -> QString
 path as pass names it: relative to the store, without the .gpg pass appends itself.
auto insertWritten (const QString &err) const -> bool override
 Whether the failed pass insert wrote its entry before its git step failed. pass does not say, so: the entry's bytes differ from what they were when that insert started to run (a new entry appeared, or an existing one was rewritten), and pass did not say that the encryption broke off (gpg can leave a partial file behind then).
auto refuseUnverifiedList (const QString &file) -> bool
 Refuse to have pass encrypt file when the list it would use is a link (refuseLinkedList()), pass would read it differently from QtPass (refuseMisreadList()), or, with signing on, not one QtPass accepts: its folder's own list was passed over, the signature does not verify, or the list is older than one this device accepted or signed for another folder.
auto listLinesUnder (const QString &dir, const QString &except) -> QStringList
 The lines of every folder's own .gpg-id that pass's walk of dir meets, for keyLinesHeldTwice(): pass re-encrypts each entry there to its folder's nearest list.
auto entryWouldGain (const QString &entry, const QStringList &target, const QStringList &before, QHash< QString, std::optional< QSet< QString > > > &probes) -> bool
 Whether pass re-encrypting entry to target would hand it to someone who cannot read it now, less whom the change from before to target adds.
auto refuseLinkedList (const QString &file, const QString &within=QString(), const QString &except=QString(), LinkedWalks *walks=nullptr) -> bool
 Refuse to have pass encrypt file when the walk to its list meets a .gpg-id that is a link or junction (Pass::linkedGpgId()), with or without a signing key: pass would follow it, while QtPass shows the list of a folder above it.
auto refuseMisreadList (const QString &file, const QString &within, const QString &except, QSet< QString > &checked) -> bool
 Refuse to have pass encrypt file when its nearest .gpg-id holds lines pass reads differently from the Users dialog (Pass::passReadsDifferently()), with or without a signing key: pass would encrypt to recipients the dialog does not show. A list that is there but not a regular file within Util::kMaxGpgIdBytes is refused too; a missing one is left to pass.
auto storeGit (const QStringList &args, QString *out) -> bool override
 Run a git command in the store through pass git, blocking.
auto repositoryOf (const QString &path) -> QString
 The Git repository pass commits path in: the store's own, or one a folder in it holds (pass looks for the repository from the path's folder, as git does).
auto statusEntries (const QStringList &args, const QString &repository=QString()) -> QStringList
 git status --porcelain -z through pass git, read: one "XY name" per entry, a rename's old name dropped. Empty without Git, or when git cannot say.
auto unrecorded (const QStringList &paths, bool ignored) -> QStringList
 What git has not recorded at paths: git status --porcelain lines, through pass git. Empty without Git, or when git cannot say.
auto refuseUnrecordedChanges (const QStringList &paths, const QStringList &committing) -> bool
 Refuse a pass init, mv, cp or insert when paths hold changes git has not recorded, or anything at all is staged in the repository it commits in. pass stages the folder it wrote with git add and then commits the whole index, so a plaintext export lying in the folder or staged anywhere, or files a failed pull wrote, would be committed and pushed along with the change. Ignored files are left alone, as git add leaves them. When the changes include untracked files a file manager writes by itself (.DS_Store, Thumbs.db), the message says which .gitignore lines keep them out for good, for the .gitignore of each repository that reports them (unless a deeper rule there un-ignores them again).
void reportUnrecorded (const QStringList &paths)
 After a pass insert, init, mv or cp that exited 0, say so when git did not record the entries it wrote: pass exits 0 whatever its git add and commit did (an entry a .gitignore matches, say), and an unrecorded entry is not pushed and a pull may overwrite it.
auto refuseLinkInCopiedFolder (const QString &src) -> bool
 Refuse a pass cp of the folder src when anything in it is a symbolic link or NTFS junction, or a folder in it holds a name Qt cannot read.
auto refuseIgnoredThatMoves (const QString &src, const QString &dest) -> bool
 Refuse a pass mv or cp of the folder src when a file in it that Git ignores would not be ignored where it lands: a rule naming the old place (/team/export.csv) does not follow the file, and pass stages the new path whole. Entries and recipient lists are not counted: committing those is what pass is for.
auto ignoredByRulesWithin (const QString &repository, const QString &from, const QStringList &moving) -> QStringList
 Those of moving that a .gitignore inside the folder from ignores, by git check-ignore -v: the rule moves with them.
auto checkIgnore (const QString &repository, const QStringList &paths, bool verbose, QStringList *fields) -> bool
 git check-ignore --stdin -z on paths through pass git.
auto refuseSpecialEntry (const QString &entry) -> bool
 Refuse, and tell the user, when entry is set: an entry named like a password that is no regular file, which pass would hand to gpg.
auto refuseLineBreakName (const QString &path) -> bool
 Refuse, and tell the user, when the store-relative name of path holds a line feed or carriage return.
auto refuseUnverifiedTree (const QString &dir, bool onlyListsWithin, const QString &except=QString()) -> bool
 For a folder pass is about to re-encrypt in a move or copy: refuse when an entry pass's walk takes (hidden ones included) is no regular file (refuseSpecialEntry()), or when the signed list of one of them is not one QtPass accepts where it lies now (as refuseUnverifiedList()).
auto listSigner () -> GpgIdSigner
 The verifier for signed lists, gpg in the store's environment.
auto refuseList (const QString &file, const GpgIdSigner &signer, QSet< QString > &verified, const QString &within=QString(), const QString &except=QString(), SkippedWalks *walks=nullptr) -> bool
 The checks of refuseUnverifiedList() for file's nearest list, once per list.
void onDequeuing (int id, bool completes)
 The executor is about to run (or drop) its next item: for an insert, take its entry from m_insertQueue and fingerprint it now, not when it was queued, so an earlier queued save of the same entry counts as "before". Kept in m_insertPending for that insert's own completion. For pass init, mv and cp, add --status-fd 2 to that one process's PASSWORD_STORE_GPG_OPTS, so finished() can tell whether every entry was re-encrypted (reencryptFailed()), and move its scope from m_reencryptScopes to m_reencryptPending (dropped when it does not complete).

Static Private Member Functions

static auto entryFingerprint (const QString &path) -> QByteArray
 A SHA-256 of the size and first 64 KiB of the regular file path (opened without following a link or blocking on a FIFO).

Private Attributes

NativeGrep m_grep
QQueue< LinkCommit > m_linkCommits
QQueue< QString > m_insertQueue
 The entries of the queued inserts, oldest first.
QQueue< InsertRecord > m_insertPending
InsertRecord m_insertDone
 The insert whose completion is being handled.
QQueue< QString > m_reencryptScopes
QQueue< QString > m_reencryptPending
bool m_pushAfterReencrypt = false
bool m_deferredPushByHand = false
 One of those pushes was asked for by hand: it goes despite a hold.

Additional Inherited Members

Public Types inherited from Pass
using SkippedWalks = QHash<QString, SkippedWalk>
 SkippedWalk per absolute folder, for one check of many folders.
using LinkedWalks = QHash<QString, std::optional<QString>>
Signals inherited from Pass
void idle ()
 Nothing of the store's runs or waits any more (isIdle()).
void startingExecuteWrapper ()
 Emitted each time a queued process is about to start, and by the refusals that go on to emit processErrorExit().
void statusMsg (const QString &msg, int timeout)
 Progress or a non-fatal problem worth a line in the status bar ("Creating backup commit", "Git pull failed: ...").
void critical (const QString &title, const QString &message)
 Something went wrong that the user has to be told about in a dialog, such as a refused path or a failed backup commit.
void processErrorExit (int exitCode, const QString &err)
 An operation ended in failure: its process exited non-zero, could not be started or crashed, or the operation was refused.
void finishedAnyWithPid (const QString &out, const QString &err, Enums::PROCESS pid)
 A process of any kind finished successfully and its output cannot contain a secret.
void finishedGitInit (const QString &out, const QString &err)
 git init in the store succeeded; the store is a repository now and the tree is re-read.
void finishedGitPull (const QString &out, const QString &err)
 git pull succeeded; entries may have changed on disk.
void finishedGitPush (const QString &out, const QString &err)
 git push succeeded.
void finishedShow (const QString &out, const QString &file, bool lossless=true)
 Emitted when a Show() succeeds.
void finishedInsert (const QString &out, const QString &err)
 An Insert() succeeded: the entry is in the store and, with Git in use, committed.
void finishedRemove (const QString &out, const QString &err)
 A Remove() succeeded; the entry or folder is gone from the store.
void finishedInit (const QString &out, const QString &err)
 An Init() succeeded: the folder's .gpg-id holds the new recipient list.
void finishedMove (const QString &out, const QString &err)
 A Move() succeeded; the entry or folder is under its new name.
void finishedCopy (const QString &out, const QString &err)
 A Copy() succeeded; the copy exists beside the original.
void finishedGenerateGPGKeys (const QString &out, const QString &err)
 GenerateGPGKeys() succeeded; the new key pair is in the keyring.
void generateGPGKeysFailed (const QString &err)
 Emitted when GPG key generation fails, alongside the generic processErrorExit(); lets the keygen dialog react to its own failure only, not to any other command failing meanwhile.
void insertFailed (const QString &err, bool written)
 Emitted when an Insert() fails through a queued command, before the generic processErrorExit(): the process exited non-zero, crashed or could not be started, or the entry could not be put in place afterwards. Lets the password dialog keep what was typed and say why, without reacting to any other command failing meanwhile. An insert refused before anything is queued does not emit it.
void finishedGrep (const QList< QPair< QString, QStringList > > &results)
 The newest Grep() is over; an empty list means no entry matched.
Static Public Attributes inherited from Pass
static constexpr int kBlockingPullMs = 30000
 How long the pull before an edit may block the window.
static constexpr qint64 kMaxPlaintextBytes = 64LL * 1024 * 1024
 Most bytes of plaintext a gpg decryption may produce.
Protected Types inherited from Pass
enum class  LinkScope { EntryAndParents , ParentsOnly }
 What refuseLinkedPath() judges. More...
enum class  PathSpelling { Configured , PlacedByCaller }
 How a path handed to refuseLinkedPath() is spelled. More...
using PROCESS = Enums::PROCESS
 Alias for Enums::PROCESS used throughout this class.
Static Protected Member Functions inherited from Pass
static auto enabledKeyLines (const QList< UserInfo > &users) -> QStringList
 The enabled users' key IDs, as Init() writes them to .gpg-id.
static auto withoutStatusLines (const QString &err) -> QString
 gpg's stderr without its machine-readable [GNUPG:] lines (and without carriage returns), as a person reads it.
Protected Attributes inherited from Pass
AppSettings m_settings
 Application settings snapshot injected at init() time.
Executor exec
 Internal command executor for queuing and running subprocesses.

Detailed Description

Implementation of Pass that wraps the 'pass' command-line tool.

RealPass delegates all password store operations to the external 'pass' utility. It provides a Qt-native interface while handling:

  • Git integration (init, pull, push)
  • Password CRUD (show, insert, remove, move, copy)
  • OTP generation
  • Store initialization with GPG keys

This is the primary implementation when 'pass' is available on the system.

Definition at line 35 of file realpass.h.

Constructor & Destructor Documentation

◆ RealPass()

RealPass::RealPass ( )

Construct a RealPass instance.

Definition at line 46 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~RealPass()

RealPass::~RealPass ( )
override

Destructor; lets the search workers wind down.

Definition at line 51 of file realpass.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ CancelGrep()

void RealPass::CancelGrep ( )
inlineoverridevirtual

Stop the running search (NativeGrep::cancel()).

Reimplemented from Pass.

Definition at line 679 of file realpass.h.

Here is the call graph for this function:

◆ checkIgnore()

auto RealPass::checkIgnore ( const QString & repository,
const QStringList & paths,
bool verbose,
QStringList * fields ) -> bool
private

git check-ignore --stdin -z on paths through pass git.

Parameters
repositoryWhere to ask, as repositoryOf() gives it.
pathsPaths relative to that repository.
verboseWhether to ask which rule matched (-v): four fields per ignored path (rule's file, line, pattern, path).
fieldsReceives the output's fields: the ignored paths, or the four fields each with verbose.
Returns
false when git could not say.

Definition at line 1007 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Copy()

void RealPass::Copy ( const QString src,
const QString dest,
const bool force )
overridevirtual

Copy password file or directory.

Parameters
srcSource path.
destDestination path.
forceOverwrite existing.

Implements Pass.

Definition at line 1476 of file realpass.cpp.

Here is the call graph for this function:

◆ entriesInitWouldWiden()

auto RealPass::entriesInitWouldWiden ( const QString & dir,
const QList< UserInfo > & users ) -> QStringList
overridevirtual

Entries a pass init of dir with users would hand to someone who cannot read them now (an entry copied in from a folder they are not on), less whom the change adds. pass re-encrypts every entry itself, so the caller asks before it runs. None by default; the pass backend tells.

Parameters
dirThe folder, as Init() gets it.
usersThe recipients Init() would write.
Returns
The entries' absolute paths.

Reimplemented from Pass.

Definition at line 405 of file realpass.cpp.

Here is the call graph for this function:

◆ entriesMoveWouldWiden()

auto RealPass::entriesMoveWouldWiden ( const QString & src,
const QString & dest ) -> QStringList
overridevirtual

Entries already in the place a pass mv or pass cp of src to dest re-encrypts (the whole destination folder) that would gain a reader they do not have. What is moved or copied itself is the user's own and not counted. None by default.

Parameters
srcThe entry or folder moved or copied.
destWhere it goes.
Returns
The entries' absolute paths.

Reimplemented from Pass.

Definition at line 440 of file realpass.cpp.

Here is the call graph for this function:

◆ entryFingerprint()

auto RealPass::entryFingerprint ( const QString & path) -> QByteArray
staticprivate

A SHA-256 of the size and first 64 KiB of the regular file path (opened without following a link or blocking on a FIFO).

Enough to tell a rewritten entry: each encryption starts with a fresh session key. Not the whole file, which a co-writer could pad to gigabytes on the GUI thread's way.

Parameters
pathThe entry's file.
Returns
The hash; empty when path is no readable regular file.

Definition at line 1144 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ entryWouldGain()

auto RealPass::entryWouldGain ( const QString & entry,
const QStringList & target,
const QStringList & before,
QHash< QString, std::optional< QSet< QString > > > & probes ) -> bool
private

Whether pass re-encrypting entry to target would hand it to someone who cannot read it now, less whom the change from before to target adds.

Parameters
entryThe entry.
targetThe list pass would encrypt it to.
beforeThe list that applied to it until now.
probesProbes of lists made so far, by their joined lines.
Returns
true when it would gain such a reader, or the target list cannot be probed.

Definition at line 360 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ executePass()

void RealPass::executePass ( PROCESS id,
const QStringList & args,
QString input = QString(),
bool readStdout = true,
bool readStderr = true )
private

Execute pass command with arguments.

Parameters
idProcess identifier.
argsCommand arguments.
inputInput to pass to stdin.
readStdoutCapture stdout.
readStderrCapture stderr.

Definition at line 1685 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finished()

void RealPass::finished ( int id,
int exitCode,
const QString & out,
const QString & err )
overrideprotectedvirtual

Finish a process; a linked-folder removal commit (GIT_COMMIT, which RealPass uses for nothing else) is judged by finishLinkCommit().

Parameters
idProcess identifier.
exitCodeExit code.
outStandard output.
errStandard error.

Reimplemented from Pass.

Definition at line 1247 of file realpass.cpp.

Here is the call graph for this function:

◆ finishLinkCommit()

void RealPass::finishLinkCommit ( const LinkCommit & commit,
const QString & out,
const QString & err )
private

Judge a queued linked-folder removal commit by what is left staged in the store it ran in: pass git exits 0 whatever git did.

Parameters
commitThe folder and the store it was queued for.
outThe commit's standard output.
errThe commit's standard error.

Definition at line 1380 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finishRecipientRun()

void RealPass::finishRecipientRun ( Enums::PROCESS pid,
int exitCode,
const QString & out,
const QString & err )
private

Finish a pass init, mv or cp: hold the automatic push for a run that left entries to the previous recipients or failed after its commit, release the holds a clean init covers, report what Git did not record, then send any deferred push and hand the completion on.

Parameters
pidPASS_INIT, PASS_MOVE or PASS_COPY.
exitCodepass's exit code.
outpass's standard output.
errpass's and gpg's standard error, status lines included.

Holds or releases the automatic push by how the run went, then hands the completion on.

Definition at line 1273 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GitInit()

void RealPass::GitInit ( )
overridevirtual

Initialize Git repository in password store.

Implements Pass.

Definition at line 53 of file realpass.cpp.

Here is the call graph for this function:

◆ GitPull()

void RealPass::GitPull ( )
overridevirtual

Pull changes from remote.

Implements Pass.

Definition at line 77 of file realpass.cpp.

Here is the call graph for this function:

◆ GitPull_b()

void RealPass::GitPull_b ( int timeoutMs)
overridevirtual

Run pass git pull and wait for it, at most timeoutMs.

Parameters
timeoutMsMost milliseconds to wait (Pass::kBlockingPullMs).

Implements Pass.

Definition at line 55 of file realpass.cpp.

Here is the call graph for this function:

◆ GitPush()

void RealPass::GitPush ( )
overridevirtual

Push changes to remote.

Implements Pass.

Definition at line 79 of file realpass.cpp.

Here is the call graph for this function:

◆ Grep()

void RealPass::Grep ( QString pattern,
bool caseInsensitive )
overridevirtual

Search all password content by GPG-decrypting each real .gpg file, as ImitatePass does.

Not pass grep: that enumerates with find -L, which follows a link out of the store and decrypts what it finds there. Same pattern semantics as ImitatePass::Grep (QRegularExpression).

Parameters
patternSearch pattern (QRegularExpression).
caseInsensitivetrue for case-insensitive search.

Implements Pass.

Definition at line 1674 of file realpass.cpp.

Here is the call graph for this function:

◆ ignoredByRulesWithin()

auto RealPass::ignoredByRulesWithin ( const QString & repository,
const QString & from,
const QStringList & moving ) -> QStringList
private

Those of moving that a .gitignore inside the folder from ignores, by git check-ignore -v: the rule moves with them.

Parameters
repositoryWhere the files lie now, as repositoryOf() gives it.
fromThe folder, relative to that repository.
movingIts ignored files, relative to that repository.
Returns
The files a rule within from ignores; none when git could not say.

Definition at line 992 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Init()

void RealPass::Init ( QString path,
const QList< UserInfo > & users )
overridevirtual

Initialize password store.

Parameters
pathStore root path.
usersGPG recipients.

Implements Pass.

Definition at line 1407 of file realpass.cpp.

Here is the call graph for this function:

◆ Insert()

void RealPass::Insert ( QString file,
QString newValue,
bool overwrite )
overridevirtual

Insert new password.

Parameters
filePath to password file.
newValuePassword content.
overwritetrue to overwrite existing.

Implements Pass.

Definition at line 1054 of file realpass.cpp.

Here is the call graph for this function:

◆ insertWritten()

auto RealPass::insertWritten ( const QString & err) const -> bool
nodiscardoverrideprivatevirtual

Whether the failed pass insert wrote its entry before its git step failed. pass does not say, so: the entry's bytes differ from what they were when that insert started to run (a new entry appeared, or an existing one was rewritten), and pass did not say that the encryption broke off (gpg can leave a partial file behind then).

Parameters
errWhat pass reported on stderr.
Returns
true when the entry was written.

Reimplemented from Pass.

Definition at line 1126 of file realpass.cpp.

Here is the call graph for this function:

◆ linesPassEncryptsTo()

auto RealPass::linesPassEncryptsTo ( const QString & src,
const PassMoveTarget & target,
bool srcIsDir,
bool intoFolder ) -> QStringList
nodiscardprivate

The recipient lines pass re-encrypts to when it moves or copies src as target says: the destination's list, the lists in a moved folder, and those in a folder it writes into.

Parameters
srcThe entry file or folder, absolute.
targetWhere pass puts it.
srcIsDirWhether src is a folder, as already established.
intoFolderWhether pass writes into an existing folder, as already established.
Returns
The lines, unsorted, possibly repeated.

Definition at line 1659 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ listLinesUnder()

auto RealPass::listLinesUnder ( const QString & dir,
const QString & except ) -> QStringList
private

The lines of every folder's own .gpg-id that pass's walk of dir meets, for keyLinesHeldTwice(): pass re-encrypts each entry there to its folder's nearest list.

Parameters
dirThe folder pass walks.
exceptA list left out (the one Init() replaces); empty for none.
Returns
Their lines, together.

Definition at line 340 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ listSigner()

auto RealPass::listSigner ( ) -> GpgIdSigner
private

The verifier for signed lists, gpg in the store's environment.

Returns
A GpgIdSigner with the configured signing keys.

Definition at line 120 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Move()

void RealPass::Move ( const QString src,
const QString dest,
const bool force )
overridevirtual

Move password file or directory.

Parameters
srcSource path.
destDestination path.
forceOverwrite existing.

Implements Pass.

Definition at line 1472 of file realpass.cpp.

Here is the call graph for this function:

◆ onDequeuing()

void RealPass::onDequeuing ( int id,
bool completes )
private

The executor is about to run (or drop) its next item: for an insert, take its entry from m_insertQueue and fingerprint it now, not when it was queued, so an earlier queued save of the same entry counts as "before". Kept in m_insertPending for that insert's own completion. For pass init, mv and cp, add --status-fd 2 to that one process's PASSWORD_STORE_GPG_OPTS, so finished() can tell whether every entry was re-encrypted (reencryptFailed()), and move its scope from m_reencryptScopes to m_reencryptPending (dropped when it does not complete).

Parameters
idThe item's process id.
completesWhether a completion follows (not for a dropped one).

Definition at line 1091 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ passMoveOrCopy()

void RealPass::passMoveOrCopy ( PROCESS id,
const QString & subcommand,
const QString & src,
const QString & dest,
bool force )
private

Shared implementation of Move and Copy via pass mv/pass cp.

Parameters
idProcess id (PASS_MOVE or PASS_COPY).
subcommandThe pass subcommand, "mv" or "cp".
srcSource path.
destDestination path.
forceOverwrite an existing entry named as dest; without it that is refused (pass would otherwise force). Nothing else that exists where pass would write is overwritten, with or without it.

Definition at line 1543 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ passMoveTarget()

auto RealPass::passMoveTarget ( const QString & src,
const QString & dest ) const -> PassMoveTarget
private

Name src and dest for pass mv/pass cp, and work out where pass 1.7.4 then puts the source.

pass resolves the names by its own rules: it takes the entry <name>.gpg over a folder of the same name unless the name ends in a slash, appends .gpg to the destination unless a folder is moved or the destination is a folder (a link to one included), and mv and cp put the source inside such a folder. The checks run on what this returns, not on the names as the caller spelled them.

Parameters
srcThe entry file or folder to move or copy, absolute.
destWhere to, absolute, as the caller spelled it.
Returns
The names for pass and the paths it touches.

Definition at line 1514 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ passName()

auto RealPass::passName ( const QString & path,
bool stripGpg ) const -> QString
private

path as pass names it: relative to the store, without the .gpg pass appends itself.

Parameters
pathThe file or folder, absolute or relative to the working directory.
stripGpgWhether to drop a trailing .gpg.
Returns
The store-relative name.

Definition at line 1480 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ recipientArgument()

auto RealPass::recipientArgument ( const QString & line) const -> QString
inlinenodiscardoverridevirtual

As written: pass hands each line to gpg itself, so the probe must reach what pass will.

Parameters
lineOne recipient line.
Returns
line.

Reimplemented from Pass.

Definition at line 626 of file realpass.h.

◆ reencryptFailed() [1/2]

auto RealPass::reencryptFailed ( const QString & out,
const QHash< QString, qint64 > & status ) -> bool
static

reencryptFailed() on status records already counted, as the Executor counts them over the whole of stderr (Executor::lastStatusCounts()): the stderr text it hands on is capped, and a large store's END_ENCRYPTION lines would not all be in it.

Parameters
outpass's standard output.
statusgpg status keyword to the number of its lines.
Returns
As reencryptFailed().

Definition at line 1319 of file realpass.cpp.

◆ reencryptFailed() [2/2]

auto RealPass::reencryptFailed ( const QString & out,
const QString & err ) -> bool
static

Whether a pass init, mv or cp that exited 0 left entries as they were: pass carries on past an entry gpg could not re-encrypt.

Judged by gpg's status lines (onDequeuing() adds --status-fd 2), which no locale changes: an INV_RECP, FAILURE or DECRYPTION_FAILED line, or fewer END_ENCRYPTION lines than the entries pass said it was re-encrypting ("name: reencrypting to ..." on stdout). KEYEXPIRED and NO_SECKEY alone are not failures.

Parameters
outpass's standard output.
errpass's and gpg's standard error.
Returns
true on a failure; false without any status line, since then the option did not reach gpg and there is nothing to judge by.

Definition at line 1312 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refuseIgnoredThatMoves()

auto RealPass::refuseIgnoredThatMoves ( const QString & src,
const QString & dest ) -> bool
private

Refuse a pass mv or cp of the folder src when a file in it that Git ignores would not be ignored where it lands: a rule naming the old place (/team/export.csv) does not follow the file, and pass stages the new path whole. Entries and recipient lists are not counted: committing those is what pass is for.

Parameters
srcThe folder moved or copied (anything else passes).
destWhere to, as handed to pass: an existing folder takes it in.
Returns
Whether it was refused (and the user told).

Definition at line 919 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refuseLineBreakName()

auto RealPass::refuseLineBreakName ( const QString & path) -> bool
private

Refuse, and tell the user, when the store-relative name of path holds a line feed or carriage return.

pass finds an entry's folder with $(dirname -- "$path"), and command substitution drops trailing line feeds: for Finance<LF>/x pass reads Finance/.gpg-id, not the list QtPass checked. A co-writer can push such a folder beside a real one. Move and copy are not refused: pass finds the folder there without a command substitution, and renaming is how the user gets rid of such a name.

Parameters
pathAn entry or folder in the store.
Returns
Whether it was refused.

Definition at line 322 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refuseLinkedList()

auto RealPass::refuseLinkedList ( const QString & file,
const QString & within = QString(),
const QString & except = QString(),
LinkedWalks * walks = nullptr ) -> bool
private

Refuse to have pass encrypt file when the walk to its list meets a .gpg-id that is a link or junction (Pass::linkedGpgId()), with or without a signing key: pass would follow it, while QtPass shows the list of a folder above it.

Parameters
fileThe entry or folder.
withinWhen set, only a link under this folder (absolute, cleaned, with a trailing "/") is refused.
exceptA list about to be written (pass init's own), not refused.
walksPassed on to Pass::linkedGpgId(), for a check of many folders; null for none.
Returns
Whether it was refused (and the user told).

Definition at line 163 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refuseLinkInCopiedFolder()

auto RealPass::refuseLinkInCopiedFolder ( const QString & src) -> bool
private

Refuse a pass cp of the folder src when anything in it is a symbolic link or NTFS junction, or a folder in it holds a name Qt cannot read.

pass copies with cp -r. GNU cp copies a link as a link, but BSD and macOS cp follow it with -r, so what a link pushed into a shared store points to (a file in the user's home) would be copied into the store and committed. Refused on every platform, so the result does not depend on which cp pass finds. Hidden folders are walked too; links are not followed.

Parameters
srcThe folder to copy.
Returns
Whether it was refused (and the user told).

Definition at line 876 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refuseList()

auto RealPass::refuseList ( const QString & file,
const GpgIdSigner & signer,
QSet< QString > & verified,
const QString & within = QString(),
const QString & except = QString(),
SkippedWalks * walks = nullptr ) -> bool
private

The checks of refuseUnverifiedList() for file's nearest list, once per list.

Parameters
fileThe entry.
signerThe verifier.
verifiedThe lists already found good; extended.
withinWhen set, only a list under this folder (absolute, cleaned, with a trailing "/") is verified; the skipped-list check applies regardless.
exceptA list about to be written, neither verified nor refused for being missing.
walksPassed on to skippedGpgId(), for a check of many folders; null for none.
Returns
Whether it was refused (and the user told).

Definition at line 134 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refuseMisreadList()

auto RealPass::refuseMisreadList ( const QString & file,
const QString & within,
const QString & except,
QSet< QString > & checked ) -> bool
private

Refuse to have pass encrypt file when its nearest .gpg-id holds lines pass reads differently from the Users dialog (Pass::passReadsDifferently()), with or without a signing key: pass would encrypt to recipients the dialog does not show. A list that is there but not a regular file within Util::kMaxGpgIdBytes is refused too; a missing one is left to pass.

Parameters
fileThe entry or folder.
withinWhen set, only a list under this folder (absolute, cleaned, with a trailing "/") is refused.
exceptA list about to be written (pass init's own), not refused.
checkedLists already found fine in this walk; the list is added when it is.
Returns
Whether it was refused (and the user told).

Definition at line 188 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refuseMoveOrCopyRisks()

auto RealPass::refuseMoveOrCopyRisks ( PROCESS id,
const QString & src,
const QFileInfo & srcFileInfo,
const PassMoveTarget & target ) -> bool
private

Whether a move or copy is refused for what pass would do along the way: re-encrypt to an unverified list, follow a link inside a copied folder, commit over unfinished or unrecorded Git work, move ignored files, or encrypt to a key line two key blocks hold.

Parameters
idPASS_MOVE or PASS_COPY.
srcThe entry file or folder, absolute.
srcFileInfosrc, as the caller already asked about it.
targetWhere pass puts it.
Returns
true when refused; the refusal has been shown.

Definition at line 1625 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refuseSpecialEntry()

auto RealPass::refuseSpecialEntry ( const QString & entry) -> bool
private

Refuse, and tell the user, when entry is set: an entry named like a password that is no regular file, which pass would hand to gpg.

Parameters
entryIts path, or empty when there is none.
Returns
Whether it was refused.

Definition at line 307 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refuseUnrecordedChanges()

auto RealPass::refuseUnrecordedChanges ( const QStringList & paths,
const QStringList & committing ) -> bool
private

Refuse a pass init, mv, cp or insert when paths hold changes git has not recorded, or anything at all is staged in the repository it commits in. pass stages the folder it wrote with git add and then commits the whole index, so a plaintext export lying in the folder or staged anywhere, or files a failed pull wrote, would be committed and pushed along with the change. Ignored files are left alone, as git add leaves them. When the changes include untracked files a file manager writes by itself (.DS_Store, Thumbs.db), the message says which .gitignore lines keep them out for good, for the .gitignore of each repository that reports them (unless a deeper rule there un-ignores them again).

Parameters
pathsAbsolute paths in the store that pass will stage; empty for none (an insert stages its own entry alone).
committingAbsolute paths pass commits: the index of each one's repository (see repositoryOf()) is checked.
Returns
Whether it was refused (and the user told).

Definition at line 782 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refuseUnverifiedList()

auto RealPass::refuseUnverifiedList ( const QString & file) -> bool
private

Refuse to have pass encrypt file when the list it would use is a link (refuseLinkedList()), pass would read it differently from QtPass (refuseMisreadList()), or, with signing on, not one QtPass accepts: its folder's own list was passed over, the signature does not verify, or the list is older than one this device accepted or signed for another folder.

Parameters
fileThe entry (or the place a move or copy writes to).
Returns
Whether it was refused (and the user told).

Definition at line 233 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refuseUnverifiedTree()

auto RealPass::refuseUnverifiedTree ( const QString & dir,
bool onlyListsWithin,
const QString & except = QString() ) -> bool
private

For a folder pass is about to re-encrypt in a move or copy: refuse when an entry pass's walk takes (hidden ones included) is no regular file (refuseSpecialEntry()), or when the signed list of one of them is not one QtPass accepts where it lies now (as refuseUnverifiedList()).

Parameters
dirThe folder moved or copied, or the existing folder written into. Each of its folders' lists counts, used by an entry yet or not: a copy merges into a folder of the same name, so lists on either side meet the other side's entries.
onlyListsWithinWhether only lists inside dir count: for the folder that moves, whose entries get the destination's list in place of any list above it.
exceptA list about to be written (pass init's own), neither verified nor refused for being missing.
Returns
Whether it was refused (and the user told).

Definition at line 499 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Remove()

void RealPass::Remove ( QString file,
bool isDir )
overridevirtual

Remove an entry or folder with pass rm.

A folder that is a link is unlinked here instead, without deleting its target; that removal is committed only when Git is enabled and the tracking lookup and index removal both report success.

Parameters
fileStore-relative entry path, without .gpg for a password file.
isDirtrue to remove a directory; false to remove a password file.

Implements Pass.

Definition at line 1228 of file realpass.cpp.

Here is the call graph for this function:

◆ removeLinkedFolder()

void RealPass::removeLinkedFolder ( const QString & full)
private

Remove a linked folder for Remove(): unlink it here, so that pass rm -rf cannot follow it, and have pass's git forget and commit it. Reports a failure, or ends with finishedRemove() or the queued commit.

Parameters
fullThe link's cleaned absolute path.

Definition at line 1164 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reportReencryptFailure()

void RealPass::reportReencryptFailure ( Enums::PROCESS pid,
const QString & out,
const QString & err )
private

Report a pass init, mv or cp that exited 0 having left entries encrypted to the previous recipients: a critical message and processErrorExit() instead of the completion signal, so the store is not pushed as it now is (a later push still sends what pass committed).

Parameters
pidPASS_INIT, PASS_MOVE or PASS_COPY.
outpass's standard output.
errpass's and gpg's standard error, status lines included.

Definition at line 1345 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reportUnrecorded()

void RealPass::reportUnrecorded ( const QStringList & paths)
private

After a pass insert, init, mv or cp that exited 0, say so when git did not record the entries it wrote: pass exits 0 whatever its git add and commit did (an entry a .gitignore matches, say), and an unrecorded entry is not pushed and a pull may overwrite it.

Parameters
pathsAbsolute paths the change wrote.

Definition at line 857 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ repositoryOf()

auto RealPass::repositoryOf ( const QString & path) -> QString
private

The Git repository pass commits path in: the store's own, or one a folder in it holds (pass looks for the repository from the path's folder, as git does).

Parameters
pathAn absolute path in the store; it need not exist yet.
Returns
The repository's folder relative to the store, empty for the store's own (or when git cannot say).

Definition at line 602 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendDeferredPush()

void RealPass::sendDeferredPush ( )
private

Once the last queued init, move or copy has completed, make the push asked for meanwhile (GitPush()). An automatic one is dropped while a re-encryption in this store is held, and the status line says why; one asked for by hand goes.

Definition at line 91 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Show()

void RealPass::Show ( QString file)
overridevirtual

Show decrypted password.

Parameters
filePath to password file.

Implements Pass.

Definition at line 108 of file realpass.cpp.

Here is the call graph for this function:

◆ statusEntries()

auto RealPass::statusEntries ( const QStringList & args,
const QString & repository = QString() ) -> QStringList
private

git status --porcelain -z through pass git, read: one "XY name" per entry, a rename's old name dropped. Empty without Git, or when git cannot say.

Parameters
argsFurther status arguments (options, then a pathspec relative to repository).
repositoryThe repository to ask, as repositoryOf() gives it; its entries are named from the store.
Returns
The entries.

Definition at line 638 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stopsAtOccupiedTarget()

auto RealPass::stopsAtOccupiedTarget ( PROCESS id,
const QString & src,
const QFileInfo & srcFileInfo,
const QString & dest,
const QString & occupied,
bool force ) -> bool
private

Whether a move or copy stops at what already lies where pass writes: a file dest the user declined to overwrite, the source itself under its own name (nothing to do), or anything else there, which is refused with a message.

Parameters
idPASS_MOVE or PASS_COPY, for the message title.
srcThe entry file or folder, absolute.
srcFileInfosrc, as the caller already asked about it.
destThe destination as the caller spelled it, absolute.
occupiedWhere pass writes (PassMoveTarget::written).
forceConsent to overwrite the entry named as dest only.
Returns
true when pass must not run.

Definition at line 1587 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ storeGit()

auto RealPass::storeGit ( const QStringList & args,
QString * out ) -> bool
overrideprivatevirtual

Run a git command in the store through pass git, blocking.

Parameters
argsThe git arguments (without git).
outReceives stdout; may be null.
Returns
true when pass git ran and exited 0 (git on).

Reimplemented from Pass.

Definition at line 574 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unrecorded()

auto RealPass::unrecorded ( const QStringList & paths,
bool ignored ) -> QStringList
private

What git has not recorded at paths: git status --porcelain lines, through pass git. Empty without Git, or when git cannot say.

Parameters
pathsAbsolute paths in the store.
ignoredWhether ignored files are listed too (as !!).
Returns
The status entries, "XY name" each.

Definition at line 672 of file realpass.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_deferredPushByHand

bool RealPass::m_deferredPushByHand = false
private

One of those pushes was asked for by hand: it goes despite a hold.

Definition at line 533 of file realpass.h.

◆ m_grep

NativeGrep RealPass::m_grep
private

The store's own search: pass grep runs find -L, which follows a link out of the store and decrypts what it finds there.

Definition at line 38 of file realpass.h.

◆ m_insertDone

InsertRecord RealPass::m_insertDone
private

The insert whose completion is being handled.

Definition at line 521 of file realpass.h.

◆ m_insertPending

QQueue<InsertRecord> RealPass::m_insertPending
private

The inserts that left the queue and have yet to complete, in the order their completions come (a failed start's error is posted, and the executor starts nothing else until it is out).

Definition at line 519 of file realpass.h.

◆ m_insertQueue

QQueue<QString> RealPass::m_insertQueue
private

The entries of the queued inserts, oldest first.

Definition at line 515 of file realpass.h.

◆ m_linkCommits

QQueue<LinkCommit> RealPass::m_linkCommits
private

Queued linked-folder removal commits (as GIT_COMMIT), oldest first; finished() judges each.

Definition at line 50 of file realpass.h.

◆ m_pushAfterReencrypt

bool RealPass::m_pushAfterReencrypt = false
private

A push was asked for while an init, move or copy was queued or running: sendDeferredPush() makes it once they have completed.

Definition at line 531 of file realpass.h.

◆ m_reencryptPending

QQueue<QString> RealPass::m_reencryptPending
private

The scopes of the inits, moves and copies that left the queue and have yet to complete, in completion order; one the executor drops never gets here, so it cannot pair with a later command's completion.

Definition at line 528 of file realpass.h.

◆ m_reencryptScopes

QQueue<QString> RealPass::m_reencryptScopes
private

What each queued init, move or copy re-encrypts (its folder, or the destination), oldest first, for the push hold.

Definition at line 524 of file realpass.h.


The documentation for this class was generated from the following files: