From 2865be8a1c1d928ad86453e6dbf1c2a3508ad127 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 19 Nov 2008 12:38:38 +0100 Subject: pidl: fix generated s3-server in,out,ref qualifiers that are used for buffer allocation. Guenther --- pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm b/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm index e5d8f1c1d2..eb3cdf20cb 100644 --- a/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm +++ b/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm @@ -142,6 +142,13 @@ sub ParseFunction($$) my @dir = @{$_->{DIRECTION}}; if (grep(/in/, @dir) and grep(/out/, @dir)) { pidl "r->out.$_->{NAME} = r->in.$_->{NAME};"; + } + } + + foreach (@{$fn->{ELEMENTS}}) { + my @dir = @{$_->{DIRECTION}}; + if (grep(/in/, @dir) and grep(/out/, @dir)) { + # noop } elsif (grep(/out/, @dir) and not has_property($_, "represent_as")) { AllocOutVar($_, "r", "r->out.$_->{NAME}", $env); -- cgit From 07b3a1e988deae2e2d8d619fb2792dd0a719504f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 19 Nov 2008 22:00:43 +0100 Subject: s3-build: re-run make samba3-idl after pidl change. Guenther --- source3/librpc/gen_ndr/srv_lsa.c | 28 ++++++++++++++-------------- source3/librpc/gen_ndr/srv_netlogon.c | 10 +++++----- source3/librpc/gen_ndr/srv_ntsvcs.c | 6 +++--- source3/librpc/gen_ndr/srv_srvsvc.c | 20 ++++++++++---------- source3/librpc/gen_ndr/srv_svcctl.c | 16 ++++++++-------- source3/librpc/gen_ndr/srv_winreg.c | 2 +- source3/librpc/gen_ndr/srv_wkssvc.c | 6 +++--- 7 files changed, 44 insertions(+), 44 deletions(-) diff --git a/source3/librpc/gen_ndr/srv_lsa.c b/source3/librpc/gen_ndr/srv_lsa.c index b0893623a8..c30f276800 100644 --- a/source3/librpc/gen_ndr/srv_lsa.c +++ b/source3/librpc/gen_ndr/srv_lsa.c @@ -1128,14 +1128,14 @@ static bool api_lsa_LookupNames(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.sids = r->in.sids; + r->out.count = r->in.count; r->out.domains = talloc_zero(r, struct lsa_RefDomainList *); if (r->out.domains == NULL) { talloc_free(r); return false; } - r->out.sids = r->in.sids; - r->out.count = r->in.count; r->out.result = _lsa_LookupNames(p, r); if (p->rng_fault_state) { @@ -1210,14 +1210,14 @@ static bool api_lsa_LookupSids(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.names = r->in.names; + r->out.count = r->in.count; r->out.domains = talloc_zero(r, struct lsa_RefDomainList *); if (r->out.domains == NULL) { talloc_free(r); return false; } - r->out.names = r->in.names; - r->out.count = r->in.count; r->out.result = _lsa_LookupSids(p, r); if (p->rng_fault_state) { @@ -4444,14 +4444,14 @@ static bool api_lsa_LookupSids2(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.names = r->in.names; + r->out.count = r->in.count; r->out.domains = talloc_zero(r, struct lsa_RefDomainList *); if (r->out.domains == NULL) { talloc_free(r); return false; } - r->out.names = r->in.names; - r->out.count = r->in.count; r->out.result = _lsa_LookupSids2(p, r); if (p->rng_fault_state) { @@ -4526,14 +4526,14 @@ static bool api_lsa_LookupNames2(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.sids = r->in.sids; + r->out.count = r->in.count; r->out.domains = talloc_zero(r, struct lsa_RefDomainList *); if (r->out.domains == NULL) { talloc_free(r); return false; } - r->out.sids = r->in.sids; - r->out.count = r->in.count; r->out.result = _lsa_LookupNames2(p, r); if (p->rng_fault_state) { @@ -5272,14 +5272,14 @@ static bool api_lsa_LookupNames3(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.sids = r->in.sids; + r->out.count = r->in.count; r->out.domains = talloc_zero(r, struct lsa_RefDomainList *); if (r->out.domains == NULL) { talloc_free(r); return false; } - r->out.sids = r->in.sids; - r->out.count = r->in.count; r->out.result = _lsa_LookupNames3(p, r); if (p->rng_fault_state) { @@ -5872,14 +5872,14 @@ static bool api_lsa_LookupSids3(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.names = r->in.names; + r->out.count = r->in.count; r->out.domains = talloc_zero(r, struct lsa_RefDomainList *); if (r->out.domains == NULL) { talloc_free(r); return false; } - r->out.names = r->in.names; - r->out.count = r->in.count; r->out.result = _lsa_LookupSids3(p, r); if (p->rng_fault_state) { @@ -5954,14 +5954,14 @@ static bool api_lsa_LookupNames4(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.sids = r->in.sids; + r->out.count = r->in.count; r->out.domains = talloc_zero(r, struct lsa_RefDomainList *); if (r->out.domains == NULL) { talloc_free(r); return false; } - r->out.sids = r->in.sids; - r->out.count = r->in.count; r->out.result = _lsa_LookupNames4(p, r); if (p->rng_fault_state) { diff --git a/source3/librpc/gen_ndr/srv_netlogon.c b/source3/librpc/gen_ndr/srv_netlogon.c index 9546b2551b..2cb2978af2 100644 --- a/source3/librpc/gen_ndr/srv_netlogon.c +++ b/source3/librpc/gen_ndr/srv_netlogon.c @@ -871,6 +871,7 @@ static bool api_netr_AccountSync(pipes_struct *p) ZERO_STRUCT(r->out); r->out.return_authenticator = r->in.return_authenticator; + r->out.recordid = r->in.recordid; r->out.buffer = talloc_zero(r, struct netr_AccountBuffer); if (r->out.buffer == NULL) { talloc_free(r); @@ -895,7 +896,6 @@ static bool api_netr_AccountSync(pipes_struct *p) return false; } - r->out.recordid = r->in.recordid; r->out.result = _netr_AccountSync(p, r); if (p->rng_fault_state) { @@ -1290,13 +1290,13 @@ static bool api_netr_ServerAuthenticate2(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.negotiate_flags = r->in.negotiate_flags; r->out.return_credentials = talloc_zero(r, struct netr_Credential); if (r->out.return_credentials == NULL) { talloc_free(r); return false; } - r->out.negotiate_flags = r->in.negotiate_flags; r->out.result = _netr_ServerAuthenticate2(p, r); if (p->rng_fault_state) { @@ -2146,13 +2146,13 @@ static bool api_netr_ServerAuthenticate3(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.negotiate_flags = r->in.negotiate_flags; r->out.return_credentials = talloc_zero(r, struct netr_Credential); if (r->out.return_credentials == NULL) { talloc_free(r); return false; } - r->out.negotiate_flags = r->in.negotiate_flags; r->out.rid = talloc_zero(r, uint32_t); if (r->out.rid == NULL) { talloc_free(r); @@ -3186,6 +3186,7 @@ static bool api_netr_LogonSamLogonEx(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.flags = r->in.flags; r->out.validation = talloc_zero(r, union netr_Validation); if (r->out.validation == NULL) { talloc_free(r); @@ -3198,7 +3199,6 @@ static bool api_netr_LogonSamLogonEx(pipes_struct *p) return false; } - r->out.flags = r->in.flags; r->out.result = _netr_LogonSamLogonEx(p, r); if (p->rng_fault_state) { @@ -3685,6 +3685,7 @@ static bool api_netr_LogonSamLogonWithFlags(pipes_struct *p) ZERO_STRUCT(r->out); r->out.return_authenticator = r->in.return_authenticator; + r->out.flags = r->in.flags; r->out.validation = talloc_zero(r, union netr_Validation); if (r->out.validation == NULL) { talloc_free(r); @@ -3697,7 +3698,6 @@ static bool api_netr_LogonSamLogonWithFlags(pipes_struct *p) return false; } - r->out.flags = r->in.flags; r->out.result = _netr_LogonSamLogonWithFlags(p, r); if (p->rng_fault_state) { diff --git a/source3/librpc/gen_ndr/srv_ntsvcs.c b/source3/librpc/gen_ndr/srv_ntsvcs.c index ae28b9932e..288f3ed5d7 100644 --- a/source3/librpc/gen_ndr/srv_ntsvcs.c +++ b/source3/librpc/gen_ndr/srv_ntsvcs.c @@ -782,13 +782,13 @@ static bool api_PNP_GetDeviceList(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.length = r->in.length; r->out.buffer = talloc_zero_array(r, uint16_t, *r->out.length); if (r->out.buffer == NULL) { talloc_free(r); return false; } - r->out.length = r->in.length; r->out.result = _PNP_GetDeviceList(p, r); if (p->rng_fault_state) { @@ -1017,14 +1017,14 @@ static bool api_PNP_GetDeviceRegProp(pipes_struct *p) ZERO_STRUCT(r->out); r->out.reg_data_type = r->in.reg_data_type; + r->out.buffer_size = r->in.buffer_size; + r->out.needed = r->in.needed; r->out.buffer = talloc_zero_array(r, uint8_t, *r->out.buffer_size); if (r->out.buffer == NULL) { talloc_free(r); return false; } - r->out.buffer_size = r->in.buffer_size; - r->out.needed = r->in.needed; r->out.result = _PNP_GetDeviceRegProp(p, r); if (p->rng_fault_state) { diff --git a/source3/librpc/gen_ndr/srv_srvsvc.c b/source3/librpc/gen_ndr/srv_srvsvc.c index f995930b89..59f51ba774 100644 --- a/source3/librpc/gen_ndr/srv_srvsvc.c +++ b/source3/librpc/gen_ndr/srv_srvsvc.c @@ -46,13 +46,13 @@ static bool api_srvsvc_NetCharDevEnum(pipes_struct *p) ZERO_STRUCT(r->out); r->out.info_ctr = r->in.info_ctr; + r->out.resume_handle = r->in.resume_handle; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); return false; } - r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetCharDevEnum(p, r); if (p->rng_fault_state) { @@ -281,13 +281,13 @@ static bool api_srvsvc_NetCharDevQEnum(pipes_struct *p) ZERO_STRUCT(r->out); r->out.info_ctr = r->in.info_ctr; + r->out.resume_handle = r->in.resume_handle; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); return false; } - r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetCharDevQEnum(p, r); if (p->rng_fault_state) { @@ -664,13 +664,13 @@ static bool api_srvsvc_NetConnEnum(pipes_struct *p) ZERO_STRUCT(r->out); r->out.info_ctr = r->in.info_ctr; + r->out.resume_handle = r->in.resume_handle; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); return false; } - r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetConnEnum(p, r); if (p->rng_fault_state) { @@ -746,13 +746,13 @@ static bool api_srvsvc_NetFileEnum(pipes_struct *p) ZERO_STRUCT(r->out); r->out.info_ctr = r->in.info_ctr; + r->out.resume_handle = r->in.resume_handle; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); return false; } - r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetFileEnum(p, r); if (p->rng_fault_state) { @@ -981,13 +981,13 @@ static bool api_srvsvc_NetSessEnum(pipes_struct *p) ZERO_STRUCT(r->out); r->out.info_ctr = r->in.info_ctr; + r->out.resume_handle = r->in.resume_handle; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); return false; } - r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetSessEnum(p, r); if (p->rng_fault_state) { @@ -1211,13 +1211,13 @@ static bool api_srvsvc_NetShareEnumAll(pipes_struct *p) ZERO_STRUCT(r->out); r->out.info_ctr = r->in.info_ctr; + r->out.resume_handle = r->in.resume_handle; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); return false; } - r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetShareEnumAll(p, r); if (p->rng_fault_state) { @@ -1829,13 +1829,13 @@ static bool api_srvsvc_NetDiskEnum(pipes_struct *p) ZERO_STRUCT(r->out); r->out.info = r->in.info; + r->out.resume_handle = r->in.resume_handle; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); return false; } - r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetDiskEnum(p, r); if (p->rng_fault_state) { @@ -2064,13 +2064,13 @@ static bool api_srvsvc_NetTransportEnum(pipes_struct *p) ZERO_STRUCT(r->out); r->out.transports = r->in.transports; + r->out.resume_handle = r->in.resume_handle; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); return false; } - r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetTransportEnum(p, r); if (p->rng_fault_state) { @@ -2451,13 +2451,13 @@ static bool api_srvsvc_NetPathCanonicalize(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.pathtype = r->in.pathtype; r->out.can_path = talloc_zero_array(r, uint8_t, r->in.maxbuf); if (r->out.can_path == NULL) { talloc_free(r); return false; } - r->out.pathtype = r->in.pathtype; r->out.result = _srvsvc_NetPathCanonicalize(p, r); if (p->rng_fault_state) { @@ -2825,13 +2825,13 @@ static bool api_srvsvc_NetShareEnum(pipes_struct *p) ZERO_STRUCT(r->out); r->out.info_ctr = r->in.info_ctr; + r->out.resume_handle = r->in.resume_handle; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); return false; } - r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetShareEnum(p, r); if (p->rng_fault_state) { diff --git a/source3/librpc/gen_ndr/srv_svcctl.c b/source3/librpc/gen_ndr/srv_svcctl.c index f37111137e..5b30bf00f7 100644 --- a/source3/librpc/gen_ndr/srv_svcctl.c +++ b/source3/librpc/gen_ndr/srv_svcctl.c @@ -1139,6 +1139,7 @@ static bool api_svcctl_EnumServicesStatusW(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; r->out.service = talloc_zero_array(r, uint8_t, r->in.buf_size); if (r->out.service == NULL) { talloc_free(r); @@ -1157,7 +1158,6 @@ static bool api_svcctl_EnumServicesStatusW(pipes_struct *p) return false; } - r->out.resume_handle = r->in.resume_handle; r->out.result = _svcctl_EnumServicesStatusW(p, r); if (p->rng_fault_state) { @@ -1637,13 +1637,13 @@ static bool api_svcctl_GetServiceDisplayNameW(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.display_name_length = r->in.display_name_length; r->out.display_name = talloc_zero(r, const char *); if (r->out.display_name == NULL) { talloc_free(r); return false; } - r->out.display_name_length = r->in.display_name_length; r->out.result = _svcctl_GetServiceDisplayNameW(p, r); if (p->rng_fault_state) { @@ -1718,13 +1718,13 @@ static bool api_svcctl_GetServiceKeyNameW(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.display_name_length = r->in.display_name_length; r->out.key_name = talloc_zero(r, const char *); if (r->out.key_name == NULL) { talloc_free(r); return false; } - r->out.display_name_length = r->in.display_name_length; r->out.result = _svcctl_GetServiceKeyNameW(p, r); if (p->rng_fault_state) { @@ -2124,6 +2124,7 @@ static bool api_svcctl_EnumServicesStatusA(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; r->out.service = talloc_zero_array(r, uint8_t, r->in.buf_size); if (r->out.service == NULL) { talloc_free(r); @@ -2142,7 +2143,6 @@ static bool api_svcctl_EnumServicesStatusA(pipes_struct *p) return false; } - r->out.resume_handle = r->in.resume_handle; r->out.result = _svcctl_EnumServicesStatusA(p, r); if (p->rng_fault_state) { @@ -2615,13 +2615,13 @@ static bool api_svcctl_GetServiceDisplayNameA(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.display_name_length = r->in.display_name_length; r->out.display_name = talloc_zero(r, const char *); if (r->out.display_name == NULL) { talloc_free(r); return false; } - r->out.display_name_length = r->in.display_name_length; r->out.result = _svcctl_GetServiceDisplayNameA(p, r); if (p->rng_fault_state) { @@ -2696,13 +2696,13 @@ static bool api_svcctl_GetServiceKeyNameA(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.display_name_length = r->in.display_name_length; r->out.key_name = talloc_zero(r, const char *); if (r->out.key_name == NULL) { talloc_free(r); return false; } - r->out.display_name_length = r->in.display_name_length; r->out.result = _svcctl_GetServiceKeyNameA(p, r); if (p->rng_fault_state) { @@ -3327,6 +3327,7 @@ static bool api_EnumServicesStatusExA(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; r->out.services = talloc_zero_array(r, uint8_t, r->in.buf_size); if (r->out.services == NULL) { talloc_free(r); @@ -3345,7 +3346,6 @@ static bool api_EnumServicesStatusExA(pipes_struct *p) return false; } - r->out.resume_handle = r->in.resume_handle; r->out.group_name = talloc_zero(r, const char *); if (r->out.group_name == NULL) { talloc_free(r); @@ -3426,6 +3426,7 @@ static bool api_EnumServicesStatusExW(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; r->out.services = talloc_zero_array(r, uint8_t, r->in.buf_size); if (r->out.services == NULL) { talloc_free(r); @@ -3444,7 +3445,6 @@ static bool api_EnumServicesStatusExW(pipes_struct *p) return false; } - r->out.resume_handle = r->in.resume_handle; r->out.result = _EnumServicesStatusExW(p, r); if (p->rng_fault_state) { diff --git a/source3/librpc/gen_ndr/srv_winreg.c b/source3/librpc/gen_ndr/srv_winreg.c index 77b0a1c5d2..ac70b41219 100644 --- a/source3/librpc/gen_ndr/srv_winreg.c +++ b/source3/librpc/gen_ndr/srv_winreg.c @@ -520,13 +520,13 @@ static bool api_winreg_CreateKey(pipes_struct *p) } ZERO_STRUCT(r->out); + r->out.action_taken = r->in.action_taken; r->out.new_handle = talloc_zero(r, struct policy_handle); if (r->out.new_handle == NULL) { talloc_free(r); return false; } - r->out.action_taken = r->in.action_taken; r->out.result = _winreg_CreateKey(p, r); if (p->rng_fault_state) { diff --git a/source3/librpc/gen_ndr/srv_wkssvc.c b/source3/librpc/gen_ndr/srv_wkssvc.c index 9c07fa86ea..61a5be081f 100644 --- a/source3/librpc/gen_ndr/srv_wkssvc.c +++ b/source3/librpc/gen_ndr/srv_wkssvc.c @@ -201,13 +201,13 @@ static bool api_wkssvc_NetWkstaEnumUsers(pipes_struct *p) ZERO_STRUCT(r->out); r->out.info = r->in.info; + r->out.resume_handle = r->in.resume_handle; r->out.entries_read = talloc_zero(r, uint32_t); if (r->out.entries_read == NULL) { talloc_free(r); return false; } - r->out.resume_handle = r->in.resume_handle; r->out.result = _wkssvc_NetWkstaEnumUsers(p, r); if (p->rng_fault_state) { @@ -438,13 +438,13 @@ static bool api_wkssvc_NetWkstaTransportEnum(pipes_struct *p) ZERO_STRUCT(r->out); r->out.info = r->in.info; + r->out.resume_handle = r->in.resume_handle; r->out.total_entries = talloc_zero(r, uint32_t); if (r->out.total_entries == NULL) { talloc_free(r); return false; } - r->out.resume_handle = r->in.resume_handle; r->out.result = _wkssvc_NetWkstaTransportEnum(p, r); if (p->rng_fault_state) { @@ -896,13 +896,13 @@ static bool api_wkssvc_NetrUseEnum(pipes_struct *p) ZERO_STRUCT(r->out); r->out.info = r->in.info; + r->out.resume_handle = r->in.resume_handle; r->out.entries_read = talloc_zero(r, uint32_t); if (r->out.entries_read == NULL) { talloc_free(r); return false; } - r->out.resume_handle = r->in.resume_handle; r->out.result = _wkssvc_NetrUseEnum(p, r); if (p->rng_fault_state) { -- cgit From 9b40d26e30518c666e4dad9cf55ec319cf19e28e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 19 Nov 2008 23:02:49 +0100 Subject: s3-rpcclient: fix cmd_ntsvcs_get_dev_reg_prop. Guenther --- source3/rpcclient/cmd_ntsvcs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source3/rpcclient/cmd_ntsvcs.c b/source3/rpcclient/cmd_ntsvcs.c index 11f16d3462..eb620d06b2 100644 --- a/source3/rpcclient/cmd_ntsvcs.c +++ b/source3/rpcclient/cmd_ntsvcs.c @@ -149,13 +149,13 @@ static WERROR cmd_ntsvcs_get_dev_reg_prop(struct rpc_pipe_client *cli, const char *devicepath = NULL; uint32_t property = DEV_REGPROP_DESC; uint32_t reg_data_type = REG_NONE; - uint8_t buffer; + uint8_t *buffer; uint32_t buffer_size = 0; uint32_t needed = 0; uint32_t flags = 0; if (argc < 2) { - printf("usage: %s [devicepath]\n", argv[0]); + printf("usage: %s [devicepath] [buffersize]\n", argv[0]); return WERR_OK; } @@ -166,11 +166,14 @@ static WERROR cmd_ntsvcs_get_dev_reg_prop(struct rpc_pipe_client *cli, needed = buffer_size; } + buffer = talloc_array(mem_ctx, uint8_t, buffer_size); + W_ERROR_HAVE_NO_MEMORY(buffer); + status = rpccli_PNP_GetDeviceRegProp(cli, mem_ctx, devicepath, property, ®_data_type, - &buffer, + buffer, &buffer_size, &needed, flags, -- cgit From 12fdb5eb4628db08a665791fb76d15e9f5894478 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 11 Nov 2008 11:21:45 +0100 Subject: s3-ntsvcs: use pidl for _PNP_GetDeviceRegProp. Guenther --- source3/rpc_server/srv_ntsvcs.c | 18 +--------------- source3/rpc_server/srv_ntsvcs_nt.c | 43 +++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 38 deletions(-) diff --git a/source3/rpc_server/srv_ntsvcs.c b/source3/rpc_server/srv_ntsvcs.c index 5010990b58..840da3eec4 100644 --- a/source3/rpc_server/srv_ntsvcs.c +++ b/source3/rpc_server/srv_ntsvcs.c @@ -97,23 +97,7 @@ static bool api_ntsvcs_validate_device_instance(pipes_struct *p) static bool api_ntsvcs_get_device_reg_property(pipes_struct *p) { - NTSVCS_Q_GET_DEVICE_REG_PROPERTY q_u; - NTSVCS_R_GET_DEVICE_REG_PROPERTY 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(!ntsvcs_io_q_get_device_reg_property("", &q_u, data, 0)) - return False; - - r_u.status = _ntsvcs_get_device_reg_property(p, &q_u, &r_u); - - if(!ntsvcs_io_r_get_device_reg_property("", &r_u, rdata, 0)) - return False; - - return True; + return proxy_ntsvcs_call(p, NDR_PNP_GETDEVICEREGPROP); } /******************************************************************* diff --git a/source3/rpc_server/srv_ntsvcs_nt.c b/source3/rpc_server/srv_ntsvcs_nt.c index 268da52896..abeb2ca856 100644 --- a/source3/rpc_server/srv_ntsvcs_nt.c +++ b/source3/rpc_server/srv_ntsvcs_nt.c @@ -93,26 +93,26 @@ WERROR _ntsvcs_get_device_list( pipes_struct *p, NTSVCS_Q_GET_DEVICE_LIST *q_u, } /******************************************************************** +_PNP_GetDeviceRegProp ********************************************************************/ -WERROR _ntsvcs_get_device_reg_property( pipes_struct *p, NTSVCS_Q_GET_DEVICE_REG_PROPERTY *q_u, NTSVCS_R_GET_DEVICE_REG_PROPERTY *r_u ) +WERROR _PNP_GetDeviceRegProp(pipes_struct *p, + struct PNP_GetDeviceRegProp *r) { - fstring devicepath; char *ptr; REGVAL_CTR *values; REGISTRY_VALUE *val; - rpcstr_pull(devicepath, q_u->devicepath.buffer, sizeof(devicepath), q_u->devicepath.uni_str_len*2, 0); - - switch( q_u->property ) { + switch( r->in.property ) { case DEV_REGPROP_DESC: + /* just parse the service name from the device path and then lookup the display name */ - if ( !(ptr = strrchr_m( devicepath, '\\' )) ) + if ( !(ptr = strrchr_m( r->in.devicepath, '\\' )) ) return WERR_GENERAL_FAILURE; *ptr = '\0'; - if ( !(ptr = strrchr_m( devicepath, '_' )) ) + if ( !(ptr = strrchr_m( r->in.devicepath, '_' )) ) return WERR_GENERAL_FAILURE; ptr++; @@ -124,16 +124,27 @@ WERROR _ntsvcs_get_device_reg_property( pipes_struct *p, NTSVCS_Q_GET_DEVICE_REG return WERR_GENERAL_FAILURE; } - r_u->unknown1 = 0x1; /* always 1...tested using a remove device manager connection */ - r_u->size = reg_init_regval_buffer( &r_u->value, val ); - r_u->needed = r_u->size; + if (*r->in.buffer_size < val->size) { + *r->out.needed = val->size; + *r->out.buffer_size = 0; + TALLOC_FREE( values ); + return WERR_CM_BUFFER_SMALL; + } + r->out.buffer = (uint8_t *)talloc_memdup(p->mem_ctx, val->data_p, val->size); TALLOC_FREE(values); + if (!r->out.buffer) { + return WERR_NOMEM; + } + + *r->out.reg_data_type = REG_SZ; /* always 1...tested using a remove device manager connection */ + *r->out.buffer_size = val->size; + *r->out.needed = val->size; break; default: - r_u->unknown1 = 0x00437c98; + *r->out.reg_data_type = 0x00437c98; /* ??? */ return WERR_CM_NO_SUCH_VALUE; } @@ -279,16 +290,6 @@ WERROR _PNP_GetDepth(pipes_struct *p, /**************************************************************** ****************************************************************/ -WERROR _PNP_GetDeviceRegProp(pipes_struct *p, - struct PNP_GetDeviceRegProp *r) -{ - p->rng_fault_state = true; - return WERR_NOT_SUPPORTED; -} - -/**************************************************************** -****************************************************************/ - WERROR _PNP_SetDeviceRegProp(pipes_struct *p, struct PNP_SetDeviceRegProp *r) { -- cgit From f9d691d9d808ec2f91f3f469fe2201b0909a8552 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 11 Nov 2008 12:49:20 +0100 Subject: s3-ntsvcs: remove old hand-marshalling for ntsvcs getdevregprop. Guenther --- source3/include/proto.h | 7 ----- source3/include/rpc_ntsvcs.h | 19 ----------- source3/rpc_client/cli_reg.c | 17 ---------- source3/rpc_parse/parse_misc.c | 54 ------------------------------- source3/rpc_parse/parse_ntsvcs.c | 68 ---------------------------------------- source3/rpc_parse/parse_prs.c | 33 ------------------- 6 files changed, 198 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 45f66203e1..dd4b9d15f7 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5296,7 +5296,6 @@ NTSTATUS cli_get_session_key(TALLOC_CTX *mem_ctx, NTSTATUS rpccli_winreg_Connect(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32 reg_type, uint32 access_mask, POLICY_HND *reg_hnd); -uint32 reg_init_regval_buffer( REGVAL_BUFFER *buf2, REGISTRY_VALUE *val ); /* The following definitions come from rpc_client/cli_samr.c */ @@ -5910,8 +5909,6 @@ void init_rpc_blob_str(RPC_DATA_BLOB *str, const char *buf, int len); void init_rpc_blob_hex(RPC_DATA_BLOB *str, const char *buf); void init_rpc_blob_bytes(RPC_DATA_BLOB *str, uint8 *buf, size_t len); bool smb_io_buffer5(const char *desc, BUFFER5 *buf5, prs_struct *ps, int depth); -void init_regval_buffer(REGVAL_BUFFER *str, const uint8 *buf, size_t len); -bool smb_io_regval_buffer(const char *desc, prs_struct *ps, int depth, REGVAL_BUFFER *buf2); void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf); void copy_unistr2(UNISTR2 *str, const UNISTR2 *from); void init_string2(STRING2 *str, const char *buf, size_t max_len, size_t str_len); @@ -5974,8 +5971,6 @@ bool policy_handle_is_valid(const POLICY_HND *hnd); bool ntsvcs_io_q_get_device_list(const char *desc, NTSVCS_Q_GET_DEVICE_LIST *q_u, prs_struct *ps, int depth); bool ntsvcs_io_r_get_device_list(const char *desc, NTSVCS_R_GET_DEVICE_LIST *r_u, prs_struct *ps, int depth); -bool ntsvcs_io_q_get_device_reg_property(const char *desc, NTSVCS_Q_GET_DEVICE_REG_PROPERTY *q_u, prs_struct *ps, int depth); -bool ntsvcs_io_r_get_device_reg_property(const char *desc, NTSVCS_R_GET_DEVICE_REG_PROPERTY *r_u, prs_struct *ps, int depth); /* The following definitions come from rpc_parse/parse_prs.c */ @@ -6031,7 +6026,6 @@ bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, uin bool prs_uint16uni(bool charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len); bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, uint32 *data32s, int len); bool prs_buffer5(bool charmode, const char *name, prs_struct *ps, int depth, BUFFER5 *str); -bool prs_regval_buffer(bool charmode, const char *name, prs_struct *ps, int depth, REGVAL_BUFFER *buf); bool prs_string2(bool charmode, const char *name, prs_struct *ps, int depth, STRING2 *str); bool prs_unistr2(bool charmode, const char *name, prs_struct *ps, int depth, UNISTR2 *str); bool prs_unistr3(bool charmode, const char *name, UNISTR3 *str, prs_struct *ps, int depth); @@ -6824,7 +6818,6 @@ WERROR _PNP_GetVersion(pipes_struct *p, WERROR _PNP_GetDeviceListSize(pipes_struct *p, struct PNP_GetDeviceListSize *r); WERROR _ntsvcs_get_device_list( pipes_struct *p, NTSVCS_Q_GET_DEVICE_LIST *q_u, NTSVCS_R_GET_DEVICE_LIST *r_u ); -WERROR _ntsvcs_get_device_reg_property( pipes_struct *p, NTSVCS_Q_GET_DEVICE_REG_PROPERTY *q_u, NTSVCS_R_GET_DEVICE_REG_PROPERTY *r_u ); WERROR _PNP_ValidateDeviceInstance(pipes_struct *p, struct PNP_ValidateDeviceInstance *r); WERROR _PNP_GetHwProfInfo(pipes_struct *p, diff --git a/source3/include/rpc_ntsvcs.h b/source3/include/rpc_ntsvcs.h index 0056d16eb9..dc74298cb9 100644 --- a/source3/include/rpc_ntsvcs.h +++ b/source3/include/rpc_ntsvcs.h @@ -47,23 +47,4 @@ typedef struct { WERROR status; } NTSVCS_R_GET_DEVICE_LIST; -/**************************/ - -typedef struct { - UNISTR2 devicepath; - uint32 property; - uint32 unknown2; - uint32 buffer_size1; - uint32 buffer_size2; - uint32 unknown5; -} NTSVCS_Q_GET_DEVICE_REG_PROPERTY; - -typedef struct { - uint32 unknown1; - REGVAL_BUFFER value; - uint32 size; - uint32 needed; - WERROR status; -} NTSVCS_R_GET_DEVICE_REG_PROPERTY; - #endif /* _RPC_NTSVCS_H */ diff --git a/source3/rpc_client/cli_reg.c b/source3/rpc_client/cli_reg.c index ba98e25d63..2ed7119f4b 100644 --- a/source3/rpc_client/cli_reg.c +++ b/source3/rpc_client/cli_reg.c @@ -60,20 +60,3 @@ NTSTATUS rpccli_winreg_Connect(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return NT_STATUS_INVALID_PARAMETER; } - -/******************************************************************* - Fill in a REGVAL_BUFFER for the data given a REGISTRY_VALUE - *******************************************************************/ - -uint32 reg_init_regval_buffer( REGVAL_BUFFER *buf2, REGISTRY_VALUE *val ) -{ - uint32 real_size = 0; - - if ( !buf2 || !val ) - return 0; - - real_size = regval_size(val); - init_regval_buffer( buf2, (unsigned char*)regval_data_p(val), real_size ); - - return real_size; -} diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index cf989c8b5e..169e5cb560 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -557,60 +557,6 @@ bool smb_io_buffer5(const char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) return True; } -/******************************************************************* - Inits a REGVAL_BUFFER structure. -********************************************************************/ - -void init_regval_buffer(REGVAL_BUFFER *str, const uint8 *buf, size_t len) -{ - ZERO_STRUCTP(str); - - /* max buffer size (allocated size) */ - str->buf_max_len = len; - str->offset = 0; - str->buf_len = buf != NULL ? len : 0; - - if (buf != NULL) { - SMB_ASSERT(str->buf_max_len >= str->buf_len); - str->buffer = (uint16 *)TALLOC_ZERO(talloc_tos(), - str->buf_max_len); - if (str->buffer == NULL) - smb_panic("init_regval_buffer: talloc fail"); - memcpy(str->buffer, buf, str->buf_len); - } -} - -/******************************************************************* - Reads or writes a REGVAL_BUFFER structure. - the uni_max_len member tells you how large the buffer is. - the uni_str_len member tells you how much of the buffer is really used. -********************************************************************/ - -bool smb_io_regval_buffer(const char *desc, prs_struct *ps, int depth, REGVAL_BUFFER *buf2) -{ - - prs_debug(ps, depth, desc, "smb_io_regval_buffer"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("buf_max_len", ps, depth, &buf2->buf_max_len)) - return False; - if(!prs_uint32("offset ", ps, depth, &buf2->offset)) - return False; - if(!prs_uint32("buf_len ", ps, depth, &buf2->buf_len)) - return False; - - /* buffer advanced by indicated length of string - NOT by searching for null-termination */ - - if(!prs_regval_buffer(True, "buffer ", ps, depth, buf2)) - return False; - - return True; -} - /******************************************************************* creates a UNISTR2 structure: sets up the buffer, too ********************************************************************/ diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c index 2b15a45506..17b51fa751 100644 --- a/source3/rpc_parse/parse_ntsvcs.c +++ b/source3/rpc_parse/parse_ntsvcs.c @@ -77,71 +77,3 @@ bool ntsvcs_io_r_get_device_list(const char *desc, NTSVCS_R_GET_DEVICE_LIST *r_u return True; } - -/******************************************************************* -********************************************************************/ - -bool ntsvcs_io_q_get_device_reg_property(const char *desc, NTSVCS_Q_GET_DEVICE_REG_PROPERTY *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "ntsvcs_io_q_get_device_reg_property"); - depth++; - - if(!prs_align(ps)) - return False; - - if ( !prs_io_unistr2("devicepath", ps, depth, &q_u->devicepath) ) - return False; - if( !prs_align(ps) ) - return False; - - if ( !prs_uint32("property", ps, depth, &q_u->property) ) - return False; - if ( !prs_uint32("unknown2", ps, depth, &q_u->unknown2) ) - return False; - if ( !prs_uint32("buffer_size1", ps, depth, &q_u->buffer_size1) ) - return False; - if ( !prs_uint32("buffer_size2", ps, depth, &q_u->buffer_size2) ) - return False; - if ( !prs_uint32("unknown5", ps, depth, &q_u->unknown5) ) - return False; - - return True; - -} - -/******************************************************************* -********************************************************************/ - -bool ntsvcs_io_r_get_device_reg_property(const char *desc, NTSVCS_R_GET_DEVICE_REG_PROPERTY *r_u, prs_struct *ps, int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_reg_property"); - depth++; - - if ( !prs_align(ps) ) - return False; - - if ( !prs_uint32("unknown1", ps, depth, &r_u->unknown1) ) - return False; - - if ( !smb_io_regval_buffer("value", ps, depth, &r_u->value) ) - return False; - if ( !prs_align(ps) ) - return False; - - if ( !prs_uint32("size", ps, depth, &r_u->size) ) - 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; -} diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index a0d3ed7397..acc0cc88ef 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1055,39 +1055,6 @@ bool prs_buffer5(bool charmode, const char *name, prs_struct *ps, int depth, BUF return True; } -/****************************************************************** - Stream a "not" unicode string, length/buffer specified separately, - in byte chars. String is in little-endian format. - ********************************************************************/ - -bool prs_regval_buffer(bool charmode, const char *name, prs_struct *ps, int depth, REGVAL_BUFFER *buf) -{ - char *p; - char *q = prs_mem_get(ps, buf->buf_len); - if (q == NULL) - return False; - - if (UNMARSHALLING(ps)) { - if (buf->buf_len > buf->buf_max_len) { - return False; - } - if ( buf->buf_max_len ) { - buf->buffer = PRS_ALLOC_MEM(ps, uint16, buf->buf_max_len); - if ( buf->buffer == NULL ) - return False; - } else { - buf->buffer = NULL; - } - } - - p = (char *)buf->buffer; - - dbg_rw_punival(charmode, name, depth, ps, q, p, buf->buf_len/2); - ps->data_offset += buf->buf_len; - - return True; -} - /****************************************************************** Stream a string, length/buffer specified separately, in uint8 chars. -- cgit