mirror of
https://github.com/ceph/ceph
synced 2025-02-19 17:08:05 +00:00
mount.ceph: key -> secret
This commit is contained in:
parent
821d9ef76d
commit
b362024a70
@ -170,34 +170,34 @@ static int parse_options(char ** optionsp, int * filesys_flags)
|
||||
*filesys_flags &= ~MS_RDONLY;
|
||||
} else if (strncmp(data, "remount", 7) == 0) {
|
||||
*filesys_flags |= MS_REMOUNT;
|
||||
} else if (strncmp(data, "keyfile", 7) == 0) {
|
||||
} else if (strncmp(data, "secretfile", 7) == 0) {
|
||||
char *fn = value;
|
||||
char *end = fn;
|
||||
int fd;
|
||||
char key[1000];
|
||||
char secret[1000];
|
||||
int len;
|
||||
|
||||
while (*end && *end != ',')
|
||||
end++;
|
||||
fd = open(fn, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
perror("unable to read keyfile");
|
||||
perror("unable to read secretfile");
|
||||
return -1;
|
||||
}
|
||||
len = read(fd, key, 1000);
|
||||
len = read(fd, secret, 1000);
|
||||
if (len <= 0) {
|
||||
perror("unable to read key from keyfile");
|
||||
perror("unable to read secret from secretfile");
|
||||
return -1;
|
||||
}
|
||||
end = key;
|
||||
while (end < key + len && *end && *end != '\n' && *end != '\r')
|
||||
end = secret;
|
||||
while (end < secret + len && *end && *end != '\n' && *end != '\r')
|
||||
end++;
|
||||
*end = '\0';
|
||||
close(fd);
|
||||
|
||||
//printf("read key of len %d from %s\n", len, fn);
|
||||
data = "key";
|
||||
value = key;
|
||||
//printf("read secret of len %d from %s\n", len, fn);
|
||||
data = "secret";
|
||||
value = secret;
|
||||
skip = 0;
|
||||
} else {
|
||||
skip = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user