password.c: Fixes to allow Win95 clients to have lm encrypted passwords
authorJeremy Allison <jra@samba.org>
Mon, 6 Jul 1998 22:48:21 +0000 (22:48 +0000)
committerJeremy Allison <jra@samba.org>
Mon, 6 Jul 1998 22:48:21 +0000 (22:48 +0000)
            recognised.
lib/rpc/client/cli_login.c: Fix debug comment.
lib/rpc/parse/parse_misc.c: Fix for passing null pointers.
lib/rpc/parse/parse_net.c: Send correct password lengths when called
                           from Win95.
Jeremy.
(This used to be commit ad1848b35521b3d478ea3226db818a1edef78254)

source3/rpc_client/cli_login.c
source3/rpc_parse/parse_misc.c
source3/rpc_parse/parse_net.c
source3/smbd/password.c

index 42363e4ca5d879f17b9ac2f7393fb9ddd58e64b7..43ee45d48d249e1858dac2c18ab6b30d1d5004e4 100644 (file)
@@ -125,7 +125,7 @@ BOOL cli_nt_login_interactive(struct cli_state *cli, char *domain, char *usernam
 
 #endif
 
-  DEBUG(5,("cli_nt_login_network: %d\n", __LINE__));
+  DEBUG(5,("cli_nt_login_interactive: %d\n", __LINE__));
 
   /* indicate an "interactive" login */
   ctr->switch_value = INTERACTIVE_LOGON_TYPE;
index 35ca6c9553cdb9237ac968cecc5b902c19b55c43..3c83382f0cbcd2c1cfa38164d6ed385ecc4c41f5 100644 (file)
@@ -369,13 +369,14 @@ creates a STRING2 structure.
 ********************************************************************/
 void make_string2(STRING2 *str, char *buf, int len)
 {
-       /* set up string lengths. */
-       str->str_max_len = len;
-       str->undoc       = 0;
-       str->str_str_len = len;
-
-       /* store the string */
-       memcpy(str->buffer, buf, len);
+  /* set up string lengths. */
+  str->str_max_len = len;
+  str->undoc       = 0;
+  str->str_str_len = len;
+
+  /* store the string */
+  if(len != 0)
+    memcpy(str->buffer, buf, len);
 }
 
 /*******************************************************************
index a5dfad9b7f7aaef62294824a0df88a070ddcf92f..1b253beeb94cc2efd6ebd793334781072b19a32d 100644 (file)
@@ -705,7 +705,8 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name,
        int len_domain_name = strlen(domain_name);
        int len_user_name   = strlen(user_name  );
        int len_wksta_name  = strlen(wksta_name );
-
+    int nt_chal_resp_len = ((nt_chal_resp != NULL) ? 24 : 0);
+    int lm_chal_resp_len = ((lm_chal_resp != NULL) ? 24 : 0);
        unsigned char lm_owf[24];
        unsigned char nt_owf[24];
 
@@ -737,15 +738,15 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name,
        }
 
        memcpy(id->lm_chal, lm_challenge, sizeof(id->lm_chal));
-       make_str_hdr(&(id->hdr_nt_chal_resp), 24, 24, nt_chal_resp != NULL ? 1 : 0);
-       make_str_hdr(&(id->hdr_lm_chal_resp), 24, 24, lm_chal_resp != NULL ? 1 : 0);
+       make_str_hdr(&(id->hdr_nt_chal_resp), 24, nt_chal_resp_len, nt_chal_resp != NULL ? 1 : 0);
+       make_str_hdr(&(id->hdr_lm_chal_resp), 24, lm_chal_resp_len, lm_chal_resp != NULL ? 1 : 0);
 
        make_unistr2(&(id->uni_domain_name), domain_name, len_domain_name);
        make_unistr2(&(id->uni_user_name  ), user_name  , len_user_name  );
        make_unistr2(&(id->uni_wksta_name ), wksta_name , len_wksta_name );
 
-       make_string2(&(id->nt_chal_resp ), (char *)nt_chal_resp , nt_chal_resp != NULL ? 24 : 0);
-       make_string2(&(id->lm_chal_resp ), (char *)lm_chal_resp , lm_chal_resp != NULL ? 24 : 0);
+       make_string2(&(id->nt_chal_resp ), (char *)nt_chal_resp , nt_chal_resp_len);
+       make_string2(&(id->lm_chal_resp ), (char *)lm_chal_resp , lm_chal_resp_len);
 }
 
 /*******************************************************************
index 277e3a592e4ede672f918b8678a7169b5d430e93..1924a32780e80bbdd3222acd6e4c469357c8f738 100644 (file)
@@ -1947,7 +1947,8 @@ BOOL domain_client_validate( char *user, char *domain,
    * Next, check that the passwords given were encrypted.
    */
 
-  if(smb_apasslen != 24 || smb_ntpasslen != 24) {
+  if(((smb_apasslen != 24) && (smb_apasslen != 0)) || 
+     ((smb_ntpasslen != 24) && (smb_ntpasslen != 0))) {
 
     /*
      * Not encrypted - do so.
@@ -2129,7 +2130,9 @@ machine %s. Error was : %s.\n", remote_machine, cli_errstr(&cli)));
   generate_random_buffer( (unsigned char *)&smb_uid_low, 4, False);
 
   if(cli_nt_login_network(&cli, domain, user, smb_uid_low, (char *)local_challenge,
-                          smb_apasswd, smb_ntpasswd, &ctr, &info3) == False) {
+                          ((smb_apasslen != 0) ? smb_apasswd : NULL),
+                          ((smb_ntpasslen != 0) ? smb_ntpasswd : NULL),
+                          &ctr, &info3) == False) {
     DEBUG(0,("domain_client_validate: unable to validate password for user %s in domain \
 %s to Domain controller %s. Error was %s.\n", user, domain, remote_machine, cli_errstr(&cli)));
     cli_nt_session_close(&cli);