From e02b05b5658fa50e6f94e604fc518a624211b6de Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 14 Mar 1998 13:00:09 +0000 Subject: new files to support starting/stopping the server (This used to be commit 087981009d57006ff80a0cf50891d4473f86f1bb) --- source3/web/diagnose.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 source3/web/diagnose.c (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c new file mode 100644 index 0000000000..054de2a631 --- /dev/null +++ b/source3/web/diagnose.c @@ -0,0 +1,67 @@ +/* + Unix SMB/Netbios implementation. + Version 1.9. + diagnosis tools for web admin + Copyright (C) Andrew Tridgell 1998 + + 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 "smb.h" + + +/* check to see if nmbd is running on localhost by looking for a __SAMBA__ + response */ +BOOL nmbd_running(void) +{ + extern struct in_addr loopback_ip; + int fd, count; + struct in_addr *ip_list; + + if ((fd = open_socket_in(SOCK_DGRAM, 0, 3, + interpret_addr("127.0.0.1"))) != -1) { + if ((ip_list = name_query(fd, "__SAMBA__", 0, + True, True, loopback_ip, + &count,0)) != NULL) { + free(ip_list); + close(fd); + return True; + } + close (fd); + } + + return False; +} + + +/* check to see if smbd is running on localhost by trying to open a connection + then closing it */ +BOOL smbd_running(void) +{ + static struct cli_state cli; + extern struct in_addr loopback_ip; + + if (!cli_initialise(&cli)) + return False; + + if (!cli_connect(&cli, "localhost", &loopback_ip)) { + cli_shutdown(&cli); + return False; + } + + cli_shutdown(&cli); + return True; +} -- cgit From 3db52feb1f3b2c07ce0b06ad4a7099fa6efe3fc7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 13 Dec 1999 13:27:58 +0000 Subject: first pass at updating head branch to be to be the same as the SAMBA_2_0 branch (This used to be commit 453a822a76780063dff23526c35408866d0c0154) --- source3/web/diagnose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index 054de2a631..f29e380b93 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -32,7 +32,7 @@ BOOL nmbd_running(void) struct in_addr *ip_list; if ((fd = open_socket_in(SOCK_DGRAM, 0, 3, - interpret_addr("127.0.0.1"))) != -1) { + interpret_addr("127.0.0.1"), True)) != -1) { if ((ip_list = name_query(fd, "__SAMBA__", 0, True, True, loopback_ip, &count,0)) != NULL) { -- cgit From 574788039f53fada4769731ea3fafe9710417b71 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 3 Jan 2000 03:17:16 +0000 Subject: added the unexpected packet database (unexpected.tdb) this means "nmblookup -S" now always works, even with broken servers the database stores all unexpected replies and these can be accessed by any client. while doing this I cleaned up a couple of functions, and put in place a better trn_id generator. in most places the code got quite a bit simpler due to the addition of simple helper functions. I haven't yet put the code in to take advantage of this for pdc replies - that will be next. Jeremys pdc finding code will then work :) (This used to be commit 280e6359d36c9bc8dcded302f15c3a1db8e3feeb) --- source3/web/diagnose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index f29e380b93..f22fe0d9b2 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -35,7 +35,7 @@ BOOL nmbd_running(void) interpret_addr("127.0.0.1"), True)) != -1) { if ((ip_list = name_query(fd, "__SAMBA__", 0, True, True, loopback_ip, - &count,0)) != NULL) { + &count)) != NULL) { free(ip_list); close(fd); return True; -- cgit From c0ef0e113e8d3117891b4b137f660ca3c4c6b1f0 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 17 Sep 2001 11:48:29 +0000 Subject: move to SAFE_FREE() (This used to be commit 67db8f03c5c9e81e11b5f3276b50ee23e09a2659) --- source3/web/diagnose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index f22fe0d9b2..bf2e6da17d 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -36,7 +36,7 @@ BOOL nmbd_running(void) if ((ip_list = name_query(fd, "__SAMBA__", 0, True, True, loopback_ip, &count)) != NULL) { - free(ip_list); + SAFE_FREE(ip_list); close(fd); return True; } -- cgit From cd68afe31256ad60748b34f7318a180cfc2127cc Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 30 Jan 2002 06:08:46 +0000 Subject: Removed version number from file header. Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa) --- source3/web/diagnose.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index bf2e6da17d..73c23ea2bb 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -1,6 +1,5 @@ /* - Unix SMB/Netbios implementation. - Version 1.9. + Unix SMB/CIFS implementation. diagnosis tools for web admin Copyright (C) Andrew Tridgell 1998 -- cgit From e90b65284812aaa5ff9e9935ce9bbad7791cbbcd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 Jul 2002 10:35:28 +0000 Subject: updated the 3.0 branch from the head branch - ready for alpha18 (This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce) --- source3/web/diagnose.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index 73c23ea2bb..e822474aab 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -19,7 +19,7 @@ */ #include "includes.h" -#include "smb.h" +#include "../web/swat_proto.h" /* check to see if nmbd is running on localhost by looking for a __SAMBA__ @@ -27,14 +27,14 @@ BOOL nmbd_running(void) { extern struct in_addr loopback_ip; - int fd, count; + int fd, count, flags; struct in_addr *ip_list; if ((fd = open_socket_in(SOCK_DGRAM, 0, 3, interpret_addr("127.0.0.1"), True)) != -1) { if ((ip_list = name_query(fd, "__SAMBA__", 0, True, True, loopback_ip, - &count)) != NULL) { + &count, &flags, NULL)) != NULL) { SAFE_FREE(ip_list); close(fd); return True; -- cgit From fcbb06414d2c8385ce4e68f23905a528c8fbd4e8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 17 Aug 2002 14:34:48 +0000 Subject: sync 3.0 branch with HEAD (This used to be commit d53d77cc8e21dfbfd376d529661ef299e14e31a0) --- source3/web/diagnose.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index e822474aab..396499bcb9 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -21,6 +21,23 @@ #include "includes.h" #include "../web/swat_proto.h" +#ifdef WITH_WINBIND + +NSS_STATUS winbindd_request(int req_type, + struct winbindd_request *request, + struct winbindd_response *response); + +/* check to see if winbind is running by pinging it */ + +BOOL winbindd_running(void) +{ + + if (winbindd_request(WINBINDD_PING, NULL, NULL)) + return False; + + return True; +} +#endif /* check to see if nmbd is running on localhost by looking for a __SAMBA__ response */ -- cgit From 01b805e06bf495061f72616b0edf6bf766121b91 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 17 Jan 2003 14:34:07 +0000 Subject: connect to the actual netbios name in smb.conf and not LOCALHOST (This used to be commit 50d65996e497a6b4647b74dadb4a7f3f5dddf2ed) --- source3/web/diagnose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index 396499bcb9..efd6d1d0a1 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -73,7 +73,7 @@ BOOL smbd_running(void) if (!cli_initialise(&cli)) return False; - if (!cli_connect(&cli, "localhost", &loopback_ip)) { + if (!cli_connect(&cli, global_myname(), &loopback_ip)) { cli_shutdown(&cli); return False; } -- cgit From 8a53eed206a6be996dda5e3555619cdccaf8d2c3 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 22 Nov 2003 04:47:34 +0000 Subject: fix winbind ping call so that SWAT correctly determines if winbindd is running; bug 398 (This used to be commit 04e37283f230b28f3019bfab3a71dde5e4ae4e23) --- source3/web/diagnose.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index efd6d1d0a1..46432c41f8 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -31,11 +31,7 @@ NSS_STATUS winbindd_request(int req_type, BOOL winbindd_running(void) { - - if (winbindd_request(WINBINDD_PING, NULL, NULL)) - return False; - - return True; + return winbind_ping(); } #endif -- cgit From b4cf9e95059071df49b34ff8574e48cb96f42da1 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 7 Oct 2004 04:01:18 +0000 Subject: r2835: Since we always have -I. and -I$(srcdir) in CFLAGS, we can get rid of '..' from all #include preprocessor commands. This fixes bugzilla #1880 where OpenVMS gets confused about the '.' characters. (This used to be commit 7f161702fa4916979602cc0295919b541912acd6) --- source3/web/diagnose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index 46432c41f8..a490786068 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -19,7 +19,7 @@ */ #include "includes.h" -#include "../web/swat_proto.h" +#include "web/swat_proto.h" #ifdef WITH_WINBIND -- cgit From 978ca8486031e43754a3c23757f361bf3a85f335 Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Wed, 6 Apr 2005 16:28:04 +0000 Subject: r6225: get rid of warnings from my compiler about nested externs (This used to be commit efea76ac71412f8622cd233912309e91b9ea52da) --- source3/web/diagnose.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index a490786068..0c9c854df7 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -23,6 +23,8 @@ #ifdef WITH_WINBIND +extern struct in_addr loopback_ip; + NSS_STATUS winbindd_request(int req_type, struct winbindd_request *request, struct winbindd_response *response); @@ -39,7 +41,6 @@ BOOL winbindd_running(void) response */ BOOL nmbd_running(void) { - extern struct in_addr loopback_ip; int fd, count, flags; struct in_addr *ip_list; @@ -64,7 +65,6 @@ BOOL nmbd_running(void) BOOL smbd_running(void) { static struct cli_state cli; - extern struct in_addr loopback_ip; if (!cli_initialise(&cli)) return False; -- cgit From dded66808dab60c4e64e5401a5cb8b1605e29f0e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 10 Apr 2005 15:54:18 +0000 Subject: r6281: Fix the build for FreeBSD 4 -- no winbind (This used to be commit 1ce9a0159d36c2e4f154fb60c86cebcfbc2038dc) --- source3/web/diagnose.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index 0c9c854df7..f4b022cf58 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -21,10 +21,10 @@ #include "includes.h" #include "web/swat_proto.h" -#ifdef WITH_WINBIND - extern struct in_addr loopback_ip; +#ifdef WITH_WINBIND + NSS_STATUS winbindd_request(int req_type, struct winbindd_request *request, struct winbindd_response *response); -- cgit From 19ca97a70f6b7b41d251eaa76e4d3c980c6eedff Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 24 Jun 2005 20:25:18 +0000 Subject: r7882: Looks like a large patch - but what it actually does is make Samba safe for using our headers and linking with C++ modules. Stops us from using C++ reserved keywords in our code. Jeremy (This used to be commit 9506b8e145982b1160a2f0aee5c9b7a54980940a) --- source3/web/diagnose.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index f4b022cf58..d259717da0 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -25,10 +25,6 @@ extern struct in_addr loopback_ip; #ifdef WITH_WINBIND -NSS_STATUS winbindd_request(int req_type, - struct winbindd_request *request, - struct winbindd_response *response); - /* check to see if winbind is running by pinging it */ BOOL winbindd_running(void) -- cgit From 54abd2aa66069e6baf7769c496f46d9dba18db39 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 30 Sep 2005 17:13:37 +0000 Subject: r10656: BIG merge from trunk. Features not copied over * \PIPE\unixinfo * winbindd's {group,alias}membership new functions * winbindd's lookupsids() functionality * swat (trunk changes to be reverted as per discussion with Deryck) (This used to be commit 939c3cb5d78e3a2236209b296aa8aba8bdce32d3) --- source3/web/diagnose.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index d259717da0..c7a7a3598e 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -21,8 +21,6 @@ #include "includes.h" #include "web/swat_proto.h" -extern struct in_addr loopback_ip; - #ifdef WITH_WINBIND /* check to see if winbind is running by pinging it */ @@ -37,6 +35,7 @@ BOOL winbindd_running(void) response */ BOOL nmbd_running(void) { + extern struct in_addr loopback_ip; int fd, count, flags; struct in_addr *ip_list; @@ -61,6 +60,7 @@ BOOL nmbd_running(void) BOOL smbd_running(void) { static struct cli_state cli; + extern struct in_addr loopback_ip; if (!cli_initialise(&cli)) return False; -- cgit From 67e8af8527d08d97736f9d1468d4ccd582940f44 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 20 Dec 2005 02:23:51 +0000 Subject: r12393: cleaning up swat bugs. *no one* tests swat it seems. This has been broken since r10656 (This used to be commit 85ea7afd8bd30e0a2bcbc7181f75fde63b016a34) --- source3/web/diagnose.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index c7a7a3598e..d259717da0 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -21,6 +21,8 @@ #include "includes.h" #include "web/swat_proto.h" +extern struct in_addr loopback_ip; + #ifdef WITH_WINBIND /* check to see if winbind is running by pinging it */ @@ -35,7 +37,6 @@ BOOL winbindd_running(void) response */ BOOL nmbd_running(void) { - extern struct in_addr loopback_ip; int fd, count, flags; struct in_addr *ip_list; @@ -60,7 +61,6 @@ BOOL nmbd_running(void) BOOL smbd_running(void) { static struct cli_state cli; - extern struct in_addr loopback_ip; if (!cli_initialise(&cli)) return False; -- cgit From fbdcf2663b56007a438ac4f0d8d82436b1bfe688 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 11 Jul 2006 18:01:26 +0000 Subject: r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need to do the upper layer directories but this is what everyone is waiting for.... Jeremy. (This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8) --- source3/web/diagnose.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index d259717da0..b53e139ca9 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -60,16 +60,16 @@ BOOL nmbd_running(void) then closing it */ BOOL smbd_running(void) { - static struct cli_state cli; + struct cli_state *cli; - if (!cli_initialise(&cli)) + if ((cli = cli_initialise()) == NULL) return False; - if (!cli_connect(&cli, global_myname(), &loopback_ip)) { - cli_shutdown(&cli); + if (!cli_connect(cli, global_myname(), &loopback_ip)) { + cli_shutdown(cli); return False; } - cli_shutdown(&cli); + cli_shutdown(cli); return True; } -- cgit From ce02d0dfcbeeeec316578322257d998589090c6f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 20 Jun 2007 17:38:42 +0000 Subject: r23554: Fix bug #4711 by makeing cli_connect return an NTSTATUS. Long overdue fix.... Jeremy. (This used to be commit 073fdc5a58139796dbaa7ea9833dca5308f11282) --- source3/web/diagnose.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index b53e139ca9..5f05d8ac9e 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -60,12 +60,14 @@ BOOL nmbd_running(void) then closing it */ BOOL smbd_running(void) { + NTSTATUS status; struct cli_state *cli; if ((cli = cli_initialise()) == NULL) return False; - if (!cli_connect(cli, global_myname(), &loopback_ip)) { + status = cli_connect(cli, global_myname(), &loopback_ip); + if (!NT_STATUS_IS_OK(status)) { cli_shutdown(cli); return False; } -- cgit From d824b98f80ba186030cbb70b3a1e5daf80469ecd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Jul 2007 19:25:36 +0000 Subject: r23779: Change from v2 or later to v3 or later. Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3) --- source3/web/diagnose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index 5f05d8ac9e..ae0103684e 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -5,7 +5,7 @@ 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 + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, -- cgit From 5e54558c6dea67b56bbfaba5698f3a434d3dffb6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 00:52:41 +0000 Subject: r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text (This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07) --- source3/web/diagnose.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index ae0103684e..227c68dd6d 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -14,8 +14,7 @@ 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. + along with this program. If not, see . */ #include "includes.h" -- cgit From 8e54530b52fd256137740107e9fdf000f00a7a30 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 10 Oct 2007 18:25:16 -0700 Subject: Add start of IPv6 implementation. Currently most of this is avoiding IPv6 in winbindd, but moves most of the socket functions that were wrongly in lib/util.c into lib/util_sock.c and provides generic IPv4/6 independent versions of most things. Still lots of work to do, but now I can see how I'll fix the access check code. Nasty part that remains is the name resolution code which is used to returning arrays of in_addr structs. Jeremy. (This used to be commit 3f6bd0e1ec5cc6670f3d08f76fc2cd94c9cd1a08) --- source3/web/diagnose.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index 227c68dd6d..9aba27c774 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -20,8 +20,6 @@ #include "includes.h" #include "web/swat_proto.h" -extern struct in_addr loopback_ip; - #ifdef WITH_WINBIND /* check to see if winbind is running by pinging it */ @@ -36,9 +34,12 @@ BOOL winbindd_running(void) response */ BOOL nmbd_running(void) { + struct in_addr loopback_ip; int fd, count, flags; struct in_addr *ip_list; + loopback_ip.s_addr = htonl(INADDR_LOOPBACK); + if ((fd = open_socket_in(SOCK_DGRAM, 0, 3, interpret_addr("127.0.0.1"), True)) != -1) { if ((ip_list = name_query(fd, "__SAMBA__", 0, @@ -59,9 +60,12 @@ BOOL nmbd_running(void) then closing it */ BOOL smbd_running(void) { + struct in_addr loopback_ip; NTSTATUS status; struct cli_state *cli; + loopback_ip.s_addr = htonl(INADDR_LOOPBACK); + if ((cli = cli_initialise()) == NULL) return False; -- cgit From 30191d1a5704ad2b158386b511558972d539ce47 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Oct 2007 17:40:25 -0700 Subject: RIP BOOL. Convert BOOL -> bool. I found a few interesting bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f) --- source3/web/diagnose.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index 9aba27c774..df3b34dd16 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -24,7 +24,7 @@ /* check to see if winbind is running by pinging it */ -BOOL winbindd_running(void) +bool winbindd_running(void) { return winbind_ping(); } @@ -32,7 +32,7 @@ BOOL winbindd_running(void) /* check to see if nmbd is running on localhost by looking for a __SAMBA__ response */ -BOOL nmbd_running(void) +bool nmbd_running(void) { struct in_addr loopback_ip; int fd, count, flags; @@ -58,7 +58,7 @@ BOOL nmbd_running(void) /* check to see if smbd is running on localhost by trying to open a connection then closing it */ -BOOL smbd_running(void) +bool smbd_running(void) { struct in_addr loopback_ip; NTSTATUS status; -- cgit From f88b7a076be74a29a3bf876b4e2705f4a1ecf42b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 24 Oct 2007 14:16:54 -0700 Subject: This is a large patch (sorry). Migrate from struct in_addr to struct sockaddr_storage in most places that matter (ie. not the nmbd and NetBIOS lookups). This passes make test on an IPv4 box, but I'll have to do more work/testing on IPv6 enabled boxes. This should now give us a framework for testing and finishing the IPv6 migration. It's at the state where someone with a working IPv6 setup should (theorecically) be able to type : smbclient //ipv6-address/share and have it work. Jeremy. (This used to be commit 98e154c3125d5732c37a72d74b0eb5cd7b6155fd) --- source3/web/diagnose.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'source3/web/diagnose.c') diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c index df3b34dd16..221ce83f82 100644 --- a/source3/web/diagnose.c +++ b/source3/web/diagnose.c @@ -36,16 +36,18 @@ bool nmbd_running(void) { struct in_addr loopback_ip; int fd, count, flags; - struct in_addr *ip_list; + struct sockaddr_storage *ss_list; + struct sockaddr_storage ss; loopback_ip.s_addr = htonl(INADDR_LOOPBACK); + in_addr_to_sockaddr_storage(&ss, loopback_ip); if ((fd = open_socket_in(SOCK_DGRAM, 0, 3, - interpret_addr("127.0.0.1"), True)) != -1) { - if ((ip_list = name_query(fd, "__SAMBA__", 0, - True, True, loopback_ip, + &ss, True)) != -1) { + if ((ss_list = name_query(fd, "__SAMBA__", 0, + True, True, &ss, &count, &flags, NULL)) != NULL) { - SAFE_FREE(ip_list); + SAFE_FREE(ss_list); close(fd); return True; } @@ -63,13 +65,15 @@ bool smbd_running(void) struct in_addr loopback_ip; NTSTATUS status; struct cli_state *cli; + struct sockaddr_storage ss; loopback_ip.s_addr = htonl(INADDR_LOOPBACK); + in_addr_to_sockaddr_storage(&ss, loopback_ip); if ((cli = cli_initialise()) == NULL) return False; - status = cli_connect(cli, global_myname(), &loopback_ip); + status = cli_connect(cli, global_myname(), &ss); if (!NT_STATUS_IS_OK(status)) { cli_shutdown(cli); return False; -- cgit