diff options
-rw-r--r-- | source3/include/nameserv.h | 2 | ||||
-rw-r--r-- | source3/nmbd/nmbd_processlogon.c | 73 |
2 files changed, 74 insertions, 1 deletions
diff --git a/source3/include/nameserv.h b/source3/include/nameserv.h index 912e6f76f4..ff777fd1ca 100644 --- a/source3/include/nameserv.h +++ b/source3/include/nameserv.h @@ -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 diff --git a/source3/nmbd/nmbd_processlogon.c b/source3/nmbd/nmbd_processlogon.c index 3e4591c0cf..6d38b53070 100644 --- a/source3/nmbd/nmbd_processlogon.c +++ b/source3/nmbd/nmbd_processlogon.c @@ -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)); |