Re: Re: problem compiling KDar with libdar CVS

Johnathan Burchill <[email protected]> Thu, 04 Nov 2004 09:09:18 -0700
Newsgroups gmane.comp.sysutils.backup.dar.libdar
Organization Department of Physics and Astronomy, University of Calgary
Message-ID <[email protected]>
On Thursday 04 November 2004 02:27, Denis Corbin wrote:
> Johnathan Burchill wrote:
>
> Hello Johnathan,
>
> | On Wednesday 03 November 2004 13:08, Denis Corbin wrote:
> |>Denis Corbin wrote:
> |>|[...]
> |
> |[...]
> | As far as I can tell from the latest cvs API, when I read an existing
> | archive with the archive "read" constructor, I need to give it a
> | "const std::string &pass" argument, i.e. the password. So it seems
> | that the application has to know beforehand whether the user is
> | opening an encrypted archive or an unencrypted archive.
>
> In my point of view, the user has to know if the archive he tends to
> open is encrypted or not and if so it has to know too the password. The
> pass argument may be an empty string, or any other value, the given
> value will only be used if the archive has a flag set in the header of
> the archive telling that the archive has been encrypted (no information
> about the algorithm used or the block size used --- or the password of
> course --- is present in the header). Note that the pass has the
> structure described in the dar man page (option -K), "[algo:]pass" .
> where algo is bf, blowfish, scram or scrambling (more will follow I hope
> before the end of november) with "bf" = "blowfish", "scram" =
> "scrambling". If the password must contain a ':' the algo must be
> specified (in the form <algo>:<password_with_column>), so you can safely
> always specify the cypher used.
>
> A warning is issued if an encrypted archive is openned, because the
> diagnostic of a wrong password, is not easy to diagnostic neither for
> the user nor for libdar.
>
> | I see that archive::archive calls "macro_tools_open_archive" which in
>
> turn
>
> | 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.

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.

>
> This is what I was looking for, to implement the password out of
> command-line for dar. Libdar could interactively ask the user for
> password when the user gives "-K bf:" or maybe just "-K :" where no
> password is given and the cypher is blowfish or where nothing is given
> at all, so the default cypher (bf actually) is used and no password is
> used.
>
> Thanks for the idea ! :-)
>
> | Or, is there a way in the API to check the archive, before opening it,
> | to see whether it is encrypted?
>
> well, it may have implications for the user if openning the archive once
> just to see if the archive is encrypted and a second time to open it for
> real. Implications can be extra change of disk for example.
>
> | Cheers,
> | JB
>
> Cheers,
> Denis.
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Sybase ASE Linux Express Edition - download now for FREE
> LinuxWorld Reader's Choice Award Winner for best database on Linux.
> http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> _______________________________________________
> Dar-libdar_api mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/dar-libdar_api

-- 
Johnathan K. Burchill, Ph.D.
Department of Physics and Astronomy
University of Calgary
2500 University Drive N.W.
Calgary, AB T2N 1N4
Canada

(403) 217-4286
[email protected]


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click