summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2001-11-01 05:02:41 +0000
committerAndrew Bartlett <abartlet@samba.org>2001-11-01 05:02:41 +0000
commitacb81fe408f0e674088f0952aaba442ddb494b0c (patch)
tree484380d71c128f11eb1f7ffae2471fccecd0d16d /source3/smbd
parentec09a3e0c7fd20b78cccd32c9e351de2c6e62fb8 (diff)
downloadsamba-acb81fe408f0e674088f0952aaba442ddb494b0c.tar.gz
samba-acb81fe408f0e674088f0952aaba442ddb494b0c.tar.bz2
samba-acb81fe408f0e674088f0952aaba442ddb494b0c.zip
Various post AuthRewrite cleanups, fixups and tidyups.
Zero out some of the plaintext passwords for paranoia Fix up some of the other passdb backends with the change to *uid_t rather than uid_t. Make some of the code in srv_netlog_nt.c clearer, is passing an array around, so pass its lenght in is definition, not as a seperate paramater. Use sizeof() rather than magic numbers, it makes things easier to read. Cope with a PAM authenticated user who is not in /etc/passwd - currently by saying NO_SUCH_USER, but this can change in future. Andrew Bartlett (This used to be commit 514c91b16baca639bb04638042bf9894d881172a)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/auth_unix.c6
-rw-r--r--source3/smbd/auth_util.c47
-rw-r--r--source3/smbd/reply.c4
-rw-r--r--source3/smbd/sesssetup.c6
4 files changed, 36 insertions, 27 deletions
diff --git a/source3/smbd/auth_unix.c b/source3/smbd/auth_unix.c
index d456da1fdf..8c4a520350 100644
--- a/source3/smbd/auth_unix.c
+++ b/source3/smbd/auth_unix.c
@@ -98,13 +98,15 @@ NTSTATUS check_unix_security(const auth_usersupplied_info *user_info, auth_serve
update_smbpassword_file : NULL,
True);
+ unbecome_root();
+
if NT_STATUS_IS_OK(nt_status) {
if (pass) {
make_server_info_pw(server_info, pass);
+ } else {
+ nt_status = NT_STATUS_NO_SUCH_USER;
}
}
- unbecome_root();
-
return nt_status;
}
diff --git a/source3/smbd/auth_util.c b/source3/smbd/auth_util.c
index 85f01605ab..9de8142578 100644
--- a/source3/smbd/auth_util.c
+++ b/source3/smbd/auth_util.c
@@ -282,9 +282,12 @@ BOOL make_user_info_netlogon_network(auth_usersupplied_info **user_info,
if (lm_pwd_len)
ntlmssp_flags |= NTLMSSP_NEGOTIATE_OEM;
- if (nt_pwd_len)
+ if (nt_pwd_len == 24) {
ntlmssp_flags |= NTLMSSP_NEGOTIATE_NTLM;
-
+ } else if (nt_pwd_len != 0) {
+ ntlmssp_flags |= NTLMSSP_NEGOTIATE_NTLM2;
+ }
+
ret = make_user_info_map(user_info,
smb_name, client_domain,
wksta_name, sec_blob,
@@ -303,15 +306,15 @@ BOOL make_user_info_netlogon_network(auth_usersupplied_info **user_info,
****************************************************************************/
BOOL make_user_info_netlogon_interactive(auth_usersupplied_info **user_info,
- char *smb_name,
- char *client_domain,
- char *wksta_name,
- uchar *lm_interactive_pwd, int lm_pwd_len,
- uchar *nt_interactive_pwd, int nt_pwd_len,
- uchar *dc_sess_key)
+ char *smb_name,
+ char *client_domain,
+ char *wksta_name,
+ uchar lm_interactive_pwd[16],
+ uchar nt_interactive_pwd[16],
+ uchar *dc_sess_key)
{
- char nt_pwd[16];
char lm_pwd[16];
+ char nt_pwd[16];
unsigned char local_lm_response[24];
unsigned char local_nt_response[24];
unsigned char key[16];
@@ -320,32 +323,32 @@ BOOL make_user_info_netlogon_interactive(auth_usersupplied_info **user_info,
generate_random_buffer(chal, 8, False);
- memset(key, 0, 16);
+ ZERO_STRUCT(key);
memcpy(key, dc_sess_key, 8);
- memcpy(lm_pwd, lm_interactive_pwd, 16);
- memcpy(nt_pwd, nt_interactive_pwd, 16);
+ if (lm_interactive_pwd) memcpy(lm_pwd, lm_interactive_pwd, sizeof(lm_pwd));
+ if (nt_interactive_pwd) memcpy(nt_pwd, nt_interactive_pwd, sizeof(nt_pwd));
#ifdef DEBUG_PASSWORD
DEBUG(100,("key:"));
- dump_data(100, (char *)key, 16);
+ dump_data(100, (char *)key, sizeof(key));
DEBUG(100,("lm owf password:"));
- dump_data(100, lm_pwd, 16);
+ dump_data(100, lm_pwd, sizeof(lm_pwd));
DEBUG(100,("nt owf password:"));
- dump_data(100, nt_pwd, 16);
+ dump_data(100, nt_pwd, sizeof(nt_pwd));
#endif
- SamOEMhash((uchar *)lm_pwd, key, 16);
- SamOEMhash((uchar *)nt_pwd, key, 16);
+ SamOEMhash((uchar *)lm_pwd, key, sizeof(lm_pwd));
+ SamOEMhash((uchar *)nt_pwd, key, sizeof(nt_pwd));
#ifdef DEBUG_PASSWORD
DEBUG(100,("decrypt of lm owf password:"));
- dump_data(100, lm_pwd, 16);
+ dump_data(100, lm_pwd, sizeof(lm_pwd));
DEBUG(100,("decrypt of nt owf password:"));
- dump_data(100, nt_pwd, 16);
+ dump_data(100, nt_pwd, sizeof(nt_pwd));
#endif
generate_random_buffer(chal, 8, False);
@@ -364,7 +367,11 @@ BOOL make_user_info_netlogon_interactive(auth_usersupplied_info **user_info,
DATA_BLOB local_nt_blob = data_blob(local_nt_response, sizeof(local_nt_response));
DATA_BLOB plaintext_blob = data_blob(NULL, 0);
- ntlmssp_flags = NTLMSSP_NEGOTIATE_OEM | NTLMSSP_NEGOTIATE_NTLM;
+ if (lm_interactive_pwd)
+ ntlmssp_flags |= NTLMSSP_NEGOTIATE_OEM;
+ if (nt_interactive_pwd)
+ ntlmssp_flags |= NTLMSSP_NEGOTIATE_NTLM;
+
ret = make_user_info_map(user_info,
smb_name, client_domain,
wksta_name, sec_blob,
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 8a1fecba3f..54238e90e7 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -180,7 +180,7 @@ int reply_tcon(connection_struct *conn,
conn = make_connection(service,password_blob,dev,vuid,&nt_status);
- data_blob_clear_free(&password);
+ data_blob_clear_free(&password_blob);
if (!conn) {
END_PROFILE(SMBtcon);
@@ -260,7 +260,7 @@ int reply_tcon_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
conn = make_connection(service,password,devicename,vuid,&nt_status);
data_blob_clear_free(&password);
-
+
if (!conn) {
END_PROFILE(SMBtconX);
return ERROR_NT(nt_status);
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index 7361db0205..85ffadea08 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -646,7 +646,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,
data_blob_free(&lm_resp);
data_blob_free(&nt_resp);
- data_blob_free(&plaintext_password);
+ data_blob_clear_free(&plaintext_password);
guest = True;
map_username(user);
@@ -667,7 +667,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,
data_blob_free(&lm_resp);
data_blob_free(&nt_resp);
- data_blob_free(&plaintext_password);
+ data_blob_clear_free(&plaintext_password);
END_PROFILE(SMBsesssetupX);
return ERROR_DOS(ERRDOS,ERRnoaccess);
@@ -689,7 +689,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,
data_blob_free(&lm_resp);
data_blob_free(&nt_resp);
- data_blob_free(&plaintext_password);
+ data_blob_clear_free(&plaintext_password);
if (!NT_STATUS_IS_OK(nt_status)) {
if NT_STATUS_EQUAL(nt_status, NT_STATUS_NO_SUCH_USER) {