Process the SAM/UAS change notification message.
authorTim Potter <tpot@samba.org>
Fri, 24 Aug 2001 19:28:08 +0000 (19:28 +0000)
committerTim Potter <tpot@samba.org>
Fri, 24 Aug 2001 19:28:08 +0000 (19:28 +0000)
(This used to be commit efcbcfaa48d36063c974c20692ee2c38d09d2216)

source3/include/nameserv.h
source3/nmbd/nmbd_processlogon.c

index 912e6f76f49df3229432747e43acefe342da81e9..ff777fd1ca734cab133e707a00843e5a7dd893eb 100644 (file)
@@ -507,12 +507,12 @@ struct packet_struct
 /* NETLOGON opcodes */
 
 #define QUERYFORPDC     7 /* Query for PDC. */
+#define SAM_UAS_CHANGE  10 /* Announce change to UAS or SAM. */
 #define QUERYFORPDC_R  12 /* Response to Query for PDC. */
 #define SAMLOGON       18
 #define SAMLOGON_R     19
 #define SAMLOGON_UNK_R 21
 
-
 /* Ids for netbios packet types. */
 
 #define ANN_HostAnnouncement         1
index 3e4591c0cf83af4af653068e3dd99841c0725ea3..6d38b530701ca98c241f6922e225a2888588424c 100644 (file)
@@ -31,6 +31,20 @@ extern int DEBUGLEVEL;
 extern pstring global_myname;
 extern fstring global_myworkgroup;
 
+struct sam_database_info {
+        uint32 index;
+        uint32 serial_lo, serial_hi;
+        uint32 date_lo, date_hi;
+};
+
+/****************************************************************************
+Handle a sam/uas change notification
+**************************************************************************/
+static void handle_sam_uas_change(int db_count, 
+                                  struct sam_database_info *db_info)
+{
+}
+
 /****************************************************************************
 Process a domain logon packet
 **************************************************************************/
@@ -278,6 +292,65 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
       break;
     }
 
+    /* Announce change to UAS or SAM */
+
+  case SAM_UAS_CHANGE: {
+          struct sam_database_info *db_info;
+          char *q = buf + 2;
+          int i, db_count;
+          
+          /* Header */
+          
+          q += 4;                   /* Low serial number */
+          q += 4;                   /* Date/time */
+          q += 4;                   /* Pulse */
+          q += 4;                   /* Random */
+          
+          /* Domain info */
+          
+          q = skip_string(q, 1);    /* PDC name */
+          q = skip_string(q, 1);    /* Domain name */
+          q = skip_unibuf(q, PTR_DIFF(buf + len, q)); /* Unicode PDC name */
+          q = skip_unibuf(q, PTR_DIFF(buf + len, q)); /* Unicode domain name */
+          
+          /* Database info */
+          
+          db_count = IVAL(q, 0); q += 2;
+          
+          db_info = (struct sam_database_info *)
+                  malloc(sizeof(struct sam_database_info) * db_count);
+
+          if (db_info == NULL) {
+                  DEBUG(3, ("out of memory allocating info for %d databases\n",
+                            db_count));
+                  return;
+          }
+          
+          for (i = 0; i < db_count; i++) {
+                  db_info[i].index = IVAL(q, 0);
+                  db_info[i].serial_lo = IVAL(q, 4);
+                  db_info[i].serial_hi = IVAL(q, 8);
+                  db_info[i].date_lo = IVAL(q, 12);
+                  db_info[i].date_hi = IVAL(q, 16);
+                  q += 20;
+          }
+
+          /* Domain SID */
+
+          q += IVAL(q, 0) + 4;  /* 4 byte length plus data */
+          
+          q += 2;               /* Alignment? */
+
+          /* Misc other info */
+
+          q += 4;               /* NT version (0x1) */
+          q += 2;               /* LMNT token (0xff) */
+          q += 2;               /* LM20 token (0xff) */
+
+          handle_sam_uas_change(db_count, db_info);
+          free(db_info);
+  }
+
     default:
     {
       DEBUG(3,("process_logon_packet: Unknown domain request %d\n",code));