summaryrefslogtreecommitdiff
path: root/source4/rpc_server/srvsvc
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-09-15 05:18:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:18:44 -0500
commitb0fb34fd24f5d73cfc2d3aca09379d85b9fb57dd (patch)
tree64217e71e2acf9c49c12bea35adf008373edc78c /source4/rpc_server/srvsvc
parentd928bce0d8ef5abbb1ef8fe659836b22e62266d1 (diff)
downloadsamba-b0fb34fd24f5d73cfc2d3aca09379d85b9fb57dd.tar.gz
samba-b0fb34fd24f5d73cfc2d3aca09379d85b9fb57dd.tar.bz2
samba-b0fb34fd24f5d73cfc2d3aca09379d85b9fb57dd.zip
r18542: Some late nite work.
Now we can add and remove a share from the "Computer Management" console (not yet modify!) usinf share backend = ldb (This used to be commit ae2f6d4a5a372a37b9783a02bb8e7f16588b21f0)
Diffstat (limited to 'source4/rpc_server/srvsvc')
-rw-r--r--source4/rpc_server/srvsvc/dcesrv_srvsvc.c75
1 files changed, 73 insertions, 2 deletions
diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
index 2464da447a..68ab1498c2 100644
--- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
+++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
@@ -452,10 +452,68 @@ static WERROR srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX
}
case 502:
{
+ NTSTATUS nterr;
+ struct share_info *info;
+ struct share_context *sctx;
+
+ nterr = share_get_context(mem_ctx, &sctx);
+ if (!NT_STATUS_IS_OK(nterr)) {
+ return ntstatus_to_werror(nterr);
+ }
+
+ info = talloc_zero(mem_ctx, struct share_info);
+ W_ERROR_HAVE_NO_MEMORY(info);
+
+ info->name = talloc_strdup(info, r->in.info.info502->name);
+ W_ERROR_HAVE_NO_MEMORY(info->name);
+ switch (r->in.info.info502->type) {
+ case 0x00:
+ info->type = talloc_strdup(mem_ctx, "DISK");
+ break;
+ case 0x01:
+ info->type = talloc_strdup(mem_ctx, "PRINTER");
+ break;
+ case 0x03:
+ info->type = talloc_strdup(mem_ctx, "IPC");
+ break;
+ default:
+ return WERR_INVALID_PARAM;
+ }
+ W_ERROR_HAVE_NO_MEMORY(info->type);
+
+ /* Windows will send a path in a form of C:\example\path */
+ if (r->in.info.info502->path[1] == ':') {
+ info->path = talloc_strdup(info, &r->in.info.info502->path[2]);
+ } else {
+ info->path = talloc_strdup(info, r->in.info.info502->path);
+ }
+ W_ERROR_HAVE_NO_MEMORY(info->path);
+ all_string_sub(info->path, "\\", "/", 0);
+
+ if (r->in.info.info502->comment && r->in.info.info502->comment[0]) {
+ info->comment = talloc_strdup(info, r->in.info.info502->comment);
+ W_ERROR_HAVE_NO_MEMORY(info->comment);
+ }
+
+ if (r->in.info.info502->password && r->in.info.info502->password[0]) {
+ info->password = talloc_strdup(info, r->in.info.info502->password);
+ W_ERROR_HAVE_NO_MEMORY(info->password);
+ }
+
+ info->max_users = r->in.info.info502->max_users;
+ /* TODO: security descriptor */
+
+
+ nterr = share_create(sctx, info);
+ if (!NT_STATUS_IS_OK(nterr)) {
+ return ntstatus_to_werror(nterr);
+ }
+
if (r->in.parm_error) {
r->out.parm_error = r->in.parm_error;
}
- return WERR_NOT_SUPPORTED;
+
+ return WERR_OK;
}
default:
return WERR_UNKNOWN_LEVEL;
@@ -1808,7 +1866,20 @@ static WERROR srvsvc_NETRSERVERTRANSPORTDELEX(struct dcesrv_call_state *dce_call
static WERROR srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct srvsvc_NetShareDel *r)
{
- DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
+ NTSTATUS nterr;
+ struct share_context *sctx;
+
+ nterr = share_get_context(mem_ctx, &sctx);
+ if (!NT_STATUS_IS_OK(nterr)) {
+ return ntstatus_to_werror(nterr);
+ }
+
+ nterr = share_remove(sctx, r->in.share_name);
+ if (!NT_STATUS_IS_OK(nterr)) {
+ return ntstatus_to_werror(nterr);
+ }
+
+ return WERR_OK;
}
/*