Skip to content

Commit

Permalink
Renaming the variable
Browse files Browse the repository at this point in the history
  • Loading branch information
formiano committed Dec 13, 2024
1 parent 71fd70e commit 2fa3cb0
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions lib/dvb/streamserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,19 @@ void eStreamClient::notifier(int what)
if (pwdresult)
{
struct crypt_data cryptdata = {};
char *cryptresult = NULL;
cryptdata.initialized = 0;
crypt = pwd.pw_passwd;
if (crypt == "*" || crypt == "x")
{
struct spwd spwd = {};
struct spwd *spwdresult = NULL;
getspnam_r(username.c_str(), &spwd, buffer, 4096, &spwdresult);
if (spwdresult)
{
crypt = spwd.sp_pwdp;
}
const char* stored_hash = pwd.pw_passwd;
if (std::string(stored_hash) == "*" || std::string(stored_hash) == "x") {
struct spwd spwd = {};
struct spwd* spwdresult = NULL;
char buffer[4096];
if (getspnam_r(username.c_str(), &spwd, buffer, sizeof(buffer), &spwdresult) == 0 && spwdresult) {
stored_hash = spwd.sp_pwdp;
}
cryptresult = crypt(password.c_str(), crypt.c_str());
authenticated = cryptresult && (std::string(cryptresult) == crypt);
}

const char* cryptresult = crypt_r(password.c_str(), stored_hash, &cryptdata);
authenticated = cryptresult && (std::string(cryptresult) == stored_hash);
}
free(buffer);
}
Expand Down

0 comments on commit 2fa3cb0

Please sign in to comment.