Whamcloud - gitweb
LU-6803 gss: add printf format checking to printerr() 51/15751/2
authorJames Simmons <uja.ornl@yahoo.com>
Mon, 27 Jul 2015 18:26:56 +0000 (14:26 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 31 Jul 2015 01:33:24 +0000 (01:33 +0000)
Add printf format checking to the gss error reporting functions
printerr(). Fixup all errors exposed by this change.

Change-Id: I2b7a2d65cb3ee81b11eb6af45297dad2e6cbb796
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: http://review.whamcloud.com/15751
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Sebastien Buisson <sebastien.buisson@bull.net>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/utils/gss/err_util.h
lustre/utils/gss/gss_util.c
lustre/utils/gss/svcgssd_proc.c

index 1d6b20c..7fff5ba 100644 (file)
@@ -32,7 +32,8 @@
 #define _ERR_UTIL_H_
 
 void initerr(char *progname, int verbosity, int fg);
 #define _ERR_UTIL_H_
 
 void initerr(char *progname, int verbosity, int fg);
-void printerr(int priority, char *format, ...);
+void printerr(int priority, char *format, ...)
+             __attribute__((__format__(__printf__, 2, 3)));
 void print_hexl(int pri, unsigned char *cp, int length);
 
 #endif /* _ERR_UTIL_H_ */
 void print_hexl(int pri, unsigned char *cp, int length);
 
 #endif /* _ERR_UTIL_H_ */
index d5974d0..7b9a9ff 100644 (file)
@@ -264,7 +264,7 @@ int gssd_acquire_cred(char *server_name, gss_cred_id_t *cred,
                                target_name, &pbuf, NULL);
                if (ignore_maj_stat == GSS_S_COMPLETE) {
                        printerr(0, "Unable to obtain credentials for '%.*s'\n",
                                target_name, &pbuf, NULL);
                if (ignore_maj_stat == GSS_S_COMPLETE) {
                        printerr(0, "Unable to obtain credentials for '%.*s'\n",
-                                pbuf.length, pbuf.value);
+                                (int) pbuf.length, (char *) pbuf.value);
                        ignore_maj_stat = gss_release_buffer(&ignore_min_stat,
                                                             &pbuf);
                }
                        ignore_maj_stat = gss_release_buffer(&ignore_min_stat,
                                                             &pbuf);
                }
index 5a9e816..3e0a7ce 100644 (file)
@@ -326,7 +326,7 @@ get_ids(gss_name_t client_name, gss_OID mech, struct svc_cred *cred,
        }
        if (name.length >= 0xffff || /* be certain name.length+1 doesn't overflow */
            !(sname = calloc(name.length + 1, 1))) {
        }
        if (name.length >= 0xffff || /* be certain name.length+1 doesn't overflow */
            !(sname = calloc(name.length + 1, 1))) {
-               printerr(0, "WARNING: get_ids: error allocating %d bytes "
+               printerr(0, "WARNING: get_ids: error allocating %zu bytes "
                        "for sname\n", name.length + 1);
                gss_release_buffer(&min_stat, &name);
                return -1;
                        "for sname\n", name.length + 1);
                gss_release_buffer(&min_stat, &name);
                return -1;
@@ -511,7 +511,7 @@ handle_nullreq(FILE *f) {
        qword_get(&cp, (char *) &lustre_svc, sizeof(lustre_svc));
        qword_get(&cp, (char *) &nid, sizeof(nid));
        qword_get(&cp, (char *) &handle_seq, sizeof(handle_seq));
        qword_get(&cp, (char *) &lustre_svc, sizeof(lustre_svc));
        qword_get(&cp, (char *) &nid, sizeof(nid));
        qword_get(&cp, (char *) &handle_seq, sizeof(handle_seq));
-       printerr(2, "handling req: svc %u, nid %016llx, idx %llx\n",
+       printerr(2, "handling req: svc %u, nid %016llx, idx %"PRIx64"\n",
                 lustre_svc, nid, handle_seq);
 
        get_len = qword_get(&cp, in_handle.value, sizeof(in_handle_buf));
                 lustre_svc, nid, handle_seq);
 
        get_len = qword_get(&cp, in_handle.value, sizeof(in_handle_buf));
@@ -539,7 +539,7 @@ handle_nullreq(FILE *f) {
        if (in_handle.length != 0) { /* CONTINUE_INIT case */
                if (in_handle.length != sizeof(ctx)) {
                        printerr(0, "WARNING: handle_nullreq: "
        if (in_handle.length != 0) { /* CONTINUE_INIT case */
                if (in_handle.length != sizeof(ctx)) {
                        printerr(0, "WARNING: handle_nullreq: "
-                                   "input handle has unexpected length %d\n",
+                                   "input handle has unexpected length %zu\n",
                                    in_handle.length);
                        goto out_err;
                }
                                    in_handle.length);
                        goto out_err;
                }