web/diagnose.c

説明を見る。
00001 /* 
00002    Unix SMB/CIFS implementation.
00003    diagnosis tools for web admin
00004    Copyright (C) Andrew Tridgell 1998
00005    
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015    
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 */
00020 
00021 #include "includes.h"
00022 #include "web/swat_proto.h"
00023 
00024 extern struct in_addr loopback_ip;
00025 
00026 #ifdef WITH_WINBIND
00027 
00028 /* check to see if winbind is running by pinging it */
00029 
00030 BOOL winbindd_running(void)
00031 {
00032         return winbind_ping();
00033 }       
00034 #endif
00035 
00036 /* check to see if nmbd is running on localhost by looking for a __SAMBA__
00037    response */
00038 BOOL nmbd_running(void)
00039 {
00040         int fd, count, flags;
00041         struct in_addr *ip_list;
00042 
00043         if ((fd = open_socket_in(SOCK_DGRAM, 0, 3,
00044                                  interpret_addr("127.0.0.1"), True)) != -1) {
00045                 if ((ip_list = name_query(fd, "__SAMBA__", 0, 
00046                                           True, True, loopback_ip,
00047                                           &count, &flags, NULL)) != NULL) {
00048                         SAFE_FREE(ip_list);
00049                         close(fd);
00050                         return True;
00051                 }
00052                 close (fd);
00053         }
00054 
00055         return False;
00056 }
00057 
00058 
00059 /* check to see if smbd is running on localhost by trying to open a connection
00060    then closing it */
00061 BOOL smbd_running(void)
00062 {
00063         NTSTATUS status;
00064         struct cli_state *cli;
00065 
00066         if ((cli = cli_initialise()) == NULL)
00067                 return False;
00068 
00069         status = cli_connect(cli, global_myname(), &loopback_ip);
00070         if (!NT_STATUS_IS_OK(status)) {
00071                 cli_shutdown(cli);
00072                 return False;
00073         }
00074 
00075         cli_shutdown(cli);
00076         return True;
00077 }

Sambaに対してSat Aug 29 21:23:30 2009に生成されました。  doxygen 1.4.7