[Dar-libdar_api] Re: problem compiling KDar with libdar CVS
For full, incremental, compressed and encrypted backups or archives
Brought to you by:
edrusb
|
From: Denis C. <dar...@fr...> - 2004-11-04 18:06:58
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Johnathan Burchill wrote: | On Thursday 04 November 2004 02:27, Denis Corbin wrote: | |>Johnathan Burchill wrote: |> |[...] |> |>| calls dialog.warning(...) if the archive is encrypted and no password |>| is given. Perhaps if "macro_tools_open_archive" could throw an |>| Epassword() exception, that could be caught by the application, which |>| could transparently ask the user for a password and try the read |>| again. |> |>I like the idea, but throwing an exception is not a reversible operation |>~ from the stack point of view (you cannot continue execution where it |>has been thrown). I suppose you mean that libdar should rather use a the |>user_interaction::pause(...) method to ask the password to the user, it |>the pass argument was something like "bf:" or "scram:" where just the |>algorithm (the cypher) is given ? | | | I didn't expect libdar to continue where it left off after issuing | Epassword(). Just that it would be a way to inform the application to ask | the user for a password and try again to read the archive from the | beginning. | | However, your idea of using user_interaction::pause looks promising. I did | not think of that one because the current implementation seems to be able | to handle boolean questions, not arbitrary responses. Yes you are right. user_interaction::pause() is only able to handle boolean questions. Thus I had to add a new method to user_interaction class: ~ std::string get_string(const std::string & message, bool echo); the message argument shall be displayed to the user and the user answer be the returned value of the method. The echo argument is the "echo local" value. In brief, if libdar set it to true the user answer can be displayed, if libdar set it to false while calling get_string() all that the user types must be hidden (like when entering passwords). The inherited class like the user_interaction_callback must implement get_string(). For this later class this implies a new callback function, but nothing extraordinary there. Dar is updated and used this behavior. So if the pass is an empty string while encryption cypher is set, this mechanism is used to ask the pass to the user. Same thing when reading an archive, if the archive uses encryption while a cypher encryption is set and the pass argument is an empty string, libdar will ask the user for a password through the same mechanisme. I have added another check when reading an archive that is encrypted. If the no cypher has been set (crypto_none) libdar will abort and refuse too perform the operation as obviously this will lead to failure to read the archive. | | The user_interaction::pause method is nice, because the application can use | whatever external program or library it wants to interact with the user. | For example, I think KDE or QT has a library call for securely requesting | passwords. | | The application would have to know how user_interaction::pause is to be | used, though, right? Libdar would have to indicate that a particular | user_interaction::pause call is to be for passwords, and not a yes/no | response. Yes. I realized this just after my previous mail. | | | Cheers, Denis. P.S.: CVS is up to date. Last feature added has been tested and seems to work fine so far. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFBimsxpC5CI8gYGlIRAvsRAKC0NVROXpnuXshNPFdH3ezS2K/y6wCgnQWf 8VPx0+AD3AOJA1xBMaLoCF4= =182c -----END PGP SIGNATURE----- |