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] */,
/* 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;
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] */,
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)] */,
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] */,
/* 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;
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] */,
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] */,
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)] */,
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)] */,
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] */,
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] */,
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)] */,
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] */,
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] */,
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] */,
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)] */,
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)] */,
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) {
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));
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));
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);
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) {
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) {
}
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)));
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);
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) {
}
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)));
}
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)) {
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++;
}
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) {
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");
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++;
}
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)));
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);
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) {
}
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)));
}
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);
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) {
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) {
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);
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--;
}
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) {
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");
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--;
}
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) {
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");
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--;
}
#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);
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)] */
#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 )
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;
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 {
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)] */
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)] */
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;
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)] */
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)] */
struct svcctl_QueryServiceConfig2A {
struct {
struct policy_handle *handle;/* [ref] */
- uint32_t info_level;
+ enum svcctl_ConfigLevel info_level;
uint32_t buf_size;
} in;
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;
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;
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;
/*****************/
/* 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,
[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,
/*****************/
/* 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,
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;
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,
[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,
/*****************/
/* 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
/* 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
/*****************/
/* 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
$(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) \
/* 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 */
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 */
/* 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 */
#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 */
/**************************/
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 */
/*******************************************************************
********************************************************************/
-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;
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;
-}
-
/*******************************************************************
********************************************************************/
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;
-}
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);
}
+
/*******************************************************************
********************************************************************/
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);
}
/*******************************************************************
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);
}
/*******************************************************************
}
/********************************************************************
+ _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 */
/* 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;
}
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;
}
}
/********************************************************************
+ _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 */
/* 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;
}
}
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;
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;
*/
#include "includes.h"
+#include "smbd/globals.h"
#if defined(WITH_AIO)
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);
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. */
}
bool aio_finished(void)
{
- return (signals_received != 0);
+ return (aio_signals_received != 0);
}
/****************************************************************************
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);
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;
}
*/
#include "includes.h"
+#include "smbd/globals.h"
+
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_LOCKING
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.
**************************************************************************/
uint64_t count,
uint32_t blocking_pid)
{
- static bool set_lock_msg;
blocking_lock_record *blr;
NTSTATUS status;
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 "
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) {
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;
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;
}
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;
*/
#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
****************************************************************************/
*/
#include "includes.h"
+#include "smbd/globals.h"
/****************************************************************************
Normalise for DOS usage.
}
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);
*/
#include "includes.h"
+#include "smbd/globals.h"
/*
This module implements directory related functions for Samba.
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)
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;
}
/****************************************************************************
*/
#include "includes.h"
+#include "smbd/globals.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_DMAPI
#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;
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) {
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));
}
/* 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;
}
session_name, version));
}
- if (samba_dmapi_session != DM_NO_SESSION) {
+ if (ctx->session != DM_NO_SESSION) {
set_effective_capability(DMAPI_ACCESS_CAPABILITY);
}
*/
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;
}
/*
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;
}
/*
{
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;
}
/*
*/
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;
}
*/
#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);
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 */
*/
#include "includes.h"
+#include "smbd/globals.h"
static bool setup_write_cache(files_struct *, SMB_OFF_T);
return(ret);
}
-/* how many write cache buffers have been allocated */
-static unsigned int allocated_write_caches;
-
/****************************************************************************
*Really* write to a 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;
files_struct **result)
{
int i;
- static int first_file;
files_struct *fsp;
/* we want to give out file handles differently on each new
--- /dev/null
+/*
+ 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
+}
--- /dev/null
+/*
+ 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);
*/
#include "includes.h"
-
-extern int max_send;
+#include "smbd/globals.h"
#define NERR_notsupported 50
*/
#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 },
*/
#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)
smb_ucs2_t *ucs2name;
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
size_t size;
+ char magic_char;
magic_char = lp_magicchar(p);
static bool is_mangled(const char *s, const struct share_params *p)
{
char *magic;
+ char magic_char;
magic_char = lp_magicchar(p);
TDB_DATA data_val;
char *saved_ext = NULL;
char *s = talloc_strdup(ctx, in);
+ char magic_char;
magic_char = lp_magicchar(p);
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;
smb_ucs2_t *name_ucs2 = NULL;
NTSTATUS status;
size_t converted_size;
+ char magic_char;
magic_char = lp_magicchar(p);
{
smb_ucs2_t *in_ucs2 = NULL;
size_t converted_size;
+ char magic_char;
magic_char = lp_magicchar(p);
}
SAFE_FREE(in_ucs2);
- if (!to_8_3(in, out, default_case)) {
+ if (!to_8_3(magic_char, in, out, default_case)) {
return False;
}
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,
};
/* return the methods for this mangling implementation */
-struct mangle_fns *mangle_hash_init(void)
+const struct mangle_fns *mangle_hash_init(void)
{
mangle_reset();
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;
}
#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 };
/*
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,
};
/* 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();
init_tables();
mangle_reset();
- return &mangle_fns;
+ return &mangle_hash2_fns;
}
static void posix_mangle_reset(void)
}
/* 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,
posix_name_to_8_3
};
-struct mangle_fns *posix_mangle_init(void)
+const struct mangle_fns *posix_mangle_init(void)
{
return &posix_mangle_fns;
}
*/
#include "includes.h"
+#include "smbd/globals.h"
/*******************************************************************
Map a username from a dos name to a unix name by looking in the username
Returns True if username was changed, false otherwise.
********************************************************************/
-static char *last_from, *last_to;
-
static const char *get_last_from(void)
{
if (!last_from) {
#include "includes.h"
+#include "smbd/globals.h"
extern userdom_struct current_user_info;
char *msg;
};
-static struct msg_state *smbd_msg_state;
-
/****************************************************************************
Deliver the message.
****************************************************************************/
#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
*/
#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])
{
int i;
size_t converted_size;
- static bool done_negprot = False;
-
START_PROFILE(SMBnegprot);
if (done_negprot) {
*/
#include "includes.h"
+#include "smbd/globals.h"
struct notify_change_request {
struct notify_change_request *prev, *next;
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.
*/
#include "includes.h"
+#include "smbd/globals.h"
-extern int max_send;
extern enum protocol_types Protocol;
extern const struct generic_mapping file_generic_mapping;
files_struct *fsp;
uint8 isFSctl;
uint8 compfilter;
- static bool logged_message;
char *pdata = *ppdata;
if (setup_count != 8) {
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));
}
*/
#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;
#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.
#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.
****************************************************************************/
struct kernel_oplocks *irix_init_kernel_oplocks(void)
{
int pfd[2];
- static struct kernel_oplocks koplocks;
if (!irix_oplocks_available())
return NULL;
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);
#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
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);
}
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);
static bool linux_oplock_msg_waiting(fd_set *fds)
{
- return signals_received != 0;
+ return oplock_signals_received != 0;
}
/****************************************************************************
struct kernel_oplocks *linux_init_kernel_oplocks(void)
{
- static struct kernel_oplocks koplocks;
struct sigaction act;
if (!linux_oplocks_available()) {
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);
*/
#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,
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 {
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);
}
*/
#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);
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
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
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);
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;
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
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) {
#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 ))
static int my_xdr_getquota_rslt(XDR *xdrsp, struct getquota_rslt *gqr)
{
+ int quotastat;
+
if (!xdr_int(xdrsp, "astat)) {
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;
}
/*
- * 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;
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,
#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 ))
static int my_xdr_getquota_rslt(XDR *xdrsp, struct getquota_rslt *gqr)
{
+ int quotastat;
+
if (!xdr_int(xdrsp, "astat)) {
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;
}
/*
- * 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;
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,
*/
#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
*/
char outbuf[smb_size];
- static bool already_got_session = False;
-
*name1 = *name2 = 0;
memset(outbuf, '\0', sizeof(outbuf));
*/
#include "includes.h"
+#include "smbd/globals.h"
/******************************************************************************
Server side encryption.
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.
******************************************************************************/
*/
#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 ?
****************************************************************************/
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;
}
}
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;
}
}
*/
#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;
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;
}
/*******************************************************************
pid_t pid;
};
-static struct child_pid *children;
-static int num_children;
-
static void add_child_pid(pid_t pid)
{
struct child_pid *child;
}
#ifdef HAVE_ATEXIT
- {
- static int atexit_set;
- if(atexit_set == 0) {
- atexit_set=1;
- atexit(killkids);
- }
- }
+ atexit(killkids);
#endif
/* Stop zombies */
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();
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;
};
TALLOC_CTX *frame = talloc_stackframe(); /* Setup tos. */
+ smbd_init_globals();
+
TimeInit();
#ifdef HAVE_SET_AUTH_PARAMETERS
*/
#include "includes.h"
+#include "smbd/globals.h"
extern userdom_struct current_user_info;
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) {
*/
#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)
*/
#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"
return;
}
-/****************************************************************************
- List to store partial SPNEGO auth fragments.
-****************************************************************************/
-
-static struct pending_auth_data *pd_list;
-
/****************************************************************************
Delete an entry on the list.
****************************************************************************/
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;
*/
#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 */
*/
#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
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
char **ppdata, int total_data,
unsigned int max_data_bytes)
{
- static uint16 fnf_handle = 257;
char *params = *pparams;
uint16 info_level;
*/
#include "includes.h"
+#include "smbd/globals.h"
/* what user is current? */
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
current_user.vuid = UID_FIELD_INVALID;
TALLOC_FREE(pass);
- pass = NULL;
- return True;
+ return true;
}
/*******************************************************************
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;
#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)
"" ;
# endif
-static const char *wx_pathname =
+static const char * const wx_pathname =
# if defined (WTMPX_FILE)
WTMPX_FILE ;
# elif defined (_WTMPX_FILE)
#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)
"" ;
# endif
-static const char *wt_pathname =
+static const char * const wt_pathname =
# if defined (WTMP_FILE)
WTMP_FILE ;
# elif defined (_WTMP_FILE)
*/
#include "includes.h"
+#include "smbd/globals.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
struct vfs_init_function_entry *prev, *next;
};
-static struct vfs_init_function_entry *backends = NULL;
-
/****************************************************************************
maintain the list of available backends
****************************************************************************/
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)
int vfs_ChDir(connection_struct *conn, const char *path)
{
int res;
- static char *LastDir = NULL;
if (!LastDir) {
LastDir = SMB_STRDUP("");
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
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;
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;