char username[SIZ];
int found_user;
+ lprintf(9, "CtdlLoginExistingUser(%s, %s)\n", authname, trythisname);
+
if ((CC->logged_in)) {
return login_already_logged_in;
}
* If not found, make one attempt to create it.
*/
found_user = getuserbyuid(&CC->user, pd.pw_uid);
- lprintf(CTDL_DEBUG, "found it: uid=%ld, gecos=%s here: %ld\n", (long)pd.pw_uid, pd.pw_gecos, found_user);
+ lprintf(CTDL_DEBUG, "found it: uid=%ld, gecos=%s here: %d\n",
+ (long)pd.pw_uid, pd.pw_gecos, found_user);
if (found_user != 0) {
create_user(username, 0);
found_user = getuserbyuid(&CC->user, pd.pw_uid);
/* Do modular stuff... */
PerformSessionHooks(EVT_LOGOUT);
+
+ /* Check to see if the user was deleted whilst logged in and purge them if necessary */
+ if (who->user.axlevel == 0)
+ purge_user(who->user.fullname);
/* Free any output buffers */
if (who->output_buffer != NULL) {
{
char buf[256];
+ if (IsEmptyStr(pass)) {
+ lprintf(CTDL_DEBUG, "refusing to check empty password for uid=%d using chkpwd...\n", uid);
+ return 0;
+ }
+
lprintf(CTDL_DEBUG, "Validating password for uid=%d using chkpwd...\n", uid);
begin_critical_section(S_CHKPWD);
makeuserkey(usernamekey, pname);
+ /* If the name is empty we can't find them in the DB any way so just return */
+ if (IsEmptyStr(pname))
+ return (ERROR + NO_SUCH_USER);
+
if (getuser(&usbuf, pname) != 0) {
lprintf(CTDL_ERR, "Cannot purge user <%s> - not found\n", pname);
return (ERROR + NO_SUCH_USER);