wins.dat manipulation

Dmitry Melekhov dm at belkam.com
Wed Mar 24 04:52:03 GMT 2004


Andrew Bartlett wrote:

>On Tue, 2004-03-23 at 22:58, Dmitry Melekhov wrote:
>  
>
>>Hello!
>>
>>I need to edit wins.dat without restarting nmbd, so I wrote very little 
>>patch to smbcontrol which add two messages:
>>       dump-wins                     Dump wins database
>>        load-wins                     Load wins database
>>
>>
>>They are handled by
>>
>>void nmbd_message_winsload(int msg_type, pid_t src, void *buf, size_t len)
>>{
>>  initialise_wins();
>>}
>>
>>void nmbd_message_winsdump(int msg_type, pid_t src, void *buf, size_t len)
>>{
>>  wins_write_database(True);
>>}
>>
>>
>>Is this correct or I broke something?
>>    
>>
>
>It is racy - what happens if some machine registers while you are
>editing?
>

I just tried :-)
Certanly, this machine will be removed from wins database after wins.dat 
load.
But then this machine will reregister and all will be OK.
At least this works with windows 2003 server.
And, as I see, there is no problems with registration during wins.dat 
loading,
process () handle messages first and then packets.

btw, it would be better to have interface for register/unregister names 
instead of dumping and loading wins.dat, but I'm not programmer,
I'm fat and lazy admin with almost no C knowledge ;-)





More information about the samba-technical mailing list