Changeset 745 for trunk/server/source4/lib/registry/rpc.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source4/lib/registry/rpc.c
r414 r745 28 28 struct registry_key key; 29 29 struct policy_handle pol; 30 struct dcerpc_pipe *pipe; 31 30 struct dcerpc_binding_handle *binding_handle; 32 31 const char* classname; 33 32 uint32_t num_subkeys; … … 44 43 struct registry_context context; 45 44 struct dcerpc_pipe *pipe; 45 struct dcerpc_binding_handle *binding_handle; 46 46 }; 47 47 … … 52 52 */ 53 53 54 #define openhive(u) static WERROR open_ ## u(struct dcerpc_ pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *hnd) \54 #define openhive(u) static WERROR open_ ## u(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, struct policy_handle *hnd) \ 55 55 { \ 56 56 struct winreg_Open ## u r; \ … … 62 62 r.out.handle = hnd;\ 63 63 \ 64 status = dcerpc_winreg_Open ## u (p, mem_ctx, &r); \64 status = dcerpc_winreg_Open ## u ## _r(b, mem_ctx, &r); \ 65 65 \ 66 66 if (!NT_STATUS_IS_OK(status)) { \ … … 82 82 static struct { 83 83 uint32_t hkey; 84 WERROR (*open) (struct dcerpc_ pipe *p, TALLOC_CTX *,84 WERROR (*open) (struct dcerpc_binding_handle *b, TALLOC_CTX *, 85 85 struct policy_handle *h); 86 86 } known_hives[] = { … … 118 118 119 119 mykeydata = talloc_zero(ctx, struct rpc_key); 120 W_ERROR_HAVE_NO_MEMORY(mykeydata); 120 121 mykeydata->key.context = ctx; 121 mykeydata-> pipe = talloc_reference(mykeydata, rctx->pipe);122 mykeydata->binding_handle = rctx->binding_handle; 122 123 mykeydata->num_values = -1; 123 124 mykeydata->num_subkeys = -1; 124 125 *k = (struct registry_key *)mykeydata; 125 return known_hives[n].open(mykeydata-> pipe, mykeydata, &(mykeydata->pol));126 return known_hives[n].open(mykeydata->binding_handle, mykeydata, &mykeydata->pol); 126 127 } 127 128 … … 161 162 162 163 mykeydata = talloc_zero(mem_ctx, struct rpc_key); 164 W_ERROR_HAVE_NO_MEMORY(mykeydata); 163 165 mykeydata->key.context = parentkeydata->key.context; 164 mykeydata-> pipe = talloc_reference(mykeydata, parentkeydata->pipe);166 mykeydata->binding_handle = parentkeydata->binding_handle; 165 167 mykeydata->num_values = -1; 166 168 mykeydata->num_subkeys = -1; … … 171 173 r.in.parent_handle = &parentkeydata->pol; 172 174 r.in.keyname.name = name; 173 r.in. unknown= 0x00000000;175 r.in.options = 0x00000000; 174 176 r.in.access_mask = 0x02000000; 175 177 r.out.handle = &mykeydata->pol; 176 178 177 status = dcerpc_winreg_OpenKey (mykeydata->pipe, mem_ctx, &r);179 status = dcerpc_winreg_OpenKey_r(mykeydata->binding_handle, mem_ctx, &r); 178 180 179 181 if (!NT_STATUS_IS_OK(status)) { … … 213 215 r.in.enum_index = n; 214 216 r.in.name = &name; 215 r.in.type = type;217 r.in.type = (enum winreg_Type *) type; 216 218 r.in.value = &value; 217 219 r.in.size = &val_size; 218 220 r.in.length = &zero; 219 221 r.out.name = &name; 220 r.out.type = type;222 r.out.type = (enum winreg_Type *) type; 221 223 r.out.value = &value; 222 224 r.out.size = &val_size; 223 225 r.out.length = &zero; 224 226 225 status = dcerpc_winreg_EnumValue (mykeydata->pipe, mem_ctx, &r);227 status = dcerpc_winreg_EnumValue_r(mykeydata->binding_handle, mem_ctx, &r); 226 228 227 229 if (!NT_STATUS_IS_OK(status)) { … … 230 232 } 231 233 232 *value_name = talloc_ reference(mem_ctx, r.out.name->name);234 *value_name = talloc_steal(mem_ctx, r.out.name->name); 233 235 *type = *(r.out.type); 234 236 *data = data_blob_talloc(mem_ctx, r.out.value, *r.out.length); … … 262 264 r.in.handle = &mykeydata->pol; 263 265 r.in.value_name = &name; 264 r.in.type = type;266 r.in.type = (enum winreg_Type *) type; 265 267 r.in.data = &value; 266 268 r.in.data_size = &val_size; 267 269 r.in.data_length = &zero; 268 r.out.type = type;270 r.out.type = (enum winreg_Type *) type; 269 271 r.out.data = &value; 270 272 r.out.data_size = &val_size; 271 273 r.out.data_length = &zero; 272 274 273 status = dcerpc_winreg_QueryValue (mykeydata->pipe, mem_ctx, &r);275 status = dcerpc_winreg_QueryValue_r(mykeydata->binding_handle, mem_ctx, &r); 274 276 275 277 if (!NT_STATUS_IS_OK(status)) { … … 312 314 r.out.last_changed_time = &change_time; 313 315 314 status = dcerpc_winreg_EnumKey (mykeydata->pipe, mem_ctx, &r);316 status = dcerpc_winreg_EnumKey_r(mykeydata->binding_handle, mem_ctx, &r); 315 317 316 318 if (!NT_STATUS_IS_OK(status)) { … … 320 322 321 323 if (name != NULL) 322 *name = talloc_ reference(mem_ctx, r.out.name->name);324 *name = talloc_steal(mem_ctx, r.out.name->name); 323 325 if (keyclass != NULL) 324 *keyclass = talloc_ reference(mem_ctx, r.out.keyclass->name);326 *keyclass = talloc_steal(mem_ctx, r.out.keyclass->name); 325 327 if (last_changed_time != NULL) 326 328 *last_changed_time = *(r.out.last_changed_time); … … 330 332 331 333 static WERROR rpc_add_key(TALLOC_CTX *mem_ctx, 332 struct registry_key *parent, const char * name,334 struct registry_key *parent, const char *path, 333 335 const char *key_class, 334 336 struct security_descriptor *sec, … … 343 345 ZERO_STRUCT(r); 344 346 r.in.handle = &parentkd->pol; 345 r.in.name.name = name;347 r.in.name.name = path; 346 348 r.in.keyclass.name = NULL; 347 349 r.in.options = 0; … … 352 354 r.out.action_taken = NULL; 353 355 354 status = dcerpc_winreg_CreateKey (parentkd->pipe, mem_ctx, &r);356 status = dcerpc_winreg_CreateKey_r(parentkd->binding_handle, mem_ctx, &r); 355 357 356 358 if (!NT_STATUS_IS_OK(status)) { … … 360 362 } 361 363 362 rpck-> pipe = talloc_reference(rpck, parentkd->pipe);364 rpck->binding_handle = parentkd->binding_handle; 363 365 *key = (struct registry_key *)rpck; 364 366 … … 388 390 r.out.last_changed_time = &mykeydata->last_changed_time; 389 391 390 status = dcerpc_winreg_QueryInfoKey (mykeydata->pipe, mem_ctx, &r);392 status = dcerpc_winreg_QueryInfoKey_r(mykeydata->binding_handle, mem_ctx, &r); 391 393 392 394 if (!NT_STATUS_IS_OK(status)) { … … 395 397 } 396 398 397 mykeydata->classname = talloc_reference(mem_ctx, r.out.classname->name); 398 399 return r.out.result; 400 } 401 402 static WERROR rpc_del_key(struct registry_key *parent, const char *name) 399 mykeydata->classname = talloc_steal(mem_ctx, r.out.classname->name); 400 401 return r.out.result; 402 } 403 404 static WERROR rpc_del_key(TALLOC_CTX *mem_ctx, struct registry_key *parent, 405 const char *name) 403 406 { 404 407 NTSTATUS status; 405 408 struct rpc_key *mykeydata = talloc_get_type(parent, struct rpc_key); 406 409 struct winreg_DeleteKey r; 407 TALLOC_CTX *mem_ctx = talloc_init("del_key");408 410 409 411 ZERO_STRUCT(r); … … 411 413 r.in.key.name = name; 412 414 413 status = dcerpc_winreg_DeleteKey(mykeydata->pipe, mem_ctx, &r); 414 415 talloc_free(mem_ctx); 415 status = dcerpc_winreg_DeleteKey_r(mykeydata->binding_handle, mem_ctx, &r); 416 416 417 417 if (!NT_STATUS_IS_OK(status)) { … … 474 474 .delete_key = rpc_del_key, 475 475 .get_key_info = rpc_get_info, 476 .get_predefined_key = rpc_get_predefined_key,477 476 }; 478 477 … … 490 489 491 490 rctx = talloc(NULL, struct rpc_registry_context); 491 W_ERROR_HAVE_NO_MEMORY(rctx); 492 492 493 493 /* Default to local smbd if no connection is specified */ … … 498 498 status = dcerpc_pipe_connect(rctx /* TALLOC_CTX */, 499 499 &p, location, 500 500 &ndr_table_winreg, 501 501 credentials, ev, lp_ctx); 502 rctx->pipe = p;503 504 502 if(NT_STATUS_IS_ERR(status)) { 505 503 DEBUG(1, ("Unable to open '%s': %s\n", location, … … 510 508 } 511 509 510 rctx->pipe = p; 511 rctx->binding_handle = p->binding_handle; 512 512 513 *ctx = (struct registry_context *)rctx; 513 514 (*ctx)->ops = ®_backend_rpc;
Note:
See TracChangeset
for help on using the changeset viewer.