Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta crashes with no face model known #836

Closed
tokox opened this issue Sep 13, 2023 · 3 comments · Fixed by #803
Closed

Beta crashes with no face model known #836

tokox opened this issue Sep 13, 2023 · 3 comments · Fixed by #803

Comments

@tokox
Copy link

tokox commented Sep 13, 2023

While testing beta version I discovered that when there is no face model known for user, then howdy crashes with this error:

Child killed by signal User defined signal 1 (10)

However, this error is definitely not right. 'pam_howdy' is detecting 'no face model' there (checked it):

howdy/howdy/src/pam/main.cc

Lines 254 to 259 in f7649fc

// pre-check if this user has face model file
auto model_path = std::string("/etc/howdy/models/") + username + ".dat";
if (!std::ifstream(model_path)) {
return howdy_status(username, CompareError::NO_FACE_MODEL, config,
conv_function);
}

Error steps:

  1. 'no face model' check fails
  2. howdy_status is called
  3. status isn't success, so howdy_error is called

    howdy/howdy/src/pam/main.cc

    Lines 112 to 117 in f7649fc

    auto howdy_status(char *username, int status, const INIReader &config,
    const std::function<int(int, const char *)> &conv_function)
    -> int {
    if (status != EXIT_SUCCESS) {
    return howdy_error(status, conv_function);
    }
  4. status isn't child return value or signal (undefined behaviour probably? (idk how WIFEXITED and WIFSIGNALED work))
    auto howdy_error(int status,
    const std::function<int(int, const char *)> &conv_function)
    -> int {
    // If the process has exited
    if (WIFEXITED(status)) {
    // Get the status code returned
    status = WEXITSTATUS(status);
  5. second if is executed
    }
    } else if (WIFSIGNALED(status)) {
    // We get the signal
    status = WTERMSIG(status);
  6. 'Child killed...' message logged
    status = WTERMSIG(status);
    syslog(LOG_ERR, "Child killed by signal %s (%d)", strsignal(status),
    status);
    }
  7. error is returned to pam
    // As this function is only called for error status codes, signal an error to
    // PAM
    return PAM_AUTH_ERR;
    }

Maybe separate function to detect type of CompareError and what happened to child will be a good solution? What do you think?

Error created in #824 in a5184dc


I've searched for similar issues already, and my issue has not been reported yet.

Linux distribution (if applicable): Fedora 38

Howdy version (sudo howdy version): Howdy 3.0.0 BETA

@musikid
Copy link
Collaborator

musikid commented Sep 13, 2023

#803 contains a fix for this.

@tokox
Copy link
Author

tokox commented Sep 13, 2023

OK, didn't checked there. When will it be merged? Thanks

@boltgolt
Copy link
Owner

Just now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants