-DUSE_ARCFOUR_FROM_SSH_SOURCE still enables to login wit

johanh at fusion.kth.se johanh at fusion.kth.se
Thu Mar 26 14:00:00 GMT 1998


I figured out what was wrong with -DUSE_ARCFOUR_FROM_SSH_SOURCE and
I have now made a patch to the current version of Samba NTDOMAIN for using
with arcfour.c from ssh-1.2.22. The patch is included in Appendix A. It is
tested and working with Solaris 2.6 and Win NT 4.0 Sp 3 (English version).

Johan

/---------------------------------------------------------------------\
| Johan Hedin                      | johanh at fusion.kth.se             |
| Ph.D. Student and System Manager | http://www.fusion.kth.se/~johanh |
\---------------------------------------------------------------------/


--- Appendix A ---

Index: lib/util/smbencrypt.c
===================================================================
RCS file: /cvsroot/samba/source/lib/util/Attic/smbencrypt.c,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 smbencrypt.c
--- smbencrypt.c        1998/01/31 11:47:56        1.1.2.3
+++ smbencrypt.c        1998/03/25 13:00:00
@@ -204,7 +204,7 @@
 
                 ArcfourContext ctx;
                 arcfour_init(&ctx, sess_key, 16);
-                arcfour_encrypt(&ctx, pwd, pwd_c, 16);
+                arcfour_encrypt(&ctx, pwd_c, pwd, 16);
 
 #else
                 return False;
Index: lib/rpc/server/srv_netlog.c
===================================================================
RCS file: /cvsroot/samba/source/lib/rpc/server/srv_netlog.c,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 srv_netlog.c
--- srv_netlog.c        1998/02/05 06:33:12        1.1.2.3
+++ srv_netlog.c        1998/03/25 13:00:02
@@ -26,6 +26,10 @@
 #include "includes.h"
 #include "nterr.h"
 
+#ifdef USE_ARCFOUR_FROM_SSH_SOURCE
+#include "arcfour.h"
+#endif
+
 extern int DEBUGLEVEL;
 
 extern BOOL sam_logon_in_ssb;
@@ -485,16 +489,27 @@
 {
         uint32 status = 0x0;
 
-#ifdef USE_ARCFOUR
-        extern void arcfour(uint8 key[16], uint8 out[16], uint8 in[16]);
+#if defined(USE_ARCFOUR) || defined(USE_ARCFOUR_FROM_SSH_SOURCE)
         char nt_pwd[16];
         char lm_pwd[16];
         unsigned char arc4_key[16];
+#ifdef USE_ARCFOUR
+        extern void arcfour(uint8 key[16], uint8 out[16], uint8 in[16]);
         memset(arc4_key, 0, 16);
         memcpy(arc4_key, vuser->dc.sess_key, 8);
 
         arcfour(arc4_key, lm_pwd, id1->arc4_lm_owf.data);
         arcfour(arc4_key, nt_pwd, id1->arc4_nt_owf.data);
+#else
+        ArcfourContext ctx;
+
+        memset(arc4_key, 0, 16);
+        memcpy(arc4_key, vuser->dc.sess_key, 8);
+
+        arcfour_init(&ctx, arc4_key, 16);
+        arcfour_encrypt(&ctx, lm_pwd, id1->arc4_lm_owf.data, 16);
+        arcfour_encrypt(&ctx, nt_pwd, id1->arc4_nt_owf.data, 16);
+#endif
 
 #ifdef DEBUG_PASSWORD
         DEBUG(100,("arcfour decrypt of lm owf password:"));
Index: lib/rpc/parse/parse_net.c
===================================================================
RCS file: /cvsroot/samba/source/lib/rpc/parse/parse_net.c,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 parse_net.c
--- parse_net.c        1998/02/07 06:30:13        1.1.2.3
+++ parse_net.c        1998/03/25 13:00:04
@@ -24,6 +24,10 @@
 #include "includes.h"
 #include "nterr.h"
 
+#ifdef USE_ARCFOUR_FROM_SSH_SOURCE
+#include "arcfour.h"
+#endif
+
 extern int DEBUGLEVEL;
 
 /*******************************************************************
@@ -597,12 +601,16 @@
         make_uni_hdr(&(id->hdr_user_name  ), len_user_name  , len_user_name  ,
4);
         make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name , len_wksta_name ,
4);
 
-#ifdef USE_ARCFOUR
+#if defined(USE_ARCFOUR) || defined(USE_ARCFOUR_FROM_SSH_SOURCE)
 
         if (lm_cypher && nt_cypher)
         {
+#ifdef USE_ARCFOUR
                 void arcfour(uint8 key[16], uint8 out[16], uint8 in[16]);
                 unsigned char arc4_key[16];
+#else
+                ArcfourContext ctx;
+#endif
 #ifdef DEBUG_PASSWORD
                 DEBUG(100,("lm cypher:"));
                 dump_data(100, lm_cypher, 16);
@@ -611,11 +619,17 @@
                 dump_data(100, nt_cypher, 16);
 #endif
 
+#ifdef USE_ARCFOUR
                 memset(arc4_key, 0, 16);
                 memcpy(arc4_key, sess_key, 16);
 
                 arcfour(arc4_key, arc4_lm_owf, lm_cypher);
                 arcfour(arc4_key, arc4_nt_owf, nt_cypher);
+#else
+                arcfour_init(&ctx, sess_key, 16);
+                arcfour_encrypt(&ctx, arc4_lm_owf, lm_cypher, 16);
+                arcfour_encrypt(&ctx, arc4_nt_owf, nt_cypher, 16);
+#endif
 
 #ifdef DEBUG_PASSWORD
                 DEBUG(100,("arcfour encrypt of lm owf password:"));





More information about the samba-ntdom mailing list