Bugzilla – Attachment 39 Details for
Bug 158
ssh-add trips up due to missing key types
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Updated patch to only disregard errors finding default keys
PATCH_2 (text/plain), 1.80 KB, created by
William Knox
on 2002-03-12 08:53:16 AEDT
(
hide
)
Description:
Updated patch to only disregard errors finding default keys
Filename:
MIME Type:
Creator:
William Knox
Created:
2002-03-12 08:53:16 AEDT
Size:
1.80 KB
patch
obsolete
>--- ssh-add.c~ Mon Feb 4 20:12:50 2002 >+++ ssh-add.c Mon Mar 11 16:32:29 2002 >@@ -123,7 +123,7 @@ > } > > static int >-add_file(AuthenticationConnection *ac, const char *filename) >+add_file(AuthenticationConnection *ac, const char *filename, int defaults) > { > struct stat st; > Key *private; >@@ -132,8 +132,12 @@ > int ret = -1; > > if (stat(filename, &st) < 0) { >- perror(filename); >- return -1; >+ if (errno == ENOENT && defaults) { >+ return 0; >+ } else { >+ perror(filename); >+ return -1; >+ } > } > /* At first, try empty passphrase */ > private = key_load_private(filename, "", &comment); >@@ -223,13 +227,13 @@ > } > > static int >-do_file(AuthenticationConnection *ac, int deleting, char *file) >+do_file(AuthenticationConnection *ac, int deleting, char *file, int defaults) > { > if (deleting) { > if (delete_file(ac, file) == -1) > return -1; > } else { >- if (add_file(ac, file) == -1) >+ if (add_file(ac, file, defaults) == -1) > return -1; > } > return 0; >@@ -257,7 +261,7 @@ > extern int optind; > AuthenticationConnection *ac = NULL; > char *sc_reader_id = NULL; >- int i, ch, deleting = 0, ret = 0; >+ int i, ch, deleting = 0, ret = 0, defaults = 0; > > __progname = get_progname(argv[0]); > init_rng(); >@@ -310,6 +314,7 @@ > if (argc == 0) { > char buf[MAXPATHLEN]; > struct passwd *pw; >+ defaults = 1; > > if ((pw = getpwuid(getuid())) == NULL) { > fprintf(stderr, "No user found with uid %u\n", >@@ -321,12 +326,12 @@ > for(i = 0; default_files[i]; i++) { > snprintf(buf, sizeof(buf), "%s/%s", pw->pw_dir, > default_files[i]); >- if (do_file(ac, deleting, buf) == -1) >+ if (do_file(ac, deleting, buf, defaults) == -1) > ret = 1; > } > } else { > for(i = 0; i < argc; i++) { >- if (do_file(ac, deleting, argv[i]) == -1) >+ if (do_file(ac, deleting, argv[i], defaults) == -1) > ret = 1; > } > }
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 158
:
38
| 39 |
45
|
49