1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

nss-wins: Do not lookup invalid netbios names

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Andreas Schneider 2015-01-30 14:29:26 +01:00 committed by Jeremy Allison
parent a5e3a198d0
commit a782ae1da4

View File

@ -59,10 +59,12 @@ static void nss_wins_init(void)
static struct in_addr *lookup_byname_backend(const char *name, int *count)
{
TALLOC_CTX *frame = talloc_stackframe();
TALLOC_CTX *frame;
struct sockaddr_storage *address = NULL;
struct in_addr *ret = NULL;
NTSTATUS status;
const char *p;
size_t nbt_len;
int j;
if (!initialised) {
@ -71,6 +73,16 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count)
*count = 0;
nbt_len = strlen(name);
if (nbt_len > MAX_NETBIOSNAME_LEN - 1) {
return NULL;
}
p = strchr(name, '.');
if (p != NULL) {
return NULL;
}
frame = talloc_stackframe();
/* always try with wins first */
status = resolve_wins(name, 0x00, talloc_tos(),
&address, count);