Added rpcclient/display_dfs.c module.
authorShirish Kalele <kalele@samba.org>
Fri, 17 Mar 2000 22:42:25 +0000 (22:42 +0000)
committerShirish Kalele <kalele@samba.org>
Fri, 17 Mar 2000 22:42:25 +0000 (22:42 +0000)
source/Makefile.in
source/include/proto.h
source/include/rpc_dfs.h
source/rpc_client/cli_dfs.c
source/rpc_parse/parse_dfs.c
source/rpcclient/cmd_dfs.c
source/rpcclient/dfs_cmds.c

index a652493ac5edfbfa3986b6dfadbd663e6e8f566d..0b876f22fbc842048259257211ad38baaeb92d9a 100644 (file)
@@ -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 \
index 30a0caaee30edda89bf8306aaa679e0f8dd9b374..397341a4f6006df5c51101636af249d095d69880 100644 (file)
@@ -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);
index 1677f7f7ed01eacb4e2cb0655c23d370bb061a49..35d240db7d6d59fd4dffb5dacac5363ca262318b 100644 (file)
@@ -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
 
index 415aabe3ca8b909ec46b59c263fa918909209ed1..ddebebbdc8c76a5fb4f3a48455abb62506f6ec4a 100644 (file)
@@ -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
index 136dadcfa40697219c323fa3917e1ba2c057f11c..982c9174f69bc72ed4ec11cf940008133c3ab5e0 100644 (file)
@@ -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"   
index d73613149c9da73b6e62fce7a4d3b2a592810d44..b9477b5783ddfd0cd37a7843b0d862355dc2b9d2 100644 (file)
@@ -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;
+    }
 }
 
     
index 6c21970333b38559acec571350afa42a69708aa1..7d7a6f2a80da406a39a7580e827ced7cb3dbaa38 100644 (file)
@@ -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"