static void send_announcement(struct subnet_record *subrec, int announce_type, const char *from_name, const char *to_name, int to_type, struct in_addr to_ip, time_t announce_interval, const char *server_name, int server_type, const char *server_comment) { pstring outbuf; char *p; memset(outbuf,'\0',sizeof(outbuf)); p = outbuf+1; SCVAL(outbuf,0,announce_type); /* Announcement parameters. */ SCVAL(p,0,updatecount); SIVAL(p,1,announce_interval*1000); /* Milliseconds - despite the spec. */ push_string(NULL, p+5, server_name, 15, STR_ASCII|STR_UPPER|STR_TERMINATE); SCVAL(p,21,lp_major_announce_version()); /* Major version. */ SCVAL(p,22,lp_minor_announce_version()); /* Minor version. */ SIVAL(p,23,server_type & ~SV_TYPE_LOCAL_LIST_ONLY); /* Browse version: got from NT/AS 4.00 - Value defined in smb.h (JHT). */ SSVAL(p,27,BROWSER_ELECTION_VERSION); SSVAL(p,29,BROWSER_CONSTANT); /* Browse signature. */ p += 31 + push_string(NULL, p+31, server_comment, -1, STR_ASCII|STR_TERMINATE); send_mailslot(False,BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf), from_name, 0x0, to_name, to_type, to_ip, subrec->myip, DGRAM_PORT); }
static void send_lm_announcement(struct subnet_record *subrec, int announce_type, char *from_name, char *to_name, int to_type, struct in_addr to_ip, time_t announce_interval, char *server_name, int server_type, char *server_comment) { pstring outbuf; char *p=outbuf; memset(outbuf,'\0',sizeof(outbuf)); SSVAL(p,0,announce_type); SIVAL(p,2,server_type & ~SV_TYPE_LOCAL_LIST_ONLY); SCVAL(p,6,lp_major_announce_version()); /* Major version. */ SCVAL(p,7,lp_minor_announce_version()); /* Minor version. */ SSVAL(p,8,announce_interval); /* In seconds - according to spec. */ p += 10; StrnCpy(p,server_name,15); strupper(p); p = skip_string(p,1); pstrcpy(p,server_comment); p = skip_string(p,1); send_mailslot(False,LANMAN_MAILSLOT, outbuf, PTR_DIFF(p,outbuf), from_name, 0x0, to_name, to_type, to_ip, subrec->myip, DGRAM_PORT); }
static WERROR NetServerGetInfo_l_101(struct libnetapi_ctx *ctx, uint8_t **buffer) { struct SERVER_INFO_101 i; i.sv101_platform_id = PLATFORM_ID_NT; i.sv101_name = global_myname(); i.sv101_version_major = lp_major_announce_version(); i.sv101_version_minor = lp_minor_announce_version(); i.sv101_type = lp_default_server_announce(); i.sv101_comment = lp_serverstring(); *buffer = (uint8_t *)talloc_memdup(ctx, &i, sizeof(i)); if (!*buffer) { return WERR_NOMEM; } return WERR_OK; }
static void create_wks_info_100(WKS_INFO_100 *inf) { pstring my_name; pstring domain; DEBUG(5,("create_wks_info_100: %d\n", __LINE__)); pstrcpy (my_name, global_myname()); strupper_m(my_name); pstrcpy (domain, lp_workgroup()); strupper_m(domain); init_wks_info_100(inf, 0x000001f4, /* platform id info */ lp_major_announce_version(), lp_minor_announce_version(), my_name, domain); }
static void send_lm_announcement(struct subnet_record *subrec, int announce_type, char *from_name, char *to_name, int to_type, struct in_addr to_ip, time_t announce_interval, char *server_name, int server_type, char *server_comment) { char outbuf[PSTRING_LEN]; char *p=outbuf; memset(outbuf,'\0',sizeof(outbuf)); SSVAL(p,0,announce_type); SIVAL(p,2,server_type & ~SV_TYPE_LOCAL_LIST_ONLY); SCVAL(p,6,lp_major_announce_version()); /* Major version. */ SCVAL(p,7,lp_minor_announce_version()); /* Minor version. */ SSVAL(p,8,announce_interval); /* In seconds - according to spec. */ p += 10; p += push_string(NULL, p, server_name, 15, STR_ASCII|STR_UPPER|STR_TERMINATE); p += push_string(NULL, p, server_comment, sizeof(outbuf)- (p - outbuf), STR_ASCII|STR_UPPER|STR_TERMINATE); send_mailslot(False,LANMAN_MAILSLOT, outbuf, PTR_DIFF(p,outbuf), from_name, 0x0, to_name, to_type, to_ip, subrec->myip, DGRAM_PORT); }