Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/nsswitch/libwbclient/wbclient.c

    r740 r988  
    55
    66   Copyright (C) Gerald (Jerry) Carter 2007
     7   Copyright (C) Matthew Newton 2015
    78
    89
     
    2829/* From wb_common.c */
    2930
    30 NSS_STATUS winbindd_request_response(int req_type,
     31struct winbindd_context;
     32
     33NSS_STATUS winbindd_request_response(struct winbindd_context *wbctx,
     34                                     int req_type,
    3135                                     struct winbindd_request *request,
    3236                                     struct winbindd_response *response);
    33 NSS_STATUS winbindd_priv_request_response(int req_type,
     37NSS_STATUS winbindd_priv_request_response(struct winbindd_context *wbctx,
     38                                          int req_type,
    3439                                          struct winbindd_request *request,
    3540                                          struct winbindd_response *response);
     41struct winbindd_context *winbindd_ctx_create(void);
     42void winbindd_ctx_free(struct winbindd_context *ctx);
     43
     44/* Global context used for non-Ctx functions */
     45
     46static struct wbcContext wbcGlobalCtx = {
     47        .winbindd_ctx = NULL,
     48        .pw_cache_size = 0,
     49        .pw_cache_idx = 0,
     50        .gr_cache_size = 0,
     51        .gr_cache_idx = 0
     52};
    3653
    3754/*
     
    4966
    5067static wbcErr wbcRequestResponseInt(
     68        struct winbindd_context *wbctx,
    5169        int cmd,
    5270        struct winbindd_request *request,
    5371        struct winbindd_response *response,
    54         NSS_STATUS (*fn)(int req_type,
     72        NSS_STATUS (*fn)(struct winbindd_context *wbctx, int req_type,
    5573                         struct winbindd_request *request,
    5674                         struct winbindd_response *response))
     
    6179        /* for some calls the request and/or response can be NULL */
    6280
    63         nss_status = fn(cmd, request, response);
     81        nss_status = fn(wbctx, cmd, request, response);
    6482
    6583        switch (nss_status) {
     
    84102 * @brief Wrapper around Winbind's send/receive API call
    85103 *
     104 * @param ctx       Context
    86105 * @param cmd       Winbind command operation to perform
    87106 * @param request   Send structure
     
    90109 * @return #wbcErr
    91110 */
    92 wbcErr wbcRequestResponse(int cmd,
     111wbcErr wbcRequestResponse(struct wbcContext *ctx, int cmd,
    93112                          struct winbindd_request *request,
    94113                          struct winbindd_response *response)
    95114{
    96         return wbcRequestResponseInt(cmd, request, response,
     115        struct winbindd_context *wbctx = NULL;
     116
     117        if (ctx) {
     118                wbctx = ctx->winbindd_ctx;
     119        }
     120
     121        return wbcRequestResponseInt(wbctx, cmd, request, response,
    97122                                     winbindd_request_response);
    98123}
    99124
    100 wbcErr wbcRequestResponsePriv(int cmd,
     125wbcErr wbcRequestResponsePriv(struct wbcContext *ctx, int cmd,
    101126                              struct winbindd_request *request,
    102127                              struct winbindd_response *response)
    103128{
    104         return wbcRequestResponseInt(cmd, request, response,
     129        struct winbindd_context *wbctx = NULL;
     130
     131        if (ctx) {
     132                wbctx = ctx->winbindd_ctx;
     133        }
     134
     135        return wbcRequestResponseInt(wbctx, cmd, request, response,
    105136                                     winbindd_priv_request_response);
    106137}
     
    258289        return WBC_ERR_SUCCESS;
    259290}
     291
     292/* Context handling functions */
     293
     294static void wbcContextDestructor(void *ptr)
     295{
     296        struct wbcContext *ctx = (struct wbcContext *)ptr;
     297
     298        winbindd_ctx_free(ctx->winbindd_ctx);
     299}
     300
     301struct wbcContext *wbcCtxCreate(void)
     302{
     303        struct wbcContext *ctx;
     304        struct winbindd_context *wbctx;
     305
     306        ctx = (struct wbcContext *)wbcAllocateMemory(
     307                1, sizeof(struct wbcContext), wbcContextDestructor);
     308
     309        if (!ctx) {
     310                return NULL;
     311        }
     312
     313        wbctx = winbindd_ctx_create();
     314
     315        if (!wbctx) {
     316                wbcFreeMemory(ctx);
     317                return NULL;
     318        }
     319
     320        ctx->winbindd_ctx = wbctx;
     321
     322        return ctx;
     323}
     324
     325void wbcCtxFree(struct wbcContext *ctx)
     326{
     327        wbcFreeMemory(ctx);
     328}
     329
     330struct wbcContext *wbcGetGlobalCtx(void)
     331{
     332        return &wbcGlobalCtx;
     333}
Note: See TracChangeset for help on using the changeset viewer.