Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source4/lib/registry/rpc.c

    r414 r745  
    2828        struct registry_key key;
    2929        struct policy_handle pol;
    30         struct dcerpc_pipe *pipe;
    31 
     30        struct dcerpc_binding_handle *binding_handle;
    3231        const char* classname; 
    3332        uint32_t num_subkeys;
     
    4443        struct registry_context context;
    4544        struct dcerpc_pipe *pipe;
     45        struct dcerpc_binding_handle *binding_handle;
    4646};
    4747
     
    5252 */
    5353
    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) \
    5555{ \
    5656        struct winreg_Open ## u r; \
     
    6262        r.out.handle = hnd;\
    6363\
    64         status = dcerpc_winreg_Open ## u(p, mem_ctx, &r); \
     64        status = dcerpc_winreg_Open ## u ## _r(b, mem_ctx, &r); \
    6565\
    6666        if (!NT_STATUS_IS_OK(status)) { \
     
    8282static struct {
    8383        uint32_t hkey;
    84         WERROR (*open) (struct dcerpc_pipe *p, TALLOC_CTX *,
     84        WERROR (*open) (struct dcerpc_binding_handle *b, TALLOC_CTX *,
    8585                        struct policy_handle *h);
    8686} known_hives[] = {
     
    118118
    119119        mykeydata = talloc_zero(ctx, struct rpc_key);
     120        W_ERROR_HAVE_NO_MEMORY(mykeydata);
    120121        mykeydata->key.context = ctx;
    121         mykeydata->pipe = talloc_reference(mykeydata, rctx->pipe);
     122        mykeydata->binding_handle = rctx->binding_handle;
    122123        mykeydata->num_values = -1;
    123124        mykeydata->num_subkeys = -1;
    124125        *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);
    126127}
    127128
     
    161162
    162163        mykeydata = talloc_zero(mem_ctx, struct rpc_key);
     164        W_ERROR_HAVE_NO_MEMORY(mykeydata);
    163165        mykeydata->key.context = parentkeydata->key.context;
    164         mykeydata->pipe = talloc_reference(mykeydata, parentkeydata->pipe);
     166        mykeydata->binding_handle = parentkeydata->binding_handle;
    165167        mykeydata->num_values = -1;
    166168        mykeydata->num_subkeys = -1;
     
    171173        r.in.parent_handle = &parentkeydata->pol;
    172174        r.in.keyname.name = name;
    173         r.in.unknown = 0x00000000;
     175        r.in.options = 0x00000000;
    174176        r.in.access_mask = 0x02000000;
    175177        r.out.handle = &mykeydata->pol;
    176178
    177         status = dcerpc_winreg_OpenKey(mykeydata->pipe, mem_ctx, &r);
     179        status = dcerpc_winreg_OpenKey_r(mykeydata->binding_handle, mem_ctx, &r);
    178180
    179181        if (!NT_STATUS_IS_OK(status)) {
     
    213215        r.in.enum_index = n;
    214216        r.in.name = &name;
    215         r.in.type = type;
     217        r.in.type = (enum winreg_Type *) type;
    216218        r.in.value = &value;
    217219        r.in.size = &val_size;
    218220        r.in.length = &zero;
    219221        r.out.name = &name;
    220         r.out.type = type;
     222        r.out.type = (enum winreg_Type *) type;
    221223        r.out.value = &value;
    222224        r.out.size = &val_size;
    223225        r.out.length = &zero;
    224226
    225         status = dcerpc_winreg_EnumValue(mykeydata->pipe, mem_ctx, &r);
     227        status = dcerpc_winreg_EnumValue_r(mykeydata->binding_handle, mem_ctx, &r);
    226228
    227229        if (!NT_STATUS_IS_OK(status)) {
     
    230232        }
    231233
    232         *value_name = talloc_reference(mem_ctx, r.out.name->name);
     234        *value_name = talloc_steal(mem_ctx, r.out.name->name);
    233235        *type = *(r.out.type);
    234236        *data = data_blob_talloc(mem_ctx, r.out.value, *r.out.length);
     
    262264        r.in.handle = &mykeydata->pol;
    263265        r.in.value_name = &name;
    264         r.in.type = type;
     266        r.in.type = (enum winreg_Type *) type;
    265267        r.in.data = &value;
    266268        r.in.data_size = &val_size;
    267269        r.in.data_length = &zero;
    268         r.out.type = type;
     270        r.out.type = (enum winreg_Type *) type;
    269271        r.out.data = &value;
    270272        r.out.data_size = &val_size;
    271273        r.out.data_length = &zero;
    272274
    273         status = dcerpc_winreg_QueryValue(mykeydata->pipe, mem_ctx, &r);
     275        status = dcerpc_winreg_QueryValue_r(mykeydata->binding_handle, mem_ctx, &r);
    274276
    275277        if (!NT_STATUS_IS_OK(status)) {
     
    312314        r.out.last_changed_time = &change_time;
    313315
    314         status = dcerpc_winreg_EnumKey(mykeydata->pipe, mem_ctx, &r);
     316        status = dcerpc_winreg_EnumKey_r(mykeydata->binding_handle, mem_ctx, &r);
    315317
    316318        if (!NT_STATUS_IS_OK(status)) {
     
    320322
    321323        if (name != NULL)
    322                 *name = talloc_reference(mem_ctx, r.out.name->name);
     324                *name = talloc_steal(mem_ctx, r.out.name->name);
    323325        if (keyclass != NULL)
    324                 *keyclass = talloc_reference(mem_ctx, r.out.keyclass->name);
     326                *keyclass = talloc_steal(mem_ctx, r.out.keyclass->name);
    325327        if (last_changed_time != NULL)
    326328                *last_changed_time = *(r.out.last_changed_time);
     
    330332
    331333static WERROR rpc_add_key(TALLOC_CTX *mem_ctx,
    332                           struct registry_key *parent, const char *name,
     334                          struct registry_key *parent, const char *path,
    333335                          const char *key_class,
    334336                          struct security_descriptor *sec,
     
    343345        ZERO_STRUCT(r);
    344346        r.in.handle = &parentkd->pol;
    345         r.in.name.name = name;
     347        r.in.name.name = path;
    346348        r.in.keyclass.name = NULL;
    347349        r.in.options = 0;
     
    352354        r.out.action_taken = NULL;
    353355
    354         status = dcerpc_winreg_CreateKey(parentkd->pipe, mem_ctx, &r);
     356        status = dcerpc_winreg_CreateKey_r(parentkd->binding_handle, mem_ctx, &r);
    355357
    356358        if (!NT_STATUS_IS_OK(status)) {
     
    360362        }
    361363
    362         rpck->pipe = talloc_reference(rpck, parentkd->pipe);
     364        rpck->binding_handle = parentkd->binding_handle;
    363365        *key = (struct registry_key *)rpck;
    364366
     
    388390        r.out.last_changed_time = &mykeydata->last_changed_time;
    389391
    390         status = dcerpc_winreg_QueryInfoKey(mykeydata->pipe, mem_ctx, &r);
     392        status = dcerpc_winreg_QueryInfoKey_r(mykeydata->binding_handle, mem_ctx, &r);
    391393
    392394        if (!NT_STATUS_IS_OK(status)) {
     
    395397        }
    396398
    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
     404static WERROR rpc_del_key(TALLOC_CTX *mem_ctx, struct registry_key *parent,
     405                          const char *name)
    403406{
    404407        NTSTATUS status;
    405408        struct rpc_key *mykeydata = talloc_get_type(parent, struct rpc_key);
    406409        struct winreg_DeleteKey r;
    407         TALLOC_CTX *mem_ctx = talloc_init("del_key");
    408410
    409411        ZERO_STRUCT(r);
     
    411413        r.in.key.name = name;
    412414
    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);
    416416
    417417        if (!NT_STATUS_IS_OK(status)) {
     
    474474        .delete_key = rpc_del_key,
    475475        .get_key_info = rpc_get_info,
    476         .get_predefined_key = rpc_get_predefined_key,
    477476};
    478477
     
    490489
    491490        rctx = talloc(NULL, struct rpc_registry_context);
     491        W_ERROR_HAVE_NO_MEMORY(rctx);
    492492
    493493        /* Default to local smbd if no connection is specified */
     
    498498        status = dcerpc_pipe_connect(rctx /* TALLOC_CTX */,
    499499                                     &p, location,
    500                                         &ndr_table_winreg,
     500                                    &ndr_table_winreg,
    501501                                     credentials, ev, lp_ctx);
    502         rctx->pipe = p;
    503 
    504502        if(NT_STATUS_IS_ERR(status)) {
    505503                DEBUG(1, ("Unable to open '%s': %s\n", location,
     
    510508        }
    511509
     510        rctx->pipe = p;
     511        rctx->binding_handle = p->binding_handle;
     512
    512513        *ctx = (struct registry_context *)rctx;
    513514        (*ctx)->ops = &reg_backend_rpc;
Note: See TracChangeset for help on using the changeset viewer.