Bugzilla – Attachment 1390 Details for
Bug 1393
patch modifies gnome-ssh-askpass to optionally use one-time password
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Updated gnome-ssh-askpass2.c/otac patch
gnome-ssh-askpass2.c.patch (text/plain), 2.91 KB, created by
Paul Sery
on 2007-12-10 04:54:46 AEDT
(
hide
)
Description:
Updated gnome-ssh-askpass2.c/otac patch
Filename:
MIME Type:
Creator:
Paul Sery
Created:
2007-12-10 04:54:46 AEDT
Size:
2.91 KB
patch
obsolete
>--- gnome-ssh-askpass2.c.orig 2007-11-29 22:07:10.000000000 -0700 >+++ gnome-ssh-askpass2.c 2007-11-30 23:57:21.000000000 -0700 >@@ -38,6 +38,7 @@ > > #define GRAB_TRIES 16 > #define GRAB_WAIT 250 /* milliseconds */ >+#define OTAC_PWD_LEN 4 /* number of characters in otac passphrase */ > > /* > * Compile with: >@@ -56,6 +57,42 @@ > #include <gtk/gtk.h> > #include <gdk/gdkx.h> > >+/* generate the one-time agent confirm password and write it to fifo */ >+static char * >+write_otac_to_fifo(char *otac_fifo) >+{ >+ FILE *out; >+ int i,ran,otac_length=OTAC_PWD_LEN; >+ char cpool[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; >+ size_t nchars = sizeof(cpool) - 1; >+ char *otac_passphrase; >+ >+ /* generate one-time agent confirmation (otac) passphrase */ >+ otac_passphrase=malloc(otac_length+1); >+ if (otac_passphrase == NULL) >+ exit(-1); >+ >+ for (i=0;i<otac_length;i++) { >+ ran = arc4random(); >+ otac_passphrase[i] = cpool[ran%nchars]; >+ } >+ otac_passphrase[otac_length] = '\0'; >+ >+ /* write otac password to fifo */ >+ if ( (out=fopen(otac_fifo,"w")) == NULL) { >+ mkfifo(otac_fifo, 0660); >+ } >+ if ( (out=fopen(otac_fifo,"w")) == NULL) >+ exit(-1); >+ fflush(out); >+ fprintf(out,"One-time agent confirm: %s\n",otac_passphrase); >+ fclose(out); >+ >+ /* return otac passphrase */ >+ return(otac_passphrase); >+} >+ > static void > report_failed_grab (const char *what) > { >@@ -87,11 +124,15 @@ > passphrase_dialog(char *message) > { > const char *failed; >- char *passphrase, *local; >+ char *passphrase, *local, *otac_passphrase, *otac_fifo; > int result, grab_tries, grab_server, grab_pointer; > GtkWidget *dialog, *entry; > GdkGrabStatus status; > >+ /* generate and transmit otac passphrase if env var set */ >+ otac_fifo = getenv("SSH_OTAC_FIFO"); >+ if (otac_fifo) >+ otac_passphrase = write_otac_to_fifo(otac_fifo); > grab_server = (getenv("GNOME_SSH_ASKPASS_GRAB_SERVER") != NULL); > grab_pointer = (getenv("GNOME_SSH_ASKPASS_GRAB_POINTER") != NULL); > grab_tries = 0; >@@ -163,14 +204,27 @@ > /* Report passphrase if user selected OK */ > passphrase = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry))); > if (result == GTK_RESPONSE_OK) { >- local = g_locale_from_utf8(passphrase, strlen(passphrase), >- NULL, NULL, NULL); >- if (local != NULL) { >- puts(local); >- memset(local, '\0', strlen(local)); >- g_free(local); >+ if (otac_fifo) { >+ if (strcmp(otac_passphrase,passphrase) == 0) { >+ puts("yes"); >+ } else { >+ puts("no"); >+ } >+ /* Zero otac passphrase in memory */ >+ memset(otac_passphrase, '\b', strlen(otac_passphrase)); >+ gtk_entry_set_text(GTK_ENTRY(entry), otac_passphrase); >+ memset(otac_passphrase, '\0', strlen(otac_passphrase)); >+ g_free(otac_passphrase); > } else { >- puts(passphrase); >+ local = g_locale_from_utf8(passphrase, strlen(passphrase), >+ NULL, NULL, NULL); >+ if (local != NULL) { >+ puts(local); >+ memset(local, '\0', strlen(local)); >+ g_free(local); >+ } else { >+ puts(passphrase); >+ } > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1393
:
1383
|
1384
| 1390 |
1391