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

Added debug so if zero length messages get sent we successfully remove

them (this can happen if smbd processes are shut down at the wrong time).
Jeremy.
(This used to be commit c1de97f96b)
This commit is contained in:
Jeremy Allison 2000-10-02 19:28:26 +00:00
parent 7de0b5588e
commit e26d09685c
2 changed files with 16 additions and 3 deletions

View File

@ -591,6 +591,13 @@ void srv_spoolss_receive_message(int msg_type, pid_t src, void *buf, size_t len)
*printer = '\0';
fstrcpy(printer,buf);
if (len == 0) {
DEBUG(0,("srv_spoolss_receive_message: got null message !\n"));
return;
}
DEBUG(10,("srv_spoolss_receive_message: Got message about printer %s\n", printer ));
find_printer = (Printer_entry *)ubi_dlFirst(&Printer_list);
/* Iterate the printer list. */
@ -631,6 +638,8 @@ static BOOL srv_spoolss_sendnotify(POLICY_HND *handle)
fstrcpy(printer, "");
/*srv_spoolss_receive_message(printer);*/
DEBUG(10,("srv_spoolss_sendnotify: Sending message about printer %s\n", printer ));
message_send_all(MSG_PRINTER_NOTIFY, printer, strlen(printer) + 1); /* Null terminate... */
return True;

View File

@ -696,9 +696,12 @@ TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key)
rec_ptr = tdb_find(tdb, key, hash, &rec);
if (rec_ptr) {
ret.dptr = tdb_alloc_read(tdb,
rec_ptr + sizeof(rec) + rec.key_len,
if (rec.data_len)
ret.dptr = tdb_alloc_read(tdb,
rec_ptr + sizeof(rec) + rec.key_len,
rec.data_len);
else
ret.dptr = NULL;
ret.dsize = rec.data_len;
}
@ -1106,7 +1109,8 @@ int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag)
memcpy(p, &rec, sizeof(rec));
memcpy(p+sizeof(rec), key.dptr, key.dsize);
memcpy(p+sizeof(rec)+key.dsize, dbuf.dptr, dbuf.dsize);
if (dbuf.dsize)
memcpy(p+sizeof(rec)+key.dsize, dbuf.dptr, dbuf.dsize);
if (tdb_write(tdb, rec_ptr, p, sizeof(rec)+key.dsize+dbuf.dsize) == -1)
goto fail;