]> eyrie.org Git - kerberos/krb5-strength.git/commitdiff
Fix warnings with Clang 10
authorRuss Allbery <eagle@eyrie.org>
Sat, 16 May 2020 22:35:53 +0000 (15:35 -0700)
committerRuss Allbery <eagle@eyrie.org>
Sat, 16 May 2020 22:35:53 +0000 (15:35 -0700)
Fix warnings from both the compiler and the static analyzer.
Reword cracklib/HISTORY to consistently use the past tense.

cracklib/HISTORY
cracklib/rules.c
plugin/sqlite.c
tests/data/passwords/make-c-data
tests/plugin/mit-t.c

index e88ca5c3ef2a8a771190a77c9f4fd2e077b7383e..09391e206d74bc10f27dc83e600d6f8661f08511 100644 (file)
@@ -7,17 +7,15 @@ following modifications have been made:
  * Modified the adjacent character check to depend on the password length.
  * Remove checks against the user's GECOS entry.
  * Don't exit on failure to open the database.
- * Improve the search algorithm in FindPW somewhat.
+ * Improved the search algorithm in FindPW somewhat.
  * Don't segfault on corrupt dictionaries.
  * Fixed the data format output by packer to properly pad the end.
- * Add ANSI C prototypes for all functions and mark const variables.
- * Remove unused functions.
- * Various compilation warning and portability fixes.
- * Use Autoconf and portable/system.h to find types of specific lengths.
- * Increase MINLENGTH.
- * Add a check for a duplicated dictionary word.
+ * Added ANSI C prototypes for all functions and mark const variables.
+ * Removed unused functions.
+ * Increased MINLENGTH.
+ * Added a check for a duplicated dictionary word.
  * Changed error for very short passwords to match current CrackLib.
- * Remove last block optimization in GetPW and start fresh each time.
+ * Removed last block optimization in GetPW and start fresh each time.
  * Close the dictionary after each password lookup.
  * Set hidden visibility on all CrackLib symbols.
  * Close the wfp file handle on PWClose if it's open.
@@ -25,8 +23,9 @@ following modifications have been made:
  * Changed the type of some variables to size_t to avoid truncation.
  * Forced locale in mkdict to avoid problems with non-C-locale sort.
  * Added a warning to packer if processing out-of-order words.
- * Added cast of CRACK_TOLOWER and CRACK_TOUPPER to char.
+ * Used Autoconf and portable/system.h to find types of specific lengths.
  * Added missing break to RULE_MFIRST "(" and RULE_MLAST ")" handling.
+ * Various compilation warning and portability fixes.
 
 See the leading comments in each source file for a more detailed timeline
 and list of changes.
index 9046ac86b4d2c762b6ae707b5bd9247c1dab8766..0e25f3c74907d1e35911decb140e1ebf97927e4c 100644 (file)
@@ -31,6 +31,7 @@
  * 2020-05-16  Russ Allbery <eagle@eyrie.org>
  *   - Change variables from int to size_t to silence warnings.
  *   - Add missing break to RULE_MFIRST and RULE_MLAST handling.
+ *   - Remove break after return to silence Clang warnings.
  */
 
 #include <stdarg.h>
@@ -362,7 +363,6 @@ MatchClass(char class, char input)
     default:
        Debug(1, "MatchClass: unknown class %c\n", class);
        return (0);
-       break;
     }
 
     if (isupper(class))
@@ -832,7 +832,6 @@ Mangle(const char *input, const char *control)
        default:
            Debug(1, "Mangle: unknown command %c in %s\n", *ptr, control);
            return ((char *) 0);
-           break;
        }
     }
     if (!area[0])              /* have we deweted de poor widdle fing away? */
index 37aea63763ecdbad753b5a576af961025c7f64cb..34a5b0cd239eeba286a32067f2390d63b5b12c62 100644 (file)
@@ -379,7 +379,8 @@ found:
     code = strength_error_dict(ctx, ERROR_DICT);
 
 fail:
-    memset(prefix, 0, length);
+    if (prefix != NULL)
+        memset(prefix, 0, length);
     memset(drowssap, 0, length);
     free(prefix);
     free(drowssap);
index 471a05025aa347c0afd3d6da47e0298807c4e3ca..9753850bd525ab8f77809d90bfd3782591052633 100755 (executable)
@@ -5,6 +5,8 @@
 # The canonical representation of our password tests is in JSON, but I don't
 # want to require a JSON parser for the C tests to run.  This script reads the
 # JSON input and generates a C data structure that holds all of the tests.
+#
+# SPDX-License-Identifier: MIT
 
 use 5.010;
 use autodie;
@@ -31,10 +33,12 @@ Readonly my $HEADER => <<'END_HEADER';
  * for the use in C test programs.  To make changes, modify the original
  * JSON source or (more rarely) the make-c-data script and run it again.
  *
+ * Written by Russ Allbery <eagle@eyrie.org>
+ * Copyright 2020 Russ Allbery <eagle@eyrie.org>
  * Copyright 2013
  *     The Board of Trustees of the Leland Stanford Junior University
  *
- * See LICENSE for licensing terms.
+ * SPDX-License-Identifier: MIT
  */
 
 #include <tests/data/passwords/tests.h>
@@ -135,6 +139,7 @@ my $tests_ref = load_password_tests($datafile);
 my $name = basename($datafile);
 $name =~ s{ [.]json \z }{}xms;
 print_fh(\*STDOUT, $HEADER);
+say_fh(\*STDOUT, "extern const struct password_test ${name}_tests[];");
 say_fh(\*STDOUT, "const struct password_test ${name}_tests[] = {");
 
 # Print out the test data.
@@ -195,6 +200,8 @@ Russ Allbery <eagle@eyrie.org>
 
 =head1 COPYRIGHT AND LICENSE
 
+Copyright 2020 Russ Alllbery <eagle@eyrie.org>
+
 Copyright 2013 The Board of Trustees of the Leland Stanford Junior
 University
 
index 9857bb9e5bac050d19fe7ca9118fcbe203a67210..cdfeec9b8ce4b46017fa7787c64778bf9dcac6db 100644 (file)
@@ -71,7 +71,7 @@ load_plugin(krb5_context ctx, void **handle)
     char *path;
     krb5_error_code code;
     krb5_pwqual_vtable vtable = NULL;
-    krb5_error_code (*init)(krb5_context, int, int, krb5_plugin_vtable);
+    pwqual_strength_initvt *init;
 
     /* Load the module. */
     path = test_file_path("../plugin/.libs/strength.so");
@@ -83,7 +83,7 @@ load_plugin(krb5_context ctx, void **handle)
     test_file_path_free(path);
 
     /* Find the entry point function. */
-    init = dlsym(*handle, "pwqual_strength_initvt");
+    init = (pwqual_strength_initvt *) dlsym(*handle, "pwqual_strength_initvt");
     if (init == NULL)
         bail("cannot get pwqual_strength_initvt symbol: %s", dlerror());