mount.ceph: key -> secret

This commit is contained in:
Sage Weil 2009-08-14 12:50:03 -07:00
parent 821d9ef76d
commit b362024a70

View File

@ -170,34 +170,34 @@ static int parse_options(char ** optionsp, int * filesys_flags)
*filesys_flags &= ~MS_RDONLY; *filesys_flags &= ~MS_RDONLY;
} else if (strncmp(data, "remount", 7) == 0) { } else if (strncmp(data, "remount", 7) == 0) {
*filesys_flags |= MS_REMOUNT; *filesys_flags |= MS_REMOUNT;
} else if (strncmp(data, "keyfile", 7) == 0) { } else if (strncmp(data, "secretfile", 7) == 0) {
char *fn = value; char *fn = value;
char *end = fn; char *end = fn;
int fd; int fd;
char key[1000]; char secret[1000];
int len; int len;
while (*end && *end != ',') while (*end && *end != ',')
end++; end++;
fd = open(fn, O_RDONLY); fd = open(fn, O_RDONLY);
if (fd < 0) { if (fd < 0) {
perror("unable to read keyfile"); perror("unable to read secretfile");
return -1; return -1;
} }
len = read(fd, key, 1000); len = read(fd, secret, 1000);
if (len <= 0) { if (len <= 0) {
perror("unable to read key from keyfile"); perror("unable to read secret from secretfile");
return -1; return -1;
} }
end = key; end = secret;
while (end < key + len && *end && *end != '\n' && *end != '\r') while (end < secret + len && *end && *end != '\n' && *end != '\r')
end++; end++;
*end = '\0'; *end = '\0';
close(fd); close(fd);
//printf("read key of len %d from %s\n", len, fn); //printf("read secret of len %d from %s\n", len, fn);
data = "key"; data = "secret";
value = key; value = secret;
skip = 0; skip = 0;
} else { } else {
skip = 0; skip = 0;