BUG: Null passwords = no ignored

Andrew Bartlett abartlet at pcug.org.au
Thu Aug 24 12:41:37 GMT 2000


Most recent samba versions (i have noted 2.0.6 and 2.0.7 in particular)
seem to ignore the null passwords = no option in smb.conf.

This has three implications:
 - Firstly if anyone set a null password on an account in smbpassword,
safe in the knowledge that null passwords are disallowed they will get
burned (this happened to me - oops).
 - The documentation seems to indicate that you need null passwords =
yes for null passwords to work.
 - Extra entries are made in the log files with this line in
pass_check_smb(), without any indication that the failed login was just
the null password sent before NT asks the user for their password:

DEBUG(2,("pass_check_smb failed - invalid password for user [%s]\n",
user));


What appears to happen (I am not a C programmer) is that the null
password is checked in pass_check_smb():

if (lm_pwd[0] == '\0' && IS_BITS_SET_ALL(smb_pass->acct_ctrl,
ACB_PWNOTREQ) && lp_null_passwords())
        {
                DEBUG(3,("Account for user '%s' has no password and null
passwords are allowed.\n", smb_pass->smb_name));
                return(True);
        }

but with lp_null_passwords this fails and the check is advanced into
smb_password_ok().

Unfortunately

        if((smb_pass->smb_passwd == NULL) && 
           (smb_pass->acct_ctrl & ACB_PWNOTREQ)) {
                DEBUG(4,("no password required for user %s\n",
                         smb_pass->smb_name));
                return True;
        }

means that the login is successful none-the-less, only the message is
even lower in the debug priority.

I would suggest that the previous code be replaced with:

if (lm_pwd[0] == '\0' )
	{
	if IS_BITS_SET_ALL(smb_pass->acct_ctrl, ACB_PWNOTREQ) &&
lp_null_passwords())
        {
                DEBUG(3,("Account for user '%s' has no password and null
passwords are allowed.\n", smb_pass->smb_name));
                return(True);
        } else {
		DEBUG(5,("Account for user '%s' has a password or null passwords are
not allowed.\n", smb_pass->smb_name));
		return(False);
	}
	}

Remember I am not a C programer, but the above looks like a better
algorithm.  I have also not tested the changes, they are in (what i hope
is) C only for communication.

-- 
Andrew Bartlett
abartlet at pcug.org.au




More information about the samba-technical mailing list