267 lines
8.2 KiB
Diff
267 lines
8.2 KiB
Diff
From 648fe74986f2a84416805cfd73206e9e67166ae2 Mon Sep 17 00:00:00 2001
|
|
From: Rob Crittenden <rcritten@redhat.com>
|
|
Date: Thu, 13 Sep 2018 15:40:23 -0400
|
|
Subject: [PATCH 11/17] clang: Dead assignment
|
|
|
|
---
|
|
src/casave.c | 4 +++-
|
|
src/keygen-n.c | 1 -
|
|
src/keyiread-n.c | 1 -
|
|
src/store-files.c | 2 --
|
|
src/store-gen.c | 3 ---
|
|
src/submit-e.c | 54 ++++++++++++++++++++++++++------------------------
|
|
src/submit-u.c | 2 --
|
|
src/tdbush.c | 8 ++++++--
|
|
tests/tools/addcinfo.c | 1 -
|
|
tests/tools/certsave.c | 4 +++-
|
|
10 files changed, 40 insertions(+), 40 deletions(-)
|
|
|
|
diff --git a/src/casave.c b/src/casave.c
|
|
index 5fb31b8d..bde63f99 100644
|
|
--- a/src/casave.c
|
|
+++ b/src/casave.c
|
|
@@ -163,7 +163,6 @@ cm_casave_main_n(int fd, struct cm_store_ca *ca, struct cm_store_entry *e,
|
|
decoded = CERT_DecodeCertFromPackage(package,
|
|
strlen(package));
|
|
p = state->certs[i]->nickname;
|
|
- ttrust = ",,";
|
|
switch (state->certs[i]->level) {
|
|
case root:
|
|
case other_root:
|
|
@@ -178,6 +177,9 @@ cm_casave_main_n(int fd, struct cm_store_ca *ca, struct cm_store_entry *e,
|
|
ttrust = ",,";
|
|
}
|
|
break;
|
|
+ default:
|
|
+ ttrust = ",,";
|
|
+ break;
|
|
}
|
|
memset(&trust, 0, sizeof(trust));
|
|
CERT_DecodeTrustString(&trust, ttrust);
|
|
diff --git a/src/keygen-n.c b/src/keygen-n.c
|
|
index 76a5c1d3..061bd2af 100644
|
|
--- a/src/keygen-n.c
|
|
+++ b/src/keygen-n.c
|
|
@@ -591,7 +591,6 @@ retry_gen:
|
|
break;
|
|
}
|
|
}
|
|
- generated_size = SECKEY_PublicKeyStrengthInBits(pubkey);
|
|
cm_log(1, "Ended up with %d bit public key.\n",
|
|
SECKEY_PublicKeyStrengthInBits(pubkey));
|
|
/* Check for keys with the desired name, selecting a new name if
|
|
diff --git a/src/keyiread-n.c b/src/keyiread-n.c
|
|
index 8f46ec0f..91b1be41 100644
|
|
--- a/src/keyiread-n.c
|
|
+++ b/src/keyiread-n.c
|
|
@@ -492,7 +492,6 @@ cm_keyiread_n_main(int fd, struct cm_store_ca *ca, struct cm_store_entry *entry,
|
|
readwrite = settings->readwrite;
|
|
keys = cm_keyiread_n_get_keys(entry, readwrite);
|
|
alg = "";
|
|
- size = 0;
|
|
if (keys != NULL) {
|
|
switch (SECKEY_GetPrivateKeyType(keys->privkey)) {
|
|
case rsaKey:
|
|
diff --git a/src/store-files.c b/src/store-files.c
|
|
index 06a17485..df1fa336 100644
|
|
--- a/src/store-files.c
|
|
+++ b/src/store-files.c
|
|
@@ -2182,7 +2182,6 @@ cm_store_entry_delete(struct cm_store_entry *entry)
|
|
} else {
|
|
cm_log(3, "No file to remove for \"%s\".\n",
|
|
entry->cm_nickname);
|
|
- ret = 0;
|
|
}
|
|
return 0;
|
|
}
|
|
@@ -2469,7 +2468,6 @@ cm_store_ca_delete(struct cm_store_ca *ca)
|
|
}
|
|
} else {
|
|
cm_log(3, "No file to remove for \"%s\".\n", ca->cm_nickname);
|
|
- ret = 0;
|
|
}
|
|
return 0;
|
|
}
|
|
diff --git a/src/store-gen.c b/src/store-gen.c
|
|
index 5ce4ab84..da32afc8 100644
|
|
--- a/src/store-gen.c
|
|
+++ b/src/store-gen.c
|
|
@@ -530,8 +530,6 @@ cm_store_hex_to_bin(const char *serial, unsigned char *buf, int length)
|
|
const char *p, *q, *chars = "0123456789abcdef";
|
|
unsigned char *b, u;
|
|
|
|
- p = serial;
|
|
- b = buf;
|
|
u = 0;
|
|
for (p = serial, b = buf;
|
|
((*p != '\0') && ((b - buf) < length));
|
|
@@ -606,7 +604,6 @@ cm_store_canonicalize_path(void *parent, const char *path)
|
|
for (p = tmp; *p != '\0'; p++) {
|
|
if ((strncmp(p, "/.", 2) == 0) &&
|
|
((p[2] == '/') || (p[2] == '\0'))) {
|
|
- q = p - 1;
|
|
memmove(p, p + 2, strlen(p + 2) + 1);
|
|
}
|
|
}
|
|
diff --git a/src/submit-e.c b/src/submit-e.c
|
|
index 8ba8e44c..d6158d7a 100644
|
|
--- a/src/submit-e.c
|
|
+++ b/src/submit-e.c
|
|
@@ -587,32 +587,34 @@ cm_submit_e_postprocess_main(int fd, struct cm_store_ca *ca,
|
|
estate->msg_length, NULL);
|
|
msg = cm_json_new_object(estate);
|
|
chain = cm_json_new_array(msg);
|
|
- if (leaf != NULL) {
|
|
- cert = cm_json_new_string(msg, leaf, -1);
|
|
- cm_json_set(msg, CM_SUBMIT_E_CERTIFICATE, cert);
|
|
- }
|
|
- for (i = 0;
|
|
- (others != NULL) && (others[i] != NULL);
|
|
- i++) {
|
|
- cert = cm_json_new_object(chain);
|
|
- val = cm_json_new_string(cert, others[i], -1);
|
|
- cm_json_set(cert, CM_SUBMIT_E_CERTIFICATE, val);
|
|
- nthnick = talloc_asprintf(cert, "chain #%d", i + 1);
|
|
- nick = cm_json_new_string(cert, nthnick, -1);
|
|
- cm_json_set(cert, CM_SUBMIT_E_NICKNAME, nick);
|
|
- cm_json_append(chain, cert);
|
|
- }
|
|
- if (top!= NULL) {
|
|
- cert = cm_json_new_object(chain);
|
|
- val = cm_json_new_string(cert, top, -1);
|
|
- cm_json_set(cert, CM_SUBMIT_E_CERTIFICATE, val);
|
|
- nthnick = talloc_asprintf(cert, "chain #%d", i + 1);
|
|
- nick = cm_json_new_string(cert, nthnick, -1);
|
|
- cm_json_set(cert, CM_SUBMIT_E_NICKNAME, nick);
|
|
- cm_json_append(chain, cert);
|
|
- }
|
|
- if (cm_json_array_size(chain) > 0) {
|
|
- cm_json_set(msg, CM_SUBMIT_E_CHAIN, chain);
|
|
+ if (i == 0) {
|
|
+ if (leaf != NULL) {
|
|
+ cert = cm_json_new_string(msg, leaf, -1);
|
|
+ cm_json_set(msg, CM_SUBMIT_E_CERTIFICATE, cert);
|
|
+ }
|
|
+ for (i = 0;
|
|
+ (others != NULL) && (others[i] != NULL);
|
|
+ i++) {
|
|
+ cert = cm_json_new_object(chain);
|
|
+ val = cm_json_new_string(cert, others[i], -1);
|
|
+ cm_json_set(cert, CM_SUBMIT_E_CERTIFICATE, val);
|
|
+ nthnick = talloc_asprintf(cert, "chain #%d", i + 1);
|
|
+ nick = cm_json_new_string(cert, nthnick, -1);
|
|
+ cm_json_set(cert, CM_SUBMIT_E_NICKNAME, nick);
|
|
+ cm_json_append(chain, cert);
|
|
+ }
|
|
+ if (top!= NULL) {
|
|
+ cert = cm_json_new_object(chain);
|
|
+ val = cm_json_new_string(cert, top, -1);
|
|
+ cm_json_set(cert, CM_SUBMIT_E_CERTIFICATE, val);
|
|
+ nthnick = talloc_asprintf(cert, "chain #%d", i + 1);
|
|
+ nick = cm_json_new_string(cert, nthnick, -1);
|
|
+ cm_json_set(cert, CM_SUBMIT_E_NICKNAME, nick);
|
|
+ cm_json_append(chain, cert);
|
|
+ }
|
|
+ if (cm_json_array_size(chain) > 0) {
|
|
+ cm_json_set(msg, CM_SUBMIT_E_CHAIN, chain);
|
|
+ }
|
|
}
|
|
}
|
|
/* Get ready to build an output message. */
|
|
diff --git a/src/submit-u.c b/src/submit-u.c
|
|
index dda2edbc..b0b45baf 100644
|
|
--- a/src/submit-u.c
|
|
+++ b/src/submit-u.c
|
|
@@ -120,14 +120,12 @@ cm_submit_u_from_file_single(const char *filename)
|
|
if (csr == NULL) {
|
|
return NULL;
|
|
}
|
|
- p = csr;
|
|
for (i = 0; i < sizeof(strip) / sizeof(strip[0]); i++) {
|
|
while ((p = strstr(csr, strip[i])) != NULL) {
|
|
q = p + strcspn(p, "\r\n");
|
|
memmove(p, q, strlen(q) + 1);
|
|
}
|
|
}
|
|
- p = csr;
|
|
q = strdup(csr);
|
|
for (p = csr, i = 0; *p != '\0'; p++) {
|
|
if (strchr("\r\n\t ", *p) == NULL) {
|
|
diff --git a/src/tdbush.c b/src/tdbush.c
|
|
index 1d487222..3184e67a 100644
|
|
--- a/src/tdbush.c
|
|
+++ b/src/tdbush.c
|
|
@@ -2911,7 +2911,6 @@ request_get_key_type_and_size(DBusConnection *conn, DBusMessage *msg,
|
|
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
|
}
|
|
rep = dbus_message_new_method_return(msg);
|
|
- type = "UNKNOWN";
|
|
switch (entry->cm_key_type.cm_key_algorithm) {
|
|
case cm_key_unspecified:
|
|
type = "UNKNOWN";
|
|
@@ -2929,6 +2928,9 @@ request_get_key_type_and_size(DBusConnection *conn, DBusMessage *msg,
|
|
type = "EC";
|
|
break;
|
|
#endif
|
|
+ default:
|
|
+ type = "UNKNOWN";
|
|
+ break;
|
|
}
|
|
if (rep != NULL) {
|
|
size = entry->cm_key_type.cm_key_size;
|
|
@@ -4790,7 +4792,6 @@ cm_tdbush_introspect_method(void *parent,
|
|
method->cm_name);
|
|
arg = method->cm_args;
|
|
while (arg != NULL) {
|
|
- direction = "unknown";
|
|
switch (arg->cm_direction) {
|
|
case cm_tdbush_method_arg_in:
|
|
direction = "in";
|
|
@@ -4798,6 +4799,9 @@ cm_tdbush_introspect_method(void *parent,
|
|
case cm_tdbush_method_arg_out:
|
|
direction = "out";
|
|
break;
|
|
+ default:
|
|
+ direction = "unknown";
|
|
+ break;
|
|
}
|
|
ret = talloc_asprintf(parent,
|
|
"%s\n <arg name=\"%s\" type=\"%s\" "
|
|
diff --git a/tests/tools/addcinfo.c b/tests/tools/addcinfo.c
|
|
index d3cea2ca..f016acb4 100644
|
|
--- a/tests/tools/addcinfo.c
|
|
+++ b/tests/tools/addcinfo.c
|
|
@@ -98,7 +98,6 @@ main(int argc, char **argv)
|
|
PR_ErrorToName(PORT_GetError()));
|
|
return 1;
|
|
}
|
|
- n = encoded.len;
|
|
j = 0;
|
|
while ((i = write(STDOUT_FILENO, encoded.data + j, encoded.len - j)) > 0) {
|
|
j += i;
|
|
diff --git a/tests/tools/certsave.c b/tests/tools/certsave.c
|
|
index fd86a4c1..8ec60ddd 100644
|
|
--- a/tests/tools/certsave.c
|
|
+++ b/tests/tools/certsave.c
|
|
@@ -83,7 +83,6 @@ main(int argc, char **argv)
|
|
if (cm_certsave_saved(state) == 0) {
|
|
ret = 0;
|
|
} else {
|
|
- ctype = "unknown";
|
|
switch (entry->cm_cert_storage_type) {
|
|
case cm_cert_storage_file:
|
|
ctype = "FILE";
|
|
@@ -91,6 +90,9 @@ main(int argc, char **argv)
|
|
case cm_cert_storage_nssdb:
|
|
ctype = "NSS";
|
|
break;
|
|
+ default:
|
|
+ ctype = "unknown";
|
|
+ break;
|
|
}
|
|
if (cm_certsave_conflict_subject(state) == 0) {
|
|
printf("Failed to save (%s:%s), "
|
|
--
|
|
2.14.4
|
|
|