]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/secret.c: fix key parsing when doing a remount 28610/head
authorLuis Henriques <lhenriques@suse.com>
Thu, 16 May 2019 10:50:56 +0000 (11:50 +0100)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 17 Jun 2019 20:05:12 +0000 (13:05 -0700)
When doing a CephFS remount (-o remount) the secret is parsed from procfs
and we get '<hidden>' as a result and the mount will fail with:

  secret is not valid base64: Invalid argument.
  adding ceph secret key to kernel failed: Invalid argument.

As the kernel already have the key, we simply need to use it.

Fixes: https://tracker.ceph.com/issues/39951
Signed-off-by: Luis Henriques <lhenriques@suse.com>
(cherry picked from commit f44516bcde8d48ef5dca4f92017d1e241eb8e26e)

src/common/secret.c

index b6f26ec3ece5c2e9af3107230828f91d392f76f9..8f92fb0a7f01bce100e69c6f99be4369cbe55abe 100644 (file)
@@ -101,8 +101,8 @@ int get_secret_option(const char *secret, const char *key_name,
 
   option[olen] = '\0';
 
-
-  if (secret) {
+  /* when parsing kernel options (-o remount) we get '<hidden>' as the secret */
+  if (secret && (strcmp(secret, "<hidden>") != 0)) {
     ret = set_kernel_secret(secret, key_name);
     if (ret < 0) {
       if (ret == -ENODEV || ret == -ENOSYS) {