Rearrange case checking to avoid compiler warnings
The compiler was complaining that 'compa' could be uninitialized. USe this occasion to make the code simpler to understand and assign actually meaningful values to the variable, even though the proper actions are not implemented yet. License: MIT Signed-off-by: Simo Sorce <simo@redhat.com>
This commit is contained in:
parent
86bfc84ba1
commit
cb7ea06ca5
|
@ -1824,16 +1824,16 @@ lasso_login_must_authenticate(LassoLogin *login)
|
|||
char *class_ref;
|
||||
GList *class_refs = request->RequestAuthnContext->AuthnContextClassRef;
|
||||
GList *t1, *t2;
|
||||
int compa;
|
||||
int compa = -1;
|
||||
|
||||
if (comparison == NULL || strcmp(comparison, "exact") == 0) {
|
||||
compa = 0;
|
||||
} else if (strcmp(comparison, "minimum") == 0) {
|
||||
message(G_LOG_LEVEL_CRITICAL, "'minimum' comparison is not implemented");
|
||||
compa = 0;
|
||||
compa = 1;
|
||||
} else if (strcmp(comparison, "better") == 0) {
|
||||
message(G_LOG_LEVEL_CRITICAL, "'better' comparison is not implemented");
|
||||
compa = 0;
|
||||
compa = 2;
|
||||
}
|
||||
|
||||
if (class_refs) {
|
||||
|
@ -1867,15 +1867,21 @@ lasso_login_must_authenticate(LassoLogin *login)
|
|||
method = LASSO_LIB_AUTHN_CONTEXT_CLASS_REF_PASSWORD;
|
||||
}
|
||||
|
||||
if (compa == 0) { /* exact */
|
||||
switch (compa) {
|
||||
case 1: /* minimum */
|
||||
/* XXX: implement 'minimum' comparison */
|
||||
case 2: /* better */
|
||||
/* XXX: implement 'better' comparison */
|
||||
case 0: /* exact */
|
||||
if (strcmp(method, class_ref) == 0) {
|
||||
matched = TRUE;
|
||||
break;
|
||||
}
|
||||
} else if (compa == 1) { /* minimum */
|
||||
/* XXX: implement 'minimum' comparison */
|
||||
} else if (compa == 2) { /* better */
|
||||
/* XXX: implement 'better' comparison */
|
||||
break;
|
||||
default: /* inever reached */
|
||||
break;
|
||||
}
|
||||
if (matched == TRUE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -405,19 +405,19 @@ lasso_saml20_login_must_authenticate(LassoLogin *login)
|
|||
GList *class_refs = request->RequestedAuthnContext->AuthnContextClassRef;
|
||||
char *class_ref;
|
||||
GList *t1, *t2;
|
||||
int compa;
|
||||
int compa = -1;
|
||||
|
||||
if (comparison == NULL || lasso_strisequal(comparison,"exact")) {
|
||||
compa = 0;
|
||||
} else if (lasso_strisequal(comparison,"minimum")) {
|
||||
message(G_LOG_LEVEL_CRITICAL, "'minimum' comparison is not implemented");
|
||||
compa = 0;
|
||||
compa = 1;
|
||||
} else if (lasso_strisequal(comparison,"better")) {
|
||||
message(G_LOG_LEVEL_CRITICAL, "'better' comparison is not implemented");
|
||||
compa = 0;
|
||||
compa = 2;
|
||||
} else if (lasso_strisequal(comparison,"maximum")) {
|
||||
message(G_LOG_LEVEL_CRITICAL, "'maximum' comparison is not implemented");
|
||||
compa = 0;
|
||||
compa = 3;
|
||||
}
|
||||
|
||||
if (class_refs) {
|
||||
|
@ -454,17 +454,23 @@ lasso_saml20_login_must_authenticate(LassoLogin *login)
|
|||
|
||||
method = as->AuthnContext->AuthnContextClassRef;
|
||||
|
||||
if (compa == 0) { /* exact */
|
||||
switch (compa) {
|
||||
case 1: /* minimum */
|
||||
/* XXX: implement 'minimum' comparison */
|
||||
case 2: /* better */
|
||||
/* XXX: implement 'better' comparison */
|
||||
case 3: /* maximum */
|
||||
/* XXX: implement 'maximum' comparison */
|
||||
case 0: /* exact */
|
||||
if (lasso_strisequal(method,class_ref)) {
|
||||
matched = TRUE;
|
||||
break;
|
||||
}
|
||||
} else if (compa == 1) { /* minimum */
|
||||
/* XXX: implement 'minimum' comparison */
|
||||
} else if (compa == 2) { /* better */
|
||||
/* XXX: implement 'better' comparison */
|
||||
} else if (compa == 3) { /* maximum */
|
||||
/* XXX: implement 'maximum' comparison */
|
||||
break;
|
||||
default: /* never reached */
|
||||
break;
|
||||
}
|
||||
if (matched == TRUE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue