|
Lines 124-139
delete_all(AuthenticationConnection *ac)
Link Here
|
| 124 |
static int |
124 |
static int |
| 125 |
add_file(AuthenticationConnection *ac, const char *filename) |
125 |
add_file(AuthenticationConnection *ac, const char *filename) |
| 126 |
{ |
126 |
{ |
| 127 |
struct stat st; |
|
|
| 128 |
Key *private; |
127 |
Key *private; |
| 129 |
char *comment = NULL; |
128 |
char *comment = NULL; |
| 130 |
char msg[1024]; |
129 |
char msg[1024]; |
| 131 |
int ret = -1; |
130 |
int fd, perms_ok, ret = -1; |
| 132 |
|
131 |
|
| 133 |
if (stat(filename, &st) < 0) { |
132 |
if ((fd = open(filename, 0)) < 0) { |
| 134 |
perror(filename); |
133 |
perror(filename); |
| 135 |
return -1; |
134 |
return -1; |
| 136 |
} |
135 |
} |
|
|
136 |
|
| 137 |
/* |
| 138 |
* Since we'll try to load a keyfile multiple times, permission errors |
| 139 |
* will occur multiple times, so check perms first and bail if wrong. |
| 140 |
*/ |
| 141 |
perms_ok = key_perm_ok(fd, filename); |
| 142 |
close(fd); |
| 143 |
if (!perms_ok) |
| 144 |
return -1; |
| 145 |
|
| 137 |
/* At first, try empty passphrase */ |
146 |
/* At first, try empty passphrase */ |
| 138 |
private = key_load_private(filename, "", &comment); |
147 |
private = key_load_private(filename, "", &comment); |
| 139 |
if (comment == NULL) |
148 |
if (comment == NULL) |