summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/domain_client_validate.c61
-rw-r--r--source3/libsmb/smbencrypt.c16
2 files changed, 46 insertions, 31 deletions
diff --git a/source3/libsmb/domain_client_validate.c b/source3/libsmb/domain_client_validate.c
index 26a727b1f1..20db1ee4d6 100644
--- a/source3/libsmb/domain_client_validate.c
+++ b/source3/libsmb/domain_client_validate.c
@@ -271,7 +271,7 @@ static BOOL find_connect_pdc(struct cli_state *pcli,
************************************************************************/
NTSTATUS domain_client_validate(const auth_usersupplied_info *user_info,
- auth_serversupplied_info *server_info,
+ auth_serversupplied_info **server_info,
char *server, unsigned char *trust_passwd,
time_t last_change_time)
{
@@ -282,6 +282,7 @@ NTSTATUS domain_client_validate(const auth_usersupplied_info *user_info,
uint32 smb_uid_low;
BOOL connected_ok = False;
NTSTATUS status;
+ struct passwd *pass;
/*
* Check that the requested domain is not our own machine name.
@@ -330,34 +331,48 @@ NTSTATUS domain_client_validate(const auth_usersupplied_info *user_info,
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("domain_client_validate: unable to validate password "
"for user %s in domain %s to Domain controller %s. "
- "Error was %s.\n", user_info->smb_username.str,
+ "Error was %s.\n", user_info->smb_name.str,
user_info->domain.str, cli.srv_name_slash,
get_nt_error_msg(status)));
- }
+ } else {
- /*
- * Here, if we really want it, we have lots of info about the user
- * in info3.
- */
+ /*
+ * Here, if we really want it, we have lots of info about the user
+ * in info3.
+ */
+
+ pass = Get_Pwnam(user_info->internal_username.str);
+ if (pass) {
+ make_server_info_pw(server_info, pass);
+ if (!server_info) {
+ status = NT_STATUS_NO_MEMORY;
+ }
+ } else {
+ status = NT_STATUS_NO_SUCH_USER;
+ }
+ }
/* Store the user group information in the server_info returned to
the caller. */
-
- if ((server_info->group_rids = malloc(info3.num_groups2 *
- sizeof(uint32))) == NULL) {
- DEBUG(1, ("out of memory allocating rid group membership\n"));
- status = NT_STATUS_NO_MEMORY;
- } else {
- int i;
-
- server_info->n_rids = info3.num_groups2;
-
- for (i = 0; i < server_info->n_rids; i++) {
- server_info->group_rids[i] = info3.gids[i].g_rid;
- DEBUG(5, ("** adding group rid 0x%x\n",
- info3.gids[i].g_rid));
- }
- }
+
+ if (NT_STATUS_IS_OK(status)) {
+ if (((*server_info)->group_rids = malloc(info3.num_groups2 *
+ sizeof(uint32))) == NULL) {
+ DEBUG(1, ("out of memory allocating rid group membership\n"));
+ status = NT_STATUS_NO_MEMORY;
+ free_server_info(server_info);
+ } else {
+ int i;
+
+ (*server_info)->n_rids = info3.num_groups2;
+
+ for (i = 0; i < (*server_info)->n_rids; i++) {
+ (*server_info)->group_rids[i] = info3.gids[i].g_rid;
+ DEBUG(5, ("** adding group rid 0x%x\n",
+ info3.gids[i].g_rid));
+ }
+ }
+ }
#if 0
/*
diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c
index 2868b02ed9..c1c4750e05 100644
--- a/source3/libsmb/smbencrypt.c
+++ b/source3/libsmb/smbencrypt.c
@@ -216,27 +216,27 @@ BOOL make_oem_passwd_hash(char data[516], const char *passwd, uchar old_pw_hash[
/* Does the md5 encryption from the NT hash for NTLMv2. */
void SMBOWFencrypt_ntv2(const uchar kr[16],
- const uchar * srv_chal, int srv_chal_len,
- const uchar * cli_chal, int cli_chal_len,
+ const DATA_BLOB srv_chal,
+ const DATA_BLOB cli_chal,
char resp_buf[16])
{
HMACMD5Context ctx;
hmac_md5_init_limK_to_64(kr, 16, &ctx);
- hmac_md5_update(srv_chal, srv_chal_len, &ctx);
- hmac_md5_update(cli_chal, cli_chal_len, &ctx);
+ hmac_md5_update(srv_chal.data, srv_chal.length, &ctx);
+ hmac_md5_update(cli_chal.data, cli_chal.length, &ctx);
hmac_md5_final((unsigned char *)resp_buf, &ctx);
#ifdef DEBUG_PASSWORD
DEBUG(100, ("SMBOWFencrypt_ntv2: srv_chal, cli_chal, resp_buf\n"));
- dump_data(100, srv_chal, srv_chal_len);
- dump_data(100, cli_chal, cli_chal_len);
+ dump_data(100, srv_chal.data, srv_chal.length);
+ dump_data(100, cli_chal.data, cli_chal.length);
dump_data(100, resp_buf, 16);
#endif
}
void SMBsesskeygen_ntv2(const uchar kr[16],
- const uchar * nt_resp, char sess_key[16])
+ const uchar * nt_resp, uint8 sess_key[16])
{
HMACMD5Context ctx;
@@ -251,7 +251,7 @@ void SMBsesskeygen_ntv2(const uchar kr[16],
}
void SMBsesskeygen_ntv1(const uchar kr[16],
- const uchar * nt_resp, char sess_key[16])
+ const uchar * nt_resp, uint8 sess_key[16])
{
mdfour((unsigned char *)sess_key, kr, 16);