@@ -190,7 +190,7 @@ auto check_enabled(const INIReader &config, const char *username) -> int {
190190 * The main function, runs the identification and authentication
191191 * @param pamh The handle to interface directly with PAM
192192 * @param flags Flags passed on to us by PAM, XORed
193- * @param argc Amount of rules in the PAM config (disregared )
193+ * @param argc Amount of rules in the PAM config (disregarded )
194194 * @param argv Options defined in the PAM config
195195 * @param ask_auth_tok True if we should ask for a password too
196196 * @return Returns a PAM return code
@@ -212,14 +212,15 @@ auto identify(pam_handle_t *pamh, int flags, int argc, const char **argv,
212212
213213 // Get the username from PAM, needed to match correct face model
214214 char *username = nullptr ;
215- if (( pam_res = pam_get_user (pamh, const_cast <const char **>(&username),
216- nullptr )) != PAM_SUCCESS) {
215+ pam_res = pam_get_user (pamh, const_cast <const char **>(&username), nullptr );
216+ if (pam_res != PAM_SUCCESS) {
217217 syslog (LOG_ERR, " Failed to get username" );
218218 return pam_res;
219219 }
220220
221221 // Check if we should continue
222- if ((pam_res = check_enabled (config, username)) != PAM_SUCCESS) {
222+ pam_res = check_enabled (config, username);
223+ if (pam_res != PAM_SUCCESS) {
223224 return pam_res;
224225 }
225226
@@ -231,7 +232,9 @@ auto identify(pam_handle_t *pamh, int flags, int argc, const char **argv,
231232 const void **conv_ptr =
232233 const_cast <const void **>(reinterpret_cast <void **>(&conv));
233234
234- if ((pam_res = pam_get_item (pamh, PAM_CONV, conv_ptr)) != PAM_SUCCESS) {
235+ // Retrieve the PAM conversation structure
236+ pam_res = pam_get_item (pamh, PAM_CONV, conv_ptr);
237+ if (pam_res != PAM_SUCCESS) {
235238 syslog (LOG_ERR, " Failed to acquire conversation" );
236239 return pam_res;
237240 }
0 commit comments