예제 #1
0
static void announce_server(struct subnet_record *subrec, struct work_record *work,
                     struct server_record *servrec)
{
	/* Only do domain announcements if we are a master and it's
		our primary name we're being asked to announce. */

	if (AM_LOCAL_MASTER_BROWSER(work) && strequal(lp_netbios_name(),servrec->serv.name)) {
		send_local_master_announcement(subrec, work, servrec);
		send_workgroup_announcement(subrec, work);
	} else {
		send_host_announcement(subrec, work, servrec);
	}
}
예제 #2
0
void announce_my_servers_removed(void)
{
    int announce_interval = lp_lm_interval();
    int lm_announce = lp_lm_announce();
    struct subnet_record *subrec;

    for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec))
    {
        struct work_record *work;
        for (work = subrec->workgrouplist; work; work = work->next)
        {
            struct server_record *servrec;

            work->announce_interval = 0;
            for (servrec = work->serverlist; servrec; servrec = servrec->next)
            {
                if (!is_myname(servrec->serv.name))
                    continue;
                servrec->serv.type = 0;
                if(AM_LOCAL_MASTER_BROWSER(work))
                    send_local_master_announcement(subrec, work, servrec);
                send_host_announcement(subrec, work, servrec);


                if ((announce_interval <= 0) || (lm_announce <= 0))
                {
                    /* user absolutely does not want LM announcements to be sent. */
                    continue;
                }

                if ((lm_announce >= 2) && (!found_lm_clients))
                {
                    /* has been set to 2 (Auto) but no LM clients detected (yet). */
                    continue;
                }

                /*
                 * lm announce was set or we have seen lm announcements, so do
                 * a lm announcement of host removed.
                 */

                send_lm_host_announcement(subrec, work, servrec, 0);
            }
        }
    }
}