summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShirish Kalele <kalele@samba.org>2000-03-17 22:42:25 +0000
committerShirish Kalele <kalele@samba.org>2000-03-17 22:42:25 +0000
commit491a54a2cc74b76a7b55d8456e6938ebd00de366 (patch)
tree9faafed28df6849bc58826ceb6a7c8e32432a010
parent8c39308572164d860182d315346c84b584794e0c (diff)
downloadsamba-491a54a2cc74b76a7b55d8456e6938ebd00de366.tar.gz
samba-491a54a2cc74b76a7b55d8456e6938ebd00de366.tar.xz
samba-491a54a2cc74b76a7b55d8456e6938ebd00de366.zip
Added rpcclient/display_dfs.c module.
-rw-r--r--source/Makefile.in1
-rw-r--r--source/include/proto.h13
-rw-r--r--source/include/rpc_dfs.h23
-rw-r--r--source/rpc_client/cli_dfs.c23
-rw-r--r--source/rpc_parse/parse_dfs.c23
-rw-r--r--source/rpcclient/cmd_dfs.c148
-rw-r--r--source/rpcclient/dfs_cmds.c23
7 files changed, 131 insertions, 123 deletions
diff --git a/source/Makefile.in b/source/Makefile.in
index a652493ac5e..0b876f22fbc 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -590,6 +590,7 @@ RPCCLIENT_OBJ = lib/cmd_interp.o \
rpcclient/display_srv.o \
rpcclient/display_svc.o \
rpcclient/display_sync.o \
+ rpcclient/display_dfs.o \
rpcclient/cmd_lsarpc.o \
rpcclient/cmd_wkssvc.o \
rpcclient/cmd_brs.o \
diff --git a/source/include/proto.h b/source/include/proto.h
index 30a0caaee30..397341a4f60 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -3459,11 +3459,6 @@ void cmd_brs_query_info(struct client_info *info, int argc, char *argv[]);
void cmd_dfs_add(struct client_info *info, int argc, char *argv[]);
void cmd_dfs_remove(struct client_info *info, int argc, char *argv[]);
-void display_dfs_enum_1(FILE *out_hnd, DFS_INFO_CTR *ctr);
-void display_dfs_enum_2(FILE *out_hnd, DFS_INFO_CTR *ctr);
-void display_dfs_enum_3_storages(FILE *out_hnd, DFS_INFO_3 *info3);
-void display_dfs_enum_3(FILE *out_hnd, DFS_INFO_CTR *ctr);
-void display_dfs_enum(FILE *out_hnd, char *srv_name, DFS_INFO_CTR *ctr);
void cmd_dfs_enum(struct client_info *info, int argc, char *argv[]);
/*The following definitions come from rpcclient/cmd_eventlog.c */
@@ -3618,6 +3613,14 @@ void display_at_enum_info(FILE *out_hnd, enum action_type action,
void display_at_job_info(FILE *out_hnd, enum action_type action,
AT_JOB_INFO *const job, fstring command);
+/*The following definitions come from rpcclient/display_dfs.c */
+
+void display_dfs_enum_1(FILE *hnd, DFS_INFO_CTR *ctr);
+void display_dfs_enum_2(FILE *hnd, DFS_INFO_CTR *ctr);
+void display_dfs_enum_3_storages(FILE *hnd, DFS_INFO_3 *info3);
+void display_dfs_enum_3(FILE *hnd, DFS_INFO_CTR *ctr);
+void display_dfs_enum(FILE *hnd, char *srv_name, DFS_INFO_CTR *ctr);
+
/*The following definitions come from rpcclient/display_event.c */
void display_eventlog_eventrecord(FILE *out_hnd, enum action_type action, EVENTLOGRECORD *const ev);
diff --git a/source/include/rpc_dfs.h b/source/include/rpc_dfs.h
index 1677f7f7ed0..35d240db7d6 100644
--- a/source/include/rpc_dfs.h
+++ b/source/include/rpc_dfs.h
@@ -1,3 +1,26 @@
+/*
+ Unix SMB/Netbios implementation.
+ Version 3.0
+ Samba parameters and setup
+ Copyright (C) Andrew Tridgell 1992-2000
+ Copyright (C) Luke Kenneth Casson Leighton 1996 - 2000
+ Copyright (C) Shirish Kalele 2000
+
+ 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.
+*/
+
#ifndef _RPC_DFS_H
#define _RPC_DFS_H
diff --git a/source/rpc_client/cli_dfs.c b/source/rpc_client/cli_dfs.c
index 415aabe3ca8..ddebebbdc8c 100644
--- a/source/rpc_client/cli_dfs.c
+++ b/source/rpc_client/cli_dfs.c
@@ -1,3 +1,26 @@
+/*
+ Unix SMB/Netbios implementation.
+ Version 3.0
+ MSDfs RPC calls
+ Copyright (C) Andrew Tridgell 1992-2000
+ Copyright (C) Luke Kenneth Casson Leighton 1996 - 2000
+ Copyright (C) Shirish Kalele 2000
+
+ 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.
+*/
+
#ifdef SYSLOG
#undef SYSLOG
#endif
diff --git a/source/rpc_parse/parse_dfs.c b/source/rpc_parse/parse_dfs.c
index 136dadcfa40..982c9174f69 100644
--- a/source/rpc_parse/parse_dfs.c
+++ b/source/rpc_parse/parse_dfs.c
@@ -1,3 +1,26 @@
+/*
+ * Unix SMB/Netbios implementation.
+ * Version 1.9.
+ * MSDfs RPC Pipe client / server routines
+ * Copyright (C) Andrew Tridgell 1992-2000,
+ * Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
+ * Copyright (C) Shirish Kalele 2000.
+ *
+ * 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 "nterr.h"
#include "rpc_parse.h"
diff --git a/source/rpcclient/cmd_dfs.c b/source/rpcclient/cmd_dfs.c
index d73613149c9..b9477b5783d 100644
--- a/source/rpcclient/cmd_dfs.c
+++ b/source/rpcclient/cmd_dfs.c
@@ -1,3 +1,26 @@
+/*
+ Unix SMB/Netbios implementation.
+ Version 3.0
+ Samba utility functions
+ Copyright (C) Andrew Tridgell 1992-2000
+ Copyright (C) Luke Kenneth Casson Leighton 1996 - 2000
+ Copyright (C) Shirish Kalele 2000
+
+ 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.
+*/
+
#ifdef SYSLOG
#undef SYSLOG
#endif
@@ -36,8 +59,8 @@ void cmd_dfs_add(struct client_info *info, int argc, char *argv[])
if(argc > 4)
comment = argv[4];
- DEBUG(5,("Adding Dfs path: %s\n(physically located at \\\\%s\\%s\n",entrypath,
- servername,sharename));
+ DEBUG(5,("Adding Dfs path: %s\n(physically located at \\\\%s\\%s\n",
+ entrypath, servername, sharename));
if(!dfs_add(srv_name, entrypath, servername, sharename, comment))
{
@@ -85,122 +108,7 @@ void cmd_dfs_remove(struct client_info *info, int argc, char *argv[])
}
}
-void display_dfs_enum_1(FILE *hnd, DFS_INFO_CTR *ctr)
-{
- int i=0;
- for(i=0;i<ctr->num_entries;i++)
- {
- fstring path;
- UNISTR2 *unipath = &(ctr->dfs.info1[i].entrypath);
- unistr2_to_ascii(path, unipath, sizeof(path)-1);
- report(hnd, "Path: %s\n",path);
- }
- free(ctr->dfs.info1);
-}
-
-void display_dfs_enum_2(FILE *hnd, DFS_INFO_CTR *ctr)
-{
- int i=0;
- for(i=0;i<ctr->num_entries;i++)
- {
- fstring path, comment;
- fstring state;
- UNISTR2 *unipath = &(ctr->dfs.info2[i].entrypath);
- UNISTR2 *unicomment = &(ctr->dfs.info2[i].comment);
- unistr2_to_ascii(path, unipath, sizeof(path)-1);
- unistr2_to_ascii(comment, unicomment, sizeof(comment)-1);
-
- report(hnd, "Path: %s\n",path);
- if(*comment)
- report(hnd, "Comment: [%s]\n",comment);
-
- switch(ctr->dfs.info2[i].state)
- {
- case 1: fstrcpy(state, "OK"); break;
- case 2: fstrcpy(state, "INCONSISTENT"); break;
- case 3: fstrcpy(state, "OFFLINE"); break;
- case 4: fstrcpy(state, "ONLINE"); break;
- default: fstrcpy(state, "UNKNOWN"); break;
- }
- report(hnd, "State: %s Number of storages: %u\n\n",state,
- ctr->dfs.info2[i].num_storages);
- }
- free(ctr->dfs.info2);
-}
-
-void display_dfs_enum_3_storages(FILE *hnd, DFS_INFO_3 *info3)
-{
- int i=0;
- if((info3 == NULL) || (info3->storages==NULL))
- return;
-
- for(i=0;i<info3->num_storages;i++)
- {
- DFS_STORAGE_INFO *stor = &(info3->storages[i]);
- fstring servername, sharename,storagepath;
- unistr2_to_ascii(servername, &(stor->servername), sizeof(servername)-1);
- unistr2_to_ascii(sharename, &(stor->sharename), sizeof(sharename)-1);
- fstrcpy(storagepath,"\\\\");
- fstrcat(storagepath,servername);
- fstrcat(storagepath,"\\");
- fstrcat(storagepath,sharename);
-
- report(hnd, " Storage %1u: %-33s[%s] \n",i+1, storagepath,
- (stor->state==2?"ONLINE":"OFFLINE"));
- }
-}
-void display_dfs_enum_3(FILE *hnd, DFS_INFO_CTR *ctr)
-{
- int i=0;
- for(i=0;i<ctr->num_entries;i++)
- {
- fstring path, comment;
- fstring state;
- UNISTR2 *unipath = &(ctr->dfs.info3[i].entrypath);
- UNISTR2 *unicomment = &(ctr->dfs.info3[i].comment);
- unistr2_to_ascii(path, unipath, sizeof(path)-1);
- unistr2_to_ascii(comment, unicomment, sizeof(comment)-1);
-
- switch(ctr->dfs.info3[i].state)
- {
- case 1: fstrcpy(state, "OK"); break;
- case 2: fstrcpy(state, "INCONSISTENT"); break;
- case 3: fstrcpy(state, "OFFLINE"); break;
- case 4: fstrcpy(state, "ONLINE"); break;
- default: fstrcpy(state, "UNKNOWN"); break;
- }
-
- report(hnd, "Dfs path:%-40sState: %s\n",path,state);
- if(*comment)
- report(hnd, "Comment: [%s]\n",comment);
-
- display_dfs_enum_3_storages(hnd, &(ctr->dfs.info3[i]));
- report(hnd,"\n");
- }
- free(ctr->dfs.info3);
-}
-void display_dfs_enum(FILE *hnd, char *srv_name, DFS_INFO_CTR *ctr)
-{
- /* print header */
- report(hnd, "\tDfs Namespace at %s [Info level %u]\n\n",srv_name,
- ctr->switch_value);
- switch(ctr->switch_value)
- {
- case 1:
- display_dfs_enum_1(hnd, ctr);
- break;
- case 2:
- display_dfs_enum_2(hnd, ctr);
- break;
- case 3:
- display_dfs_enum_3(hnd, ctr);
- break;
- default:
- report(hnd, "\tUnknown info level [%u]\n",ctr->switch_value);
- }
- report(hnd, "\n");
-}
/****************************************************************************
DFS enum query
@@ -236,9 +144,13 @@ void cmd_dfs_enum(struct client_info *info, int argc, char *argv[])
{
DEBUG(5,("cmd_dfs_enum: query succeeded\n"));
display_dfs_enum(out_hnd, srv_name, &ctr);
+ return;
}
else
- report(out_hnd, "FAILED: %s\n",get_nt_error_msg(res));
+ {
+ report(out_hnd, "FAILED: %s\n",get_nt_error_msg(res));
+ return;
+ }
}
diff --git a/source/rpcclient/dfs_cmds.c b/source/rpcclient/dfs_cmds.c
index 6c21970333b..7d7a6f2a80d 100644
--- a/source/rpcclient/dfs_cmds.c
+++ b/source/rpcclient/dfs_cmds.c
@@ -1,3 +1,26 @@
+/*
+ Unix SMB/Netbios implementation.
+ Version 3.0
+ MSDfs rpcclient commands
+ Copyright (C) Andrew Tridgell 1992-2000
+ Copyright (C) Luke Kenneth Casson Leighton 1996 - 2000
+ Copyright (C) Shirish Kalele 2000
+
+ 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 "ntdomain.h"
#include "rpcclient.h"