-/*
- * Unix SMB/Netbios implementation.
- * Version 1.9.
+/*
+ * Unix SMB/CIFS implementation.
* RPC Pipe client / server routines for Dfs
- * Copyright (C) Andrew Tridgell 1992-1997,
- * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
- * Copyright (C) Shirish Kalele 2000.
- * Copyright (C) Jeremy Allison 2001.
- *
+ * Copyright (C) Shirish Kalele 2000.
+ * Copyright (C) Jeremy Allison 2001-2007.
+ * Copyright (C) Jelmer Vernooij 2005-2006.
+ *
* 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,
* 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.
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
/* This is the implementation of the dfs pipe. */
#include "includes.h"
-#include "nterr.h"
-extern int DEBUGLEVEL;
-extern pstring global_myname;
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_MSDFS
-#ifdef WITH_MSDFS
+/* This function does not return a WERROR or NTSTATUS code but rather 1 if
+ dfs exists, or 0 otherwise. */
-#define MAX_MSDFS_JUNCTIONS 256
-
-uint32 _dfs_exist(pipes_struct *p, DFS_Q_DFS_EXIST *q_u, DFS_R_DFS_EXIST *r_u)
+void _dfs_GetManagerVersion(pipes_struct *p, struct dfs_GetManagerVersion *r)
{
- if(lp_host_msdfs())
- return 1;
- else
- return 0;
+ if (lp_host_msdfs()) {
+ *r->out.version = DFS_MANAGER_VERSION_NT4;
+ } else {
+ *r->out.version = (enum dfs_ManagerVersion)0;
+ }
}
-uint32 _dfs_add(pipes_struct *p, DFS_Q_DFS_ADD* q_u, DFS_R_DFS_ADD *r_u)
+WERROR _dfs_Add(pipes_struct *p, struct dfs_Add *r)
{
- struct current_user user;
- struct junction_map jn;
- struct referral* old_referral_list = NULL;
- BOOL exists = False;
-
- pstring dfspath, servername, sharename;
- pstring altpath;
-
- get_current_user(&user,p);
-
- if (user.uid != 0) {
- DEBUG(10,("_dfs_add: uid != 0. Access denied.\n"));
- return ERROR_ACCESS_DENIED;
- }
-
- unistr2_to_ascii(dfspath, &q_u->DfsEntryPath, sizeof(dfspath)-1);
- unistr2_to_ascii(servername, &q_u->ServerName, sizeof(servername)-1);
- unistr2_to_ascii(sharename, &q_u->ShareName, sizeof(sharename)-1);
-
- DEBUG(5,("init_reply_dfs_add: Request to add %s -> %s\\%s.\n",
- dfspath, servername, sharename));
-
- pstrcpy(altpath, servername);
- pstrcat(altpath, "\\");
- pstrcat(altpath, sharename);
-
- if(!create_junction(dfspath, &jn))
- return NERR_DfsNoSuchServer;
-
- if(get_referred_path(&jn))
- {
- exists = True;
- jn.referral_count += 1;
- old_referral_list = jn.referral_list;
- }
- else
- jn.referral_count = 1;
-
- jn.referral_list = (struct referral*) talloc(p->mem_ctx, jn.referral_count
- * sizeof(struct referral));
-
- if(jn.referral_list == NULL)
- {
- DEBUG(0,("init_reply_dfs_add: talloc failed for referral list!\n"));
- return NERR_DfsInternalError;
- }
-
- if(old_referral_list)
- {
- memcpy(jn.referral_list, old_referral_list,
- sizeof(struct referral)*jn.referral_count-1);
- free(old_referral_list);
- }
-
- jn.referral_list[jn.referral_count-1].proximity = 0;
- jn.referral_list[jn.referral_count-1].ttl = REFERRAL_TTL;
-
- pstrcpy(jn.referral_list[jn.referral_count-1].alternate_path, altpath);
-
- if(!create_msdfs_link(&jn, exists))
- return NERR_DfsCantCreateJunctionPoint;
-
- return NT_STATUS_NOPROBLEMO;
+ struct junction_map *jn = NULL;
+ struct referral *old_referral_list = NULL;
+ bool self_ref = False;
+ int consumedcnt = 0;
+ bool exists = False;
+ char *altpath = NULL;
+ NTSTATUS status;
+ TALLOC_CTX *ctx = talloc_tos();
+
+ if (p->pipe_user.ut.uid != 0) {
+ DEBUG(10,("_dfs_add: uid != 0. Access denied.\n"));
+ return WERR_ACCESS_DENIED;
+ }
+
+ jn = TALLOC_ZERO_P(ctx, struct junction_map);
+ if (!jn) {
+ return WERR_NOMEM;
+ }
+
+ DEBUG(5,("init_reply_dfs_add: Request to add %s -> %s\\%s.\n",
+ r->in.path, r->in.server, r->in.share));
+
+ altpath = talloc_asprintf(ctx, "%s\\%s",
+ r->in.server,
+ r->in.share);
+ if (!altpath) {
+ return WERR_NOMEM;
+ }
+
+ /* The following call can change the cwd. */
+ status = get_referred_path(ctx, r->in.path, jn,
+ &consumedcnt, &self_ref);
+ if(!NT_STATUS_IS_OK(status)) {
+ return ntstatus_to_werror(status);
+ }
+
+ exists = True;
+ jn->referral_count += 1;
+ old_referral_list = jn->referral_list;
+
+ vfs_ChDir(p->conn,p->conn->connectpath);
+
+ if (jn->referral_count < 1) {
+ return WERR_NOMEM;
+ }
+
+ jn->referral_list = TALLOC_ARRAY(ctx, struct referral, jn->referral_count);
+ if(jn->referral_list == NULL) {
+ DEBUG(0,("init_reply_dfs_add: talloc failed for referral list!\n"));
+ return WERR_DFS_INTERNAL_ERROR;
+ }
+
+ if(old_referral_list && jn->referral_list) {
+ memcpy(jn->referral_list, old_referral_list,
+ sizeof(struct referral)*jn->referral_count-1);
+ }
+
+ jn->referral_list[jn->referral_count-1].proximity = 0;
+ jn->referral_list[jn->referral_count-1].ttl = REFERRAL_TTL;
+ jn->referral_list[jn->referral_count-1].alternate_path = altpath;
+
+ if(!create_msdfs_link(jn, exists)) {
+ vfs_ChDir(p->conn,p->conn->connectpath);
+ return WERR_DFS_CANT_CREATE_JUNCT;
+ }
+ vfs_ChDir(p->conn,p->conn->connectpath);
+
+ return WERR_OK;
}
-uint32 _dfs_remove(pipes_struct *p, DFS_Q_DFS_REMOVE *q_u, DFS_R_DFS_REMOVE *r_u)
+WERROR _dfs_Remove(pipes_struct *p, struct dfs_Remove *r)
{
- struct current_user user;
- struct junction_map jn;
- BOOL found = False;
-
- pstring dfspath, servername, sharename;
- pstring altpath;
-
- get_current_user(&user,p);
-
- if (user.uid != 0) {
- DEBUG(10,("_dfs_remove: uid != 0. Access denied.\n"));
- return ERROR_ACCESS_DENIED;
- }
-
- unistr2_to_ascii(dfspath, &q_u->DfsEntryPath, sizeof(dfspath)-1);
- if(q_u->ptr_ServerName)
- unistr2_to_ascii(servername, &q_u->ServerName, sizeof(servername)-1);
-
- if(q_u->ptr_ShareName)
- unistr2_to_ascii(sharename, &q_u->ShareName, sizeof(sharename)-1);
-
- if(q_u->ptr_ServerName && q_u->ptr_ShareName)
- {
- pstrcpy(altpath, servername);
- pstrcat(altpath, "\\");
- pstrcat(altpath, sharename);
- }
-
- DEBUG(5,("init_reply_dfs_remove: Request to remove %s -> %s\\%s.\n",
- dfspath, servername, sharename));
-
- if(!create_junction(dfspath, &jn))
- return NERR_DfsNoSuchServer;
-
- if(!get_referred_path(&jn))
- return NERR_DfsNoSuchVolume;
-
- /* if no server-share pair given, remove the msdfs link completely */
- if(!q_u->ptr_ServerName && !q_u->ptr_ShareName)
- {
- if(!remove_msdfs_link(&jn))
- return NERR_DfsNoSuchVolume;
- }
- else
- {
- int i=0;
- /* compare each referral in the list with the one to remove */
- for(i=0;i<jn.referral_count;i++)
- {
- pstring refpath;
- pstrcpy(refpath,jn.referral_list[i].alternate_path);
- trim_string(refpath, "\\", "\\");
- if(strequal(refpath, altpath))
- {
- *(jn.referral_list[i].alternate_path)='\0';
- found = True;
- }
+ struct junction_map *jn = NULL;
+ bool self_ref = False;
+ int consumedcnt = 0;
+ bool found = False;
+ TALLOC_CTX *ctx = talloc_tos();
+ char *altpath = NULL;
+
+ if (p->pipe_user.ut.uid != 0) {
+ DEBUG(10,("_dfs_remove: uid != 0. Access denied.\n"));
+ return WERR_ACCESS_DENIED;
}
- if(!found)
- return NERR_DfsNoSuchShare;
-
- /* Only one referral, remove it */
- if(jn.referral_count == 1)
- {
- if(!remove_msdfs_link(&jn))
- return NERR_DfsNoSuchVolume;
+
+ jn = TALLOC_ZERO_P(ctx, struct junction_map);
+ if (!jn) {
+ return WERR_NOMEM;
}
- else
- {
- if(!create_msdfs_link(&jn, True))
- return NERR_DfsCantCreateJunctionPoint;
+
+ if (r->in.servername && r->in.sharename) {
+ altpath = talloc_asprintf(ctx, "%s\\%s",
+ r->in.servername,
+ r->in.sharename);
+ if (!altpath) {
+ return WERR_NOMEM;
+ }
+ strlower_m(altpath);
+ DEBUG(5,("init_reply_dfs_remove: Request to remove %s -> %s\\%s.\n",
+ r->in.dfs_entry_path, r->in.servername, r->in.sharename));
}
- }
- return NT_STATUS_NOPROBLEMO;
+ if(!NT_STATUS_IS_OK(get_referred_path(ctx, r->in.dfs_entry_path, jn,
+ &consumedcnt, &self_ref))) {
+ return WERR_DFS_NO_SUCH_VOL;
+ }
+
+ /* if no server-share pair given, remove the msdfs link completely */
+ if(!r->in.servername && !r->in.sharename) {
+ if(!remove_msdfs_link(jn)) {
+ vfs_ChDir(p->conn,p->conn->connectpath);
+ return WERR_DFS_NO_SUCH_VOL;
+ }
+ vfs_ChDir(p->conn,p->conn->connectpath);
+ } else {
+ int i=0;
+ /* compare each referral in the list with the one to remove */
+ DEBUG(10,("altpath: .%s. refcnt: %d\n", altpath, jn->referral_count));
+ for(i=0;i<jn->referral_count;i++) {
+ char *refpath = talloc_strdup(ctx,
+ jn->referral_list[i].alternate_path);
+ if (!refpath) {
+ return WERR_NOMEM;
+ }
+ trim_char(refpath, '\\', '\\');
+ DEBUG(10,("_dfs_remove: refpath: .%s.\n", refpath));
+ if(strequal(refpath, altpath)) {
+ *(jn->referral_list[i].alternate_path)='\0';
+ DEBUG(10,("_dfs_remove: Removal request matches referral %s\n",
+ refpath));
+ found = True;
+ }
+ }
+
+ if(!found) {
+ return WERR_DFS_NO_SUCH_SHARE;
+ }
+
+ /* Only one referral, remove it */
+ if(jn->referral_count == 1) {
+ if(!remove_msdfs_link(jn)) {
+ vfs_ChDir(p->conn,p->conn->connectpath);
+ return WERR_DFS_NO_SUCH_VOL;
+ }
+ } else {
+ if(!create_msdfs_link(jn, True)) {
+ vfs_ChDir(p->conn,p->conn->connectpath);
+ return WERR_DFS_CANT_CREATE_JUNCT;
+ }
+ }
+ vfs_ChDir(p->conn,p->conn->connectpath);
+ }
+
+ return WERR_OK;
}
-static BOOL init_reply_dfs_info_1(struct junction_map* j, DFS_INFO_1* dfs1, int num_j)
+static bool init_reply_dfs_info_1(TALLOC_CTX *mem_ctx, struct junction_map* j,struct dfs_Info1* dfs1)
{
- int i=0;
- for(i=0;i<num_j;i++)
- {
- pstring str;
- dfs1[i].ptr_entrypath = 1;
- slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s\\%s", global_myname,
- j[i].service_name, j[i].volume_name);
- DEBUG(5,("init_reply_dfs_info_1: %d) initing entrypath: %s\n",i,str));
- init_unistr2(&dfs1[i].entrypath,str,strlen(str)+1);
- }
- return True;
+ dfs1->path = talloc_asprintf(mem_ctx,
+ "\\\\%s\\%s\\%s", global_myname(),
+ j->service_name, j->volume_name);
+ if (dfs1->path == NULL)
+ return False;
+
+ DEBUG(5,("init_reply_dfs_info_1: initing entrypath: %s\n",dfs1->path));
+ return True;
}
-static BOOL init_reply_dfs_info_2(struct junction_map* j, DFS_INFO_2* dfs2, int num_j)
+static bool init_reply_dfs_info_2(TALLOC_CTX *mem_ctx, struct junction_map* j, struct dfs_Info2* dfs2)
{
- int i=0;
- for(i=0;i<num_j;i++)
- {
- pstring str;
- dfs2[i].ptr_entrypath = 1;
- slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s\\%s", global_myname,
- j[i].service_name, j[i].volume_name);
- init_unistr2(&dfs2[i].entrypath, str, strlen(str)+1);
- dfs2[i].ptr_comment = 0;
- dfs2[i].state = 1; /* set up state of dfs junction as OK */
- dfs2[i].num_storages = j[i].referral_count;
- }
- return True;
+ dfs2->path = talloc_asprintf(mem_ctx,
+ "\\\\%s\\%s\\%s", global_myname(), j->service_name, j->volume_name);
+ if (dfs2->path == NULL)
+ return False;
+ dfs2->comment = talloc_strdup(mem_ctx, j->comment);
+ dfs2->state = 1; /* set up state of dfs junction as OK */
+ dfs2->num_stores = j->referral_count;
+ return True;
}
-static BOOL init_reply_dfs_info_3(TALLOC_CTX *ctx, struct junction_map* j, DFS_INFO_3* dfs3, int num_j)
+static bool init_reply_dfs_info_3(TALLOC_CTX *mem_ctx, struct junction_map* j, struct dfs_Info3* dfs3)
{
- int i=0,ii=0;
- for(i=0;i<num_j;i++)
- {
- pstring str;
- dfs3[i].ptr_entrypath = 1;
- slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s\\%s", global_myname,
- j[i].service_name, j[i].volume_name);
- init_unistr2(&dfs3[i].entrypath, str, strlen(str)+1);
- dfs3[i].ptr_comment = 1;
- init_unistr2(&dfs3[i].comment, "", 1);
- dfs3[i].state = 1;
- dfs3[i].num_storages = dfs3[i].num_storage_infos = j[i].referral_count;
- dfs3[i].ptr_storages = 1;
-
- /* also enumerate the storages */
- dfs3[i].storages = (DFS_STORAGE_INFO*) talloc(ctx, j[i].referral_count *
- sizeof(DFS_STORAGE_INFO));
- if (!dfs3[i].storages)
- return False;
-
- memset(dfs3[i].storages, '\0', j[i].referral_count * sizeof(DFS_STORAGE_INFO));
-
- for(ii=0;ii<j[i].referral_count;ii++)
- {
- char* p;
- pstring path;
- DFS_STORAGE_INFO* stor = &(dfs3[i].storages[ii]);
- struct referral* ref = &(j[i].referral_list[ii]);
-
- pstrcpy(path, ref->alternate_path);
- trim_string(path,"\\","");
- p = strrchr(path,'\\');
- if(p==NULL)
- {
- DEBUG(4,("init_reply_dfs_info_3: invalid path: no \\ found in %s\n",path));
- continue;
- }
- *p = '\0';
- DEBUG(5,("storage %d: %s.%s\n",ii,path,p+1));
- stor->state = 2; /* set all storages as ONLINE */
- init_unistr2(&stor->servername, path, strlen(path)+1);
- init_unistr2(&stor->sharename, p+1, strlen(p+1)+1);
- stor->ptr_servername = stor->ptr_sharename = 1;
+ int ii;
+ if (j->volume_name[0] == '\0')
+ dfs3->path = talloc_asprintf(mem_ctx, "\\\\%s\\%s",
+ global_myname(), j->service_name);
+ else
+ dfs3->path = talloc_asprintf(mem_ctx, "\\\\%s\\%s\\%s", global_myname(),
+ j->service_name, j->volume_name);
+
+ if (dfs3->path == NULL)
+ return False;
+
+ dfs3->comment = talloc_strdup(mem_ctx, j->comment);
+ dfs3->state = 1;
+ dfs3->num_stores = j->referral_count;
+
+ /* also enumerate the stores */
+ if (j->referral_count) {
+ dfs3->stores = TALLOC_ARRAY(mem_ctx, struct dfs_StorageInfo, j->referral_count);
+ if (!dfs3->stores)
+ return False;
+ memset(dfs3->stores, '\0', j->referral_count * sizeof(struct dfs_StorageInfo));
+ } else {
+ dfs3->stores = NULL;
}
- }
- return True;
+
+ for(ii=0;ii<j->referral_count;ii++) {
+ char* p;
+ char *path = NULL;
+ struct dfs_StorageInfo* stor = &(dfs3->stores[ii]);
+ struct referral* ref = &(j->referral_list[ii]);
+
+ path = talloc_strdup(mem_ctx, ref->alternate_path);
+ if (!path) {
+ return False;
+ }
+ trim_char(path,'\\','\0');
+ p = strrchr_m(path,'\\');
+ if(p==NULL) {
+ DEBUG(4,("init_reply_dfs_info_3: invalid path: no \\ found in %s\n",path));
+ continue;
+ }
+ *p = '\0';
+ DEBUG(5,("storage %d: %s.%s\n",ii,path,p+1));
+ stor->state = 2; /* set all stores as ONLINE */
+ stor->server = talloc_strdup(mem_ctx, path);
+ stor->share = talloc_strdup(mem_ctx, p+1);
+ }
+ return True;
}
-static uint32 init_reply_dfs_ctr(TALLOC_CTX *ctx, uint32 level, DFS_INFO_CTR* ctr,
- struct junction_map* jn, int num_jn)
+static bool init_reply_dfs_info_100(TALLOC_CTX *mem_ctx, struct junction_map* j, struct dfs_Info100* dfs100)
{
- /* do the levels */
- switch(level)
- {
- case 1:
- {
- DFS_INFO_1* dfs1;
- dfs1 = (DFS_INFO_1*) talloc(ctx, num_jn * sizeof(DFS_INFO_1));
- if (!dfs1)
- return NT_STATUS_NO_MEMORY;
- init_reply_dfs_info_1(jn, dfs1, num_jn);
- ctr->dfs.info1 = dfs1;
- break;
- }
- case 2:
- {
- DFS_INFO_2* dfs2;
- dfs2 = (DFS_INFO_2*) talloc(ctx, num_jn * sizeof(DFS_INFO_2));
- if (!dfs2)
- return NT_STATUS_NO_MEMORY;
- init_reply_dfs_info_2(jn, dfs2, num_jn);
- ctr->dfs.info2 = dfs2;
- break;
- }
- case 3:
- {
- DFS_INFO_3* dfs3;
- dfs3 = (DFS_INFO_3*) talloc(ctx, num_jn * sizeof(DFS_INFO_3));
- if (!dfs3)
- return NT_STATUS_NO_MEMORY;
- init_reply_dfs_info_3(ctx, jn, dfs3, num_jn);
- ctr->dfs.info3 = dfs3;
- break;
- }
+ dfs100->comment = talloc_strdup(mem_ctx, j->comment);
+ return True;
+}
+
+WERROR _dfs_Enum(pipes_struct *p, struct dfs_Enum *r)
+{
+ struct junction_map *jn = NULL;
+ size_t num_jn = 0;
+ size_t i;
+ TALLOC_CTX *ctx = talloc_tos();
+
+ jn = enum_msdfs_links(ctx, &num_jn);
+ if (!jn || num_jn == 0) {
+ num_jn = 0;
+ jn = NULL;
+ }
+ vfs_ChDir(p->conn,p->conn->connectpath);
+
+ DEBUG(5,("_dfs_Enum: %u junctions found in Dfs, doing level %d\n",
+ (unsigned int)num_jn, r->in.level));
+
+ *r->out.total = num_jn;
+
+ /* Create the return array */
+ switch (r->in.level) {
+ case 1:
+ if (num_jn) {
+ if ((r->out.info->e.info1->s = TALLOC_ARRAY(ctx, struct dfs_Info1, num_jn)) == NULL) {
+ return WERR_NOMEM;
+ }
+ } else {
+ r->out.info->e.info1->s = NULL;
+ }
+ r->out.info->e.info1->count = num_jn;
+ break;
+ case 2:
+ if (num_jn) {
+ if ((r->out.info->e.info2->s = TALLOC_ARRAY(ctx, struct dfs_Info2, num_jn)) == NULL) {
+ return WERR_NOMEM;
+ }
+ } else {
+ r->out.info->e.info2->s = NULL;
+ }
+ r->out.info->e.info2->count = num_jn;
+ break;
+ case 3:
+ if (num_jn) {
+ if ((r->out.info->e.info3->s = TALLOC_ARRAY(ctx, struct dfs_Info3, num_jn)) == NULL) {
+ return WERR_NOMEM;
+ }
+ } else {
+ r->out.info->e.info3->s = NULL;
+ }
+ r->out.info->e.info3->count = num_jn;
+ break;
default:
- return NT_STATUS_INVALID_LEVEL;
- }
- return NT_STATUS_NOPROBLEMO;
+ return WERR_INVALID_PARAM;
+ }
+
+ for (i = 0; i < num_jn; i++) {
+ switch (r->in.level) {
+ case 1:
+ init_reply_dfs_info_1(ctx, &jn[i], &r->out.info->e.info1->s[i]);
+ break;
+ case 2:
+ init_reply_dfs_info_2(ctx, &jn[i], &r->out.info->e.info2->s[i]);
+ break;
+ case 3:
+ init_reply_dfs_info_3(ctx, &jn[i], &r->out.info->e.info3->s[i]);
+ break;
+ default:
+ return WERR_INVALID_PARAM;
+ }
+ }
+
+ return WERR_OK;
+}
+
+WERROR _dfs_GetInfo(pipes_struct *p, struct dfs_GetInfo *r)
+{
+ int consumedcnt = strlen(r->in.dfs_entry_path);
+ struct junction_map *jn = NULL;
+ bool self_ref = False;
+ TALLOC_CTX *ctx = talloc_tos();
+ bool ret;
+
+ jn = TALLOC_ZERO_P(ctx, struct junction_map);
+ if (!jn) {
+ return WERR_NOMEM;
+ }
+
+ if(!create_junction(ctx, r->in.dfs_entry_path, jn)) {
+ return WERR_DFS_NO_SUCH_SERVER;
+ }
+
+ /* The following call can change the cwd. */
+ if(!NT_STATUS_IS_OK(get_referred_path(ctx, r->in.dfs_entry_path,
+ jn, &consumedcnt, &self_ref)) ||
+ consumedcnt < strlen(r->in.dfs_entry_path)) {
+ vfs_ChDir(p->conn,p->conn->connectpath);
+ return WERR_DFS_NO_SUCH_VOL;
+ }
+
+ vfs_ChDir(p->conn,p->conn->connectpath);
+
+ switch (r->in.level) {
+ case 1:
+ r->out.info->info1 = TALLOC_ZERO_P(ctx,struct dfs_Info1);
+ if (!r->out.info->info1) {
+ return WERR_NOMEM;
+ }
+ ret = init_reply_dfs_info_1(ctx, jn, r->out.info->info1);
+ break;
+ case 2:
+ r->out.info->info2 = TALLOC_ZERO_P(ctx,struct dfs_Info2);
+ if (!r->out.info->info2) {
+ return WERR_NOMEM;
+ }
+ ret = init_reply_dfs_info_2(ctx, jn, r->out.info->info2);
+ break;
+ case 3:
+ r->out.info->info3 = TALLOC_ZERO_P(ctx,struct dfs_Info3);
+ if (!r->out.info->info3) {
+ return WERR_NOMEM;
+ }
+ ret = init_reply_dfs_info_3(ctx, jn, r->out.info->info3);
+ break;
+ case 100:
+ r->out.info->info100 = TALLOC_ZERO_P(ctx,struct dfs_Info100);
+ if (!r->out.info->info100) {
+ return WERR_NOMEM;
+ }
+ ret = init_reply_dfs_info_100(ctx, jn, r->out.info->info100);
+ break;
+ default:
+ r->out.info->info1 = NULL;
+ return WERR_INVALID_PARAM;
+ }
+
+ if (!ret)
+ return WERR_INVALID_PARAM;
+
+ return WERR_OK;
+}
+
+WERROR _dfs_SetInfo(pipes_struct *p, struct dfs_SetInfo *r)
+{
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
+}
+
+WERROR _dfs_Rename(pipes_struct *p, struct dfs_Rename *r)
+{
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
+}
+
+WERROR _dfs_Move(pipes_struct *p, struct dfs_Move *r)
+{
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
+}
+
+WERROR _dfs_ManagerGetConfigInfo(pipes_struct *p, struct dfs_ManagerGetConfigInfo *r)
+{
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
}
-
-uint32 _dfs_enum(pipes_struct *p, DFS_Q_DFS_ENUM *q_u, DFS_R_DFS_ENUM *r_u)
+
+WERROR _dfs_ManagerSendSiteInfo(pipes_struct *p, struct dfs_ManagerSendSiteInfo *r)
+{
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
+}
+
+WERROR _dfs_AddFtRoot(pipes_struct *p, struct dfs_AddFtRoot *r)
+{
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
+}
+
+WERROR _dfs_RemoveFtRoot(pipes_struct *p, struct dfs_RemoveFtRoot *r)
+{
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
+}
+
+WERROR _dfs_AddStdRoot(pipes_struct *p, struct dfs_AddStdRoot *r)
+{
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
+}
+
+WERROR _dfs_RemoveStdRoot(pipes_struct *p, struct dfs_RemoveStdRoot *r)
{
- uint32 level = q_u->level;
- struct junction_map jn[MAX_MSDFS_JUNCTIONS];
- int num_jn = 0;
-
- num_jn = enum_msdfs_links(jn);
-
- DEBUG(5,("make_reply_dfs_enum: %d junctions found in Dfs, doing level %d\n", num_jn, level));
-
- r_u->ptr_buffer = level;
- r_u->level = r_u->level2 = level;
- r_u->ptr_num_entries = r_u->ptr_num_entries2 = 1;
- r_u->num_entries = r_u->num_entries2 = num_jn;
- r_u->reshnd.ptr_hnd = 1;
- r_u->reshnd.handle = num_jn;
-
- r_u->ctr = (DFS_INFO_CTR*)talloc(p->mem_ctx, sizeof(DFS_INFO_CTR));
- if (!r_u->ctr)
- return NT_STATUS_NO_MEMORY;
- ZERO_STRUCTP(r_u->ctr);
- r_u->ctr->switch_value = level;
- r_u->ctr->num_entries = num_jn;
- r_u->ctr->ptr_dfs_ctr = 1;
-
- r_u->status = init_reply_dfs_ctr(p->mem_ctx, level, r_u->ctr, jn, num_jn);
-
- return r_u->status;
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
}
-
-uint32 _dfs_get_info(pipes_struct *p, DFS_Q_DFS_GET_INFO *q_u, DFS_R_DFS_GET_INFO *r_u)
+
+WERROR _dfs_ManagerInitialize(pipes_struct *p, struct dfs_ManagerInitialize *r)
+{
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
+}
+
+WERROR _dfs_AddStdRootForced(pipes_struct *p, struct dfs_AddStdRootForced *r)
+{
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
+}
+
+WERROR _dfs_GetDcAddress(pipes_struct *p, struct dfs_GetDcAddress *r)
+{
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
+}
+
+WERROR _dfs_SetDcAddress(pipes_struct *p, struct dfs_SetDcAddress *r)
+{
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
+}
+
+WERROR _dfs_FlushFtTable(pipes_struct *p, struct dfs_FlushFtTable *r)
+{
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
+}
+
+WERROR _dfs_Add2(pipes_struct *p, struct dfs_Add2 *r)
+{
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
+}
+
+WERROR _dfs_Remove2(pipes_struct *p, struct dfs_Remove2 *r)
+{
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
+}
+
+WERROR _dfs_EnumEx(pipes_struct *p, struct dfs_EnumEx *r)
+{
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
+}
+
+WERROR _dfs_SetInfo2(pipes_struct *p, struct dfs_SetInfo2 *r)
{
- UNISTR2* uni_path = &q_u->uni_path;
- uint32 level = q_u->level;
- pstring path;
- struct junction_map jn;
-
- unistr2_to_ascii(path, uni_path, sizeof(path)-1);
- if(!create_junction(path, &jn))
- return NERR_DfsNoSuchServer;
-
- if(!get_referred_path(&jn))
- return NERR_DfsNoSuchVolume;
-
- r_u->level = level;
- r_u->ptr_ctr = 1;
- r_u->status = init_reply_dfs_ctr(p->mem_ctx, level, &r_u->ctr, &jn, 1);
-
- return r_u->status;
+ /* FIXME: Implement your code here */
+ p->rng_fault_state = True;
+ return WERR_NOT_SUPPORTED;
}
-#else
- void dfs_dummy1(void) {;} /* So some compilers don't complain. */
-#endif