On 8/13/06, Luca Berra <bluca@xxxxxxxxxx> wrote:
On Sun, Aug 13, 2006 at 11:59:53AM +0200, rupert wrote: >Hello, > >im writing a small frontend(in C) for cryptsetup, only init and mount the >volumes, no creation of volumes, >and I would like to know how i can pass the password to the cryptsetup >commando? popen() ?
well, i tried something like this without luck, maybe im doing a simple mistake, could you take a look at the code? void init_password_callback(GtkWidget *dialog, gint response, char *dev_mapper){ char *argv[5] = {"/sbin/cryptsetup luksOpen", dev_mapper, NULL, NULL, NULL}; GError *error = NULL; char* fifoname = NULL; FILE* fifo = NULL; GPid mount_pid; char* passphrase = NULL; if (response == GTK_RESPONSE_OK) passphrase = gksuui_dialog_get_password(GTK_WIDGET(dialog)); if (!passphrase) g_print("kein Password"); gtk_widget_destroy(GTK_WIDGET(dialog)); // g_print("PASS: %s", passphrase); gchar pw[512]; gchar init_pw[512]; sprintf(init_pw, "/sbin/cryptsetup luksOpen %s", dev_mapper); // g_print("ARGV_3: %s",init_pw); FILE *fp = popen(init_pw, "w"); if (fp) { sprintf(pw, "%\n", passphrase); fputs(pw, fp); // fputs(pw, stdin); } return; }
Since there is no -P option i cant do it via argv. which is a good thing(tm)
i think that to, bash_history could make the whole thing useless... thx L.
-- Luca Berra -- bluca@xxxxxxxxxx Communication Media & Services S.r.l. /"\ \ / ASCII RIBBON CAMPAIGN X AGAINST HTML MAIL / \ --------------------------------------------------------------------- - http://www.saout.de/misc/dm-crypt/ To unsubscribe, e-mail: dm-crypt-unsubscribe@xxxxxxxx For additional commands, e-mail: dm-crypt-help@xxxxxxxx