diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-09-13 16:28:25 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:51:43 -0500 |
commit | 48e2a2bfb75cdc914345b498012e82331546f0c0 (patch) | |
tree | 8c8d2d5a5583adffce55a4022ba120cec7c32ab8 /source3/rpc_server | |
parent | a4743f3a76dc88f765f9bc5dde8054b60d3045cc (diff) | |
download | samba-48e2a2bfb75cdc914345b498012e82331546f0c0.tar.gz samba-48e2a2bfb75cdc914345b498012e82331546f0c0.tar.bz2 samba-48e2a2bfb75cdc914345b498012e82331546f0c0.zip |
r18481: Use pidl-generated server side code for dfs.
(This used to be commit 3f337c104d42321595161d0283b39357df252a8e)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_dfs.c | 602 | ||||
-rw-r--r-- | source3/rpc_server/srv_dfs_nt.c | 207 |
2 files changed, 77 insertions, 732 deletions
diff --git a/source3/rpc_server/srv_dfs.c b/source3/rpc_server/srv_dfs.c deleted file mode 100644 index 44a9c06a3c..0000000000 --- a/source3/rpc_server/srv_dfs.c +++ /dev/null @@ -1,602 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * server auto-generated by pidl. DO NOT MODIFY! - */ - -#include "includes.h" -#include "nterr.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_RPC - -/****************************************************************** - api_dfs_GetManagerVersion - *****************************************************************/ - -static BOOL api_dfs_GetManagerVersion(pipes_struct *p) -{ - NETDFS_Q_DFS_GETMANAGERVERSION q_u; - NETDFS_R_DFS_GETMANAGERVERSION r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_GetManagerVersion("", &q_u, data, 0)) - return False; - - _dfs_GetManagerVersion(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_GetManagerVersion("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_Add - *****************************************************************/ - -static BOOL api_dfs_Add(pipes_struct *p) -{ - NETDFS_Q_DFS_ADD q_u; - NETDFS_R_DFS_ADD r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_Add("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_Add(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_Add("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_Remove - *****************************************************************/ - -static BOOL api_dfs_Remove(pipes_struct *p) -{ - NETDFS_Q_DFS_REMOVE q_u; - NETDFS_R_DFS_REMOVE r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_Remove("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_Remove(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_Remove("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_SetInfo - *****************************************************************/ - -static BOOL api_dfs_SetInfo(pipes_struct *p) -{ - NETDFS_Q_DFS_SETINFO q_u; - NETDFS_R_DFS_SETINFO r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_SetInfo("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_SetInfo(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_SetInfo("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_GetInfo - *****************************************************************/ - -static BOOL api_dfs_GetInfo(pipes_struct *p) -{ - NETDFS_Q_DFS_GETINFO q_u; - NETDFS_R_DFS_GETINFO r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_GetInfo("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_GetInfo(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_GetInfo("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_Enum - *****************************************************************/ - -static BOOL api_dfs_Enum(pipes_struct *p) -{ - NETDFS_Q_DFS_ENUM q_u; - NETDFS_R_DFS_ENUM r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_Enum("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_Enum(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_Enum("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_Rename - *****************************************************************/ - -static BOOL api_dfs_Rename(pipes_struct *p) -{ - NETDFS_Q_DFS_RENAME q_u; - NETDFS_R_DFS_RENAME r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_Rename("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_Rename(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_Rename("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_Move - *****************************************************************/ - -static BOOL api_dfs_Move(pipes_struct *p) -{ - NETDFS_Q_DFS_MOVE q_u; - NETDFS_R_DFS_MOVE r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_Move("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_Move(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_Move("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_ManagerGetConfigInfo - *****************************************************************/ - -static BOOL api_dfs_ManagerGetConfigInfo(pipes_struct *p) -{ - NETDFS_Q_DFS_MANAGERGETCONFIGINFO q_u; - NETDFS_R_DFS_MANAGERGETCONFIGINFO r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_ManagerGetConfigInfo("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_ManagerGetConfigInfo(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_ManagerGetConfigInfo("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_ManagerSendSiteInfo - *****************************************************************/ - -static BOOL api_dfs_ManagerSendSiteInfo(pipes_struct *p) -{ - NETDFS_Q_DFS_MANAGERSENDSITEINFO q_u; - NETDFS_R_DFS_MANAGERSENDSITEINFO r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_ManagerSendSiteInfo("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_ManagerSendSiteInfo(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_ManagerSendSiteInfo("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_AddFtRoot - *****************************************************************/ - -static BOOL api_dfs_AddFtRoot(pipes_struct *p) -{ - NETDFS_Q_DFS_ADDFTROOT q_u; - NETDFS_R_DFS_ADDFTROOT r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_AddFtRoot("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_AddFtRoot(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_AddFtRoot("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_RemoveFtRoot - *****************************************************************/ - -static BOOL api_dfs_RemoveFtRoot(pipes_struct *p) -{ - NETDFS_Q_DFS_REMOVEFTROOT q_u; - NETDFS_R_DFS_REMOVEFTROOT r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_RemoveFtRoot("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_RemoveFtRoot(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_RemoveFtRoot("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_AddStdRoot - *****************************************************************/ - -static BOOL api_dfs_AddStdRoot(pipes_struct *p) -{ - NETDFS_Q_DFS_ADDSTDROOT q_u; - NETDFS_R_DFS_ADDSTDROOT r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_AddStdRoot("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_AddStdRoot(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_AddStdRoot("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_RemoveStdRoot - *****************************************************************/ - -static BOOL api_dfs_RemoveStdRoot(pipes_struct *p) -{ - NETDFS_Q_DFS_REMOVESTDROOT q_u; - NETDFS_R_DFS_REMOVESTDROOT r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_RemoveStdRoot("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_RemoveStdRoot(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_RemoveStdRoot("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_ManagerInitialize - *****************************************************************/ - -static BOOL api_dfs_ManagerInitialize(pipes_struct *p) -{ - NETDFS_Q_DFS_MANAGERINITIALIZE q_u; - NETDFS_R_DFS_MANAGERINITIALIZE r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_ManagerInitialize("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_ManagerInitialize(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_ManagerInitialize("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_AddStdRootForced - *****************************************************************/ - -static BOOL api_dfs_AddStdRootForced(pipes_struct *p) -{ - NETDFS_Q_DFS_ADDSTDROOTFORCED q_u; - NETDFS_R_DFS_ADDSTDROOTFORCED r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_AddStdRootForced("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_AddStdRootForced(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_AddStdRootForced("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_GetDcAddress - *****************************************************************/ - -static BOOL api_dfs_GetDcAddress(pipes_struct *p) -{ - NETDFS_Q_DFS_GETDCADDRESS q_u; - NETDFS_R_DFS_GETDCADDRESS r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_GetDcAddress("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_GetDcAddress(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_GetDcAddress("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_SetDcAddress - *****************************************************************/ - -static BOOL api_dfs_SetDcAddress(pipes_struct *p) -{ - NETDFS_Q_DFS_SETDCADDRESS q_u; - NETDFS_R_DFS_SETDCADDRESS r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_SetDcAddress("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_SetDcAddress(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_SetDcAddress("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_FlushFtTable - *****************************************************************/ - -static BOOL api_dfs_FlushFtTable(pipes_struct *p) -{ - NETDFS_Q_DFS_FLUSHFTTABLE q_u; - NETDFS_R_DFS_FLUSHFTTABLE r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_FlushFtTable("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_FlushFtTable(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_FlushFtTable("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_Add2 - *****************************************************************/ - -static BOOL api_dfs_Add2(pipes_struct *p) -{ - NETDFS_Q_DFS_ADD2 q_u; - NETDFS_R_DFS_ADD2 r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_Add2("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_Add2(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_Add2("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_Remove2 - *****************************************************************/ - -static BOOL api_dfs_Remove2(pipes_struct *p) -{ - NETDFS_Q_DFS_REMOVE2 q_u; - NETDFS_R_DFS_REMOVE2 r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_Remove2("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_Remove2(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_Remove2("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_EnumEx - *****************************************************************/ - -static BOOL api_dfs_EnumEx(pipes_struct *p) -{ - NETDFS_Q_DFS_ENUMEX q_u; - NETDFS_R_DFS_ENUMEX r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_EnumEx("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_EnumEx(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_EnumEx("", &r_u, rdata, 0)) - return False; - - return True; -} -/****************************************************************** - api_dfs_SetInfo2 - *****************************************************************/ - -static BOOL api_dfs_SetInfo2(pipes_struct *p) -{ - NETDFS_Q_DFS_SETINFO2 q_u; - NETDFS_R_DFS_SETINFO2 r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!netdfs_io_q_dfs_SetInfo2("", &q_u, data, 0)) - return False; - - r_u.status = _dfs_SetInfo2(p, &q_u, &r_u); - - if (!netdfs_io_r_dfs_SetInfo2("", &r_u, rdata, 0)) - return False; - - return True; -} - -/* Tables */ -static struct api_struct api_netdfs_cmds[] = -{ - {"DFS_GETMANAGERVERSION", DFS_GETMANAGERVERSION, api_dfs_GetManagerVersion}, - {"DFS_ADD", DFS_ADD, api_dfs_Add}, - {"DFS_REMOVE", DFS_REMOVE, api_dfs_Remove}, - {"DFS_SETINFO", DFS_SETINFO, api_dfs_SetInfo}, - {"DFS_GETINFO", DFS_GETINFO, api_dfs_GetInfo}, - {"DFS_ENUM", DFS_ENUM, api_dfs_Enum}, - {"DFS_RENAME", DFS_RENAME, api_dfs_Rename}, - {"DFS_MOVE", DFS_MOVE, api_dfs_Move}, - {"DFS_MANAGERGETCONFIGINFO", DFS_MANAGERGETCONFIGINFO, api_dfs_ManagerGetConfigInfo}, - {"DFS_MANAGERSENDSITEINFO", DFS_MANAGERSENDSITEINFO, api_dfs_ManagerSendSiteInfo}, - {"DFS_ADDFTROOT", DFS_ADDFTROOT, api_dfs_AddFtRoot}, - {"DFS_REMOVEFTROOT", DFS_REMOVEFTROOT, api_dfs_RemoveFtRoot}, - {"DFS_ADDSTDROOT", DFS_ADDSTDROOT, api_dfs_AddStdRoot}, - {"DFS_REMOVESTDROOT", DFS_REMOVESTDROOT, api_dfs_RemoveStdRoot}, - {"DFS_MANAGERINITIALIZE", DFS_MANAGERINITIALIZE, api_dfs_ManagerInitialize}, - {"DFS_ADDSTDROOTFORCED", DFS_ADDSTDROOTFORCED, api_dfs_AddStdRootForced}, - {"DFS_GETDCADDRESS", DFS_GETDCADDRESS, api_dfs_GetDcAddress}, - {"DFS_SETDCADDRESS", DFS_SETDCADDRESS, api_dfs_SetDcAddress}, - {"DFS_FLUSHFTTABLE", DFS_FLUSHFTTABLE, api_dfs_FlushFtTable}, - {"DFS_ADD2", DFS_ADD2, api_dfs_Add2}, - {"DFS_REMOVE2", DFS_REMOVE2, api_dfs_Remove2}, - {"DFS_ENUMEX", DFS_ENUMEX, api_dfs_EnumEx}, - {"DFS_SETINFO2", DFS_SETINFO2, api_dfs_SetInfo2}, -}; - -void netdfs_get_pipe_fns(struct api_struct **fns, int *n_fns) -{ - *fns = api_netdfs_cmds; - *n_fns = sizeof(api_netdfs_cmds) / sizeof(struct api_struct); -} - -NTSTATUS rpc_netdfs_init(void) -{ - return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "netdfs", "netdfs", api_netdfs_cmds, sizeof(api_netdfs_cmds) / sizeof(struct api_struct)); -} diff --git a/source3/rpc_server/srv_dfs_nt.c b/source3/rpc_server/srv_dfs_nt.c index abdd9e8f23..4a5aad58b9 100644 --- a/source3/rpc_server/srv_dfs_nt.c +++ b/source3/rpc_server/srv_dfs_nt.c @@ -3,7 +3,7 @@ * RPC Pipe client / server routines for Dfs * Copyright (C) Shirish Kalele 2000. * Copyright (C) Jeremy Allison 2001. - * Copyright (C) Jelmer Vernooij 2005. + * 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 @@ -30,21 +30,20 @@ /* This function does not return a WERROR or NTSTATUS code but rather 1 if dfs exists, or 0 otherwise. */ -uint32 _dfs_GetManagerVersion(pipes_struct *p, NETDFS_Q_DFS_GETMANAGERVERSION *q_u, NETDFS_R_DFS_GETMANAGERVERSION *r_u) +void _dfs_GetManagerVersion(pipes_struct *p, uint32 *exists) { if(lp_host_msdfs()) - return 1; + *exists = 1; else - return 0; + *exists = 0; } -WERROR _dfs_Add(pipes_struct *p, NETDFS_Q_DFS_ADD* q_u, NETDFS_R_DFS_ADD *r_u) +WERROR _dfs_Add(pipes_struct *p, const char *path, const char *server, const char *share, const char *comment, uint32_t flags) { struct junction_map jn; struct referral* old_referral_list = NULL; BOOL exists = False; - pstring dfspath, servername, sharename; pstring altpath; if (p->pipe_user.ut.uid != 0) { @@ -52,19 +51,15 @@ WERROR _dfs_Add(pipes_struct *p, NETDFS_Q_DFS_ADD* q_u, NETDFS_R_DFS_ADD *r_u) return WERR_ACCESS_DENIED; } - unistr2_to_ascii(dfspath, &q_u->path, sizeof(dfspath)-1); - unistr2_to_ascii(servername, &q_u->server, sizeof(servername)-1); - unistr2_to_ascii(sharename, &q_u->share, sizeof(sharename)-1); - DEBUG(5,("init_reply_dfs_add: Request to add %s -> %s\\%s.\n", - dfspath, servername, sharename)); + path, server, share)); - pstrcpy(altpath, servername); + pstrcpy(altpath, server); pstrcat(altpath, "\\"); - pstrcat(altpath, sharename); + pstrcat(altpath, share); /* The following call can change the cwd. */ - if(get_referred_path(p->mem_ctx, dfspath, &jn, NULL, NULL)) { + if(get_referred_path(p->mem_ctx, path, &jn, NULL, NULL)) { exists = True; jn.referral_count += 1; old_referral_list = jn.referral_list; @@ -98,13 +93,11 @@ WERROR _dfs_Add(pipes_struct *p, NETDFS_Q_DFS_ADD* q_u, NETDFS_R_DFS_ADD *r_u) return WERR_OK; } -WERROR _dfs_Remove(pipes_struct *p, NETDFS_Q_DFS_REMOVE *q_u, - NETDFS_R_DFS_REMOVE *r_u) +WERROR _dfs_Remove(pipes_struct *p, const char *path, const char *server, const char *share) { struct junction_map jn; BOOL found = False; - pstring dfspath, servername, sharename; pstring altpath; if (p->pipe_user.ut.uid != 0) { @@ -112,31 +105,22 @@ WERROR _dfs_Remove(pipes_struct *p, NETDFS_Q_DFS_REMOVE *q_u, return WERR_ACCESS_DENIED; } - unistr2_to_ascii(dfspath, &q_u->path, sizeof(dfspath)-1); - if(q_u->ptr0_server) { - unistr2_to_ascii(servername, &q_u->server, sizeof(servername)-1); - } - - if(q_u->ptr0_share) { - unistr2_to_ascii(sharename, &q_u->share, sizeof(sharename)-1); - } - - if(q_u->ptr0_server && q_u->ptr0_share) { - pstrcpy(altpath, servername); + if(server && share) { + pstrcpy(altpath, server); pstrcat(altpath, "\\"); - pstrcat(altpath, sharename); + pstrcat(altpath, share); strlower_m(altpath); } DEBUG(5,("init_reply_dfs_remove: Request to remove %s -> %s\\%s.\n", - dfspath, servername, sharename)); + path, server, share)); - if(!get_referred_path(p->mem_ctx, dfspath, &jn, NULL, NULL)) { + if(!get_referred_path(p->mem_ctx, path, &jn, NULL, NULL)) { return WERR_DFS_NO_SUCH_VOL; } /* if no server-share pair given, remove the msdfs link completely */ - if(!q_u->ptr0_server && !q_u->ptr0_share) { + if(!server && !share) { if(!remove_msdfs_link(&jn)) { vfs_ChDir(p->conn,p->conn->connectpath); return WERR_DFS_NO_SUCH_VOL; @@ -181,61 +165,50 @@ WERROR _dfs_Remove(pipes_struct *p, NETDFS_Q_DFS_REMOVE *q_u, return WERR_OK; } -static BOOL init_reply_dfs_info_1(struct junction_map* j, NETDFS_DFS_INFO1* dfs1) +static BOOL init_reply_dfs_info_1(TALLOC_CTX *mem_ctx, struct junction_map* j, struct dfs_Info1* dfs1) { - pstring str; - dfs1->ptr0_path = 1; - slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s\\%s", global_myname(), - j->service_name, j->volume_name); - DEBUG(5,("init_reply_dfs_info_1: initing entrypath: %s\n",str)); - init_unistr2(&dfs1->path,str,UNI_STR_TERMINATE); + dfs1->path = talloc_asprintf(mem_ctx, + "\\\\%s\\%s\\%s", global_myname(), + j->service_name, j->volume_name); + 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, NETDFS_DFS_INFO2* dfs2) +static BOOL init_reply_dfs_info_2(TALLOC_CTX *mem_ctx, struct junction_map* j, struct dfs_Info2* dfs2) { - pstring str; - dfs2->ptr0_path = 1; - slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s\\%s", global_myname(), - j->service_name, j->volume_name); - init_unistr2(&dfs2->path, str, UNI_STR_TERMINATE); - dfs2->ptr0_comment = 0; - init_unistr2(&dfs2->comment, j->comment, UNI_STR_TERMINATE); + dfs2->path = talloc_asprintf(mem_ctx, + "\\\\%s\\%s\\%s", global_myname(), j->service_name, j->volume_name); + 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, NETDFS_DFS_INFO3* dfs3) +static BOOL init_reply_dfs_info_3(TALLOC_CTX *mem_ctx, struct junction_map* j, struct dfs_Info3* dfs3) { int ii; - pstring str; - dfs3->ptr0_path = 1; if (j->volume_name[0] == '\0') - slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s", + dfs3->path = talloc_asprintf(mem_ctx, "\\\\%s\\%s", global_myname(), j->service_name); else - slprintf(str, sizeof(pstring)-1, "\\\\%s\\%s\\%s", global_myname(), + dfs3->path = talloc_asprintf(mem_ctx, "\\\\%s\\%s\\%s", global_myname(), j->service_name, j->volume_name); - init_unistr2(&dfs3->path, str, UNI_STR_TERMINATE); - dfs3->ptr0_comment = 1; - init_unistr2(&dfs3->comment, j->comment, UNI_STR_TERMINATE); + dfs3->comment = talloc_strdup(mem_ctx, j->comment); dfs3->state = 1; - dfs3->num_stores = dfs3->size_stores = j->referral_count; - dfs3->ptr0_stores = 1; + dfs3->num_stores = j->referral_count; /* also enumerate the stores */ - dfs3->stores = TALLOC_ARRAY(ctx, NETDFS_DFS_STORAGEINFO, 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(NETDFS_DFS_STORAGEINFO)); + memset(dfs3->stores, '\0', j->referral_count * sizeof(struct dfs_StorageInfo)); for(ii=0;ii<j->referral_count;ii++) { char* p; pstring path; - NETDFS_DFS_STORAGEINFO* stor = &(dfs3->stores[ii]); + struct dfs_StorageInfo* stor = &(dfs3->stores[ii]); struct referral* ref = &(j->referral_list[ii]); pstrcpy(path, ref->alternate_path); @@ -248,24 +221,21 @@ static BOOL init_reply_dfs_info_3(TALLOC_CTX *ctx, struct junction_map* j, NETDF *p = '\0'; DEBUG(5,("storage %d: %s.%s\n",ii,path,p+1)); stor->state = 2; /* set all stores as ONLINE */ - init_unistr2(&stor->server, path, UNI_STR_TERMINATE); - init_unistr2(&stor->share, p+1, UNI_STR_TERMINATE); - stor->ptr0_server = stor->ptr0_share = 1; + stor->server = talloc_strdup(mem_ctx, path); + stor->share = talloc_strdup(mem_ctx, p+1); } return True; } -static BOOL init_reply_dfs_info_100(struct junction_map* j, NETDFS_DFS_INFO100* dfs100) +static BOOL init_reply_dfs_info_100(TALLOC_CTX *mem_ctx, struct junction_map* j, struct dfs_Info100* dfs100) { - dfs100->ptr0_comment = 1; - init_unistr2(&dfs100->comment, j->comment, UNI_STR_TERMINATE); + dfs100->comment = talloc_strdup(mem_ctx, j->comment); return True; } -WERROR _dfs_Enum(pipes_struct *p, NETDFS_Q_DFS_ENUM *q_u, NETDFS_R_DFS_ENUM *r_u) +WERROR _dfs_Enum(pipes_struct *p, uint32_t level, uint32_t bufsize, struct dfs_EnumStruct *info, uint32_t *unknown, uint32_t *total) { - uint32 level = q_u->level; struct junction_map jn[MAX_MSDFS_JUNCTIONS]; int num_jn = 0; int i; @@ -275,37 +245,27 @@ WERROR _dfs_Enum(pipes_struct *p, NETDFS_Q_DFS_ENUM *q_u, NETDFS_R_DFS_ENUM *r_u DEBUG(5,("_dfs_Enum: %d junctions found in Dfs, doing level %d\n", num_jn, level)); - r_u->ptr0_info = q_u->ptr0_info; - r_u->ptr0_total = q_u->ptr0_total; - r_u->total = num_jn; - - r_u->info = q_u->info; + *total = num_jn; /* Create the return array */ switch (level) { case 1: - if ((r_u->info.e.u.info1.s = TALLOC_ARRAY(p->mem_ctx, NETDFS_DFS_INFO1, num_jn)) == NULL) { + if ((info->e.info1->s = TALLOC_ARRAY(p->mem_ctx, struct dfs_Info1, num_jn)) == NULL) { return WERR_NOMEM; } - r_u->info.e.u.info1.count = num_jn; - r_u->info.e.u.info1.ptr0_s = 1; - r_u->info.e.u.info1.size_s = num_jn; + info->e.info1->count = num_jn; break; case 2: - if ((r_u->info.e.u.info2.s = TALLOC_ARRAY(p->mem_ctx, NETDFS_DFS_INFO2, num_jn)) == NULL) { + if ((info->e.info2->s = TALLOC_ARRAY(p->mem_ctx, struct dfs_Info2, num_jn)) == NULL) { return WERR_NOMEM; } - r_u->info.e.u.info2.count = num_jn; - r_u->info.e.u.info2.ptr0_s = 1; - r_u->info.e.u.info2.size_s = num_jn; + info->e.info2->count = num_jn; break; case 3: - if ((r_u->info.e.u.info3.s = TALLOC_ARRAY(p->mem_ctx, NETDFS_DFS_INFO3, num_jn)) == NULL) { + if ((info->e.info3->s = TALLOC_ARRAY(p->mem_ctx, struct dfs_Info3, num_jn)) == NULL) { return WERR_NOMEM; } - r_u->info.e.u.info3.count = num_jn; - r_u->info.e.u.info3.ptr0_s = 1; - r_u->info.e.u.info3.size_s = num_jn; + info->e.info3->count = num_jn; break; default: return WERR_INVALID_PARAM; @@ -314,35 +274,28 @@ WERROR _dfs_Enum(pipes_struct *p, NETDFS_Q_DFS_ENUM *q_u, NETDFS_R_DFS_ENUM *r_u for (i = 0; i < num_jn; i++) { switch (level) { case 1: - init_reply_dfs_info_1(&jn[i], &r_u->info.e.u.info1.s[i]); + init_reply_dfs_info_1(p->mem_ctx, &jn[i], &info->e.info1->s[i]); break; case 2: - init_reply_dfs_info_2(&jn[i], &r_u->info.e.u.info2.s[i]); + init_reply_dfs_info_2(p->mem_ctx, &jn[i], &info->e.info2->s[i]); break; case 3: - init_reply_dfs_info_3(p->mem_ctx, &jn[i], &r_u->info.e.u.info3.s[i]); + init_reply_dfs_info_3(p->mem_ctx, &jn[i], &info->e.info3->s[i]); break; default: return WERR_INVALID_PARAM; } } - r_u->status = WERR_OK; - - return r_u->status; + return WERR_OK; } -WERROR _dfs_GetInfo(pipes_struct *p, NETDFS_Q_DFS_GETINFO *q_u, - NETDFS_R_DFS_GETINFO *r_u) +WERROR _dfs_GetInfo(pipes_struct *p, const char *path, const char *server, const char *share, uint32_t level, union dfs_Info *info) { - UNISTR2* uni_path = &q_u->path; - uint32 level = q_u->level; int consumedcnt = sizeof(pstring); - pstring path; - BOOL ret = False; struct junction_map jn; + BOOL ret; - unistr2_to_ascii(path, uni_path, sizeof(path)-1); if(!create_junction(path, &jn)) return WERR_DFS_NO_SUCH_SERVER; @@ -353,132 +306,126 @@ WERROR _dfs_GetInfo(pipes_struct *p, NETDFS_Q_DFS_GETINFO *q_u, } vfs_ChDir(p->conn,p->conn->connectpath); - r_u->info.switch_value = level; - r_u->info.ptr0 = 1; - r_u->status = WERR_OK; switch (level) { - case 1: ret = init_reply_dfs_info_1(&jn, &r_u->info.u.info1); break; - case 2: ret = init_reply_dfs_info_2(&jn, &r_u->info.u.info2); break; - case 3: ret = init_reply_dfs_info_3(p->mem_ctx, &jn, &r_u->info.u.info3); break; - case 100: ret = init_reply_dfs_info_100(&jn, &r_u->info.u.info100); break; + case 1: ret = init_reply_dfs_info_1(p->mem_ctx, &jn, info->info1); break; + case 2: ret = init_reply_dfs_info_2(p->mem_ctx, &jn, info->info2); break; + case 3: ret = init_reply_dfs_info_3(p->mem_ctx, &jn, info->info3); break; + case 100: ret = init_reply_dfs_info_100(p->mem_ctx, &jn, info->info100); break; default: - r_u->info.ptr0 = 1; - r_u->info.switch_value = 0; - r_u->status = WERR_OK; - ret = True; - break; + info->info1 = NULL; + return WERR_INVALID_PARAM; } if (!ret) - r_u->status = WERR_INVALID_PARAM; + return WERR_INVALID_PARAM; - return r_u->status; + return WERR_OK; } -WERROR _dfs_SetInfo(pipes_struct *p, NETDFS_Q_DFS_SETINFO *q_u, NETDFS_R_DFS_SETINFO *r_u) +WERROR _dfs_SetInfo(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_Rename(pipes_struct *p, NETDFS_Q_DFS_RENAME *q_u, NETDFS_R_DFS_RENAME *r_u) +WERROR _dfs_Rename(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_Move(pipes_struct *p, NETDFS_Q_DFS_MOVE *q_u, NETDFS_R_DFS_MOVE *r_u) +WERROR _dfs_Move(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_ManagerGetConfigInfo(pipes_struct *p, NETDFS_Q_DFS_MANAGERGETCONFIGINFO *q_u, NETDFS_R_DFS_MANAGERGETCONFIGINFO *r_u) +WERROR _dfs_ManagerGetConfigInfo(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_ManagerSendSiteInfo(pipes_struct *p, NETDFS_Q_DFS_MANAGERSENDSITEINFO *q_u, NETDFS_R_DFS_MANAGERSENDSITEINFO *r_u) +WERROR _dfs_ManagerSendSiteInfo(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_AddFtRoot(pipes_struct *p, NETDFS_Q_DFS_ADDFTROOT *q_u, NETDFS_R_DFS_ADDFTROOT *r_u) +WERROR _dfs_AddFtRoot(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_RemoveFtRoot(pipes_struct *p, NETDFS_Q_DFS_REMOVEFTROOT *q_u, NETDFS_R_DFS_REMOVEFTROOT *r_u) +WERROR _dfs_RemoveFtRoot(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_AddStdRoot(pipes_struct *p, NETDFS_Q_DFS_ADDSTDROOT *q_u, NETDFS_R_DFS_ADDSTDROOT *r_u) +WERROR _dfs_AddStdRoot(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_RemoveStdRoot(pipes_struct *p, NETDFS_Q_DFS_REMOVESTDROOT *q_u, NETDFS_R_DFS_REMOVESTDROOT *r_u) +WERROR _dfs_RemoveStdRoot(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_ManagerInitialize(pipes_struct *p, NETDFS_Q_DFS_MANAGERINITIALIZE *q_u, NETDFS_R_DFS_MANAGERINITIALIZE *r_u) +WERROR _dfs_ManagerInitialize(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_AddStdRootForced(pipes_struct *p, NETDFS_Q_DFS_ADDSTDROOTFORCED *q_u, NETDFS_R_DFS_ADDSTDROOTFORCED *r_u) +WERROR _dfs_AddStdRootForced(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_GetDcAddress(pipes_struct *p, NETDFS_Q_DFS_GETDCADDRESS *q_u, NETDFS_R_DFS_GETDCADDRESS *r_u) +WERROR _dfs_GetDcAddress(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_SetDcAddress(pipes_struct *p, NETDFS_Q_DFS_SETDCADDRESS *q_u, NETDFS_R_DFS_SETDCADDRESS *r_u) +WERROR _dfs_SetDcAddress(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_FlushFtTable(pipes_struct *p, NETDFS_Q_DFS_FLUSHFTTABLE *q_u, NETDFS_R_DFS_FLUSHFTTABLE *r_u) +WERROR _dfs_FlushFtTable(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_Add2(pipes_struct *p, NETDFS_Q_DFS_ADD2 *q_u, NETDFS_R_DFS_ADD2 *r_u) +WERROR _dfs_Add2(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_Remove2(pipes_struct *p, NETDFS_Q_DFS_REMOVE2 *q_u, NETDFS_R_DFS_REMOVE2 *r_u) +WERROR _dfs_Remove2(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_EnumEx(pipes_struct *p, NETDFS_Q_DFS_ENUMEX *q_u, NETDFS_R_DFS_ENUMEX *r_u) +WERROR _dfs_EnumEx(pipes_struct *p, const char *name, uint32_t level, uint32_t bufsize, struct dfs_EnumStruct *info, uint32_t *total) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; } -WERROR _dfs_SetInfo2(pipes_struct *p, NETDFS_Q_DFS_SETINFO2 *q_u, NETDFS_R_DFS_SETINFO2 *r_u) +WERROR _dfs_SetInfo2(pipes_struct *p) { /* FIXME: Implement your code here */ return WERR_NOT_SUPPORTED; |