1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

Process the SAM/UAS change notification message.

(This used to be commit efcbcfaa48)
This commit is contained in:
Tim Potter 2001-08-24 19:28:08 +00:00
parent 2236c671a0
commit c1f0d99013
2 changed files with 74 additions and 1 deletions

View 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

View 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));