Merge branch 'master' of ssh://git.samba.org/data/git/samba
authorJelmer Vernooij <jelmer@samba.org>
Thu, 8 Jan 2009 11:27:52 +0000 (12:27 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 8 Jan 2009 11:27:52 +0000 (12:27 +0100)
55 files changed:
librpc/gen_ndr/cli_svcctl.c
librpc/gen_ndr/cli_svcctl.h
librpc/gen_ndr/ndr_svcctl.c
librpc/gen_ndr/ndr_svcctl.h
librpc/gen_ndr/svcctl.h
librpc/idl/svcctl.idl
source3/Makefile.in
source3/include/proto.h
source3/include/rpc_svcctl.h
source3/rpc_parse/parse_svcctl.c
source3/rpc_server/srv_svcctl.c
source3/rpc_server/srv_svcctl_nt.c
source3/smbd/aio.c
source3/smbd/blocking.c
source3/smbd/chgpasswd.c
source3/smbd/conn.c
source3/smbd/dfree.c
source3/smbd/dir.c
source3/smbd/dmapi.c
source3/smbd/error.c
source3/smbd/fake_file.c
source3/smbd/fileio.c
source3/smbd/files.c
source3/smbd/globals.c [new file with mode: 0644]
source3/smbd/globals.h [new file with mode: 0644]
source3/smbd/ipc.c
source3/smbd/mangle.c
source3/smbd/mangle_hash.c
source3/smbd/mangle_hash2.c
source3/smbd/map_username.c
source3/smbd/message.c
source3/smbd/msdfs.c
source3/smbd/negprot.c
source3/smbd/notify.c
source3/smbd/nttrans.c
source3/smbd/open.c
source3/smbd/oplock.c
source3/smbd/oplock_irix.c
source3/smbd/oplock_linux.c
source3/smbd/password.c
source3/smbd/process.c
source3/smbd/quotas.c
source3/smbd/reply.c
source3/smbd/seal.c
source3/smbd/sec_ctx.c
source3/smbd/server.c
source3/smbd/service.c
source3/smbd/session.c
source3/smbd/sesssetup.c
source3/smbd/srvstr.c
source3/smbd/trans2.c
source3/smbd/uid.c
source3/smbd/utmp.c
source3/smbd/vfs.c
source4/torture/rpc/svcctl.c

index 3288e4a1ec76144b8c2cec8cb12e6d4fbc0ada5b..28318b31b18689f09c700981eb56cda24fdc9ea3 100644 (file)
@@ -509,8 +509,8 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli,
                                            TALLOC_CTX *mem_ctx,
                                            struct policy_handle *handle /* [in] [ref] */,
                                            uint32_t type /* [in]  */,
-                                           uint32_t start /* [in]  */,
-                                           uint32_t error /* [in]  */,
+                                           enum svcctl_StartType start_type /* [in]  */,
+                                           enum svcctl_ErrorControl error_control /* [in]  */,
                                            const char *binary_path /* [in] [unique,charset(UTF16)] */,
                                            const char *load_order_group /* [in] [unique,charset(UTF16)] */,
                                            uint32_t *tag_id /* [out] [ref] */,
@@ -526,8 +526,8 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli,
        /* In parameters */
        r.in.handle = handle;
        r.in.type = type;
-       r.in.start = start;
-       r.in.error = error;
+       r.in.start_type = start_type;
+       r.in.error_control = error_control;
        r.in.binary_path = binary_path;
        r.in.load_order_group = load_order_group;
        r.in.dependencies = dependencies;
@@ -575,8 +575,8 @@ NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli,
                                      const char *DisplayName /* [in] [unique,charset(UTF16)] */,
                                      uint32_t desired_access /* [in]  */,
                                      uint32_t type /* [in]  */,
-                                     uint32_t start_type /* [in]  */,
-                                     uint32_t error_control /* [in]  */,
+                                     enum svcctl_StartType start_type /* [in]  */,
+                                     enum svcctl_ErrorControl error_control /* [in]  */,
                                      const char *binary_path /* [in] [charset(UTF16)] */,
                                      const char *LoadOrderGroupKey /* [in] [unique,charset(UTF16)] */,
                                      uint32_t *TagId /* [in,out] [unique] */,
@@ -701,7 +701,7 @@ NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli,
                                           TALLOC_CTX *mem_ctx,
                                           struct policy_handle *handle /* [in] [ref] */,
                                           uint32_t type /* [in]  */,
-                                          uint32_t state /* [in]  */,
+                                          enum svcctl_ServiceState state /* [in]  */,
                                           uint8_t *service /* [out] [ref,size_is(buf_size)] */,
                                           uint32_t buf_size /* [in] [range(0,262144)] */,
                                           uint32_t *bytes_needed /* [out] [ref,range(0,262144)] */,
@@ -1157,8 +1157,8 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli,
                                            TALLOC_CTX *mem_ctx,
                                            struct policy_handle *handle /* [in] [ref] */,
                                            uint32_t type /* [in]  */,
-                                           uint32_t start /* [in]  */,
-                                           uint32_t error /* [in]  */,
+                                           enum svcctl_StartType start_type /* [in]  */,
+                                           enum svcctl_ErrorControl error_control /* [in]  */,
                                            const char *binary_path /* [in] [unique,charset(UTF16)] */,
                                            const char *load_order_group /* [in] [unique,charset(UTF16)] */,
                                            uint32_t *tag_id /* [out] [ref] */,
@@ -1174,8 +1174,8 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli,
        /* In parameters */
        r.in.handle = handle;
        r.in.type = type;
-       r.in.start = start;
-       r.in.error = error;
+       r.in.start_type = start_type;
+       r.in.error_control = error_control;
        r.in.binary_path = binary_path;
        r.in.load_order_group = load_order_group;
        r.in.dependencies = dependencies;
@@ -1223,8 +1223,8 @@ NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli,
                                      const char *DisplayName /* [in] [unique,charset(UTF16)] */,
                                      uint32_t desired_access /* [in]  */,
                                      uint32_t type /* [in]  */,
-                                     uint32_t start_type /* [in]  */,
-                                     uint32_t error_control /* [in]  */,
+                                     enum svcctl_StartType start_type /* [in]  */,
+                                     enum svcctl_ErrorControl error_control /* [in]  */,
                                      const char *binary_path /* [in] [unique,charset(UTF16)] */,
                                      const char *LoadOrderGroupKey /* [in] [unique,charset(UTF16)] */,
                                      uint32_t *TagId /* [out] [unique] */,
@@ -1924,7 +1924,7 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfig2W(struct rpc_pipe_client *cli,
 NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli,
                                            TALLOC_CTX *mem_ctx,
                                            struct policy_handle *handle /* [in] [ref] */,
-                                           uint32_t info_level /* [in]  */,
+                                           enum svcctl_ConfigLevel info_level /* [in]  */,
                                            uint8_t *buffer /* [out]  */,
                                            uint32_t buf_size /* [in]  */,
                                            uint32_t *bytes_needed /* [out] [ref] */,
@@ -1975,7 +1975,7 @@ NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli,
 NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli,
                                            TALLOC_CTX *mem_ctx,
                                            struct policy_handle *handle /* [in] [ref] */,
-                                           uint32_t info_level /* [in]  */,
+                                           enum svcctl_ConfigLevel info_level /* [in]  */,
                                            uint8_t *buffer /* [out] [ref,size_is(buf_size)] */,
                                            uint32_t buf_size /* [in] [range(0,8192)] */,
                                            uint32_t *bytes_needed /* [out] [ref,range(0,8192)] */,
@@ -2026,7 +2026,7 @@ NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli,
 NTSTATUS rpccli_svcctl_QueryServiceStatusEx(struct rpc_pipe_client *cli,
                                            TALLOC_CTX *mem_ctx,
                                            struct policy_handle *handle /* [in] [ref] */,
-                                           uint32_t info_level /* [in]  */,
+                                           enum svcctl_StatusLevel info_level /* [in]  */,
                                            uint8_t *buffer /* [out] [ref,size_is(buf_size)] */,
                                            uint32_t buf_size /* [in] [range(0,8192)] */,
                                            uint32_t *bytes_needed /* [out] [ref,range(0,8192)] */,
index fbd15b32a5ce27d80a9a2ec0f2a54cbf54b7c1c7..575256f62ac2e718553ce93e73313ed4760aecb5 100644 (file)
@@ -61,8 +61,8 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli,
                                            TALLOC_CTX *mem_ctx,
                                            struct policy_handle *handle /* [in] [ref] */,
                                            uint32_t type /* [in]  */,
-                                           uint32_t start /* [in]  */,
-                                           uint32_t error /* [in]  */,
+                                           enum svcctl_StartType start_type /* [in]  */,
+                                           enum svcctl_ErrorControl error_control /* [in]  */,
                                            const char *binary_path /* [in] [unique,charset(UTF16)] */,
                                            const char *load_order_group /* [in] [unique,charset(UTF16)] */,
                                            uint32_t *tag_id /* [out] [ref] */,
@@ -78,8 +78,8 @@ NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli,
                                      const char *DisplayName /* [in] [unique,charset(UTF16)] */,
                                      uint32_t desired_access /* [in]  */,
                                      uint32_t type /* [in]  */,
-                                     uint32_t start_type /* [in]  */,
-                                     uint32_t error_control /* [in]  */,
+                                     enum svcctl_StartType start_type /* [in]  */,
+                                     enum svcctl_ErrorControl error_control /* [in]  */,
                                      const char *binary_path /* [in] [charset(UTF16)] */,
                                      const char *LoadOrderGroupKey /* [in] [unique,charset(UTF16)] */,
                                      uint32_t *TagId /* [in,out] [unique] */,
@@ -103,7 +103,7 @@ NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli,
                                           TALLOC_CTX *mem_ctx,
                                           struct policy_handle *handle /* [in] [ref] */,
                                           uint32_t type /* [in]  */,
-                                          uint32_t state /* [in]  */,
+                                          enum svcctl_ServiceState state /* [in]  */,
                                           uint8_t *service /* [out] [ref,size_is(buf_size)] */,
                                           uint32_t buf_size /* [in] [range(0,262144)] */,
                                           uint32_t *bytes_needed /* [out] [ref,range(0,262144)] */,
@@ -169,8 +169,8 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli,
                                            TALLOC_CTX *mem_ctx,
                                            struct policy_handle *handle /* [in] [ref] */,
                                            uint32_t type /* [in]  */,
-                                           uint32_t start /* [in]  */,
-                                           uint32_t error /* [in]  */,
+                                           enum svcctl_StartType start_type /* [in]  */,
+                                           enum svcctl_ErrorControl error_control /* [in]  */,
                                            const char *binary_path /* [in] [unique,charset(UTF16)] */,
                                            const char *load_order_group /* [in] [unique,charset(UTF16)] */,
                                            uint32_t *tag_id /* [out] [ref] */,
@@ -186,8 +186,8 @@ NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli,
                                      const char *DisplayName /* [in] [unique,charset(UTF16)] */,
                                      uint32_t desired_access /* [in]  */,
                                      uint32_t type /* [in]  */,
-                                     uint32_t start_type /* [in]  */,
-                                     uint32_t error_control /* [in]  */,
+                                     enum svcctl_StartType start_type /* [in]  */,
+                                     enum svcctl_ErrorControl error_control /* [in]  */,
                                      const char *binary_path /* [in] [unique,charset(UTF16)] */,
                                      const char *LoadOrderGroupKey /* [in] [unique,charset(UTF16)] */,
                                      uint32_t *TagId /* [out] [unique] */,
@@ -283,7 +283,7 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfig2W(struct rpc_pipe_client *cli,
 NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli,
                                            TALLOC_CTX *mem_ctx,
                                            struct policy_handle *handle /* [in] [ref] */,
-                                           uint32_t info_level /* [in]  */,
+                                           enum svcctl_ConfigLevel info_level /* [in]  */,
                                            uint8_t *buffer /* [out]  */,
                                            uint32_t buf_size /* [in]  */,
                                            uint32_t *bytes_needed /* [out] [ref] */,
@@ -291,7 +291,7 @@ NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli,
 NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli,
                                            TALLOC_CTX *mem_ctx,
                                            struct policy_handle *handle /* [in] [ref] */,
-                                           uint32_t info_level /* [in]  */,
+                                           enum svcctl_ConfigLevel info_level /* [in]  */,
                                            uint8_t *buffer /* [out] [ref,size_is(buf_size)] */,
                                            uint32_t buf_size /* [in] [range(0,8192)] */,
                                            uint32_t *bytes_needed /* [out] [ref,range(0,8192)] */,
@@ -299,7 +299,7 @@ NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli,
 NTSTATUS rpccli_svcctl_QueryServiceStatusEx(struct rpc_pipe_client *cli,
                                            TALLOC_CTX *mem_ctx,
                                            struct policy_handle *handle /* [in] [ref] */,
-                                           uint32_t info_level /* [in]  */,
+                                           enum svcctl_StatusLevel info_level /* [in]  */,
                                            uint8_t *buffer /* [out] [ref,size_is(buf_size)] */,
                                            uint32_t buf_size /* [in] [range(0,8192)] */,
                                            uint32_t *bytes_needed /* [out] [ref,range(0,8192)] */,
index 590d493092de4437bc486735f327d23cdac863b9..54c49adef4714b9df592abfec86ff9fabc70f0db 100644 (file)
@@ -119,6 +119,42 @@ _PUBLIC_ void ndr_print_SERVICE_STATUS(struct ndr_print *ndr, const char *name,
        ndr->depth--;
 }
 
+_PUBLIC_ enum ndr_err_code ndr_push_SERVICE_STATUS_PROCESS(struct ndr_push *ndr, int ndr_flags, const struct SERVICE_STATUS_PROCESS *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_SERVICE_STATUS(ndr, NDR_SCALARS, &r->status));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->process_id));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->service_flags));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_SERVICE_STATUS_PROCESS(struct ndr_pull *ndr, int ndr_flags, struct SERVICE_STATUS_PROCESS *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_SERVICE_STATUS(ndr, NDR_SCALARS, &r->status));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->process_id));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->service_flags));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_SERVICE_STATUS_PROCESS(struct ndr_print *ndr, const char *name, const struct SERVICE_STATUS_PROCESS *r)
+{
+       ndr_print_struct(ndr, name, "SERVICE_STATUS_PROCESS");
+       ndr->depth++;
+       ndr_print_SERVICE_STATUS(ndr, "status", &r->status);
+       ndr_print_uint32(ndr, "process_id", r->process_id);
+       ndr_print_uint32(ndr, "service_flags", r->service_flags);
+       ndr->depth--;
+}
+
 static enum ndr_err_code ndr_push_ENUM_SERVICE_STATUS(struct ndr_push *ndr, int ndr_flags, const struct ENUM_SERVICE_STATUS *r)
 {
        if (ndr_flags & NDR_SCALARS) {
@@ -325,6 +361,87 @@ _PUBLIC_ void ndr_print_SERVICE_CONTROL(struct ndr_print *ndr, const char *name,
        ndr_print_enum(ndr, name, "ENUM", val, r);
 }
 
+static enum ndr_err_code ndr_push_svcctl_ErrorControl(struct ndr_push *ndr, int ndr_flags, enum svcctl_ErrorControl r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_svcctl_ErrorControl(struct ndr_pull *ndr, int ndr_flags, enum svcctl_ErrorControl *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_svcctl_ErrorControl(struct ndr_print *ndr, const char *name, enum svcctl_ErrorControl r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case SVCCTL_SVC_ERROR_IGNORE: val = "SVCCTL_SVC_ERROR_IGNORE"; break;
+               case SVCCTL_SVC_ERROR_NORMAL: val = "SVCCTL_SVC_ERROR_NORMAL"; break;
+               case SVCCTL_SVC_ERROR_CRITICAL: val = "SVCCTL_SVC_ERROR_CRITICAL"; break;
+               case SVCCTL_SVC_ERROR_SEVERE: val = "SVCCTL_SVC_ERROR_SEVERE"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_svcctl_StartType(struct ndr_push *ndr, int ndr_flags, enum svcctl_StartType r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_svcctl_StartType(struct ndr_pull *ndr, int ndr_flags, enum svcctl_StartType *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_svcctl_StartType(struct ndr_print *ndr, const char *name, enum svcctl_StartType r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case SVCCTL_BOOT_START: val = "SVCCTL_BOOT_START"; break;
+               case SVCCTL_SYSTEM_START: val = "SVCCTL_SYSTEM_START"; break;
+               case SVCCTL_AUTO_START: val = "SVCCTL_AUTO_START"; break;
+               case SVCCTL_DEMAND_START: val = "SVCCTL_DEMAND_START"; break;
+               case SVCCTL_DISABLED: val = "SVCCTL_DISABLED"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_svcctl_ServiceState(struct ndr_push *ndr, int ndr_flags, enum svcctl_ServiceState r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_svcctl_ServiceState(struct ndr_pull *ndr, int ndr_flags, enum svcctl_ServiceState *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_svcctl_ServiceState(struct ndr_print *ndr, const char *name, enum svcctl_ServiceState r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case SVCCTL_STATE_ACTIVE: val = "SVCCTL_STATE_ACTIVE"; break;
+               case SVCCTL_STATE_INACTIVE: val = "SVCCTL_STATE_INACTIVE"; break;
+               case SVCCTL_STATE_ALL: val = "SVCCTL_STATE_ALL"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
 static enum ndr_err_code ndr_push_svcctl_MgrAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r)
 {
        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
@@ -387,8 +504,8 @@ _PUBLIC_ enum ndr_err_code ndr_push_QUERY_SERVICE_CONFIG(struct ndr_push *ndr, i
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 4));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->service_type));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->start_type));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->error_control));
+               NDR_CHECK(ndr_push_svcctl_StartType(ndr, NDR_SCALARS, r->start_type));
+               NDR_CHECK(ndr_push_svcctl_ErrorControl(ndr, NDR_SCALARS, r->error_control));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->executablepath));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->loadordergroup));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->tag_id));
@@ -446,8 +563,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_QUERY_SERVICE_CONFIG(struct ndr_pull *ndr, i
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_pull_align(ndr, 4));
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->service_type));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->start_type));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->error_control));
+               NDR_CHECK(ndr_pull_svcctl_StartType(ndr, NDR_SCALARS, &r->start_type));
+               NDR_CHECK(ndr_pull_svcctl_ErrorControl(ndr, NDR_SCALARS, &r->error_control));
                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_executablepath));
                if (_ptr_executablepath) {
                        NDR_PULL_ALLOC(ndr, r->executablepath);
@@ -550,8 +667,8 @@ _PUBLIC_ void ndr_print_QUERY_SERVICE_CONFIG(struct ndr_print *ndr, const char *
        ndr_print_struct(ndr, name, "QUERY_SERVICE_CONFIG");
        ndr->depth++;
        ndr_print_uint32(ndr, "service_type", r->service_type);
-       ndr_print_uint32(ndr, "start_type", r->start_type);
-       ndr_print_uint32(ndr, "error_control", r->error_control);
+       ndr_print_svcctl_StartType(ndr, "start_type", r->start_type);
+       ndr_print_svcctl_ErrorControl(ndr, "error_control", r->error_control);
        ndr_print_ptr(ndr, "executablepath", r->executablepath);
        ndr->depth++;
        if (r->executablepath) {
@@ -591,6 +708,394 @@ _PUBLIC_ size_t ndr_size_QUERY_SERVICE_CONFIG(const struct QUERY_SERVICE_CONFIG
        return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_QUERY_SERVICE_CONFIG, ic);
 }
 
+static enum ndr_err_code ndr_push_svcctl_ConfigLevel(struct ndr_push *ndr, int ndr_flags, enum svcctl_ConfigLevel r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_svcctl_ConfigLevel(struct ndr_pull *ndr, int ndr_flags, enum svcctl_ConfigLevel *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_svcctl_ConfigLevel(struct ndr_print *ndr, const char *name, enum svcctl_ConfigLevel r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case SERVICE_CONFIG_DESCRIPTION: val = "SERVICE_CONFIG_DESCRIPTION"; break;
+               case SERVICE_CONFIG_FAILURE_ACTIONS: val = "SERVICE_CONFIG_FAILURE_ACTIONS"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_SERVICE_DESCRIPTION(struct ndr_push *ndr, int ndr_flags, const struct SERVICE_DESCRIPTION *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->description));
+                       ndr->flags = _flags_save_string;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->description) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->description));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->description));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_SERVICE_DESCRIPTION(struct ndr_pull *ndr, int ndr_flags, struct SERVICE_DESCRIPTION *r)
+{
+       uint32_t _ptr_description;
+       TALLOC_CTX *_mem_save_description_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_description));
+                       if (_ptr_description) {
+                               NDR_PULL_ALLOC(ndr, r->description);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->description, _ptr_description));
+                       } else {
+                               r->description = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->description) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->description));
+                               _mem_save_description_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->description, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->description));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_description_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_SERVICE_DESCRIPTION(struct ndr_print *ndr, const char *name, const struct SERVICE_DESCRIPTION *r)
+{
+       ndr_print_struct(ndr, name, "SERVICE_DESCRIPTION");
+       ndr->depth++;
+       ndr_print_ptr(ndr, "description", r->description);
+       ndr->depth++;
+       if (r->description) {
+               ndr_print_string(ndr, "description", r->description);
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+_PUBLIC_ size_t ndr_size_SERVICE_DESCRIPTION(const struct SERVICE_DESCRIPTION *r, struct smb_iconv_convenience *ic, int flags)
+{
+       return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_SERVICE_DESCRIPTION, ic);
+}
+
+static enum ndr_err_code ndr_push_SC_ACTION_TYPE(struct ndr_push *ndr, int ndr_flags, enum SC_ACTION_TYPE r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_SC_ACTION_TYPE(struct ndr_pull *ndr, int ndr_flags, enum SC_ACTION_TYPE *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_SC_ACTION_TYPE(struct ndr_print *ndr, const char *name, enum SC_ACTION_TYPE r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case SC_ACTION_NONE: val = "SC_ACTION_NONE"; break;
+               case SC_ACTION_RESTART: val = "SC_ACTION_RESTART"; break;
+               case SC_ACTION_REBOOT: val = "SC_ACTION_REBOOT"; break;
+               case SC_ACTION_RUN_COMMAND: val = "SC_ACTION_RUN_COMMAND"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_SC_ACTION(struct ndr_push *ndr, int ndr_flags, const struct SC_ACTION *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_SC_ACTION_TYPE(ndr, NDR_SCALARS, r->type));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->delay));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_SC_ACTION(struct ndr_pull *ndr, int ndr_flags, struct SC_ACTION *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_SC_ACTION_TYPE(ndr, NDR_SCALARS, &r->type));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->delay));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_SC_ACTION(struct ndr_print *ndr, const char *name, const struct SC_ACTION *r)
+{
+       ndr_print_struct(ndr, name, "SC_ACTION");
+       ndr->depth++;
+       ndr_print_SC_ACTION_TYPE(ndr, "type", r->type);
+       ndr_print_uint32(ndr, "delay", r->delay);
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_SERVICE_FAILURE_ACTIONS(struct ndr_push *ndr, int ndr_flags, const struct SERVICE_FAILURE_ACTIONS *r)
+{
+       uint32_t cntr_actions_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->reset_period));
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->rebootmsg));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->command));
+                       ndr->flags = _flags_save_string;
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_actions));
+               NDR_CHECK(ndr_push_relative_ptr1(ndr, r->actions));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->rebootmsg) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->rebootmsg));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->rebootmsg));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->command) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->command));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->command));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               if (r->actions) {
+                       NDR_CHECK(ndr_push_relative_ptr2(ndr, r->actions));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_actions));
+                       for (cntr_actions_1 = 0; cntr_actions_1 < r->num_actions; cntr_actions_1++) {
+                               NDR_CHECK(ndr_push_SC_ACTION(ndr, NDR_SCALARS, &r->actions[cntr_actions_1]));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_SERVICE_FAILURE_ACTIONS(struct ndr_pull *ndr, int ndr_flags, struct SERVICE_FAILURE_ACTIONS *r)
+{
+       uint32_t _ptr_rebootmsg;
+       TALLOC_CTX *_mem_save_rebootmsg_0;
+       uint32_t _ptr_command;
+       TALLOC_CTX *_mem_save_command_0;
+       uint32_t _ptr_actions;
+       uint32_t cntr_actions_1;
+       TALLOC_CTX *_mem_save_actions_0;
+       TALLOC_CTX *_mem_save_actions_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->reset_period));
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_rebootmsg));
+                       if (_ptr_rebootmsg) {
+                               NDR_PULL_ALLOC(ndr, r->rebootmsg);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->rebootmsg, _ptr_rebootmsg));
+                       } else {
+                               r->rebootmsg = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_command));
+                       if (_ptr_command) {
+                               NDR_PULL_ALLOC(ndr, r->command);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->command, _ptr_command));
+                       } else {
+                               r->command = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_actions));
+               if (r->num_actions < 0 || r->num_actions > 1024) {
+                       return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_actions));
+               if (_ptr_actions) {
+                       NDR_PULL_ALLOC(ndr, r->actions);
+                       NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->actions, _ptr_actions));
+               } else {
+                       r->actions = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->rebootmsg) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->rebootmsg));
+                               _mem_save_rebootmsg_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->rebootmsg, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->rebootmsg));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rebootmsg_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->command) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->command));
+                               _mem_save_command_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->command, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->command));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_command_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               if (r->actions) {
+                       uint32_t _relative_save_offset;
+                       _relative_save_offset = ndr->offset;
+                       NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->actions));
+                       _mem_save_actions_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->actions, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->actions));
+                       NDR_PULL_ALLOC_N(ndr, r->actions, ndr_get_array_size(ndr, &r->actions));
+                       _mem_save_actions_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->actions, 0);
+                       for (cntr_actions_1 = 0; cntr_actions_1 < r->num_actions; cntr_actions_1++) {
+                               NDR_CHECK(ndr_pull_SC_ACTION(ndr, NDR_SCALARS, &r->actions[cntr_actions_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_actions_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_actions_0, 0);
+                       ndr->offset = _relative_save_offset;
+               }
+               if (r->actions) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->actions, r->num_actions));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_SERVICE_FAILURE_ACTIONS(struct ndr_print *ndr, const char *name, const struct SERVICE_FAILURE_ACTIONS *r)
+{
+       uint32_t cntr_actions_1;
+       ndr_print_struct(ndr, name, "SERVICE_FAILURE_ACTIONS");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "reset_period", r->reset_period);
+       ndr_print_ptr(ndr, "rebootmsg", r->rebootmsg);
+       ndr->depth++;
+       if (r->rebootmsg) {
+               ndr_print_string(ndr, "rebootmsg", r->rebootmsg);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "command", r->command);
+       ndr->depth++;
+       if (r->command) {
+               ndr_print_string(ndr, "command", r->command);
+       }
+       ndr->depth--;
+       ndr_print_uint32(ndr, "num_actions", r->num_actions);
+       ndr_print_ptr(ndr, "actions", r->actions);
+       ndr->depth++;
+       if (r->actions) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "actions", (int)r->num_actions);
+               ndr->depth++;
+               for (cntr_actions_1=0;cntr_actions_1<r->num_actions;cntr_actions_1++) {
+                       char *idx_1=NULL;
+                       if (asprintf(&idx_1, "[%d]", cntr_actions_1) != -1) {
+                               ndr_print_SC_ACTION(ndr, "actions", &r->actions[cntr_actions_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+_PUBLIC_ size_t ndr_size_SERVICE_FAILURE_ACTIONS(const struct SERVICE_FAILURE_ACTIONS *r, struct smb_iconv_convenience *ic, int flags)
+{
+       return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_SERVICE_FAILURE_ACTIONS, ic);
+}
+
+static enum ndr_err_code ndr_push_svcctl_StatusLevel(struct ndr_push *ndr, int ndr_flags, enum svcctl_StatusLevel r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_svcctl_StatusLevel(struct ndr_pull *ndr, int ndr_flags, enum svcctl_StatusLevel *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_svcctl_StatusLevel(struct ndr_print *ndr, const char *name, enum svcctl_StatusLevel r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case SVC_STATUS_PROCESS_INFO: val = "SVC_STATUS_PROCESS_INFO"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
 static enum ndr_err_code ndr_push_svcctl_CloseServiceHandle(struct ndr_push *ndr, int flags, const struct svcctl_CloseServiceHandle *r)
 {
        if (flags & NDR_IN) {
@@ -1378,8 +1883,8 @@ static enum ndr_err_code ndr_push_svcctl_ChangeServiceConfigW(struct ndr_push *n
                }
                NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.type));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.start));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.error));
+               NDR_CHECK(ndr_push_svcctl_StartType(ndr, NDR_SCALARS, r->in.start_type));
+               NDR_CHECK(ndr_push_svcctl_ErrorControl(ndr, NDR_SCALARS, r->in.error_control));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.binary_path));
                if (r->in.binary_path) {
                        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.binary_path, CH_UTF16)));
@@ -1460,8 +1965,8 @@ static enum ndr_err_code ndr_pull_svcctl_ChangeServiceConfigW(struct ndr_pull *n
                NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.type));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.start));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.error));
+               NDR_CHECK(ndr_pull_svcctl_StartType(ndr, NDR_SCALARS, &r->in.start_type));
+               NDR_CHECK(ndr_pull_svcctl_ErrorControl(ndr, NDR_SCALARS, &r->in.error_control));
                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_binary_path));
                if (_ptr_binary_path) {
                        NDR_PULL_ALLOC(ndr, r->in.binary_path);
@@ -1601,8 +2106,8 @@ _PUBLIC_ void ndr_print_svcctl_ChangeServiceConfigW(struct ndr_print *ndr, const
                ndr_print_policy_handle(ndr, "handle", r->in.handle);
                ndr->depth--;
                ndr_print_uint32(ndr, "type", r->in.type);
-               ndr_print_uint32(ndr, "start", r->in.start);
-               ndr_print_uint32(ndr, "error", r->in.error);
+               ndr_print_svcctl_StartType(ndr, "start_type", r->in.start_type);
+               ndr_print_svcctl_ErrorControl(ndr, "error_control", r->in.error_control);
                ndr_print_ptr(ndr, "binary_path", r->in.binary_path);
                ndr->depth++;
                if (r->in.binary_path) {
@@ -1674,8 +2179,8 @@ static enum ndr_err_code ndr_push_svcctl_CreateServiceW(struct ndr_push *ndr, in
                }
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.desired_access));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.type));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.start_type));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.error_control));
+               NDR_CHECK(ndr_push_svcctl_StartType(ndr, NDR_SCALARS, r->in.start_type));
+               NDR_CHECK(ndr_push_svcctl_ErrorControl(ndr, NDR_SCALARS, r->in.error_control));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.binary_path, CH_UTF16)));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.binary_path, CH_UTF16)));
@@ -1778,8 +2283,8 @@ static enum ndr_err_code ndr_pull_svcctl_CreateServiceW(struct ndr_pull *ndr, in
                }
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.desired_access));
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.type));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.start_type));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.error_control));
+               NDR_CHECK(ndr_pull_svcctl_StartType(ndr, NDR_SCALARS, &r->in.start_type));
+               NDR_CHECK(ndr_pull_svcctl_ErrorControl(ndr, NDR_SCALARS, &r->in.error_control));
                NDR_CHECK(ndr_pull_array_size(ndr, &r->in.binary_path));
                NDR_CHECK(ndr_pull_array_length(ndr, &r->in.binary_path));
                if (ndr_get_array_length(ndr, &r->in.binary_path) > ndr_get_array_size(ndr, &r->in.binary_path)) {
@@ -1922,8 +2427,8 @@ _PUBLIC_ void ndr_print_svcctl_CreateServiceW(struct ndr_print *ndr, const char
                ndr->depth--;
                ndr_print_uint32(ndr, "desired_access", r->in.desired_access);
                ndr_print_uint32(ndr, "type", r->in.type);
-               ndr_print_uint32(ndr, "start_type", r->in.start_type);
-               ndr_print_uint32(ndr, "error_control", r->in.error_control);
+               ndr_print_svcctl_StartType(ndr, "start_type", r->in.start_type);
+               ndr_print_svcctl_ErrorControl(ndr, "error_control", r->in.error_control);
                ndr_print_string(ndr, "binary_path", r->in.binary_path);
                ndr_print_ptr(ndr, "LoadOrderGroupKey", r->in.LoadOrderGroupKey);
                ndr->depth++;
@@ -2115,7 +2620,7 @@ static enum ndr_err_code ndr_push_svcctl_EnumServicesStatusW(struct ndr_push *nd
                }
                NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.type));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.state));
+               NDR_CHECK(ndr_push_svcctl_ServiceState(ndr, NDR_SCALARS, r->in.state));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.resume_handle));
                if (r->in.resume_handle) {
@@ -2163,7 +2668,7 @@ static enum ndr_err_code ndr_pull_svcctl_EnumServicesStatusW(struct ndr_pull *nd
                NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.type));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.state));
+               NDR_CHECK(ndr_pull_svcctl_ServiceState(ndr, NDR_SCALARS, &r->in.state));
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
                if (r->in.buf_size < 0 || r->in.buf_size > 262144) {
                        return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
@@ -2248,7 +2753,7 @@ _PUBLIC_ void ndr_print_svcctl_EnumServicesStatusW(struct ndr_print *ndr, const
                ndr_print_policy_handle(ndr, "handle", r->in.handle);
                ndr->depth--;
                ndr_print_uint32(ndr, "type", r->in.type);
-               ndr_print_uint32(ndr, "state", r->in.state);
+               ndr_print_svcctl_ServiceState(ndr, "state", r->in.state);
                ndr_print_uint32(ndr, "buf_size", r->in.buf_size);
                ndr_print_ptr(ndr, "resume_handle", r->in.resume_handle);
                ndr->depth++;
@@ -3248,8 +3753,8 @@ static enum ndr_err_code ndr_push_svcctl_ChangeServiceConfigA(struct ndr_push *n
                }
                NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.type));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.start));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.error));
+               NDR_CHECK(ndr_push_svcctl_StartType(ndr, NDR_SCALARS, r->in.start_type));
+               NDR_CHECK(ndr_push_svcctl_ErrorControl(ndr, NDR_SCALARS, r->in.error_control));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.binary_path));
                if (r->in.binary_path) {
                        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.binary_path, CH_UTF16)));
@@ -3330,8 +3835,8 @@ static enum ndr_err_code ndr_pull_svcctl_ChangeServiceConfigA(struct ndr_pull *n
                NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.type));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.start));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.error));
+               NDR_CHECK(ndr_pull_svcctl_StartType(ndr, NDR_SCALARS, &r->in.start_type));
+               NDR_CHECK(ndr_pull_svcctl_ErrorControl(ndr, NDR_SCALARS, &r->in.error_control));
                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_binary_path));
                if (_ptr_binary_path) {
                        NDR_PULL_ALLOC(ndr, r->in.binary_path);
@@ -3471,8 +3976,8 @@ _PUBLIC_ void ndr_print_svcctl_ChangeServiceConfigA(struct ndr_print *ndr, const
                ndr_print_policy_handle(ndr, "handle", r->in.handle);
                ndr->depth--;
                ndr_print_uint32(ndr, "type", r->in.type);
-               ndr_print_uint32(ndr, "start", r->in.start);
-               ndr_print_uint32(ndr, "error", r->in.error);
+               ndr_print_svcctl_StartType(ndr, "start_type", r->in.start_type);
+               ndr_print_svcctl_ErrorControl(ndr, "error_control", r->in.error_control);
                ndr_print_ptr(ndr, "binary_path", r->in.binary_path);
                ndr->depth++;
                if (r->in.binary_path) {
@@ -3547,8 +4052,8 @@ static enum ndr_err_code ndr_push_svcctl_CreateServiceA(struct ndr_push *ndr, in
                }
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.desired_access));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.type));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.start_type));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.error_control));
+               NDR_CHECK(ndr_push_svcctl_StartType(ndr, NDR_SCALARS, r->in.start_type));
+               NDR_CHECK(ndr_push_svcctl_ErrorControl(ndr, NDR_SCALARS, r->in.error_control));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.binary_path));
                if (r->in.binary_path) {
                        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.binary_path, CH_UTF16)));
@@ -3662,8 +4167,8 @@ static enum ndr_err_code ndr_pull_svcctl_CreateServiceA(struct ndr_pull *ndr, in
                }
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.desired_access));
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.type));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.start_type));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.error_control));
+               NDR_CHECK(ndr_pull_svcctl_StartType(ndr, NDR_SCALARS, &r->in.start_type));
+               NDR_CHECK(ndr_pull_svcctl_ErrorControl(ndr, NDR_SCALARS, &r->in.error_control));
                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_binary_path));
                if (_ptr_binary_path) {
                        NDR_PULL_ALLOC(ndr, r->in.binary_path);
@@ -3801,8 +4306,8 @@ _PUBLIC_ void ndr_print_svcctl_CreateServiceA(struct ndr_print *ndr, const char
                ndr->depth--;
                ndr_print_uint32(ndr, "desired_access", r->in.desired_access);
                ndr_print_uint32(ndr, "type", r->in.type);
-               ndr_print_uint32(ndr, "start_type", r->in.start_type);
-               ndr_print_uint32(ndr, "error_control", r->in.error_control);
+               ndr_print_svcctl_StartType(ndr, "start_type", r->in.start_type);
+               ndr_print_svcctl_ErrorControl(ndr, "error_control", r->in.error_control);
                ndr_print_ptr(ndr, "binary_path", r->in.binary_path);
                ndr->depth++;
                if (r->in.binary_path) {
@@ -5261,7 +5766,7 @@ static enum ndr_err_code ndr_push_svcctl_QueryServiceConfig2A(struct ndr_push *n
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
                NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.info_level));
+               NDR_CHECK(ndr_push_svcctl_ConfigLevel(ndr, NDR_SCALARS, r->in.info_level));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
        }
        if (flags & NDR_OUT) {
@@ -5289,7 +5794,7 @@ static enum ndr_err_code ndr_pull_svcctl_QueryServiceConfig2A(struct ndr_pull *n
                NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.info_level));
+               NDR_CHECK(ndr_pull_svcctl_ConfigLevel(ndr, NDR_SCALARS, &r->in.info_level));
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
                NDR_PULL_ALLOC(ndr, r->out.bytes_needed);
                ZERO_STRUCTP(r->out.bytes_needed);
@@ -5323,7 +5828,7 @@ _PUBLIC_ void ndr_print_svcctl_QueryServiceConfig2A(struct ndr_print *ndr, const
                ndr->depth++;
                ndr_print_policy_handle(ndr, "handle", r->in.handle);
                ndr->depth--;
-               ndr_print_uint32(ndr, "info_level", r->in.info_level);
+               ndr_print_svcctl_ConfigLevel(ndr, "info_level", r->in.info_level);
                ndr_print_uint32(ndr, "buf_size", r->in.buf_size);
                ndr->depth--;
        }
@@ -5348,7 +5853,7 @@ static enum ndr_err_code ndr_push_svcctl_QueryServiceConfig2W(struct ndr_push *n
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
                NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.info_level));
+               NDR_CHECK(ndr_push_svcctl_ConfigLevel(ndr, NDR_SCALARS, r->in.info_level));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
        }
        if (flags & NDR_OUT) {
@@ -5380,7 +5885,7 @@ static enum ndr_err_code ndr_pull_svcctl_QueryServiceConfig2W(struct ndr_pull *n
                NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.info_level));
+               NDR_CHECK(ndr_pull_svcctl_ConfigLevel(ndr, NDR_SCALARS, &r->in.info_level));
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
                if (r->in.buf_size < 0 || r->in.buf_size > 8192) {
                        return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
@@ -5428,7 +5933,7 @@ _PUBLIC_ void ndr_print_svcctl_QueryServiceConfig2W(struct ndr_print *ndr, const
                ndr->depth++;
                ndr_print_policy_handle(ndr, "handle", r->in.handle);
                ndr->depth--;
-               ndr_print_uint32(ndr, "info_level", r->in.info_level);
+               ndr_print_svcctl_ConfigLevel(ndr, "info_level", r->in.info_level);
                ndr_print_uint32(ndr, "buf_size", r->in.buf_size);
                ndr->depth--;
        }
@@ -5456,7 +5961,7 @@ static enum ndr_err_code ndr_push_svcctl_QueryServiceStatusEx(struct ndr_push *n
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
                NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.info_level));
+               NDR_CHECK(ndr_push_svcctl_StatusLevel(ndr, NDR_SCALARS, r->in.info_level));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
        }
        if (flags & NDR_OUT) {
@@ -5488,7 +5993,7 @@ static enum ndr_err_code ndr_pull_svcctl_QueryServiceStatusEx(struct ndr_pull *n
                NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.info_level));
+               NDR_CHECK(ndr_pull_svcctl_StatusLevel(ndr, NDR_SCALARS, &r->in.info_level));
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
                if (r->in.buf_size < 0 || r->in.buf_size > 8192) {
                        return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
@@ -5536,7 +6041,7 @@ _PUBLIC_ void ndr_print_svcctl_QueryServiceStatusEx(struct ndr_print *ndr, const
                ndr->depth++;
                ndr_print_policy_handle(ndr, "handle", r->in.handle);
                ndr->depth--;
-               ndr_print_uint32(ndr, "info_level", r->in.info_level);
+               ndr_print_svcctl_StatusLevel(ndr, "info_level", r->in.info_level);
                ndr_print_uint32(ndr, "buf_size", r->in.buf_size);
                ndr->depth--;
        }
index 595a98041b0a2f0098ba8ddefcf3b01e8c1e3803..4b4716197320fa4ef89776acce6f4f3536a182ab 100644 (file)
@@ -102,17 +102,35 @@ extern const struct ndr_interface_table ndr_table_svcctl;
 #define NDR_SVCCTL_CALL_COUNT (44)
 void ndr_print_SERVICE_LOCK_STATUS(struct ndr_print *ndr, const char *name, const struct SERVICE_LOCK_STATUS *r);
 void ndr_print_SERVICE_STATUS(struct ndr_print *ndr, const char *name, const struct SERVICE_STATUS *r);
+enum ndr_err_code ndr_push_SERVICE_STATUS_PROCESS(struct ndr_push *ndr, int ndr_flags, const struct SERVICE_STATUS_PROCESS *r);
+enum ndr_err_code ndr_pull_SERVICE_STATUS_PROCESS(struct ndr_pull *ndr, int ndr_flags, struct SERVICE_STATUS_PROCESS *r);
+void ndr_print_SERVICE_STATUS_PROCESS(struct ndr_print *ndr, const char *name, const struct SERVICE_STATUS_PROCESS *r);
 void ndr_print_ENUM_SERVICE_STATUS(struct ndr_print *ndr, const char *name, const struct ENUM_SERVICE_STATUS *r);
 enum ndr_err_code ndr_push_svcctl_ServerType(struct ndr_push *ndr, int ndr_flags, uint32_t r);
 enum ndr_err_code ndr_pull_svcctl_ServerType(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
 void ndr_print_svcctl_ServerType(struct ndr_print *ndr, const char *name, uint32_t r);
 void ndr_print_SERVICE_CONTROL(struct ndr_print *ndr, const char *name, enum SERVICE_CONTROL r);
+void ndr_print_svcctl_ErrorControl(struct ndr_print *ndr, const char *name, enum svcctl_ErrorControl r);
+void ndr_print_svcctl_StartType(struct ndr_print *ndr, const char *name, enum svcctl_StartType r);
+void ndr_print_svcctl_ServiceState(struct ndr_print *ndr, const char *name, enum svcctl_ServiceState r);
 void ndr_print_svcctl_MgrAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
 void ndr_print_svcctl_ServiceAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
 enum ndr_err_code ndr_push_QUERY_SERVICE_CONFIG(struct ndr_push *ndr, int ndr_flags, const struct QUERY_SERVICE_CONFIG *r);
 enum ndr_err_code ndr_pull_QUERY_SERVICE_CONFIG(struct ndr_pull *ndr, int ndr_flags, struct QUERY_SERVICE_CONFIG *r);
 void ndr_print_QUERY_SERVICE_CONFIG(struct ndr_print *ndr, const char *name, const struct QUERY_SERVICE_CONFIG *r);
 size_t ndr_size_QUERY_SERVICE_CONFIG(const struct QUERY_SERVICE_CONFIG *r, struct smb_iconv_convenience *ic, int flags);
+void ndr_print_svcctl_ConfigLevel(struct ndr_print *ndr, const char *name, enum svcctl_ConfigLevel r);
+enum ndr_err_code ndr_push_SERVICE_DESCRIPTION(struct ndr_push *ndr, int ndr_flags, const struct SERVICE_DESCRIPTION *r);
+enum ndr_err_code ndr_pull_SERVICE_DESCRIPTION(struct ndr_pull *ndr, int ndr_flags, struct SERVICE_DESCRIPTION *r);
+void ndr_print_SERVICE_DESCRIPTION(struct ndr_print *ndr, const char *name, const struct SERVICE_DESCRIPTION *r);
+size_t ndr_size_SERVICE_DESCRIPTION(const struct SERVICE_DESCRIPTION *r, struct smb_iconv_convenience *ic, int flags);
+void ndr_print_SC_ACTION_TYPE(struct ndr_print *ndr, const char *name, enum SC_ACTION_TYPE r);
+void ndr_print_SC_ACTION(struct ndr_print *ndr, const char *name, const struct SC_ACTION *r);
+enum ndr_err_code ndr_push_SERVICE_FAILURE_ACTIONS(struct ndr_push *ndr, int ndr_flags, const struct SERVICE_FAILURE_ACTIONS *r);
+enum ndr_err_code ndr_pull_SERVICE_FAILURE_ACTIONS(struct ndr_pull *ndr, int ndr_flags, struct SERVICE_FAILURE_ACTIONS *r);
+void ndr_print_SERVICE_FAILURE_ACTIONS(struct ndr_print *ndr, const char *name, const struct SERVICE_FAILURE_ACTIONS *r);
+size_t ndr_size_SERVICE_FAILURE_ACTIONS(const struct SERVICE_FAILURE_ACTIONS *r, struct smb_iconv_convenience *ic, int flags);
+void ndr_print_svcctl_StatusLevel(struct ndr_print *ndr, const char *name, enum svcctl_StatusLevel r);
 void ndr_print_svcctl_CloseServiceHandle(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_CloseServiceHandle *r);
 void ndr_print_svcctl_ControlService(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_ControlService *r);
 void ndr_print_svcctl_DeleteService(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_DeleteService *r);
index 9baa122e564c38bf4a9e9a0a1806e5a677d2977c..c36f5781017ac6e71e1776d00c4e716efb75f257 100644 (file)
@@ -43,6 +43,12 @@ struct SERVICE_STATUS {
        uint32_t wait_hint;
 };
 
+struct SERVICE_STATUS_PROCESS {
+       struct SERVICE_STATUS status;
+       uint32_t process_id;
+       uint32_t service_flags;
+}/* [public] */;
+
 struct ENUM_SERVICE_STATUS {
        const char * service_name;/* [relative,flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
        const char * display_name;/* [relative,flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
@@ -97,6 +103,57 @@ enum SERVICE_CONTROL
 #endif
 ;
 
+enum svcctl_ErrorControl
+#ifndef USE_UINT_ENUMS
+ {
+       SVCCTL_SVC_ERROR_IGNORE=0x00000000,
+       SVCCTL_SVC_ERROR_NORMAL=0x00000001,
+       SVCCTL_SVC_ERROR_CRITICAL=0x00000002,
+       SVCCTL_SVC_ERROR_SEVERE=0x00000003
+}
+#else
+ { __donnot_use_enum_svcctl_ErrorControl=0x7FFFFFFF}
+#define SVCCTL_SVC_ERROR_IGNORE ( 0x00000000 )
+#define SVCCTL_SVC_ERROR_NORMAL ( 0x00000001 )
+#define SVCCTL_SVC_ERROR_CRITICAL ( 0x00000002 )
+#define SVCCTL_SVC_ERROR_SEVERE ( 0x00000003 )
+#endif
+;
+
+enum svcctl_StartType
+#ifndef USE_UINT_ENUMS
+ {
+       SVCCTL_BOOT_START=0x00000000,
+       SVCCTL_SYSTEM_START=0x00000001,
+       SVCCTL_AUTO_START=0x00000002,
+       SVCCTL_DEMAND_START=0x00000003,
+       SVCCTL_DISABLED=0x00000004
+}
+#else
+ { __donnot_use_enum_svcctl_StartType=0x7FFFFFFF}
+#define SVCCTL_BOOT_START ( 0x00000000 )
+#define SVCCTL_SYSTEM_START ( 0x00000001 )
+#define SVCCTL_AUTO_START ( 0x00000002 )
+#define SVCCTL_DEMAND_START ( 0x00000003 )
+#define SVCCTL_DISABLED ( 0x00000004 )
+#endif
+;
+
+enum svcctl_ServiceState
+#ifndef USE_UINT_ENUMS
+ {
+       SVCCTL_STATE_ACTIVE=0x00000001,
+       SVCCTL_STATE_INACTIVE=0x00000002,
+       SVCCTL_STATE_ALL=(SVCCTL_STATE_ACTIVE|SVCCTL_STATE_INACTIVE)
+}
+#else
+ { __donnot_use_enum_svcctl_ServiceState=0x7FFFFFFF}
+#define SVCCTL_STATE_ACTIVE ( 0x00000001 )
+#define SVCCTL_STATE_INACTIVE ( 0x00000002 )
+#define SVCCTL_STATE_ALL ( (SVCCTL_STATE_ACTIVE|SVCCTL_STATE_INACTIVE) )
+#endif
+;
+
 /* bitmap svcctl_MgrAccessMask */
 #define SC_RIGHT_MGR_CONNECT ( 0x0001 )
 #define SC_RIGHT_MGR_CREATE_SERVICE ( 0x0002 )
@@ -118,8 +175,8 @@ enum SERVICE_CONTROL
 
 struct QUERY_SERVICE_CONFIG {
        uint32_t service_type;
-       uint32_t start_type;
-       uint32_t error_control;
+       enum svcctl_StartType start_type;
+       enum svcctl_ErrorControl error_control;
        const char *executablepath;/* [unique,range(0,8192),charset(UTF16)] */
        const char *loadordergroup;/* [unique,range(0,8192),charset(UTF16)] */
        uint32_t tag_id;
@@ -128,6 +185,64 @@ struct QUERY_SERVICE_CONFIG {
        const char *displayname;/* [unique,range(0,8192),charset(UTF16)] */
 }/* [gensize,public] */;
 
+enum svcctl_ConfigLevel
+#ifndef USE_UINT_ENUMS
+ {
+       SERVICE_CONFIG_DESCRIPTION=0x00000001,
+       SERVICE_CONFIG_FAILURE_ACTIONS=0x00000002
+}
+#else
+ { __donnot_use_enum_svcctl_ConfigLevel=0x7FFFFFFF}
+#define SERVICE_CONFIG_DESCRIPTION ( 0x00000001 )
+#define SERVICE_CONFIG_FAILURE_ACTIONS ( 0x00000002 )
+#endif
+;
+
+struct SERVICE_DESCRIPTION {
+       const char * description;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
+}/* [gensize,public] */;
+
+enum SC_ACTION_TYPE
+#ifndef USE_UINT_ENUMS
+ {
+       SC_ACTION_NONE=0,
+       SC_ACTION_RESTART=1,
+       SC_ACTION_REBOOT=2,
+       SC_ACTION_RUN_COMMAND=3
+}
+#else
+ { __donnot_use_enum_SC_ACTION_TYPE=0x7FFFFFFF}
+#define SC_ACTION_NONE ( 0 )
+#define SC_ACTION_RESTART ( 1 )
+#define SC_ACTION_REBOOT ( 2 )
+#define SC_ACTION_RUN_COMMAND ( 3 )
+#endif
+;
+
+struct SC_ACTION {
+       enum SC_ACTION_TYPE type;
+       uint32_t delay;
+};
+
+struct SERVICE_FAILURE_ACTIONS {
+       uint32_t reset_period;
+       const char * rebootmsg;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
+       const char * command;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
+       uint32_t num_actions;/* [range(0,1024)] */
+       struct SC_ACTION *actions;/* [relative,size_is(num_actions)] */
+}/* [gensize,public] */;
+
+enum svcctl_StatusLevel
+#ifndef USE_UINT_ENUMS
+ {
+       SVC_STATUS_PROCESS_INFO=0x00000000
+}
+#else
+ { __donnot_use_enum_svcctl_StatusLevel=0x7FFFFFFF}
+#define SVC_STATUS_PROCESS_INFO ( 0x00000000 )
+#endif
+;
+
 
 struct svcctl_CloseServiceHandle {
        struct {
@@ -273,8 +388,8 @@ struct svcctl_ChangeServiceConfigW {
        struct {
                struct policy_handle *handle;/* [ref] */
                uint32_t type;
-               uint32_t start;
-               uint32_t error;
+               enum svcctl_StartType start_type;
+               enum svcctl_ErrorControl error_control;
                const char *binary_path;/* [unique,charset(UTF16)] */
                const char *load_order_group;/* [unique,charset(UTF16)] */
                const char *dependencies;/* [unique,charset(UTF16)] */
@@ -298,8 +413,8 @@ struct svcctl_CreateServiceW {
                const char *DisplayName;/* [unique,charset(UTF16)] */
                uint32_t desired_access;
                uint32_t type;
-               uint32_t start_type;
-               uint32_t error_control;
+               enum svcctl_StartType start_type;
+               enum svcctl_ErrorControl error_control;
                const char *binary_path;/* [charset(UTF16)] */
                const char *LoadOrderGroupKey;/* [unique,charset(UTF16)] */
                uint8_t *dependencies;/* [unique,size_is(dependencies_size)] */
@@ -340,7 +455,7 @@ struct svcctl_EnumServicesStatusW {
        struct {
                struct policy_handle *handle;/* [ref] */
                uint32_t type;
-               uint32_t state;
+               enum svcctl_ServiceState state;
                uint32_t buf_size;/* [range(0,262144)] */
                uint32_t *resume_handle;/* [unique] */
        } in;
@@ -481,8 +596,8 @@ struct svcctl_ChangeServiceConfigA {
        struct {
                struct policy_handle *handle;/* [ref] */
                uint32_t type;
-               uint32_t start;
-               uint32_t error;
+               enum svcctl_StartType start_type;
+               enum svcctl_ErrorControl error_control;
                const char *binary_path;/* [unique,charset(UTF16)] */
                const char *load_order_group;/* [unique,charset(UTF16)] */
                const char *dependencies;/* [unique,charset(UTF16)] */
@@ -506,8 +621,8 @@ struct svcctl_CreateServiceA {
                const char *DisplayName;/* [unique,charset(UTF16)] */
                uint32_t desired_access;
                uint32_t type;
-               uint32_t start_type;
-               uint32_t error_control;
+               enum svcctl_StartType start_type;
+               enum svcctl_ErrorControl error_control;
                const char *binary_path;/* [unique,charset(UTF16)] */
                const char *LoadOrderGroupKey;/* [unique,charset(UTF16)] */
                const char *dependencies;/* [unique,charset(UTF16)] */
@@ -712,7 +827,7 @@ struct svcctl_ChangeServiceConfig2W {
 struct svcctl_QueryServiceConfig2A {
        struct {
                struct policy_handle *handle;/* [ref] */
-               uint32_t info_level;
+               enum svcctl_ConfigLevel info_level;
                uint32_t buf_size;
        } in;
 
@@ -728,7 +843,7 @@ struct svcctl_QueryServiceConfig2A {
 struct svcctl_QueryServiceConfig2W {
        struct {
                struct policy_handle *handle;/* [ref] */
-               uint32_t info_level;
+               enum svcctl_ConfigLevel info_level;
                uint32_t buf_size;/* [range(0,8192)] */
        } in;
 
@@ -744,7 +859,7 @@ struct svcctl_QueryServiceConfig2W {
 struct svcctl_QueryServiceStatusEx {
        struct {
                struct policy_handle *handle;/* [ref] */
-               uint32_t info_level;
+               enum svcctl_StatusLevel info_level;
                uint32_t buf_size;/* [range(0,8192)] */
        } in;
 
index 4b88f5e5f415cc08a00e0dd890e3b9c6960883c9..c70858fbd9997a93c1a9b83b369e32d2875af8af 100644 (file)
@@ -28,6 +28,12 @@ import "misc.idl", "security.idl";
                uint32 wait_hint;
        } SERVICE_STATUS;
 
+       typedef [public] struct {
+               SERVICE_STATUS status;
+               uint32 process_id;
+               uint32 service_flags;
+       } SERVICE_STATUS_PROCESS;
+
        typedef struct {
                [relative] astring *service_name;
                [relative] astring *display_name;
@@ -172,11 +178,27 @@ import "misc.idl", "security.idl";
 
        /*****************/
        /* Function 0x0b */
+
+       typedef [v1_enum] enum {
+               SVCCTL_SVC_ERROR_IGNORE         = 0x00000000,
+               SVCCTL_SVC_ERROR_NORMAL         = 0x00000001,
+               SVCCTL_SVC_ERROR_CRITICAL       = 0x00000002,
+               SVCCTL_SVC_ERROR_SEVERE         = 0x00000003
+       } svcctl_ErrorControl;
+
+       typedef [v1_enum] enum {
+               SVCCTL_BOOT_START               = 0x00000000,
+               SVCCTL_SYSTEM_START             = 0x00000001,
+               SVCCTL_AUTO_START               = 0x00000002,
+               SVCCTL_DEMAND_START             = 0x00000003,
+               SVCCTL_DISABLED                 = 0x00000004
+       } svcctl_StartType;
+
        WERROR svcctl_ChangeServiceConfigW(
                [in,ref] policy_handle *handle,
                [in] uint32 type,
-               [in] uint32 start,
-               [in] uint32 error,
+               [in] svcctl_StartType start_type,
+               [in] svcctl_ErrorControl error_control,
                [in,unique] [string,charset(UTF16)] uint16 *binary_path,
                [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
                [out,ref] uint32 *tag_id,
@@ -194,8 +216,8 @@ import "misc.idl", "security.idl";
                [in,unique] [string,charset(UTF16)] uint16 *DisplayName,
                [in] uint32 desired_access,
                [in] uint32 type,
-               [in] uint32 start_type,
-               [in] uint32 error_control,
+               [in] svcctl_StartType start_type,
+               [in] svcctl_ErrorControl error_control,
                [in] [string,charset(UTF16)] uint16 binary_path[],
                [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey,
                [in,out,unique] uint32 *TagId,
@@ -220,10 +242,17 @@ import "misc.idl", "security.idl";
 
        /*****************/
        /* Function 0x0e */
+
+       typedef [v1_enum] enum {
+               SVCCTL_STATE_ACTIVE     = 0x00000001,
+               SVCCTL_STATE_INACTIVE   = 0x00000002,
+               SVCCTL_STATE_ALL        = ( SVCCTL_STATE_ACTIVE | SVCCTL_STATE_INACTIVE )
+       } svcctl_ServiceState;
+
        WERROR svcctl_EnumServicesStatusW(
                [in,ref] policy_handle *handle,
                [in] uint32 type,
-               [in] uint32 state,
+               [in] svcctl_ServiceState state,
                [out,ref,size_is(buf_size)] uint8 *service,
                [in] [range(0,262144)] uint32 buf_size,
                [out,ref] [range(0,262144)] uint32 *bytes_needed,
@@ -320,8 +349,8 @@ import "misc.idl", "security.idl";
 
        typedef [public,gensize] struct {
                uint32 service_type;
-               uint32 start_type;
-               uint32 error_control;
+               svcctl_StartType start_type;
+               svcctl_ErrorControl error_control;
                [string,charset(UTF16)] [range(0,8192)] uint16 *executablepath;
                [string,charset(UTF16)] [range(0,8192)] uint16 *loadordergroup;
                uint32 tag_id;
@@ -386,8 +415,8 @@ import "misc.idl", "security.idl";
        WERROR svcctl_ChangeServiceConfigA(
                [in,ref] policy_handle *handle,
                [in] uint32 type,
-               [in] uint32 start,
-               [in] uint32 error,
+               [in] svcctl_StartType start_type,
+               [in] svcctl_ErrorControl error_control,
                [in,unique] [string,charset(UTF16)] uint16 *binary_path,
                [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
                [out,ref] uint32 *tag_id,
@@ -405,8 +434,8 @@ import "misc.idl", "security.idl";
                [in,unique] [string,charset(UTF16)] uint16 *DisplayName,
                [in] uint32 desired_access,
                [in] uint32 type,
-               [in] uint32 start_type,
-               [in] uint32 error_control,
+               [in] svcctl_StartType start_type,
+               [in] svcctl_ErrorControl error_control,
                [in,unique] [string,charset(UTF16)] uint16 *binary_path,
                [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey,
                [out,unique] uint32 *TagId,
@@ -528,9 +557,39 @@ import "misc.idl", "security.idl";
 
        /*****************/
        /* Function 0x26 */
+
+       typedef [v1_enum] enum {
+               SERVICE_CONFIG_DESCRIPTION      = 0x00000001,
+               SERVICE_CONFIG_FAILURE_ACTIONS  = 0x00000002
+       } svcctl_ConfigLevel;
+
+       typedef [gensize,public] struct {
+               [relative] nstring *description;
+       } SERVICE_DESCRIPTION;
+
+       typedef [v1_enum] enum {
+               SC_ACTION_NONE          = 0,
+               SC_ACTION_RESTART       = 1,
+               SC_ACTION_REBOOT        = 2,
+               SC_ACTION_RUN_COMMAND   = 3
+       } SC_ACTION_TYPE;
+
+       typedef struct {
+               SC_ACTION_TYPE type;
+               uint32 delay;
+       } SC_ACTION;
+
+       typedef [public,gensize] struct {
+               uint32 reset_period;
+               [relative] nstring *rebootmsg;
+               [relative] nstring *command;
+               [range(0,1024)] uint32 num_actions;
+               [relative] [size_is(num_actions)] SC_ACTION *actions;
+       } SERVICE_FAILURE_ACTIONS;
+
        WERROR svcctl_QueryServiceConfig2A(
                [in,ref] policy_handle *handle,
-               [in] uint32 info_level,
+               [in] svcctl_ConfigLevel info_level,
                [out] uint8 buffer[buf_size],
                [in] uint32 buf_size,
                [out,ref] uint32 *bytes_needed
@@ -540,7 +599,7 @@ import "misc.idl", "security.idl";
        /* Function 0x27 */
        WERROR svcctl_QueryServiceConfig2W(
                [in,ref] policy_handle *handle,
-               [in] uint32 info_level,
+               [in] svcctl_ConfigLevel info_level,
                [out,ref,size_is(buf_size)] uint8 *buffer,
                [in] [range(0,8192)] uint32 buf_size,
                [out,ref] [range(0,8192)] uint32 *bytes_needed
@@ -548,9 +607,14 @@ import "misc.idl", "security.idl";
 
        /*****************/
        /* Function 0x28 */
+
+       typedef [v1_enum] enum {
+               SVC_STATUS_PROCESS_INFO         = 0x00000000
+       } svcctl_StatusLevel;
+
        WERROR svcctl_QueryServiceStatusEx(
                [in,ref] policy_handle *handle,
-               [in] uint32 info_level,
+               [in] svcctl_StatusLevel info_level,
                [out,ref,size_is(buf_size)] uint8 *buffer,
                [in] [range(0,8192)] uint32 buf_size,
                [out,ref] [range(0,8192)] uint32 *bytes_needed
index 1625e6595cbd7325a2b3c19c0dfbc5417ab835d9..fdddf365cece89c22a47a95a2f4b65f41296881c 100644 (file)
@@ -698,7 +698,7 @@ SMBD_OBJ_SRV = smbd/files.o smbd/chgpasswd.o smbd/connection.o \
               $(AFS_SETTOKEN_OBJ) smbd/aio.o smbd/statvfs.o \
               smbd/dmapi.o \
               smbd/file_access.o \
-              smbd/dnsregister.o \
+              smbd/dnsregister.o smbd/globals.o \
               $(MANGLE_OBJ) @VFS_STATIC@
 
 SMBD_OBJ_BASE = $(PARAM_WITHOUT_REG_OBJ) $(SMBD_OBJ_SRV) $(LIBSMB_OBJ) \
index ec8f413d2f386d6bea5bb1c3702de5f3bad74745..afc207b6f6057a204310bec285cb603da52007d1 100644 (file)
@@ -6157,19 +6157,9 @@ bool convert_port_data_1( NT_PORT_DATA_1 *port1, RPC_BUFFER *buf ) ;
 /* The following definitions come from rpc_parse/parse_svcctl.c  */
 
 bool svcctl_io_enum_services_status( const char *desc, ENUM_SERVICES_STATUS *enum_status, RPC_BUFFER *buffer, int depth );
-bool svcctl_io_service_status_process( const char *desc, SERVICE_STATUS_PROCESS *status, RPC_BUFFER *buffer, int depth );
 uint32 svcctl_sizeof_enum_services_status( ENUM_SERVICES_STATUS *status );
 bool svcctl_io_q_enum_services_status(const char *desc, SVCCTL_Q_ENUM_SERVICES_STATUS *q_u, prs_struct *ps, int depth);
 bool svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_STATUS *r_u, prs_struct *ps, int depth);
-bool svcctl_io_q_query_service_config2(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, prs_struct *ps, int depth);
-void init_service_description_buffer(SERVICE_DESCRIPTION *desc, const char *service_desc );
-bool svcctl_io_service_description( const char *desc, SERVICE_DESCRIPTION *description, RPC_BUFFER *buffer, int depth );
-uint32 svcctl_sizeof_service_description( SERVICE_DESCRIPTION *desc );
-bool svcctl_io_service_fa( const char *desc, SERVICE_FAILURE_ACTIONS *fa, RPC_BUFFER *buffer, int depth );
-uint32 svcctl_sizeof_service_fa( SERVICE_FAILURE_ACTIONS *fa);
-bool svcctl_io_r_query_service_config2(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u, prs_struct *ps, int depth);
-bool svcctl_io_q_query_service_status_ex(const char *desc, SVCCTL_Q_QUERY_SERVICE_STATUSEX *q_u, prs_struct *ps, int depth);
-bool svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVICE_STATUSEX *r_u, prs_struct *ps, int depth);
 
 /* The following definitions come from rpc_server/srv_eventlog.c  */
 
@@ -6409,8 +6399,6 @@ NTSTATUS rpc_svcctl2_init(void);
 
 bool init_service_op_table( void );
 WERROR _svcctl_enum_services_status(pipes_struct *p, SVCCTL_Q_ENUM_SERVICES_STATUS *q_u, SVCCTL_R_ENUM_SERVICES_STATUS *r_u);
-WERROR _svcctl_query_service_status_ex( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_STATUSEX *q_u, SVCCTL_R_QUERY_SERVICE_STATUSEX *r_u );
-WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u );
 
 /* The following definitions come from rpcclient/cmd_dfs.c  */
 
@@ -6826,12 +6814,12 @@ bool name_to_8_3(const char *in,
 
 /* The following definitions come from smbd/mangle_hash.c  */
 
-struct mangle_fns *mangle_hash_init(void);
+const struct mangle_fns *mangle_hash_init(void);
 
 /* The following definitions come from smbd/mangle_hash2.c  */
 
-struct mangle_fns *mangle_hash2_init(void);
-struct mangle_fns *posix_mangle_init(void);
+const struct mangle_fns *mangle_hash2_init(void);
+const struct mangle_fns *posix_mangle_init(void);
 
 /* The following definitions come from smbd/map_username.c  */
 
index 7dd849d5b41deeeb8a33dd3298bbb5c2ead94b9a..5f83b19f68c2e8c692f7cbef90ffd42322f3e731 100644 (file)
 #define SVCCTL_ACCEPT_HARDWAREPROFILECHANGE    0x00000020
 #define SVCCTL_ACCEPT_POWEREVENT               0x00000040
 
-/* SERVER_STATUS - ControlAccepted */
-#define SVCCTL_SVC_ERROR_IGNORE                 0x00000000
-#define SVCCTL_SVC_ERROR_NORMAL                 0x00000001
-#define SVCCTL_SVC_ERROR_CRITICAL               0x00000002
-#define SVCCTL_SVC_ERROR_SEVERE                 0x00000003
-
-/* QueryServiceConfig2 options */
-#define SERVICE_CONFIG_DESCRIPTION              0x00000001
-#define SERVICE_CONFIG_FAILURE_ACTIONS          0x00000002
-
-
 /* Service Config - values for ServiceType field*/
 
 #define SVCCTL_KERNEL_DRVR                         0x00000001  /* doubtful we'll have these */
 #define SVCCTL_WIN32_SHARED_PROC                   0x00000020
 #define SVCCTL_WIN32_INTERACTIVE                   0x00000100 
 
-/* Service Config - values for StartType field */
-#define SVCCTL_BOOT_START                          0x00000000
-#define SVCCTL_SYSTEM_START                        0x00000001
-#define SVCCTL_AUTO_START                          0x00000002
-#define SVCCTL_DEMAND_START                        0x00000003
-#define SVCCTL_DISABLED                            0x00000004
-
 #define SVC_HANDLE_IS_SCM                      0x0000001
 #define SVC_HANDLE_IS_SERVICE                  0x0000002
 #define SVC_HANDLE_IS_DBLOCK                   0x0000003
 
-#define SVC_STATUS_PROCESS_INFO                 0x00000000
-
 /* utility structures for RPCs */
 
 /*
 
 typedef struct SERVICE_STATUS SERVICE_STATUS;
 
-typedef struct {
-       SERVICE_STATUS status;
-       uint32 process_id;
-       uint32 service_flags;
-} SERVICE_STATUS_PROCESS;
-
-
 typedef struct {
        UNISTR servicename;
        UNISTR displayname;
        SERVICE_STATUS status;
 } ENUM_SERVICES_STATUS;
 
-typedef struct {
-       uint32 unknown; 
-        UNISTR description;
-} SERVICE_DESCRIPTION;
-
-typedef struct {
-        uint32 type;
-        uint32 delay;
-} SC_ACTION;
-
-typedef struct {
-        uint32 reset_period;
-        UNISTR2 *rebootmsg;    /* i have no idea if these are UNISTR2's.  I can't get a good trace */
-        UNISTR2 *command;
-        uint32  num_actions;
-        SC_ACTION *actions;
-} SERVICE_FAILURE_ACTIONS;
-
-
 /* rpc structures */
 
 /**************************/
@@ -169,34 +123,5 @@ typedef struct {
        WERROR status;
 } SVCCTL_R_ENUM_SERVICES_STATUS;
 
-/**************************/
-
-typedef struct {
-       POLICY_HND handle;
-       uint32 level;
-       uint32 buffer_size;
-} SVCCTL_Q_QUERY_SERVICE_CONFIG2;
-
-typedef struct {
-       RPC_BUFFER buffer;
-       uint32 needed;
-       WERROR status;
-} SVCCTL_R_QUERY_SERVICE_CONFIG2;
-
-
-/**************************/
-
-typedef struct {
-       POLICY_HND handle;
-        uint32 level;
-       uint32 buffer_size;
-} SVCCTL_Q_QUERY_SERVICE_STATUSEX;
-
-typedef struct {
-       RPC_BUFFER buffer;
-       uint32 needed;
-       WERROR status;
-} SVCCTL_R_QUERY_SERVICE_STATUSEX;
-
 #endif /* _RPC_SVCCTL_H */
 
index 7d31f4b2f01b936addd42e83d5642c62f8026ac3..559c65432e61e4086a45393fa60efded51807a2f 100644 (file)
@@ -79,29 +79,6 @@ bool svcctl_io_enum_services_status( const char *desc, ENUM_SERVICES_STATUS *enu
 /*******************************************************************
 ********************************************************************/
 
-bool svcctl_io_service_status_process( const char *desc, SERVICE_STATUS_PROCESS *status, RPC_BUFFER *buffer, int depth )
-{
-       prs_struct *ps=&buffer->prs;
-
-       prs_debug(ps, depth, desc, "svcctl_io_service_status_process");
-       depth++;
-
-       if ( !svcctl_io_service_status("status", &status->status, ps, depth) )
-               return False;
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_uint32("process_id", ps, depth, &status->process_id))
-               return False;
-       if(!prs_uint32("service_flags", ps, depth, &status->service_flags))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
 uint32 svcctl_sizeof_enum_services_status( ENUM_SERVICES_STATUS *status )
 {
        uint32 size = 0;
@@ -113,23 +90,6 @@ uint32 svcctl_sizeof_enum_services_status( ENUM_SERVICES_STATUS *status )
        return size;
 }
 
-/********************************************************************
-********************************************************************/
-
-static uint32 sizeof_unistr2( UNISTR2 *string )
-{
-       uint32 size = 0;
-
-       if ( !string ) 
-               return 0;       
-
-       size  = sizeof(uint32) * 3;             /* length fields */
-       size += 2 * string->uni_max_len;        /* string data */
-       size += size % 4;                       /* alignment */
-
-       return size;
-}
-
 /*******************************************************************
 ********************************************************************/
 
@@ -193,227 +153,3 @@ bool svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_S
 
        return True;
 }
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_q_query_service_config2(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, prs_struct *ps, int depth)
-{
-       if (q_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "svcctl_io_q_query_service_config2");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
-               return False;
-
-       if(!prs_uint32("level", ps, depth, &q_u->level))
-               return False;
-
-       if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
-               return False;
-
-       return True;
-}
-
-
-/*******************************************************************
-********************************************************************/
-
-void init_service_description_buffer(SERVICE_DESCRIPTION *desc, const char *service_desc )
-{
-       desc->unknown = 0x04;   /* always 0x0000 0004 (no idea what this is) */
-       init_unistr( &desc->description, service_desc );
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_service_description( const char *desc, SERVICE_DESCRIPTION *description, RPC_BUFFER *buffer, int depth )
-{
-        prs_struct *ps = &buffer->prs;
-
-        prs_debug(ps, depth, desc, "svcctl_io_service_description");
-        depth++;
-
-       if ( !prs_uint32("unknown", ps, depth, &description->unknown) )
-               return False;
-       if ( !prs_unistr("description", ps, depth, &description->description) )
-               return False;
-
-       return True;
-} 
-
-/*******************************************************************
-********************************************************************/
-
-uint32 svcctl_sizeof_service_description( SERVICE_DESCRIPTION *desc )
-{
-       if ( !desc )
-               return 0;
-
-       /* make sure to include the terminating NULL */
-       return ( sizeof(uint32) + (2*(str_len_uni(&desc->description)+1)) );
-}
-
-/*******************************************************************
-********************************************************************/
-
-static bool svcctl_io_action( const char *desc, SC_ACTION *action, prs_struct *ps, int depth )
-{
-
-       prs_debug(ps, depth, desc, "svcctl_io_action");
-       depth++;
-
-       if ( !prs_uint32("type", ps, depth, &action->type) )
-               return False;
-       if ( !prs_uint32("delay", ps, depth, &action->delay) )
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_service_fa( const char *desc, SERVICE_FAILURE_ACTIONS *fa, RPC_BUFFER *buffer, int depth )
-{
-        prs_struct *ps = &buffer->prs;
-       int i;
-
-        prs_debug(ps, depth, desc, "svcctl_io_service_description");
-        depth++;
-
-       if ( !prs_uint32("reset_period", ps, depth, &fa->reset_period) )
-               return False;
-
-       if ( !prs_pointer( desc, ps, depth, (void*)&fa->rebootmsg, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) )
-               return False;
-       if ( !prs_pointer( desc, ps, depth, (void*)&fa->command, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) )
-               return False;
-
-       if ( !prs_uint32("num_actions", ps, depth, &fa->num_actions) )
-               return False;
-
-       if ( UNMARSHALLING(ps)) {
-               if (fa->num_actions) {
-                       if ( !(fa->actions = TALLOC_ARRAY( talloc_tos(), SC_ACTION, fa->num_actions )) ) {
-                               DEBUG(0,("svcctl_io_service_fa: talloc() failure!\n"));
-                               return False;
-                       }
-               } else {
-                       fa->actions = NULL;
-               }
-       }
-
-       for ( i=0; i<fa->num_actions; i++ ) {
-               if ( !svcctl_io_action( "actions", &fa->actions[i], ps, depth ) )
-                       return False;
-       }
-
-       return True;
-} 
-
-/*******************************************************************
-********************************************************************/
-
-uint32 svcctl_sizeof_service_fa( SERVICE_FAILURE_ACTIONS *fa)
-{
-       uint32 size = 0;
-
-       if ( !fa )
-               return 0;
-
-       size  = sizeof(uint32) * 2;
-       size += sizeof_unistr2( fa->rebootmsg );
-       size += sizeof_unistr2( fa->command );
-       size += sizeof(SC_ACTION) * fa->num_actions;
-
-       return size;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_r_query_service_config2(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u, prs_struct *ps, int depth)
-{
-       if ( !r_u )
-               return False;
-
-       prs_debug(ps, depth, desc, "svcctl_io_r_query_service_config2");
-       depth++;
-
-       if ( !prs_align(ps) )
-               return False;
-
-       if (!prs_rpcbuffer("", ps, depth, &r_u->buffer))
-               return False;
-       if(!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("needed", ps, depth, &r_u->needed))
-               return False;
-
-       if(!prs_werror("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_q_query_service_status_ex(const char *desc, SVCCTL_Q_QUERY_SERVICE_STATUSEX *q_u, prs_struct *ps, int depth)
-{
-       if (q_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "svcctl_io_q_query_service_status_ex");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
-               return False;
-
-       if(!prs_uint32("level", ps, depth, &q_u->level))
-               return False;
-
-       if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
-               return False;
-
-       return True;
-
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVICE_STATUSEX *r_u, prs_struct *ps, int depth)
-{
-       if ( !r_u )
-               return False;
-
-       prs_debug(ps, depth, desc, "svcctl_io_r_query_service_status_ex");
-       depth++;
-
-       if (!prs_rpcbuffer("", ps, depth, &r_u->buffer))
-               return False;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_uint32("needed", ps, depth, &r_u->needed))
-               return False;
-
-       if(!prs_werror("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
index 4b3fdda3cbba123dbde1916d31c5658ad1fb4c41..275a2f62b22a2f43ce0cbb2d547f14af3cf922d8 100644 (file)
@@ -109,24 +109,9 @@ static bool api_svcctl_enum_services_status(pipes_struct *p)
 
 static bool api_svcctl_query_service_status_ex(pipes_struct *p)
 {
-       SVCCTL_Q_QUERY_SERVICE_STATUSEX q_u;
-       SVCCTL_R_QUERY_SERVICE_STATUSEX 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(!svcctl_io_q_query_service_status_ex("", &q_u, data, 0))
-               return False;
-
-       r_u.status = _svcctl_query_service_status_ex(p, &q_u, &r_u);
-
-       if(!svcctl_io_r_query_service_status_ex("", &r_u, rdata, 0))
-               return False;
-
-       return True;
+       return proxy_svcctl_call(p, NDR_SVCCTL_QUERYSERVICESTATUSEX);
 }
+
 /*******************************************************************
  ********************************************************************/
 
@@ -156,7 +141,7 @@ static bool api_svcctl_control_service(pipes_struct *p)
 
 static bool api_svcctl_query_service_config(pipes_struct *p)
 {
-       return proxy_svcctl_call(p, SVCCTL_QUERY_SERVICE_CONFIG_W);
+       return proxy_svcctl_call(p, NDR_SVCCTL_QUERYSERVICECONFIGW);
 }
 
 /*******************************************************************
@@ -164,23 +149,7 @@ static bool api_svcctl_query_service_config(pipes_struct *p)
 
 static bool api_svcctl_query_service_config2(pipes_struct *p)
 {
-       SVCCTL_Q_QUERY_SERVICE_CONFIG2 q_u;
-       SVCCTL_R_QUERY_SERVICE_CONFIG2 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(!svcctl_io_q_query_service_config2("", &q_u, data, 0))
-               return False;
-
-       r_u.status = _svcctl_query_service_config2(p, &q_u, &r_u);
-
-       if(!svcctl_io_r_query_service_config2("", &r_u, rdata, 0))
-               return False;
-
-       return True;
+       return proxy_svcctl_call(p, NDR_SVCCTL_QUERYSERVICECONFIG2W);
 }
 
 /*******************************************************************
index 187fb368e2032b98c91a7c45116108aa5193db5a..457e44a2df8483987d9187895e044c75fd31cf52 100644 (file)
@@ -555,11 +555,13 @@ WERROR _svcctl_EnumDependentServicesW(pipes_struct *p,
 }
 
 /********************************************************************
+ _svcctl_QueryServiceStatusEx
 ********************************************************************/
 
-WERROR _svcctl_query_service_status_ex( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_STATUSEX *q_u, SVCCTL_R_QUERY_SERVICE_STATUSEX *r_u )
+WERROR _svcctl_QueryServiceStatusEx(pipes_struct *p,
+                                   struct svcctl_QueryServiceStatusEx *r)
 {
-       SERVICE_INFO *info = find_service_info_by_hnd( p, &q_u->handle );
+       SERVICE_INFO *info = find_service_info_by_hnd( p, r->in.handle );
        uint32 buffer_size;
 
        /* perform access checks */
@@ -573,21 +575,29 @@ WERROR _svcctl_query_service_status_ex( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_
        /* we have to set the outgoing buffer size to the same as the
           incoming buffer size (even in the case of failure) */
 
-       rpcbuf_init( &r_u->buffer, q_u->buffer_size, p->mem_ctx );
-       r_u->needed = q_u->buffer_size;
+       *r->out.bytes_needed = r->in.buf_size;
 
-       switch ( q_u->level ) {
+       switch ( r->in.info_level ) {
                case SVC_STATUS_PROCESS_INFO:
                {
-                       SERVICE_STATUS_PROCESS svc_stat_proc;
+                       struct SERVICE_STATUS_PROCESS svc_stat_proc;
+                       enum ndr_err_code ndr_err;
+                       DATA_BLOB blob;
 
                        /* Get the status of the service.. */
                        info->ops->service_status( info->name, &svc_stat_proc.status );
                        svc_stat_proc.process_id     = sys_getpid();
                        svc_stat_proc.service_flags  = 0x0;
 
-                       svcctl_io_service_status_process( "", &svc_stat_proc, &r_u->buffer, 0 );
-                       buffer_size = sizeof(SERVICE_STATUS_PROCESS);
+                       ndr_err = ndr_push_struct_blob(&blob, p->mem_ctx, NULL,
+                                                      &svc_stat_proc,
+                                                      (ndr_push_flags_fn_t)ndr_push_SERVICE_STATUS_PROCESS);
+                       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+                               return WERR_INVALID_PARAM;
+                       }
+
+                       r->out.buffer = blob.data;
+                       buffer_size = sizeof(struct SERVICE_STATUS_PROCESS);
                        break;
                }
 
@@ -597,10 +607,11 @@ WERROR _svcctl_query_service_status_ex( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_
 
 
         buffer_size += buffer_size % 4;
-       r_u->needed = (buffer_size > q_u->buffer_size) ? buffer_size : q_u->buffer_size;
+       *r->out.bytes_needed = (buffer_size > r->in.buf_size) ? buffer_size : r->in.buf_size;
 
-        if (buffer_size > q_u->buffer_size )
-                return WERR_MORE_DATA;
+        if (buffer_size > r->in.buf_size ) {
+                return WERR_INSUFFICIENT_BUFFER;
+       }
 
        return WERR_OK;
 }
@@ -700,11 +711,13 @@ WERROR _svcctl_QueryServiceConfigW(pipes_struct *p,
 }
 
 /********************************************************************
+ _svcctl_QueryServiceConfig2W
 ********************************************************************/
 
-WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u )
+WERROR _svcctl_QueryServiceConfig2W(pipes_struct *p,
+                                   struct svcctl_QueryServiceConfig2W *r)
 {
-       SERVICE_INFO *info = find_service_info_by_hnd( p, &q_u->handle );
+       SERVICE_INFO *info = find_service_info_by_hnd( p, r->in.handle );
        uint32 buffer_size;
 
        /* perform access checks */
@@ -718,36 +731,53 @@ WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CO
        /* we have to set the outgoing buffer size to the same as the
           incoming buffer size (even in the case of failure */
 
-       rpcbuf_init( &r_u->buffer, q_u->buffer_size, p->mem_ctx );
-       r_u->needed = q_u->buffer_size;
+       *r->out.bytes_needed = r->in.buf_size;
 
-       switch ( q_u->level ) {
+       switch ( r->in.info_level ) {
        case SERVICE_CONFIG_DESCRIPTION:
                {
-                       SERVICE_DESCRIPTION desc_buf;
+                       struct SERVICE_DESCRIPTION desc_buf;
                        const char *description;
+                       enum ndr_err_code ndr_err;
+                       DATA_BLOB blob;
 
                        description = svcctl_lookup_description(
                                p->mem_ctx, info->name, p->server_info->ptok);
 
-                       ZERO_STRUCTP( &desc_buf );
+                       desc_buf.description = description;
+
+                       ndr_err = ndr_push_struct_blob(&blob, p->mem_ctx, NULL,
+                                                      &desc_buf,
+                                                      (ndr_push_flags_fn_t)ndr_push_SERVICE_DESCRIPTION);
+                       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+                               return WERR_INVALID_PARAM;
+                       }
 
-                       init_service_description_buffer( &desc_buf, description ? description : "");
-                       svcctl_io_service_description( "", &desc_buf, &r_u->buffer, 0 );
-                       buffer_size = svcctl_sizeof_service_description( &desc_buf );
+                       buffer_size = ndr_size_SERVICE_DESCRIPTION(&desc_buf, NULL, 0);
+                       r->out.buffer = blob.data;
 
                        break;
                }
                break;
        case SERVICE_CONFIG_FAILURE_ACTIONS:
                {
-                       SERVICE_FAILURE_ACTIONS actions;
+                       struct SERVICE_FAILURE_ACTIONS actions;
+                       enum ndr_err_code ndr_err;
+                       DATA_BLOB blob;
 
                        /* nothing to say...just service the request */
 
-                       ZERO_STRUCTP( &actions );
-                       svcctl_io_service_fa( "", &actions, &r_u->buffer, 0 );
-                       buffer_size = svcctl_sizeof_service_fa( &actions );
+                       ZERO_STRUCT( actions );
+
+                       ndr_err = ndr_push_struct_blob(&blob, p->mem_ctx, NULL,
+                                                      &actions,
+                                                      (ndr_push_flags_fn_t)ndr_push_SERVICE_FAILURE_ACTIONS);
+                       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+                               return WERR_INVALID_PARAM;
+                       }
+
+                       buffer_size = ndr_size_SERVICE_FAILURE_ACTIONS(&actions, NULL, 0);
+                       r->out.buffer = blob.data;
 
                        break;
                }
@@ -758,9 +788,9 @@ WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CO
        }
 
        buffer_size += buffer_size % 4;
-       r_u->needed = (buffer_size > q_u->buffer_size) ? buffer_size : q_u->buffer_size;
+       *r->out.bytes_needed = (buffer_size > r->in.buf_size) ? buffer_size : r->in.buf_size;
 
-        if (buffer_size > q_u->buffer_size )
+        if (buffer_size > r->in.buf_size )
                 return WERR_INSUFFICIENT_BUFFER;
 
        return WERR_OK;
@@ -1072,18 +1102,6 @@ WERROR _svcctl_QueryServiceConfig2A(pipes_struct *p, struct svcctl_QueryServiceC
        return WERR_NOT_SUPPORTED;
 }
 
-WERROR _svcctl_QueryServiceConfig2W(pipes_struct *p, struct svcctl_QueryServiceConfig2W *r)
-{
-       p->rng_fault_state = True;
-       return WERR_NOT_SUPPORTED;
-}
-
-WERROR _svcctl_QueryServiceStatusEx(pipes_struct *p, struct svcctl_QueryServiceStatusEx *r)
-{
-       p->rng_fault_state = True;
-       return WERR_NOT_SUPPORTED;
-}
-
 WERROR _EnumServicesStatusExA(pipes_struct *p, struct EnumServicesStatusExA *r)
 {
        p->rng_fault_state = True;
index 8beed0744c17e106194236dd426a42c47331a0e8..54ae45a7892bc150282c28af80cd78ac1458d234 100644 (file)
@@ -19,6 +19,7 @@
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 #if defined(WITH_AIO)
 
@@ -53,8 +54,6 @@ struct aio_extra {
 static int handle_aio_read_complete(struct aio_extra *aio_ex);
 static int handle_aio_write_complete(struct aio_extra *aio_ex);
 
-static struct aio_extra *aio_list_head;
-
 static int aio_extra_destructor(struct aio_extra *aio_ex)
 {
        DLIST_REMOVE(aio_list_head, aio_ex);
@@ -109,20 +108,15 @@ static struct aio_extra *find_aio_ex(uint16 mid)
  We can have these many aio buffers in flight.
 *****************************************************************************/
 
-static int aio_pending_size;
-static sig_atomic_t signals_received;
-static int outstanding_aio_calls;
-static uint16 *aio_pending_array;
-
 /****************************************************************************
  Signal handler when an aio request completes.
 *****************************************************************************/
 
 void aio_request_done(uint16_t mid)
 {
-       if (signals_received < aio_pending_size) {
-               aio_pending_array[signals_received] = mid;
-               signals_received++;
+       if (aio_signals_received < aio_pending_size) {
+               aio_pending_array[aio_signals_received] = mid;
+               aio_signals_received++;
        }
        /* Else signal is lost. */
 }
@@ -139,7 +133,7 @@ static void signal_handler(int sig, siginfo_t *info, void *unused)
 
 bool aio_finished(void)
 {
-       return (signals_received != 0);
+       return (aio_signals_received != 0);
 }
 
 /****************************************************************************
@@ -587,17 +581,17 @@ int process_aio_queue(void)
        BlockSignals(True, RT_SIGNAL_AIO);
 
        DEBUG(10,("process_aio_queue: signals_received = %d\n",
-                 (int)signals_received));
+                 (int)aio_signals_received));
        DEBUG(10,("process_aio_queue: outstanding_aio_calls = %d\n",
                  outstanding_aio_calls));
 
-       if (!signals_received) {
+       if (!aio_signals_received) {
                BlockSignals(False, RT_SIGNAL_AIO);
                return 0;
        }
 
        /* Drain all the complete aio_reads. */
-       for (i = 0; i < signals_received; i++) {
+       for (i = 0; i < aio_signals_received; i++) {
                uint16 mid = aio_pending_array[i];
                files_struct *fsp = NULL;
                struct aio_extra *aio_ex = find_aio_ex(mid);
@@ -626,8 +620,8 @@ int process_aio_queue(void)
                TALLOC_FREE(aio_ex);
        }
 
-       outstanding_aio_calls -= signals_received;
-       signals_received = 0;
+       outstanding_aio_calls -= aio_signals_received;
+       aio_signals_received = 0;
        BlockSignals(False, RT_SIGNAL_AIO);
        return ret;
 }
index 2b90d24c878ec1e328e184cc58c296d4703c92ad..cccc5ce727af6c477ef517ed5ee3b50a175b33ee 100644 (file)
@@ -18,6 +18,8 @@
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
+
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_LOCKING
 
@@ -41,15 +43,6 @@ typedef struct blocking_lock_record {
        struct smb_request *req;
 } blocking_lock_record;
 
-/* dlink list we store pending lock records on. */
-static blocking_lock_record *blocking_lock_queue;
-
-/* dlink list we move cancelled lock records onto. */
-static blocking_lock_record *blocking_lock_cancelled_queue;
-
-/* The event that makes us process our blocking lock queue */
-static struct timed_event *brl_timeout;
-
 /****************************************************************************
  Determine if this is a secondary element of a chained SMB.
   **************************************************************************/
@@ -148,7 +141,6 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
                uint64_t count,
                uint32_t blocking_pid)
 {
-       static bool set_lock_msg;
        blocking_lock_record *blr;
        NTSTATUS status;
 
@@ -211,10 +203,10 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
        recalc_brl_timeout();
 
        /* Ensure we'll receive messages when this is unlocked. */
-       if (!set_lock_msg) {
+       if (!blocking_lock_unlock_state) {
                messaging_register(smbd_messaging_context(), NULL,
                                   MSG_SMB_UNLOCK, received_unlock_msg);
-               set_lock_msg = True;
+               blocking_lock_unlock_state = true;
        }
 
        DEBUG(3,("push_blocking_lock_request: lock request blocked with "
@@ -784,17 +776,16 @@ bool blocking_lock_cancel(files_struct *fsp,
                        unsigned char locktype,
                         NTSTATUS err)
 {
-       static bool initialized;
        char msg[MSG_BLOCKING_LOCK_CANCEL_SIZE];
        blocking_lock_record *blr;
 
-       if (!initialized) {
+       if (!blocking_lock_cancel_state) {
                /* Register our message. */
                messaging_register(smbd_messaging_context(), NULL,
                                   MSG_SMB_BLOCKING_LOCK_CANCEL,
                                   process_blocking_lock_cancel_message);
 
-               initialized = True;
+               blocking_lock_cancel_state = True;
        }
 
        for (blr = blocking_lock_queue; blr; blr = blr->next) {
index e6d2bbf59fd133e511ff121b3567989c9fccecc6..78bace7e92433bc3836436f52a0745aa23065346 100644 (file)
@@ -712,7 +712,7 @@ bool check_lanman_password(char *user, uchar * pass1,
 
 bool change_lanman_password(struct samu *sampass, uchar *pass2)
 {
-       static uchar null_pw[16];
+       uchar null_pw[16];
        uchar unenc_new_pw[16];
        bool ret;
        uint32 acct_ctrl;
@@ -735,20 +735,21 @@ bool change_lanman_password(struct samu *sampass, uchar *pass2)
        if (pwd == NULL) { 
                if (acct_ctrl & ACB_PWNOTREQ) {
                        uchar no_pw[14];
-                       memset(no_pw, '\0', 14);
+
+                       ZERO_STRUCT(no_pw);
+
                        E_P16(no_pw, null_pw);
 
-                       /* Get the new lanman hash. */
-                       D_P16(null_pw, pass2, unenc_new_pw);
+                       pwd = null_pw;
                } else {
                        DEBUG(0,("change_lanman_password: no lanman password !\n"));
                        return False;
                }
-       } else {
-               /* Get the new lanman hash. */
-               D_P16(pwd, pass2, unenc_new_pw);
        }
 
+       /* Get the new lanman hash. */
+       D_P16(pwd, pass2, unenc_new_pw);
+
        if (!pdb_set_lanman_passwd(sampass, unenc_new_pw, PDB_CHANGED)) {
                return False;
        }
@@ -826,8 +827,8 @@ static NTSTATUS check_oem_password(const char *user,
                                   struct samu **hnd,
                                   char **pp_new_passwd)
 {
-       static uchar null_pw[16];
-       static uchar null_ntpw[16];
+       uchar null_pw[16];
+       uchar null_ntpw[16];
        struct samu *sampass = NULL;
        uint8 *password_encrypted;
        const uint8 *encryption_key;
index 7f34d2b8e2b3e9d1971c2bd9cb9a9e5057b1c32c..4b467b0312a5209863e3293ad20a9877ed34ec5f 100644 (file)
@@ -19,6 +19,7 @@
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 /* The connections bitmap is expanded in increments of BITMAP_BLOCK_SZ. The
  * maximum size of the bitmap is the largest positive integer, but you will hit
  */
 #define BITMAP_BLOCK_SZ 128
 
-static connection_struct *Connections;
-
-/* number of open connections */
-static struct bitmap *bmap;
-static int num_open;
-
 /****************************************************************************
 init the conn structures
 ****************************************************************************/
index cd09d739236c2aaa39ecde1557c249773a757729..dc5719a4a504f66c9c43ee5bbbb48415998cd822 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 /****************************************************************************
  Normalise for DOS usage.
@@ -150,10 +151,9 @@ uint64_t sys_disk_free(connection_struct *conn, const char *path, bool small_que
        }
 
        if ((*dsize)<1) {
-               static bool done = false;
-               if (!done) {
+               if (!dfree_broken) {
                        DEBUG(0,("WARNING: dfree is broken on this system\n"));
-                       done=true;
+                       dfree_broken=true;
                }
                *dsize = 20*1024*1024/(*bsize);
                *dfree = MAX(1,*dfree);
index c2735c032a7527a1729fbc757d476ed2b64e1ed1..2b996a41cfd8edaf960c6dc1c3c59fd1874aee6d 100644 (file)
@@ -19,6 +19,7 @@
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 /*
    This module implements directory related functions for Samba.
@@ -61,9 +62,6 @@ struct dptr_struct {
        bool did_stat; /* Optimisation for non-wcard searches. */
 };
 
-static struct bitmap *dptr_bmap;
-static struct dptr_struct *dirptrs;
-static int dirhandles_open = 0;
 
 #define INVALID_DPTR_KEY (-3)
 
@@ -119,17 +117,13 @@ bool make_dir_struct(TALLOC_CTX *ctx,
 
 void init_dptrs(void)
 {
-       static bool dptrs_init=False;
-
-       if (dptrs_init)
+       if (dptr_bmap)
                return;
 
        dptr_bmap = bitmap_allocate(MAX_DIRECTORY_HANDLES);
 
        if (!dptr_bmap)
                exit_server("out of memory in init_dptrs");
-
-       dptrs_init = True;
 }
 
 /****************************************************************************
index 1049c95a391e50c28578a8c72932d928230e2860..dbb799fd5baa26132e0333689a5543f9388a6553 100644 (file)
@@ -19,6 +19,7 @@
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_DMAPI
@@ -46,15 +47,19 @@ const void * dmapi_get_current_session(void) { return NULL; }
 #define DMAPI_SESSION_NAME "samba"
 #define DMAPI_TRACE 10
 
-static dm_sessid_t samba_dmapi_session = DM_NO_SESSION;
-static unsigned session_num;
+struct smbd_dmapi_context {
+       dm_sessid_t session;
+       unsigned session_num;
+};
+
+static struct smbd_dmapi_context *dmapi_ctx;
 
 /* 
    Initialise DMAPI session. The session is persistant kernel state, 
    so it might already exist, in which case we merely want to 
    reconnect to it. This function should be called as root.
 */
-static int dmapi_init_session(void)
+static int dmapi_init_session(struct smbd_dmapi_context *ctx)
 {
        char    buf[DM_SESSION_INFO_LEN];
        size_t  buflen;
@@ -66,11 +71,11 @@ static int dmapi_init_session(void)
 
        int i, err;
 
-       if (session_num == 0) {
-               session_name = DMAPI_SESSION_NAME;
+       if (ctx->session_num == 0) {
+               session_name = talloc_strdup(tmp_ctx, DMAPI_SESSION_NAME);
        } else {
                session_name = talloc_asprintf(tmp_ctx, "%s%u", DMAPI_SESSION_NAME,
-                                              session_num);
+                                              ctx->session_num);
        }
 
        if (session_name == NULL) {
@@ -116,7 +121,7 @@ static int dmapi_init_session(void)
                err = dm_query_session(sessions[i], sizeof(buf), buf, &buflen);
                buf[sizeof(buf) - 1] = '\0';
                if (err == 0 && strcmp(session_name, buf) == 0) {
-                       samba_dmapi_session = sessions[i];
+                       ctx->session = sessions[i];
                        DEBUGADD(DMAPI_TRACE,
                                ("attached to existing DMAPI session "
                                 "named '%s'\n", buf));
@@ -125,15 +130,15 @@ static int dmapi_init_session(void)
        }
 
        /* No session already defined. */
-       if (samba_dmapi_session == DM_NO_SESSION) {
+       if (ctx->session == DM_NO_SESSION) {
                err = dm_create_session(DM_NO_SESSION, 
                                        session_name,
-                                       &samba_dmapi_session);
+                                       &ctx->session);
                if (err < 0) {
                        DEBUGADD(DMAPI_TRACE,
                                ("failed to create new DMAPI session: %s\n",
                                strerror(errno)));
-                       samba_dmapi_session = DM_NO_SESSION;
+                       ctx->session = DM_NO_SESSION;
                        talloc_free(tmp_ctx);
                        return -1;
                }
@@ -142,7 +147,7 @@ static int dmapi_init_session(void)
                          session_name, version));
        }
 
-       if (samba_dmapi_session != DM_NO_SESSION) {
+       if (ctx->session != DM_NO_SESSION) {
                set_effective_capability(DMAPI_ACCESS_CAPABILITY);
        }
 
@@ -165,11 +170,15 @@ static int dmapi_init_session(void)
 */
 const void *dmapi_get_current_session(void)
 {
-       if (samba_dmapi_session == DM_NO_SESSION) {
+       if (!dmapi_ctx) {
+               return NULL;
+       }
+
+       if (dmapi_ctx->session == DM_NO_SESSION) {
                return NULL;
        }
 
-       return (void *)&samba_dmapi_session;
+       return (void *)&dmapi_ctx->session;
 }
        
 /*
@@ -180,17 +189,22 @@ const void *dmapi_get_current_session(void)
 
 bool dmapi_have_session(void)
 {
-       static bool initialized;
-       if (!initialized) {
-               initialized = true;
+       if (!dmapi_ctx) {
+               dmapi_ctx = talloc(talloc_autofree_context(),
+                                  struct smbd_dmapi_context);
+               if (!dmapi_ctx) {
+                       exit_server("unable to allocate smbd_dmapi_context");
+               }
+               dmapi_ctx->session = DM_NO_SESSION;
+               dmapi_ctx->session_num = 0;
 
                become_root();
-               dmapi_init_session();
+               dmapi_init_session(dmapi_ctx);
                unbecome_root();
 
        }
 
-       return samba_dmapi_session != DM_NO_SESSION;
+       return dmapi_ctx->session != DM_NO_SESSION;
 }
 
 /*
@@ -202,14 +216,14 @@ bool dmapi_new_session(void)
 {
        if (dmapi_have_session()) {
                /* try to destroy the old one - this may not succeed */
-               dm_destroy_session(samba_dmapi_session);
+               dm_destroy_session(dmapi_ctx->session);
        }
-       samba_dmapi_session = DM_NO_SESSION;
+       dmapi_ctx->session = DM_NO_SESSION;
        become_root();
-       session_num++;
-       dmapi_init_session();
+       dmapi_ctx->session_num++;
+       dmapi_init_session(dmapi_ctx);
        unbecome_root();
-       return samba_dmapi_session != DM_NO_SESSION;    
+       return dmapi_ctx->session != DM_NO_SESSION;
 }
 
 /* 
@@ -221,18 +235,21 @@ bool dmapi_new_session(void)
 */
 bool dmapi_destroy_session(void)
 {
-       if (samba_dmapi_session != DM_NO_SESSION) {
+       if (!dmapi_ctx) {
+               return true;
+       }
+       if (dmapi_ctx->session != DM_NO_SESSION) {
                become_root();
-               if (0 == dm_destroy_session(samba_dmapi_session)) {
-                       session_num--;
-                       samba_dmapi_session = DM_NO_SESSION;
+               if (0 == dm_destroy_session(dmapi_ctx->session)) {
+                       dmapi_ctx->session_num--;
+                       dmapi_ctx->session = DM_NO_SESSION;
                } else {
                        DEBUG(0,("Couldn't destroy DMAPI session: %s\n",
                                 strerror(errno)));
                }
                unbecome_root();
        }
-       return samba_dmapi_session == DM_NO_SESSION;
+       return dmapi_ctx->session == DM_NO_SESSION;
 }
 
 
index de2de088ec222f30d0c7328bf628217173b49a77..ce22f86414b385b7ff6faa0630e04aa21b83f137 100644 (file)
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 /* From lib/error.c */
 extern struct unix_error_map unix_dos_nt_errmap[];
 
-extern uint32 global_client_caps;
-
 bool use_nt_status(void)
 {
        return lp_nt_status_support() && (global_client_caps & CAP_STATUS32);
index 7feedcc9f9c8fa235a6a710d3d4613a983f28cba..ef54398bc451338768b83a9436ed6106305a8b21 100644 (file)
@@ -25,7 +25,7 @@ struct fake_file_type {
        void *(*init_pd)(TALLOC_CTX *mem_ctx);
 };
 
-static struct fake_file_type fake_files[] = {
+static const struct fake_file_type fake_files[] = {
 #ifdef WITH_QUOTAS
        {FAKE_FILE_NAME_QUOTA_UNIX, FAKE_FILE_TYPE_QUOTA, init_quota_handle},
 #endif /* WITH_QUOTAS */
index 30253d44664af9a9ed65382bfb67c87e2dcba75a..3e3f0943b3db5dd1519581aef8dec46db01dff85 100644 (file)
@@ -20,6 +20,7 @@
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 static bool setup_write_cache(files_struct *, SMB_OFF_T);
 
@@ -109,9 +110,6 @@ tryagain:
        return(ret);
 }
 
-/* how many write cache buffers have been allocated */
-static unsigned int allocated_write_caches;
-
 /****************************************************************************
  *Really* write to a file.
 ****************************************************************************/
index 1a3a997e590a0196cf298b8d7a0d1878d5a0f3f3..efaadffc061cda7569db49ce9186d0af951f76d1 100644 (file)
 */
 
 #include "includes.h"
-
-static int real_max_open_files;
+#include "smbd/globals.h"
 
 #define VALID_FNUM(fnum)   (((fnum) >= 0) && ((fnum) < real_max_open_files))
 
 #define FILE_HANDLE_OFFSET 0x1000
 
-static struct bitmap *file_bmap;
-
-static files_struct *Files;
-
-static int files_used;
-
-/* A singleton cache to speed up searching by dev/inode. */
-static struct fsp_singleton_cache {
-       files_struct *fsp;
-       struct file_id id;
-} fsp_fi_cache;
-
 /****************************************************************************
  Return a unique number identifying this fsp over the life of this pid.
 ****************************************************************************/
 
 static unsigned long get_gen_count(void)
 {
-       static unsigned long file_gen_counter;
-
        if ((++file_gen_counter) == 0)
                return ++file_gen_counter;
        return file_gen_counter;
@@ -58,7 +43,6 @@ NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
                  files_struct **result)
 {
        int i;
-       static int first_file;
        files_struct *fsp;
 
        /* we want to give out file handles differently on each new
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
new file mode 100644 (file)
index 0000000..ad017f5
--- /dev/null
@@ -0,0 +1,221 @@
+/*
+   Unix SMB/Netbios implementation.
+   smbd globals
+   Copyright (C) Stefan Metzmacher 2009
+
+   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 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, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "smbd/globals.h"
+
+#if defined(WITH_AIO)
+struct aio_extra *aio_list_head = NULL;
+int aio_pending_size = 0;
+sig_atomic_t aio_signals_received = 0;
+int outstanding_aio_calls = 0;
+uint16 *aio_pending_array = NULL;
+#endif
+
+/* dlink list we store pending lock records on. */
+struct blocking_lock_record *blocking_lock_queue = NULL;
+
+/* dlink list we move cancelled lock records onto. */
+struct blocking_lock_record *blocking_lock_cancelled_queue = NULL;
+
+/* The event that makes us process our blocking lock queue */
+struct timed_event *brl_timeout = NULL;
+
+bool blocking_lock_unlock_state = false;
+bool blocking_lock_cancel_state = false;
+
+#ifdef USE_DMAPI
+struct smbd_dmapi_context *dmapi_ctx = NULL;
+#endif
+
+connection_struct *Connections = NULL;
+/* number of open connections */
+struct bitmap *bmap = 0;
+int num_open = 0;
+
+
+bool dfree_broken = false;
+
+struct bitmap *dptr_bmap = NULL;
+struct dptr_struct *dirptrs = NULL;
+int dirhandles_open = 0;
+
+/* how many write cache buffers have been allocated */
+unsigned int allocated_write_caches = 0;
+
+int real_max_open_files = 0;
+struct bitmap *file_bmap = NULL;
+files_struct *Files = NULL;
+int files_used = 0;
+struct fsp_singleton_cache fsp_fi_cache = {
+       .fsp = NULL,
+       .id = {
+               .devid = 0,
+               .inode = 0
+       }
+};
+unsigned long file_gen_counter = 0;
+int first_file = 0;
+
+const struct mangle_fns *mangle_fns = NULL;
+
+unsigned char *chartest = NULL;
+TDB_CONTEXT *tdb_mangled_cache = NULL;
+
+/* these tables are used to provide fast tests for characters */
+unsigned char char_flags[256];
+/*
+  this determines how many characters are used from the original filename
+  in the 8.3 mangled name. A larger value leads to a weaker hash and more collisions.
+  The largest possible value is 6.
+*/
+unsigned mangle_prefix = 0;
+unsigned char base_reverse[256];
+
+char *last_from = NULL;
+char *last_to = NULL;
+
+struct msg_state *smbd_msg_state = NULL;
+
+bool global_encrypted_passwords_negotiated = false;
+bool global_spnego_negotiated = false;
+struct auth_context *negprot_global_auth_context = NULL;
+bool done_negprot = false;
+
+bool logged_ioctl_message = false;
+
+/* users from session setup */
+char *session_userlist = NULL;
+/* workgroup from session setup. */
+char *session_workgroup = NULL;
+/* this holds info on user ids that are already validated for this VC */
+user_struct *validated_users = NULL;
+uint16_t next_vuid = VUID_OFFSET;
+int num_validated_vuids = 0;
+#ifdef HAVE_NETGROUP
+char *my_yp_domain = NULL;
+#endif
+
+bool already_got_session = false;
+
+/*
+ * Size of data we can send to client. Set
+ *  by the client for all protocols above CORE.
+ *  Set by us for CORE protocol.
+ */
+int max_send = BUFFER_SIZE;
+/*
+ * Size of the data we can receive. Set by us.
+ * Can be modified by the max xmit parameter.
+ */
+int max_recv = BUFFER_SIZE;
+SIG_ATOMIC_T reload_after_sighup = 0;
+SIG_ATOMIC_T got_sig_term = 0;
+uint16 last_session_tag = UID_FIELD_INVALID;
+int trans_num = 0;
+char *orig_inbuf = NULL;
+pid_t mypid = 0;
+time_t last_smb_conf_reload_time = 0;
+time_t last_printer_reload_time = 0;
+/****************************************************************************
+ structure to hold a linked list of queued messages.
+ for processing.
+****************************************************************************/
+struct pending_message_list *deferred_open_queue = NULL;
+uint32_t common_flags2 = FLAGS2_LONG_PATH_COMPONENTS|FLAGS2_32_BIT_ERROR_CODES;
+
+struct smb_srv_trans_enc_ctx *partial_srv_trans_enc_ctx = NULL;
+struct smb_srv_trans_enc_ctx *srv_trans_enc_ctx = NULL;
+
+/* A stack of security contexts.  We include the current context as being
+   the first one, so there is room for another MAX_SEC_CTX_DEPTH more. */
+struct sec_ctx sec_ctx_stack[MAX_SEC_CTX_DEPTH + 1];
+int sec_ctx_stack_ndx = 0;
+bool become_uid_done = false;
+bool become_gid_done = false;
+
+connection_struct *last_conn = NULL;
+uint16_t last_flags = 0;
+
+struct db_context *session_db_ctx_ptr = NULL;
+
+uint32_t global_client_caps = 0;
+bool done_sesssetup = false;
+/****************************************************************************
+ List to store partial SPNEGO auth fragments.
+****************************************************************************/
+struct pending_auth_data *pd_list = NULL;
+
+uint16_t fnf_handle = 257;
+
+/* A stack of current_user connection contexts. */
+struct conn_ctx conn_ctx_stack[MAX_SEC_CTX_DEPTH];
+int conn_ctx_stack_ndx = 0;
+
+struct vfs_init_function_entry *backends = NULL;
+char *sparse_buf = NULL;
+char *LastDir = NULL;
+
+#if HAVE_KERNEL_OPLOCKS_LINUX
+SIG_ATOMIC_T oplock_signals_received = 0;
+SIG_ATOMIC_T fd_pending_array[FD_PENDING_SIZE];
+struct kernel_oplocks linux_koplocks;
+#endif
+
+#if HAVE_KERNEL_OPLOCKS_IRIX
+int oplock_pipe_write = -1;
+int oplock_pipe_read = -1;
+struct kernel_oplocks irix_koplocks;
+#endif
+
+/* Current number of oplocks we have outstanding. */
+int32_t exclusive_oplocks_open = 0;
+int32_t level_II_oplocks_open = 0;
+bool global_client_failed_oplock_break = false;
+const struct kernel_oplocks *koplocks = NULL;
+
+struct notify_mid_map *notify_changes_by_mid = NULL;
+
+int am_parent = 1;
+SIG_ATOMIC_T got_sig_cld = 0;
+int server_fd = -1;
+struct event_context *smbd_event_ctx = NULL;
+struct messaging_context *smbd_msg_ctx = NULL;
+struct memcache *smbd_memcache_ctx = NULL;
+bool exit_firsttime = true;
+struct child_pid *children = 0;
+int num_children = 0;
+
+void smbd_init_globals(void)
+{
+       ZERO_STRUCT(char_flags);
+       ZERO_STRUCT(base_reverse);
+
+       ZERO_STRUCT(conn_ctx_stack);
+
+       ZERO_STRUCT(sec_ctx_stack);
+
+#if HAVE_KERNEL_OPLOCKS_LINUX
+       ZERO_STRUCT(fd_pending_array);
+       ZERO_STRUCT(linux_koplocks);
+#endif
+#if HAVE_KERNEL_OPLOCKS_IRIX
+       ZERO_STRUCT(irix_koplocks);
+#endif
+}
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
new file mode 100644 (file)
index 0000000..178263b
--- /dev/null
@@ -0,0 +1,219 @@
+/*
+   Unix SMB/Netbios implementation.
+   smbd globals
+   Copyright (C) Stefan Metzmacher 2009
+
+   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 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, see <http://www.gnu.org/licenses/>.
+*/
+
+#if defined(WITH_AIO)
+struct aio_extra;
+extern struct aio_extra *aio_list_head;
+extern int aio_pending_size;
+extern sig_atomic_t aio_signals_received;
+extern int outstanding_aio_calls;
+extern uint16_t *aio_pending_array;
+#endif
+
+/* dlink list we store pending lock records on. */
+extern struct blocking_lock_record *blocking_lock_queue;
+
+/* dlink list we move cancelled lock records onto. */
+extern struct blocking_lock_record *blocking_lock_cancelled_queue;
+
+/* The event that makes us process our blocking lock queue */
+extern struct timed_event *brl_timeout;
+
+extern bool blocking_lock_unlock_state;
+extern bool blocking_lock_cancel_state;
+
+#ifdef USE_DMAPI
+struct smbd_dmapi_context;
+extern struct smbd_dmapi_context *dmapi_ctx;
+#endif
+
+extern connection_struct *Connections;
+/* number of open connections */
+extern struct bitmap *bmap;
+extern int num_open;
+
+extern bool dfree_broken;
+
+extern struct bitmap *dptr_bmap;
+//struct dptr_struct;
+extern struct dptr_struct *dirptrs;
+extern int dirhandles_open;
+
+/* how many write cache buffers have been allocated */
+extern unsigned int allocated_write_caches;
+
+extern int real_max_open_files;
+extern struct bitmap *file_bmap;
+extern files_struct *Files;
+extern int files_used;
+/* A singleton cache to speed up searching by dev/inode. */
+struct fsp_singleton_cache {
+       files_struct *fsp;
+       struct file_id id;
+};
+extern struct fsp_singleton_cache fsp_fi_cache;
+extern unsigned long file_gen_counter;
+extern int first_file;
+
+extern const struct mangle_fns *mangle_fns;
+
+extern unsigned char *chartest;
+extern TDB_CONTEXT *tdb_mangled_cache;
+
+/* these tables are used to provide fast tests for characters */
+extern unsigned char char_flags[256];
+/*
+  this determines how many characters are used from the original filename
+  in the 8.3 mangled name. A larger value leads to a weaker hash and more collisions.
+  The largest possible value is 6.
+*/
+extern unsigned mangle_prefix;
+extern unsigned char base_reverse[256];
+
+extern char *last_from;
+extern char *last_to;
+
+struct msg_state;
+extern struct msg_state *smbd_msg_state;
+
+extern bool global_encrypted_passwords_negotiated;
+extern bool global_spnego_negotiated;
+extern struct auth_context *negprot_global_auth_context;
+extern bool done_negprot;
+
+extern bool logged_ioctl_message;
+
+/* users from session setup */
+extern char *session_userlist;
+/* workgroup from session setup. */
+extern char *session_workgroup;
+/* this holds info on user ids that are already validated for this VC */
+extern user_struct *validated_users;
+extern uint16_t next_vuid;
+extern int num_validated_vuids;
+#ifdef HAVE_NETGROUP
+extern char *my_yp_domain;
+#endif
+
+extern bool already_got_session;
+
+/*
+ * Size of data we can send to client. Set
+ *  by the client for all protocols above CORE.
+ *  Set by us for CORE protocol.
+ */
+extern int max_send;
+/*
+ * Size of the data we can receive. Set by us.
+ * Can be modified by the max xmit parameter.
+ */
+extern int max_recv;
+extern SIG_ATOMIC_T reload_after_sighup;
+extern SIG_ATOMIC_T got_sig_term;
+extern uint16 last_session_tag;
+extern int trans_num;
+extern char *orig_inbuf;
+
+extern pid_t mypid;
+extern time_t last_smb_conf_reload_time;
+extern time_t last_printer_reload_time;
+/****************************************************************************
+ structure to hold a linked list of queued messages.
+ for processing.
+****************************************************************************/
+struct pending_message_list;
+extern struct pending_message_list *deferred_open_queue;
+extern uint32_t common_flags2;
+
+struct smb_srv_trans_enc_ctx;
+extern struct smb_srv_trans_enc_ctx *partial_srv_trans_enc_ctx;
+extern struct smb_srv_trans_enc_ctx *srv_trans_enc_ctx;
+
+struct sec_ctx {
+       UNIX_USER_TOKEN ut;
+       NT_USER_TOKEN *token;
+};
+/* A stack of security contexts.  We include the current context as being
+   the first one, so there is room for another MAX_SEC_CTX_DEPTH more. */
+extern struct sec_ctx sec_ctx_stack[MAX_SEC_CTX_DEPTH + 1];
+extern int sec_ctx_stack_ndx;
+extern bool become_uid_done;
+extern bool become_gid_done;
+
+extern connection_struct *last_conn;
+extern uint16_t last_flags;
+
+extern struct db_context *session_db_ctx_ptr;
+
+extern uint32_t global_client_caps;
+extern bool done_sesssetup;
+/****************************************************************************
+ List to store partial SPNEGO auth fragments.
+****************************************************************************/
+struct pending_auth_data;
+extern struct pending_auth_data *pd_list;
+
+extern uint16_t fnf_handle;
+
+struct conn_ctx {
+       connection_struct *conn;
+       uint16 vuid;
+};
+/* A stack of current_user connection contexts. */
+extern struct conn_ctx conn_ctx_stack[MAX_SEC_CTX_DEPTH];
+extern int conn_ctx_stack_ndx;
+
+struct vfs_init_function_entry;
+extern struct vfs_init_function_entry *backends;
+extern char *sparse_buf;
+extern char *LastDir;
+
+#if HAVE_KERNEL_OPLOCKS_LINUX
+extern SIG_ATOMIC_T oplock_signals_received;
+#define FD_PENDING_SIZE 100
+extern SIG_ATOMIC_T fd_pending_array[FD_PENDING_SIZE];
+extern struct kernel_oplocks linux_koplocks;
+#endif
+
+#if HAVE_KERNEL_OPLOCKS_IRIX
+extern int oplock_pipe_write;
+extern int oplock_pipe_read;
+extern struct kernel_oplocks irix_koplocks;
+#endif
+
+/* Current number of oplocks we have outstanding. */
+extern int32_t exclusive_oplocks_open;
+extern int32_t level_II_oplocks_open;
+extern bool global_client_failed_oplock_break;
+extern const struct kernel_oplocks *koplocks;
+
+extern struct notify_mid_map *notify_changes_by_mid;
+
+extern int am_parent;
+extern SIG_ATOMIC_T got_sig_cld;
+extern int server_fd;
+extern struct event_context *smbd_event_ctx;
+extern struct messaging_context *smbd_msg_ctx;
+extern struct memcache *smbd_memcache_ctx;
+extern bool exit_firsttime;
+struct child_pid;
+extern struct child_pid *children;
+extern int num_children;
+
+void smbd_init_globals(void);
index 649ead468281e545656823f068025d053a5abbc9..fabc8393ce31fce4ff9b0f8d9edda012dc26edeb 100644 (file)
@@ -25,8 +25,7 @@
    */
 
 #include "includes.h"
-
-extern int max_send;
+#include "smbd/globals.h"
 
 #define NERR_notsupported 50
 
index 4d4d0dc5afbb5c70c3065a65510ed6e99a97f5a9..d5608ab0bf51223b3a25f582bfcc143330598561 100644 (file)
 */
 
 #include "includes.h"
-
-static struct mangle_fns *mangle_fns;
+#include "smbd/globals.h"
 
 /* this allows us to add more mangling backends */
 static const struct {
        const char *name;
-       struct mangle_fns *(*init_fn)(void);
+       const struct mangle_fns *(*init_fn)(void);
 } mangle_backends[] = {
        { "hash", mangle_hash_init },
        { "hash2", mangle_hash2_init },
index 69ecf77834b09ce494799c7d23bb459594b27ac5..ebd93ff5d0d0e9d880e1137eb45fa6b69e4451f3 100644 (file)
@@ -21,6 +21,7 @@
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 /* -------------------------------------------------------------------------- **
  * Other stuff...
  *
  */
 
-static char magic_char = '~';
-
 static const char basechars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_-!@#$%";
 #define MANGLE_BASE       (sizeof(basechars)/sizeof(char)-1)
 
-static unsigned char *chartest;
-
 #define mangle(V) ((char)(basechars[(V) % MANGLE_BASE]))
 #define BASECHAR_MASK 0xf0
 #define isbasechar(C) ( (chartest[ ((C) & 0xff) ]) & BASECHAR_MASK )
 
-static TDB_CONTEXT *tdb_mangled_cache;
-
 /* -------------------------------------------------------------------- */
 
 static NTSTATUS has_valid_83_chars(const smb_ucs2_t *s, bool allow_wildcards)
@@ -281,6 +276,7 @@ static bool is_8_3(const char *fname, bool check_case, bool allow_wildcards,
        smb_ucs2_t *ucs2name;
        NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
        size_t size;
+       char magic_char;
 
        magic_char = lp_magicchar(p);
 
@@ -362,6 +358,7 @@ static void init_chartest( void )
 static bool is_mangled(const char *s, const struct share_params *p)
 {
        char *magic;
+       char magic_char;
 
        magic_char = lp_magicchar(p);
 
@@ -468,6 +465,7 @@ static bool lookup_name_from_8_3(TALLOC_CTX *ctx,
        TDB_DATA data_val;
        char *saved_ext = NULL;
        char *s = talloc_strdup(ctx, in);
+       char magic_char;
 
        magic_char = lp_magicchar(p);
 
@@ -525,7 +523,7 @@ static bool lookup_name_from_8_3(TALLOC_CTX *ctx,
  Do the actual mangling to 8.3 format.
 *****************************************************************************/
 
-static bool to_8_3(const char *in, char out[13], int default_case)
+static bool to_8_3(char magic_char, const char *in, char out[13], int default_case)
 {
        int csum;
        char *p;
@@ -604,6 +602,7 @@ static bool must_mangle(const char *name,
        smb_ucs2_t *name_ucs2 = NULL;
        NTSTATUS status;
        size_t converted_size;
+       char magic_char;
 
        magic_char = lp_magicchar(p);
 
@@ -639,6 +638,7 @@ static bool hash_name_to_8_3(const char *in,
 {
        smb_ucs2_t *in_ucs2 = NULL;
        size_t converted_size;
+       char magic_char;
 
        magic_char = lp_magicchar(p);
 
@@ -659,7 +659,7 @@ static bool hash_name_to_8_3(const char *in,
        }
 
        SAFE_FREE(in_ucs2);
-       if (!to_8_3(in, out, default_case)) {
+       if (!to_8_3(magic_char, in, out, default_case)) {
                return False;
        }
 
@@ -673,7 +673,7 @@ static bool hash_name_to_8_3(const char *in,
   the following provides the abstraction layer to make it easier
   to drop in an alternative mangling implementation
 */
-static struct mangle_fns mangle_fns = {
+static const struct mangle_fns mangle_hash_fns = {
        mangle_reset,
        is_mangled,
        must_mangle,
@@ -683,7 +683,7 @@ static struct mangle_fns mangle_fns = {
 };
 
 /* return the methods for this mangling implementation */
-struct mangle_fns *mangle_hash_init(void)
+const struct mangle_fns *mangle_hash_init(void)
 {
        mangle_reset();
 
@@ -691,5 +691,5 @@ struct mangle_fns *mangle_hash_init(void)
        tdb_mangled_cache = tdb_open_ex("mangled_cache", 1031, TDB_INTERNAL,
                                (O_RDWR|O_CREAT), 0644, NULL, fast_string_hash);
 
-       return &mangle_fns;
+       return &mangle_hash_fns;
 }
index a9b94aabc3877fcaf5d1014ebfd2a72efa80442d..859e5e72272a996b1372bb92693db5aaa159148c 100644 (file)
@@ -51,6 +51,7 @@
 
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 #if 1
 #define M_DEBUG(level, x) DEBUG(level, x)
 /*the following number is a fnv1 of the string: idra@samba.org 2002 */
 #define FNV1_INIT  0xa6b93095
 
-/* these tables are used to provide fast tests for characters */
-static unsigned char char_flags[256];
-
 #define FLAG_CHECK(c, flag) (char_flags[(unsigned char)(c)] & (flag))
 
-/*
-  this determines how many characters are used from the original filename
-  in the 8.3 mangled name. A larger value leads to a weaker hash and more collisions.
-  The largest possible value is 6.
-*/
-static unsigned mangle_prefix;
-
 /* these are the characters we use in the 8.3 hash. Must be 36 chars long */
-static const char *basechars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-static unsigned char base_reverse[256];
+static const char * const basechars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 #define base_forward(v) basechars[v]
 
 /* the list of reserved dos names - all of these are illegal */
-static const char *reserved_names[] = 
+static const char * const reserved_names[] =
 { "AUX", "LOCK$", "CON", "COM1", "COM2", "COM3", "COM4",
   "LPT1", "LPT2", "LPT3", "NUL", "PRN", NULL };
 
@@ -679,7 +669,7 @@ static void init_tables(void)
 /*
   the following provides the abstraction layer to make it easier
   to drop in an alternative mangling implementation */
-static struct mangle_fns mangle_fns = {
+static const struct mangle_fns mangle_hash2_fns = {
        mangle_reset,
        is_mangled,
        must_mangle,
@@ -689,7 +679,7 @@ static struct mangle_fns mangle_fns = {
 };
 
 /* return the methods for this mangling implementation */
-struct mangle_fns *mangle_hash2_init(void)
+const struct mangle_fns *mangle_hash2_init(void)
 {
        /* the mangle prefix can only be in the mange 1 to 6 */
        mangle_prefix = lp_mangle_prefix();
@@ -703,7 +693,7 @@ struct mangle_fns *mangle_hash2_init(void)
        init_tables();
        mangle_reset();
 
-       return &mangle_fns;
+       return &mangle_hash2_fns;
 }
 
 static void posix_mangle_reset(void)
@@ -746,7 +736,7 @@ static bool posix_name_to_8_3(const char *in,
 }
 
 /* POSIX paths backend - no mangle. */
-static struct mangle_fns posix_mangle_fns = {
+static const struct mangle_fns posix_mangle_fns = {
        posix_mangle_reset,
        posix_is_mangled,
        posix_must_mangle,
@@ -755,7 +745,7 @@ static struct mangle_fns posix_mangle_fns = {
        posix_name_to_8_3
 };
 
-struct mangle_fns *posix_mangle_init(void)
+const struct mangle_fns *posix_mangle_init(void)
 {
        return &posix_mangle_fns;
 }
index f549f0c9f301dcbecfc98bf7989928092785add6..fde2a3c4d3a1da770d360cfa5ed0736ffdddf7e1 100644 (file)
@@ -20,6 +20,7 @@
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 /*******************************************************************
  Map a username from a dos name to a unix name by looking in the username
@@ -32,8 +33,6 @@
  Returns True if username was changed, false otherwise.
 ********************************************************************/
 
-static char *last_from, *last_to;
-
 static const char *get_last_from(void)
 {
        if (!last_from) {
index 65eaeca777bc76493014bc7c3ab8352793354db4..dbc833f091f09a1c397a5565e77d6263ae26271f 100644 (file)
@@ -23,6 +23,7 @@
 
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 extern userdom_struct current_user_info;
 
@@ -32,8 +33,6 @@ struct msg_state {
        char *msg;
 };
 
-static struct msg_state *smbd_msg_state;
-
 /****************************************************************************
  Deliver the message.
 ****************************************************************************/
index d46be6426252343701c7ac48643533fd40bcfbe8..adeaf96bd2d78e7793614cd36dfcd1a9254f7576 100644 (file)
@@ -22,8 +22,7 @@
 
 #define DBGC_CLASS DBGC_MSDFS
 #include "includes.h"
-
-extern uint32 global_client_caps;
+#include "smbd/globals.h"
 
 /**********************************************************************
  Parse a DFS pathname of the form \hostname\service\reqpath
index 43fdc1d60861403bfa0046871457e2180d88dda0..729d144ea1bae4e81d9637a62befb802be282a54 100644 (file)
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 extern fstring remote_proto;
 extern enum protocol_types Protocol;
-extern int max_recv;
-
-bool global_encrypted_passwords_negotiated = False;
-bool global_spnego_negotiated = False;
-struct auth_context *negprot_global_auth_context = NULL;
 
 static void get_challenge(uint8 buff[8])
 {
@@ -516,8 +512,6 @@ void reply_negprot(struct smb_request *req)
        int i;
        size_t converted_size;
 
-       static bool done_negprot = False;
-
        START_PROFILE(SMBnegprot);
 
        if (done_negprot) {
index 2d0811bc1c0a47e8e7cfa6e627d653d3c5486c62..7ffe62058c36be78a51557ba8ac5922de92650ec 100644 (file)
@@ -20,6 +20,7 @@
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 struct notify_change_request {
        struct notify_change_request *prev, *next;
@@ -33,8 +34,6 @@ struct notify_change_request {
 
 static void notify_fsp(files_struct *fsp, uint32 action, const char *name);
 
-static struct notify_mid_map *notify_changes_by_mid;
-
 /*
  * For NTCancel, we need to find the notify_change_request indexed by
  * mid. Separate list here.
index db92e28610c9e007fd0ab064792b6572a01ff7e7..f1423c028e1b3cf08507ba922714e0b64b8a0ac8 100644 (file)
@@ -19,8 +19,8 @@
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
-extern int max_send;
 extern enum protocol_types Protocol;
 extern const struct generic_mapping file_generic_mapping;
 
@@ -1770,7 +1770,6 @@ static void call_nt_transact_ioctl(connection_struct *conn,
        files_struct *fsp;
        uint8 isFSctl;
        uint8 compfilter;
-       static bool logged_message;
        char *pdata = *ppdata;
 
        if (setup_count != 8) {
@@ -2030,8 +2029,8 @@ static void call_nt_transact_ioctl(connection_struct *conn,
                return;
        }
        default:
-               if (!logged_message) {
-                       logged_message = True; /* Only print this once... */
+               if (!logged_ioctl_message) {
+                       logged_ioctl_message = true; /* Only print this once... */
                        DEBUG(0,("call_nt_transact_ioctl(0x%x): Currently not implemented.\n",
                                 function));
                }
index 05b131efaffa3d0fd4e91ea57379d426b51cb60b..52e31dfc231cbca8b02ef981ca0ff460a07ec810 100644 (file)
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 extern const struct generic_mapping file_generic_mapping;
-extern bool global_client_failed_oplock_break;
-extern uint32 global_client_caps;
 
 struct deferred_open_record {
        bool delayed_for_oplocks;
index 6efa3dcfc62e08d76a79e6f774c853e639581d9e..3fd5afef22f2352149917d76cd108050bc7ba35d 100644 (file)
 
 #define DBGC_CLASS DBGC_LOCKING
 #include "includes.h"
-
-/* Current number of oplocks we have outstanding. */
-static int32 exclusive_oplocks_open = 0;
-static int32 level_II_oplocks_open = 0;
-bool global_client_failed_oplock_break = False;
-
-extern uint32 global_client_caps;
-
-static struct kernel_oplocks *koplocks;
+#include "smbd/globals.h"
 
 /****************************************************************************
  Get the number of current exclusive oplocks.
index 8c287c9836ebad8878f1b3694985952777afc2f8..496b0b72ea845d976762dd94dee1e27ebdc53b36 100644 (file)
 
 #define DBGC_CLASS DBGC_LOCKING
 #include "includes.h"
+#include "smbd/globals.h"
 
 #if HAVE_KERNEL_OPLOCKS_IRIX
 
-static int oplock_pipe_write = -1;
-static int oplock_pipe_read = -1;
-
 /****************************************************************************
  Test to see if IRIX kernel oplocks work.
 ****************************************************************************/
@@ -273,7 +271,6 @@ static bool irix_oplock_msg_waiting(fd_set *fds)
 struct kernel_oplocks *irix_init_kernel_oplocks(void) 
 {
        int pfd[2];
-       static struct kernel_oplocks koplocks;
 
        if (!irix_oplocks_available())
                return NULL;
@@ -287,13 +284,13 @@ struct kernel_oplocks *irix_init_kernel_oplocks(void)
        oplock_pipe_read = pfd[0];
        oplock_pipe_write = pfd[1];
 
-       koplocks.receive_message = irix_oplock_receive_message;
-       koplocks.set_oplock = irix_set_kernel_oplock;
-       koplocks.release_oplock = irix_release_kernel_oplock;
-       koplocks.msg_waiting = irix_oplock_msg_waiting;
-       koplocks.notification_fd = oplock_pipe_read;
+       irix_koplocks.receive_message = irix_oplock_receive_message;
+       irix_koplocks.set_oplock = irix_set_kernel_oplock;
+       irix_koplocks.release_oplock = irix_release_kernel_oplock;
+       irix_koplocks.msg_waiting = irix_oplock_msg_waiting;
+       irix_koplocks.notification_fd = oplock_pipe_read;
 
-       return &koplocks;
+       return &irix_koplocks;
 }
 #else
  void oplock_irix_dummy(void);
index 08df228f8fd6d4c604591d400aa7235ba848e142..cb37a81fb926a87162b28e2c899088e1e4d8bbcf 100644 (file)
 
 #define DBGC_CLASS DBGC_LOCKING
 #include "includes.h"
+#include "smbd/globals.h"
 
 #if HAVE_KERNEL_OPLOCKS_LINUX
 
-static SIG_ATOMIC_T signals_received;
-#define FD_PENDING_SIZE 100
-static SIG_ATOMIC_T fd_pending_array[FD_PENDING_SIZE];
-
 #ifndef F_SETLEASE
 #define F_SETLEASE     1024
 #endif
@@ -52,9 +49,9 @@ static SIG_ATOMIC_T fd_pending_array[FD_PENDING_SIZE];
 
 static void signal_handler(int sig, siginfo_t *info, void *unused)
 {
-       if (signals_received < FD_PENDING_SIZE - 1) {
-               fd_pending_array[signals_received] = (SIG_ATOMIC_T)info->si_fd;
-               signals_received++;
+       if (oplock_signals_received < FD_PENDING_SIZE - 1) {
+               fd_pending_array[oplock_signals_received] = (SIG_ATOMIC_T)info->si_fd;
+               oplock_signals_received++;
        } /* Else signal is lost. */
        sys_select_signal(RT_SIGNAL_LEASE);
 }
@@ -113,11 +110,11 @@ static files_struct *linux_oplock_receive_message(fd_set *fds)
        fd = fd_pending_array[0];
        fsp = file_find_fd(fd);
        fd_pending_array[0] = (SIG_ATOMIC_T)-1;
-       if (signals_received > 1)
+       if (oplock_signals_received > 1)
                 memmove(CONST_DISCARD(void *, &fd_pending_array[0]),
                         CONST_DISCARD(void *, &fd_pending_array[1]),
-                       sizeof(SIG_ATOMIC_T)*(signals_received-1));
-       signals_received--;
+                       sizeof(SIG_ATOMIC_T)*(oplock_signals_received-1));
+       oplock_signals_received--;
        /* now we can receive more signals */
        BlockSignals(False, RT_SIGNAL_LEASE);
 
@@ -186,7 +183,7 @@ static void linux_release_kernel_oplock(files_struct *fsp)
 
 static bool linux_oplock_msg_waiting(fd_set *fds)
 {
-       return signals_received != 0;
+       return oplock_signals_received != 0;
 }
 
 /****************************************************************************
@@ -210,7 +207,6 @@ static bool linux_oplocks_available(void)
 
 struct kernel_oplocks *linux_init_kernel_oplocks(void) 
 {
-       static struct kernel_oplocks koplocks;
         struct sigaction act;
 
        if (!linux_oplocks_available()) {
@@ -229,18 +225,18 @@ struct kernel_oplocks *linux_init_kernel_oplocks(void)
                return NULL;
        }
 
-       koplocks.receive_message = linux_oplock_receive_message;
-       koplocks.set_oplock = linux_set_kernel_oplock;
-       koplocks.release_oplock = linux_release_kernel_oplock;
-       koplocks.msg_waiting = linux_oplock_msg_waiting;
-       koplocks.notification_fd = -1;
+       linux_koplocks.receive_message = linux_oplock_receive_message;
+       linux_koplocks.set_oplock = linux_set_kernel_oplock;
+       linux_koplocks.release_oplock = linux_release_kernel_oplock;
+       linux_koplocks.msg_waiting = linux_oplock_msg_waiting;
+       linux_koplocks.notification_fd = -1;
 
        /* the signal can start off blocked due to a bug in bash */
        BlockSignals(False, RT_SIGNAL_LEASE);
 
        DEBUG(3,("Linux kernel oplocks enabled\n"));
 
-       return &koplocks;
+       return &linux_koplocks;
 }
 #else
  void oplock_linux_dummy(void);
index 005d92bd88d7acc8d26086b2c955b00e0dc08005..293ba85852dadd8221910f279dbcf2c9e0deac8d 100644 (file)
 */
 
 #include "includes.h"
-
-/* users from session setup */
-static char *session_userlist = NULL;
-/* workgroup from session setup. */
-static char *session_workgroup = NULL;
-
-/* this holds info on user ids that are already validated for this VC */
-static user_struct *validated_users;
-static uint16_t next_vuid = VUID_OFFSET;
-static int num_validated_vuids;
+#include "smbd/globals.h"
 
 enum server_allocated_state { SERVER_ALLOCATED_REQUIRED_YES,
                                SERVER_ALLOCATED_REQUIRED_NO,
@@ -403,21 +394,20 @@ const char *get_session_workgroup(void)
 bool user_in_netgroup(const char *user, const char *ngname)
 {
 #ifdef HAVE_NETGROUP
-       static char *mydomain = NULL;
        fstring lowercase_user;
 
-       if (mydomain == NULL)
-               yp_get_default_domain(&mydomain);
+       if (my_yp_domain == NULL)
+               yp_get_default_domain(&my_yp_domain);
 
-       if(mydomain == NULL) {
+       if(my_yp_domain == NULL) {
                DEBUG(5,("Unable to get default yp domain, "
                        "let's try without specifying it\n"));
        }
 
        DEBUG(5,("looking for user %s of domain %s in netgroup %s\n",
-               user, mydomain?mydomain:"(ANY)", ngname));
+               user, my_yp_domain?my_yp_domain:"(ANY)", ngname));
 
-       if (innetgr(ngname, NULL, user, mydomain)) {
+       if (innetgr(ngname, NULL, user, my_yp_domain)) {
                DEBUG(5,("user_in_netgroup: Found\n"));
                return (True);
        } else {
@@ -431,9 +421,9 @@ bool user_in_netgroup(const char *user, const char *ngname)
                strlower_m(lowercase_user);
 
                DEBUG(5,("looking for user %s of domain %s in netgroup %s\n",
-                       lowercase_user, mydomain?mydomain:"(ANY)", ngname));
+                       lowercase_user, my_yp_domain?my_yp_domain:"(ANY)", ngname));
 
-               if (innetgr(ngname, NULL, lowercase_user, mydomain)) {
+               if (innetgr(ngname, NULL, lowercase_user, my_yp_domain)) {
                        DEBUG(5,("user_in_netgroup: Found\n"));
                        return (True);
                }
index cd9eaa6b1ed87915b3059e1abcf24e8b37ef2869..6f0a10da4ae576a2d2b5b591642cb61b693770da 100644 (file)
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
-/*
- * Size of data we can send to client. Set
- *  by the client for all protocols above CORE.
- *  Set by us for CORE protocol.
- */
-int max_send = BUFFER_SIZE;
-/*
- * Size of the data we can receive. Set by us.
- * Can be modified by the max xmit parameter.
- */
-int max_recv = BUFFER_SIZE;
-
-SIG_ATOMIC_T reload_after_sighup = 0;
-SIG_ATOMIC_T got_sig_term = 0;
 extern bool global_machine_password_needs_changing;
-extern int max_send;
 
 static void construct_reply_common(struct smb_request *req, const char *inbuf,
                                   char *outbuf);
@@ -406,12 +392,6 @@ void init_smb_request(struct smb_request *req,
        req->outbuf = NULL;
 }
 
-/****************************************************************************
- structure to hold a linked list of queued messages.
- for processing.
-****************************************************************************/
-
-static struct pending_message_list *deferred_open_queue;
 
 /****************************************************************************
  Function to push a message onto the tail of a linked list of smb messages ready
@@ -1351,8 +1331,6 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in
        uint16 session_tag;
        connection_struct *conn = NULL;
 
-       static uint16 last_session_tag = UID_FIELD_INVALID;
-
        errno = 0;
 
        /* Make sure this is an SMB packet. smb_size contains NetBIOS header
@@ -1543,7 +1521,6 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes, bool enc
 
 static void process_smb(char *inbuf, size_t nread, size_t unread_bytes, bool encrypted)
 {
-       static int trans_num;
        int msg_type = CVAL(inbuf,0);
 
        DO_PROFILE_INC(smb_count);
@@ -1587,8 +1564,6 @@ const char *smb_fn_name(int type)
  Helper functions for contruct_reply.
 ****************************************************************************/
 
-static uint32 common_flags2 = FLAGS2_LONG_PATH_COMPONENTS|FLAGS2_32_BIT_ERROR_CODES;
-
 void add_to_common_flags2(uint32 v)
 {
        common_flags2 |= v;
@@ -1629,8 +1604,6 @@ void construct_reply_common_req(struct smb_request *req, char *outbuf)
 
 void chain_reply(struct smb_request *req)
 {
-       static char *orig_inbuf;
-
        /*
         * Dirty little const_discard: We mess with req->inbuf, which is
         * declared as const. If maybe at some point this routine gets
@@ -1839,9 +1812,6 @@ void chain_reply(struct smb_request *req)
 
 void check_reload(time_t t)
 {
-       static pid_t mypid = 0;
-       static time_t last_smb_conf_reload_time = 0;
-       static time_t last_printer_reload_time = 0;
        time_t printcap_cache_time = (time_t)lp_printcap_cache_time();
 
        if(last_smb_conf_reload_time == 0) {
index 3aa46525088bb019b4b2c82b88ceccbbf0faf314..c4664e71cf367a879e4eac6aefaa160ab4b3dc61 100644 (file)
@@ -413,8 +413,6 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *d
 #include <rpc/nettype.h>
 #include <rpc/xdr.h>
 
-static int quotastat;
-
 static int my_xdr_getquota_args(XDR *xdrsp, struct getquota_args *args)
 {
        if (!xdr_string(xdrsp, &args->gqa_pathp, RQ_PATHLEN ))
@@ -426,10 +424,14 @@ static int my_xdr_getquota_args(XDR *xdrsp, struct getquota_args *args)
 
 static int my_xdr_getquota_rslt(XDR *xdrsp, struct getquota_rslt *gqr)
 {
+       int quotastat;
+
        if (!xdr_int(xdrsp, &quotastat)) {
                DEBUG(6,("nfs_quotas: Status bad or zero\n"));
                return 0;
        }
+       gqr->status = quotastat;
+
        if (!xdr_int(xdrsp, &gqr->getquota_rslt_u.gqr_rquota.rq_bsize)) {
                DEBUG(6,("nfs_quotas: Block size bad or zero\n"));
                return 0;
@@ -503,14 +505,14 @@ static bool nfs_quotas(char *nfspath, uid_t euser_id, uint64_t *bsize, uint64_t
        }
 
        /*
-        * quotastat returns 0 if the rpc call fails, 1 if quotas exist, 2 if there is
+        * gqr.status returns 0 if the rpc call fails, 1 if quotas exist, 2 if there is
         * no quota set, and 3 if no permission to get the quota.  If 0 or 3 return
         * something sensible.
         */
 
-       switch ( quotastat ) {
+       switch (gqr.status) {
        case 0:
-               DEBUG(9,("nfs_quotas: Remote Quotas Failed!  Error \"%i\" \n", quotastat ));
+               DEBUG(9,("nfs_quotas: Remote Quotas Failed!  Error \"%i\" \n", gqr.status));
                ret = False;
                goto out;
 
@@ -525,16 +527,16 @@ static bool nfs_quotas(char *nfspath, uid_t euser_id, uint64_t *bsize, uint64_t
        case 3:
                D.dqb_bsoftlimit = 1;
                D.dqb_curblocks = 1;
-               DEBUG(9,("nfs_quotas: Remote Quotas returned \"%i\" \n", quotastat ));
+               DEBUG(9,("nfs_quotas: Remote Quotas returned \"%i\" \n", gqr.status));
                break;
 
        default:
-               DEBUG(9,("nfs_quotas: Remote Quotas Questionable!  Error \"%i\" \n", quotastat ));
+               DEBUG(9,("nfs_quotas: Remote Quotas Questionable!  Error \"%i\" \n", gqr.status ));
                break;
        }
 
        DEBUG(10,("nfs_quotas: Let`s look at D a bit closer... status \"%i\" bsize \"%i\" active? \"%i\" bhard \"%i\" bsoft \"%i\" curb \"%i\" \n",
-                       quotastat,
+                       gqr.status,
                        gqr.getquota_rslt_u.gqr_rquota.rq_bsize,
                        gqr.getquota_rslt_u.gqr_rquota.rq_active,
                        gqr.getquota_rslt_u.gqr_rquota.rq_bhardlimit,
@@ -968,8 +970,6 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *d
 #endif
 #include <rpc/xdr.h>
 
-static int quotastat;
-
 static int my_xdr_getquota_args(XDR *xdrsp, struct getquota_args *args)
 {
        if (!xdr_string(xdrsp, &args->gqa_pathp, RQ_PATHLEN ))
@@ -981,10 +981,14 @@ static int my_xdr_getquota_args(XDR *xdrsp, struct getquota_args *args)
 
 static int my_xdr_getquota_rslt(XDR *xdrsp, struct getquota_rslt *gqr)
 {
+       int quotastat;
+
        if (!xdr_int(xdrsp, &quotastat)) {
                DEBUG(6,("nfs_quotas: Status bad or zero\n"));
                return 0;
        }
+       gqr->status = quotastat;
+
        if (!xdr_int(xdrsp, &gqr->getquota_rslt_u.gqr_rquota.rq_bsize)) {
                DEBUG(6,("nfs_quotas: Block size bad or zero\n"));
                return 0;
@@ -1058,14 +1062,14 @@ static bool nfs_quotas(char *nfspath, uid_t euser_id, uint64_t *bsize, uint64_t
        }
 
        /* 
-        * quotastat returns 0 if the rpc call fails, 1 if quotas exist, 2 if there is
+        * gqr->status returns 0 if the rpc call fails, 1 if quotas exist, 2 if there is
         * no quota set, and 3 if no permission to get the quota.  If 0 or 3 return
         * something sensible.
         */   
 
-       switch ( quotastat ) {
+       switch (gqr.status) {
        case 0:
-               DEBUG(9,("nfs_quotas: Remote Quotas Failed!  Error \"%i\" \n", quotastat ));
+               DEBUG(9,("nfs_quotas: Remote Quotas Failed!  Error \"%i\" \n", gqr.status));
                ret = False;
                goto out;
 
@@ -1080,16 +1084,16 @@ static bool nfs_quotas(char *nfspath, uid_t euser_id, uint64_t *bsize, uint64_t
        case 3:
                D.dqb_bsoftlimit = 1;
                D.dqb_curblocks = 1;
-               DEBUG(9,("nfs_quotas: Remote Quotas returned \"%i\" \n", quotastat ));
+               DEBUG(9,("nfs_quotas: Remote Quotas returned \"%i\" \n", gqr.status));
                break;
 
        default:
-               DEBUG(9,("nfs_quotas: Remote Quotas Questionable!  Error \"%i\" \n", quotastat ));
+               DEBUG(9,("nfs_quotas: Remote Quotas Questionable!  Error \"%i\" \n", gqr.status));
                break;
        }
 
        DEBUG(10,("nfs_quotas: Let`s look at D a bit closer... status \"%i\" bsize \"%i\" active? \"%i\" bhard \"%i\" bsoft \"%i\" curb \"%i\" \n",
-                       quotastat,
+                       gqr.status,
                        gqr.getquota_rslt_u.gqr_rquota.rq_bsize,
                        gqr.getquota_rslt_u.gqr_rquota.rq_active,
                        gqr.getquota_rslt_u.gqr_rquota.rq_bhardlimit,
index 593558e3992aea0a4f87d679dc56cd646669d435..24f6cd30bd26d341efcd5d20d7a84656dc711133 100644 (file)
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
-/* look in server.c for some explanation of these variables */
 extern enum protocol_types Protocol;
-extern int max_recv;
-extern uint32 global_client_caps;
-
-extern bool global_encrypted_passwords_negotiated;
 
 /****************************************************************************
  Ensure we check the path in *exactly* the same way as W2K for a findfirst/findnext
@@ -424,8 +420,6 @@ void reply_special(char *inbuf)
         */
        char outbuf[smb_size];
 
-       static bool already_got_session = False;
-
        *name1 = *name2 = 0;
 
        memset(outbuf, '\0', sizeof(outbuf));
index bd4d85388541d84c1d74751ba547ec7905687a08..0d5415b5f48fc455fcb75afc363032637f2aeb45 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 /******************************************************************************
  Server side encryption.
@@ -32,9 +33,6 @@ struct smb_srv_trans_enc_ctx {
        AUTH_NTLMSSP_STATE *auth_ntlmssp_state; /* Must be kept in sync with pointer in ec->ntlmssp_state. */
 };
 
-static struct smb_srv_trans_enc_ctx *partial_srv_trans_enc_ctx;
-static struct smb_srv_trans_enc_ctx *srv_trans_enc_ctx;
-
 /******************************************************************************
  Return global enc context - this must change if we ever do multiple contexts.
 ******************************************************************************/
index a618f06e6b2b00ff6b1b9ca82749f9a7367ec6a2..4b9e5d47276ca36ea27e286fe0d3a8d0441e0a3f 100644 (file)
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 extern struct current_user current_user;
 
-struct sec_ctx {
-       UNIX_USER_TOKEN ut;
-       NT_USER_TOKEN *token;
-};
-
-/* A stack of security contexts.  We include the current context as being
-   the first one, so there is room for another MAX_SEC_CTX_DEPTH more. */
-
-static struct sec_ctx sec_ctx_stack[MAX_SEC_CTX_DEPTH + 1];
-static int sec_ctx_stack_ndx;
-
 /****************************************************************************
  Are two UNIX tokens equal ?
 ****************************************************************************/
@@ -59,12 +49,10 @@ static bool become_uid(uid_t uid)
 
        if (uid == (uid_t)-1 || 
            ((sizeof(uid_t) == 2) && (uid == (uid_t)65535))) {
-               static int done;
-               if (!done) {
+               if (!become_uid_done) {
                        DEBUG(1,("WARNING: using uid %d is a security risk\n",
                                 (int)uid));
-                       done = 1;
+                       become_uid_done = true;
                }
        }
 
@@ -86,12 +74,10 @@ static bool become_gid(gid_t gid)
 
        if (gid == (gid_t)-1 || ((sizeof(gid_t) == 2) && 
                                 (gid == (gid_t)65535))) {
-               static int done;
-               
-               if (!done) {
+               if (!become_gid_done) {
                        DEBUG(1,("WARNING: using gid %d is a security risk\n",
                                 (int)gid));  
-                       done = 1;
+                       become_gid_done = true;
                }
        }
   
index a84b58a05287b72f4f828ede8b6bd7b1b65f486e..6be8e9b83e7ed3aae2be574db5ae45b9440b9f23 100644 (file)
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 static_decl_rpc;
 
-static int am_parent = 1;
-
-extern struct auth_context *negprot_global_auth_context;
-extern SIG_ATOMIC_T got_sig_term;
-extern SIG_ATOMIC_T reload_after_sighup;
-static SIG_ATOMIC_T got_sig_cld;
-
 #ifdef WITH_DFS
 extern int dcelogin_atmost_once;
 #endif /* WITH_DFS */
 
-/* really we should have a top level context structure that has the
-   client file descriptor as an element. That would require a major rewrite :(
-
-   the following 2 functions are an alternative - they make the file
-   descriptor private to smbd
- */
-static int server_fd = -1;
-
 int smbd_server_fd(void)
 {
        return server_fd;
@@ -81,39 +67,39 @@ static int client_get_tcp_info(struct sockaddr_storage *server,
 
 struct event_context *smbd_event_context(void)
 {
-       static struct event_context *ctx;
-
-       if (!ctx && !(ctx = event_context_init(talloc_autofree_context()))) {
+       if (!smbd_event_ctx) {
+               smbd_event_ctx = event_context_init(talloc_autofree_context());
+       }
+       if (!smbd_event_ctx) {
                smb_panic("Could not init smbd event context");
        }
-       return ctx;
+       return smbd_event_ctx;
 }
 
 struct messaging_context *smbd_messaging_context(void)
 {
-       static struct messaging_context *ctx;
-
-       if (ctx == NULL) {
-               ctx = messaging_init(talloc_autofree_context(), server_id_self(),
-                                    smbd_event_context());
+       if (smbd_msg_ctx == NULL) {
+               smbd_msg_ctx = messaging_init(talloc_autofree_context(),
+                                             server_id_self(),
+                                             smbd_event_context());
        }
-       if (ctx == NULL) {
+       if (smbd_msg_ctx == NULL) {
                DEBUG(0, ("Could not init smbd messaging context.\n"));
        }
-       return ctx;
+       return smbd_msg_ctx;
 }
 
 struct memcache *smbd_memcache(void)
 {
-       static struct memcache *cache;
-
-       if (!cache
-           && !(cache = memcache_init(talloc_autofree_context(),
-                                      lp_max_stat_cache_size()*1024))) {
-
+       if (!smbd_memcache_ctx) {
+               smbd_memcache_ctx = memcache_init(talloc_autofree_context(),
+                                                 lp_max_stat_cache_size()*1024);
+       }
+       if (!smbd_memcache_ctx) {
                smb_panic("Could not init smbd memcache");
        }
-       return cache;
+
+       return smbd_memcache_ctx;
 }
 
 /*******************************************************************
@@ -269,9 +255,6 @@ struct child_pid {
        pid_t pid;
 };
 
-static struct child_pid *children;
-static int num_children;
-
 static void add_child_pid(pid_t pid)
 {
        struct child_pid *child;
@@ -360,13 +343,7 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_
        }
 
 #ifdef HAVE_ATEXIT
-       {
-               static int atexit_set;
-               if(atexit_set == 0) {
-                       atexit_set=1;
-                       atexit(killkids);
-               }
-       }
+       atexit(killkids);
 #endif
 
        /* Stop zombies */
@@ -897,12 +874,11 @@ static void exit_server_common(enum server_exit_reason how,
 static void exit_server_common(enum server_exit_reason how,
        const char *const reason)
 {
-       static int firsttime=1;
        bool had_open_conn;
 
-       if (!firsttime)
+       if (!exit_firsttime)
                exit(0);
-       firsttime = 0;
+       exit_firsttime = false;
 
        change_to_root_user();
 
@@ -1109,13 +1085,13 @@ extern void build_options(bool screen);
  int main(int argc,const char *argv[])
 {
        /* shall I run as a daemon */
-       static bool is_daemon = False;
-       static bool interactive = False;
-       static bool Fork = True;
-       static bool no_process_group = False;
-       static bool log_stdout = False;
-       static char *ports = NULL;
-       static char *profile_level = NULL;
+       bool is_daemon = false;
+       bool interactive = false;
+       bool Fork = true;
+       bool no_process_group = false;
+       bool log_stdout = false;
+       char *ports = NULL;
+       char *profile_level = NULL;
        int opt;
        poptContext pc;
        bool print_build_options = False;
@@ -1142,6 +1118,8 @@ extern void build_options(bool screen);
        };
        TALLOC_CTX *frame = talloc_stackframe(); /* Setup tos. */
 
+       smbd_init_globals();
+
        TimeInit();
 
 #ifdef HAVE_SET_AUTH_PARAMETERS
index e90098fed066b5f7ecdfa3a3428c7d5b7a9e6ea7..dcdd69f997cea0861ec7c539751ab31740331384 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 extern userdom_struct current_user_info;
 
@@ -167,8 +168,6 @@ bool set_conn_connectpath(connection_struct *conn, const char *connectpath)
 
 bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir)
 {
-       static connection_struct *last_conn;
-       static uint16 last_flags;
        int snum;
 
        if (!conn)  {
index 8163eb30af63b4522767587d1ab50f6eef070d8b..ebfffb7d57ead87d83843ff787d8088c406f1dc3 100644 (file)
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 /********************************************************************
 ********************************************************************/
 
 static struct db_context *session_db_ctx(void)
 {
-       static struct db_context *ctx;
+       if (session_db_ctx_ptr)
+               return session_db_ctx_ptr;
 
-       if (ctx)
-               return ctx;
-
-       ctx = db_open(NULL, lock_path("sessionid.tdb"), 0,
-                     TDB_CLEAR_IF_FIRST|TDB_DEFAULT, 
-                     O_RDWR | O_CREAT, 0644);
-       return ctx;
+       session_db_ctx_ptr = db_open(NULL, lock_path("sessionid.tdb"), 0,
+                                    TDB_CLEAR_IF_FIRST|TDB_DEFAULT,
+                                    O_RDWR | O_CREAT, 0644);
+       return session_db_ctx_ptr;
 }
 
 bool session_init(void)
index 73948eca32be04cd84e5cb1b2be7a26b6e869792..b8e0c86833e7e65fb01665be54402c4fe42d31d9 100644 (file)
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
-extern struct auth_context *negprot_global_auth_context;
-extern bool global_encrypted_passwords_negotiated;
-extern bool global_spnego_negotiated;
 extern enum protocol_types Protocol;
-extern int max_send;
-
-uint32 global_client_caps = 0;
 
 /*
   on a logon error possibly map the error to success if "map to guest"
@@ -952,12 +947,6 @@ static void reply_spnego_auth(struct smb_request *req,
        return;
 }
 
-/****************************************************************************
- List to store partial SPNEGO auth fragments.
-****************************************************************************/
-
-static struct pending_auth_data *pd_list;
-
 /****************************************************************************
  Delete an entry on the list.
 ****************************************************************************/
@@ -1406,7 +1395,6 @@ void reply_sesssetup_and_X(struct smb_request *req)
        const char *native_os;
        const char *native_lanman;
        const char *primary_domain;
-       static bool done_sesssetup = False;
        auth_usersupplied_info *user_info = NULL;
        auth_serversupplied_info *server_info = NULL;
        uint16 smb_flag2 = req->flags2;
index bae77d5d4bb5c542c928aa98a70dce92ef6f48a6..62b0fe1617e932540177abd7d8b6e1a3690d18b7 100644 (file)
@@ -19,7 +19,7 @@
 */
 
 #include "includes.h"
-extern int max_send;
+#include "smbd/globals.h"
 
 /* Make sure we can't write a string past the end of the buffer */
 
index 390b166f5f0d144b21cec75739fa36babe26c64d..9644e3d1ad0d38d744d07a8f3ac2bcb1633d0b76 100644 (file)
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
-extern int max_send;
 extern enum protocol_types Protocol;
-extern uint32 global_client_caps;
 
 #define get_file_size(sbuf) ((sbuf).st_size)
 #define DIR_ENTRY_SAFETY_MARGIN 4096
@@ -94,7 +93,7 @@ uint64_t get_allocation_size(connection_struct *conn, files_struct *fsp, const S
 
 static bool samba_private_attr_name(const char *unix_ea_name)
 {
-       static const char *prohibited_ea_names[] = {
+       static const char * const prohibited_ea_names[] = {
                SAMBA_POSIX_INHERITANCE_EA_NAME,
                SAMBA_XATTR_DOS_ATTRIB,
                NULL
@@ -7220,7 +7219,6 @@ static void call_trans2findnotifyfirst(connection_struct *conn,
                                       char **ppdata, int total_data,
                                       unsigned int max_data_bytes)
 {
-       static uint16 fnf_handle = 257;
        char *params = *pparams;
        uint16 info_level;
 
index 5a4b8a52e791bb8a65a802bb765bba72b13c31fb..4f059bdb59894f9efd00ce94e3b9dc2a4f7c786d 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 /* what user is current? */
 extern struct current_user current_user;
@@ -28,13 +29,11 @@ extern struct current_user current_user;
 
 bool change_to_guest(void)
 {
-       static struct passwd *pass=NULL;
+       struct passwd *pass;
 
+       pass = getpwnam_alloc(talloc_autofree_context(), lp_guestaccount());
        if (!pass) {
-               /* Don't need to free() this as its stored in a static */
-               pass = getpwnam_alloc(talloc_autofree_context(), lp_guestaccount());
-               if (!pass)
-                       return(False);
+               return false;
        }
 
 #ifdef AIX
@@ -49,9 +48,8 @@ bool change_to_guest(void)
        current_user.vuid = UID_FIELD_INVALID;
 
        TALLOC_FREE(pass);
-       pass = NULL;
 
-       return True;
+       return true;
 }
 
 /*******************************************************************
@@ -352,16 +350,6 @@ bool unbecome_authenticated_pipe_user(void)
  Utility functions used by become_xxx/unbecome_xxx.
 ****************************************************************************/
 
-struct conn_ctx {
-       connection_struct *conn;
-       uint16 vuid;
-};
-
-/* A stack of current_user connection contexts. */
-
-static struct conn_ctx conn_ctx_stack[MAX_SEC_CTX_DEPTH];
-static int conn_ctx_stack_ndx;
-
 static void push_conn_ctx(void)
 {
        struct conn_ctx *ctx_p;
index af947ef4620fd29cf460e82fcec0deadf01248de..74774054e855d8ce04add9edb5f386ada7377e84 100644 (file)
@@ -142,7 +142,7 @@ void sys_utmp_yield(const char *username, const char *hostname,
 
 #ifdef HAVE_UTMPX_H
 
-static const char *ux_pathname =
+static const char * const ux_pathname =
 # if defined (UTMPX_FILE)
        UTMPX_FILE ;
 # elif defined (_UTMPX_FILE)
@@ -153,7 +153,7 @@ static const char *ux_pathname =
        "" ;
 # endif
 
-static const char *wx_pathname =
+static const char * const wx_pathname =
 # if defined (WTMPX_FILE)
        WTMPX_FILE ;
 # elif defined (_WTMPX_FILE)
@@ -166,7 +166,7 @@ static const char *wx_pathname =
 
 #endif /* HAVE_UTMPX_H */
 
-static const char *ut_pathname =
+static const char * const ut_pathname =
 # if defined (UTMP_FILE)
        UTMP_FILE ;
 # elif defined (_UTMP_FILE)
@@ -177,7 +177,7 @@ static const char *ut_pathname =
        "" ;
 # endif
 
-static const char *wt_pathname =
+static const char * const wt_pathname =
 # if defined (WTMP_FILE)
        WTMP_FILE ;
 # elif defined (_WTMP_FILE)
index 011f31dd24c531d698ede308bea6ee90c1a040d7..df5a39eea2e064c2d2ce2f546f077930014df784 100644 (file)
@@ -23,6 +23,7 @@
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
@@ -35,8 +36,6 @@ struct vfs_init_function_entry {
        struct vfs_init_function_entry *prev, *next;
 };
 
-static struct vfs_init_function_entry *backends = NULL;
-
 /****************************************************************************
     maintain the list of available backends
 ****************************************************************************/
@@ -597,7 +596,6 @@ int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len)
  Returns 0 on success, -1 on failure.
 ****************************************************************************/
 
-static char *sparse_buf;
 #define SPARSE_BUF_WRITE_SIZE (32*1024)
 
 int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len)
@@ -718,7 +716,6 @@ char *vfs_readdirname(connection_struct *conn, void *p)
 int vfs_ChDir(connection_struct *conn, const char *path)
 {
        int res;
-       static char *LastDir = NULL;
 
        if (!LastDir) {
                LastDir = SMB_STRDUP("");
index 8d8f43a0cf5281755554ed58662a76d6454f66e4..4097d825b1617e2a56b1cc95000cbab74a07fc86 100644 (file)
@@ -3,6 +3,7 @@
    test suite for srvsvc rpc operations
 
    Copyright (C) Jelmer Vernooij 2004
+   Copyright (C) Guenther Deschner 2008
 
    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
@@ -77,7 +78,7 @@ static bool test_QueryServiceStatusEx(struct torture_context *tctx, struct dcerp
        struct policy_handle h, s;
        NTSTATUS status;
 
-       uint32_t info_level = 0;
+       uint32_t info_level = SVC_STATUS_PROCESS_INFO;
        uint8_t *buffer;
        uint32_t buf_size = 0;
        uint32_t bytes_needed = 0;
@@ -124,7 +125,7 @@ static bool test_QueryServiceConfig2W(struct torture_context *tctx, struct dcerp
        struct policy_handle h, s;
        NTSTATUS status;
 
-       uint32_t info_level = 1;
+       uint32_t info_level = SERVICE_CONFIG_DESCRIPTION;
        uint8_t *buffer;
        uint32_t buf_size = 0;
        uint32_t bytes_needed = 0;