*/
#include "includes.h"
+#include "system/filesys.h"
+#include "../librpc/gen_ndr/svcctl.h"
+#include "nmbd/nmbd.h"
int updatecount = 0;
fstrcpy(servrec->serv.name,name);
fstrcpy(servrec->serv.comment,comment);
- strupper_m(servrec->serv.name);
+ if (!strupper_m(servrec->serv.name)) {
+ DEBUG(2,("strupper_m %s failed\n", servrec->serv.name));
+ SAFE_FREE(servrec);
+ return NULL;
+ }
servrec->serv.type = servertype;
update_server_ttl(servrec, ttl);
out this server record from an earlier subnet.
******************************************************************/
-static uint32 write_this_server_name( struct subnet_record *subrec,
+static uint32_t write_this_server_name( struct subnet_record *subrec,
struct work_record *work,
struct server_record *servrec)
{
broadcast subnets.
******************************************************************/
-static uint32 write_this_workgroup_name( struct subnet_record *subrec,
+static uint32_t write_this_workgroup_name( struct subnet_record *subrec,
struct work_record *work)
{
struct subnet_record *ssub;
Write out the browse.dat file.
******************************************************************/
-void write_browse_list_entry(XFILE *fp, const char *name, uint32 rec_type,
+void write_browse_list_entry(XFILE *fp, const char *name, uint32_t rec_type,
const char *local_master_browser_name, const char *description)
{
fstring tmp;
struct server_record *servrec;
char *fname;
char *fnamenew;
- uint32 stype;
+ uint32_t stype;
int i;
XFILE *fp;
bool list_changed = force_write;
fnamenew = talloc_asprintf(ctx, "%s.",
fname);
if (!fnamenew) {
+ talloc_free(fname);
return;
}
if (!fp) {
DEBUG(0,("write_browse_list: Can't open file %s. Error was %s\n",
fnamenew,strerror(errno)));
+ talloc_free(fnamenew);
+ talloc_free(fname);
return;
}
DEBUG(0,("write_browse_list: Fatal error - cannot find my workgroup %s\n",
lp_workgroup()));
x_fclose(fp);
+ talloc_free(fnamenew);
+ talloc_free(fname);
return;
}
/* Output server details, plus what workgroup they're in. */
write_browse_list_entry(fp, my_netbios_names(i), stype,
- string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH), lp_workgroup());
+ string_truncate(lp_server_string(talloc_tos()), MAX_SERVER_STRING_LENGTH), lp_workgroup());
}
for (subrec = FIRST_SUBNET; subrec ; subrec = NEXT_SUBNET_INCLUDING_UNICAST(subrec)) {
for (work = subrec->workgrouplist; work ; work = work->next) {
/* Write out a workgroup record for a workgroup. */
- uint32 wg_type = write_this_workgroup_name( subrec, work);
+ uint32_t wg_type = write_this_workgroup_name( subrec, work);
if(wg_type) {
write_browse_list_entry(fp, work->work_group, wg_type,
/* Now write out any server records a workgroup may have. */
for (servrec = work->serverlist; servrec ; servrec = servrec->next) {
- uint32 serv_type;
+ uint32_t serv_type;
/* We have already written our names here. */
if(is_myname(servrec->serv.name))
chmod(fnamenew,0644);
rename(fnamenew,fname);
DEBUG(3,("write_browse_list: Wrote browse list into file %s\n",fname));
+ talloc_free(fnamenew);
+ talloc_free(fname);
}