Whamcloud - gitweb
LU-12401 gss: fix checksum for Kerberos and SSK
[fs/lustre-release.git] / lustre / ptlrpc / gss / lproc_gss.c
index 610f0b3..468633e 100644 (file)
@@ -41,7 +41,6 @@
 #include <obd.h>
 #include <obd_class.h>
 #include <obd_support.h>
-#include <lustre/lustre_idl.h>
 #include <lustre_net.h>
 #include <lustre_import.h>
 #include <lprocfs_status.h>
@@ -133,12 +132,36 @@ static const struct file_operations gss_proc_secinit = {
        .write = gss_proc_write_secinit,
 };
 
+int sptlrpc_krb5_allow_old_client_csum_seq_show(struct seq_file *m, void *data)
+{
+       seq_printf(m, "%u\n", krb5_allow_old_client_csum);
+       return 0;
+}
+
+ssize_t sptlrpc_krb5_allow_old_client_csum_seq_write(struct file *file,
+                                                    const char __user *buffer,
+                                                    size_t count, loff_t *off)
+{
+       bool val;
+       int rc;
+
+       rc = kstrtobool_from_user(buffer, count, &val);
+       if (rc)
+               return rc;
+
+       krb5_allow_old_client_csum = val;
+       return count;
+}
+LPROC_SEQ_FOPS(sptlrpc_krb5_allow_old_client_csum);
+
 static struct lprocfs_vars gss_lprocfs_vars[] = {
        { .name =       "replays",
          .fops =       &gss_proc_oos_fops      },
        { .name =       "init_channel",
          .fops =       &gss_proc_secinit,
          .proc_mode =  0222                    },
+       { .name =       "krb5_allow_old_client_csum",
+         .fops =       &sptlrpc_krb5_allow_old_client_csum_fops },
        { NULL }
 };
 
@@ -159,14 +182,14 @@ static ssize_t
 gss_lk_proc_dl_seq_write(struct file *file, const char __user *buffer,
                                size_t count, loff_t *off)
 {
+       unsigned int val;
        int rc;
-       __s64 val;
 
-       rc = lprocfs_str_to_s64(buffer, count, &val);
+       rc = kstrtouint_from_user(buffer, count, 0, &val);
        if (rc < 0)
                return rc;
 
-       if (val < 0 || val > 4)
+       if (val > 4)
                return -ERANGE;
 
        gss_lk_debug_level = val;