void wins_process_name_release_request(struct subnet_record *subrec,
struct packet_struct *p);
void initiate_wins_processing(time_t t);
-void wins_write_database(void);
+void wins_write_database(BOOL background);
/*The following definitions come from nmbd/nmbd_workgroupdb.c */
void file_chain_save(void);
void file_chain_restore(void);
-/*The following definitions come from smbd/groupname.c */
-
-void load_groupname_map(void);
-void map_gid_to_sid( gid_t gid, DOM_SID *psid);
-
/*The following definitions come from smbd/ipc.c */
int reply_trans(connection_struct *conn, char *inbuf,char *outbuf, int size, int bufsize);
DEBUG(0,("Got SIGTERM: going down...\n"));
/* Write out wins.dat file if samba is a WINS server */
- wins_write_database();
+ wins_write_database(False);
/* Remove all SELF registered names. */
release_my_names();
expire_names_on_subnet(wins_server_subnet, t);
if(wins_server_subnet->namelist_changed)
- wins_write_database();
+ wins_write_database(True);
wins_server_subnet->namelist_changed = False;
}
/*******************************************************************
Write out the current WINS database.
******************************************************************/
-void wins_write_database(void)
+void wins_write_database(BOOL background)
{
struct name_record *namerec;
pstring fname, fnamenew;
/* we will do the writing in a child process to ensure that the parent
doesn't block while this is done */
- if ((child_pid=fork())) {
- return;
+ if (background) {
+ CatchChild();
+ if ((child_pid=fork())) {
+ return;
+ }
}
- pstrcpy(fname,lp_lockdir());
- trim_string(fname,NULL,"/");
- pstrcat(fname,"/");
- pstrcat(fname,WINS_LIST);
- pstrcpy(fnamenew,fname);
- pstrcat(fnamenew,".");
+ slprintf(fname,sizeof(fname),"%s/%s.%d", lp_lockdir(), WINS_LIST, getpid());
+ string_sub(s->fname,"//", "/");
if((fp = fopen(fnamenew,"w")) == NULL)
{
}
fclose(fp);
- unlink(fname);
chmod(fnamenew,0644);
+ unlink(fname);
rename(fnamenew,fname);
}