svn commit: samba r7737 - in branches/SAMBA_4_0/source/torture: . libnet

mimir at samba.org mimir at samba.org
Sat Jun 18 22:37:11 GMT 2005


Author: mimir
Date: 2005-06-18 22:37:11 +0000 (Sat, 18 Jun 2005)
New Revision: 7737

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7737

Log:
Test for libnet_Lookup function.


rafal


Added:
   branches/SAMBA_4_0/source/torture/libnet/libnet_lookup.c
Modified:
   branches/SAMBA_4_0/source/torture/config.mk
   branches/SAMBA_4_0/source/torture/torture.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/config.mk
===================================================================
--- branches/SAMBA_4_0/source/torture/config.mk	2005-06-18 22:33:07 UTC (rev 7736)
+++ branches/SAMBA_4_0/source/torture/config.mk	2005-06-18 22:37:11 UTC (rev 7737)
@@ -196,6 +196,7 @@
 		torture/libnet/userinfo.o \
 		torture/libnet/userman.o \
 		torture/libnet/domain.o \
+		torture/libnet/libnet_lookup.o \
 		torture/libnet/libnet_user.o
 REQUIRED_SUBSYSTEMS = \
 		NDR_ALL RPC_NDR_SAMR LIBNET

Added: branches/SAMBA_4_0/source/torture/libnet/libnet_lookup.c
===================================================================
--- branches/SAMBA_4_0/source/torture/libnet/libnet_lookup.c	2005-06-18 22:33:07 UTC (rev 7736)
+++ branches/SAMBA_4_0/source/torture/libnet/libnet_lookup.c	2005-06-18 22:37:11 UTC (rev 7737)
@@ -0,0 +1,52 @@
+/* 
+   Unix SMB/CIFS implementation.
+   Test suite for libnet calls.
+
+   Copyright (C) Rafal Szczesniak 2005
+   
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+#include "libnet/libnet.h"
+#include "libnet/composite.h"
+#include "libcli/composite/monitor.h"
+#include "librpc/gen_ndr/ndr_nbt.h"
+
+
+BOOL torture_lookup(void)
+{
+	NTSTATUS status;
+	TALLOC_CTX *mem_ctx;
+	struct libnet_Lookup lookup;
+	const char address[16];
+	const char* methods[] = { "wins", "bcast", NULL };	
+
+	mem_ctx = talloc_init("test_userinfo");
+
+	lookup.in.hostname = lp_netbios_name();
+	lookup.in.methods  = NULL;
+	lookup.in.type     = NBT_NAME_SERVER;
+	lookup.out.address = (const char**)&address;
+
+	status = libnet_Lookup(mem_ctx, &lookup);
+
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("Couldn't lookup host %s: %s\n", lookup.in.hostname, nt_errstr(status));
+		return False;
+	}
+
+	return True;
+}

Modified: branches/SAMBA_4_0/source/torture/torture.c
===================================================================
--- branches/SAMBA_4_0/source/torture/torture.c	2005-06-18 22:33:07 UTC (rev 7736)
+++ branches/SAMBA_4_0/source/torture/torture.c	2005-06-18 22:37:11 UTC (rev 7737)
@@ -2342,6 +2342,7 @@
 	{"NET-USERADD", torture_useradd, 0},
 	{"NET-USERDEL", torture_userdel, 0},
 	{"NET-DOMOPEN", torture_domainopen, 0},
+	{"NET-LOOKUP", torture_lookup, 0},
 	{"NET-API-CREATEUSER", torture_createuser, 0},
 
 	{NULL, NULL, 0}};



More information about the samba-cvs mailing list