summaryrefslogtreecommitdiff
path: root/source4/rpc_server/common
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-07-23 18:43:07 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:10:18 -0500
commit9c66f601f1520a99b9236c32bc9f03a33bd4b2aa (patch)
treebba8797304b7db98aa205c3cb04344072be00030 /source4/rpc_server/common
parent2dc38416b65177aca94b4de3c9cfcb5c8edb0df2 (diff)
downloadsamba-9c66f601f1520a99b9236c32bc9f03a33bd4b2aa.tar.gz
samba-9c66f601f1520a99b9236c32bc9f03a33bd4b2aa.tar.bz2
samba-9c66f601f1520a99b9236c32bc9f03a33bd4b2aa.zip
r17206: Add a modular API for share configuration.
Commit the classic backwards compatible module which is the default one (This used to be commit a89cc346b9296cb49929898d257a064a6c2bae86)
Diffstat (limited to 'source4/rpc_server/common')
-rw-r--r--source4/rpc_server/common/common.h1
-rw-r--r--source4/rpc_server/common/share_info.c64
2 files changed, 19 insertions, 46 deletions
diff --git a/source4/rpc_server/common/common.h b/source4/rpc_server/common/common.h
index 0dc3814c71..7fec95ac52 100644
--- a/source4/rpc_server/common/common.h
+++ b/source4/rpc_server/common/common.h
@@ -60,4 +60,5 @@
struct dcesrv_context;
+#include "param/share.h"
#include "rpc_server/common/proto.h"
diff --git a/source4/rpc_server/common/share_info.c b/source4/rpc_server/common/share_info.c
index 285218bad1..727e89e84a 100644
--- a/source4/rpc_server/common/share_info.c
+++ b/source4/rpc_server/common/share_info.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "param/share.h"
#include "librpc/gen_ndr/srvsvc.h"
#include "rpc_server/dcerpc_server.h"
@@ -29,42 +30,19 @@
*/
/* This hardcoded value should go into a ldb database! */
-uint32_t dcesrv_common_get_count_of_shares(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
-{
- /* what's about int -> uint32_t overflow */
- return lp_numservices();
-}
-
-_PUBLIC_ const char *dcesrv_common_get_share_name(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
-{
- return talloc_strdup(mem_ctx, lp_servicename(snum));
-}
-
-const char *dcesrv_common_get_share_comment(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
-{
- return talloc_strdup(mem_ctx, lp_comment(snum));
-}
-
-/* This hardcoded value should go into a ldb database! */
-uint32_t dcesrv_common_get_share_permissions(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
+uint32_t dcesrv_common_get_share_permissions(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
{
return 0;
}
/* This hardcoded value should go into a ldb database! */
-uint32_t dcesrv_common_get_share_max_users(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
-{
- return lp_max_connections(snum);
-}
-
-/* This hardcoded value should go into a ldb database! */
-uint32_t dcesrv_common_get_share_current_users(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
+uint32_t dcesrv_common_get_share_current_users(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
{
return 1;
}
/* This hardcoded value should go into a ldb database! */
-enum srvsvc_ShareType dcesrv_common_get_share_type(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
+enum srvsvc_ShareType dcesrv_common_get_share_type(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
{
/* for disk share 0x00000000
* for print share 0x00000001
@@ -75,17 +53,19 @@ enum srvsvc_ShareType dcesrv_common_get_share_type(TALLOC_CTX *mem_ctx, struct d
* this ones are hidden in NetShareEnum, but shown in NetShareEnumAll
*/
enum srvsvc_ShareType share_type = 0;
+ const char *sharetype;
- if (!lp_browseable(snum)) {
+ if (!share_bool_option(scfg, SHARE_BROWSEABLE, SHARE_BROWSEABLE_DEFAULT)) {
share_type |= STYPE_HIDDEN;
}
- if (strcasecmp(lp_fstype(snum), "IPC") == 0) {
+ sharetype = share_string_option(scfg, SHARE_TYPE, SHARE_TYPE_DEFAULT);
+ if (sharetype && strcasecmp(sharetype, "IPC") == 0) {
share_type |= STYPE_IPC;
return share_type;
}
- if (lp_print_ok(snum)) {
+ if (sharetype && strcasecmp(sharetype, "PRINTER") == 0) {
share_type |= STYPE_PRINTQ;
return share_type;
}
@@ -96,40 +76,32 @@ enum srvsvc_ShareType dcesrv_common_get_share_type(TALLOC_CTX *mem_ctx, struct d
}
/* This hardcoded value should go into a ldb database! */
-const char *dcesrv_common_get_share_path(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
+const char *dcesrv_common_get_share_path(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
{
- if (strcasecmp(lp_fstype(snum), "IPC") == 0) {
+ const char *sharetype;
+
+ sharetype = share_string_option(scfg, SHARE_TYPE, SHARE_TYPE_DEFAULT);
+
+ if (sharetype && strcasecmp(sharetype, "IPC") == 0) {
return talloc_strdup(mem_ctx, "");
}
return talloc_strdup(mem_ctx, "C:\\");
}
/* This hardcoded value should go into a ldb database! */
-const char *dcesrv_common_get_share_password(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
-{
- return NULL;
-}
-
-/* This hardcoded value should go into a ldb database! */
-uint32_t dcesrv_common_get_share_csc_policy(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
-{
- return 0;
-}
-
-/* This hardcoded value should go into a ldb database! */
-uint32_t dcesrv_common_get_share_dfs_flags(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
+uint32_t dcesrv_common_get_share_dfs_flags(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
{
return 0;
}
/* This hardcoded value should go into a ldb database! */
-uint32_t dcesrv_common_get_share_unknown(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
+uint32_t dcesrv_common_get_share_unknown(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
{
return 0;
}
/* This hardcoded value should go into a ldb database! */
-struct security_descriptor *dcesrv_common_get_security_descriptor(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
+struct security_descriptor *dcesrv_common_get_security_descriptor(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
{
return NULL;
}