コード例 #1
0
void announce_remote(time_t t)
{
    char *s;
    const char *ptr;
    static time_t last_time = 0;
    pstring s2;
    struct in_addr addr;
    char *comment;
    int stype = lp_default_server_announce();

    if (last_time && (t < (last_time + REMOTE_ANNOUNCE_INTERVAL)))
        return;

    last_time = t;

    s = lp_remote_announce();
    if (!*s)
        return;

    comment = string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH);

    for (ptr=s; next_token(&ptr,s2,NULL,sizeof(s2)); ) {
        /* The entries are of the form a.b.c.d/WORKGROUP with
        		WORKGROUP being optional */
        const char *wgroup;
        char *pwgroup;
        int i;

        pwgroup = strchr_m(s2,'/');
        if (pwgroup)
            *pwgroup++ = 0;
        if (!pwgroup || !*pwgroup)
            wgroup = lp_workgroup();
        else
            wgroup = pwgroup;

        addr = *interpret_addr2(s2);

        /* Announce all our names including aliases */
        /* Give the ip address as the address of our first
        		broadcast subnet. */

        for(i=0; my_netbios_names(i); i++) {
            const char *name = my_netbios_names(i);

            DEBUG(5,("announce_remote: Doing remote announce for server %s to IP %s.\n",
                     name, inet_ntoa(addr) ));

            send_announcement(FIRST_SUBNET, ANN_HostAnnouncement,
                              name,                      /* From nbt name. */
                              wgroup, 0x1d,              /* To nbt name. */
                              addr,                      /* To ip. */
                              REMOTE_ANNOUNCE_INTERVAL,  /* Time until next announce. */
                              name,                      /* Name to announce. */
                              stype,                     /* Type field. */
                              comment);
        }
    }
}
コード例 #2
0
ファイル: nmbd_sendannounce.c プロジェクト: AIdrifter/samba
static void send_workgroup_announcement(struct subnet_record *subrec, struct work_record *work)
{
	DEBUG(3,("send_workgroup_announcement: on subnet %s for workgroup %s\n",
		subrec->subnet_name, work->work_group));

	send_announcement(subrec, ANN_DomainAnnouncement,
			lp_netbios_name(),                 /* From nbt name. */
			MSBROWSE, 0x1,                   /* To nbt name. */
			subrec->bcast_ip,                /* To ip. */
			work->announce_interval,         /* Time until next announce. */
			work->work_group,                /* Name to announce. */
			SV_TYPE_DOMAIN_ENUM|SV_TYPE_NT,  /* workgroup announce flags. */
			lp_netbios_name());                /* From name as comment. */
}
コード例 #3
0
ファイル: nmbd_sendannounce.c プロジェクト: AIdrifter/samba
static void send_host_announcement(struct subnet_record *subrec, struct work_record *work,
                                   struct server_record *servrec)
{
	/* Ensure we don't have the prohibited bits set. */
	uint32 type = servrec->serv.type & ~SV_TYPE_LOCAL_LIST_ONLY;

	DEBUG(3,("send_host_announcement: type %x for host %s on subnet %s for workgroup %s\n",
		type, servrec->serv.name, subrec->subnet_name, work->work_group));

	send_announcement(subrec, ANN_HostAnnouncement,
			servrec->serv.name,              /* From nbt name. */
			work->work_group, 0x1d,          /* To nbt name. */
			subrec->bcast_ip,                /* To ip. */
			work->announce_interval,         /* Time until next announce. */
			servrec->serv.name,              /* Name to announce. */
			type,                            /* Type field. */
			servrec->serv.comment);
}