Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

Location:
vendor/current/source4/libcli/resolve
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source4/libcli/resolve/bcast.c

    r414 r740  
    102102{
    103103        struct interface *ifaces;
    104         load_interfaces(ctx, lp_interfaces(lp_ctx), &ifaces);
    105         return resolve_context_add_bcast_method(ctx, ifaces, lp_nbt_port(lp_ctx), lp_parm_int(lp_ctx, NULL, "nbt", "timeout", 1));
     104        load_interfaces(ctx, lpcfg_interfaces(lp_ctx), &ifaces);
     105        return resolve_context_add_bcast_method(ctx, ifaces, lpcfg_nbt_port(lp_ctx), lpcfg_parm_int(lp_ctx, NULL, "nbt", "timeout", 1));
    106106}
  • vendor/current/source4/libcli/resolve/dns_ex.c

    r414 r740  
    6868
    6969        kill(state->child, SIGTERM);
    70         close(state->child_fd);
    7170        if (waitpid(state->child, &status, WNOHANG) == 0) {
    7271                kill(state->child, SIGKILL);
     
    9493        bool do_srv = (state->flags & RESOLVE_NAME_FLAG_DNS_SRV);
    9594
     95        if (strchr(state->name.name, '.') && state->name.name[strlen(state->name.name)-1] != '.') {
     96                /* we are asking for a fully qualified name, but the
     97                   name doesn't end in a '.'. We need to prevent the
     98                   DNS library trying the search domains configured in
     99                   resolv.conf */
     100                state->name.name = talloc_strdup_append(discard_const_p(char, state->name.name),
     101                                                        ".");
     102        }
     103
    96104        /* this is the blocking call we are going to lots of trouble
    97105           to avoid in the parent */
     
    169177                if (do_srv) {
    170178                        /* we are only interested in SRV records */
    171                         if (rr->type != rk_ns_c_in) {
     179                        if (rr->type != rk_ns_t_srv) {
    172180                                continue;
    173181                        }
     
    209217                        }
    210218
    211                         /* we are only interested in SRV records */
     219                        /* we are only interested in A records */
    212220                        if (rr->type != rk_ns_t_a) {
    213221                                continue;
     
    370378                ret = -1;
    371379        }
    372         close(state->child_fd);
    373380        if (waitpid(state->child, &status, WNOHANG) == 0) {
    374381                kill(state->child, SIGKILL);
     
    499506                return c;
    500507        }
     508        tevent_fd_set_auto_close(state->fde);
    501509
    502510        state->child = fork();
  • vendor/current/source4/libcli/resolve/nbtlist.c

    r414 r740  
    164164        }
    165165
    166         state->nbtsock = nbt_name_socket_init(state, event_ctx,
    167                                               global_iconv_convenience);
     166        state->nbtsock = nbt_name_socket_init(state, event_ctx);
    168167        if (composite_nomem(state->nbtsock, c)) return c;
    169168
  • vendor/current/source4/libcli/resolve/resolve.c

    r414 r740  
    2828#include "lib/socket/socket.h"
    2929#include "../lib/util/dlinklist.h"
     30#include "lib/tsocket/tsocket.h"
     31#include "lib/util/util_net.h"
    3032
    3133struct resolve_state {
     
    138140struct composite_context *resolve_name_all_send(struct resolve_context *ctx,
    139141                                                TALLOC_CTX *mem_ctx,
    140                                                 uint32_t flags,
     142                                                uint32_t flags, /* RESOLVE_NAME_FLAG_* */
    141143                                                uint16_t port,
    142144                                                struct nbt_name *name,
     
    146148        struct resolve_state *state;
    147149
    148         if (ctx == NULL || event_ctx == NULL) {
     150        if (event_ctx == NULL) {
    149151                return NULL;
    150152        }
     
    222224}
    223225
     226struct composite_context *resolve_name_ex_send(struct resolve_context *ctx,
     227                                               TALLOC_CTX *mem_ctx,
     228                                               uint32_t flags, /* RESOLVE_NAME_FLAG_* */
     229                                               uint16_t port,
     230                                               struct nbt_name *name,
     231                                               struct tevent_context *event_ctx)
     232{
     233        return resolve_name_all_send(ctx, mem_ctx, flags, port, name, event_ctx);
     234}
     235
    224236struct composite_context *resolve_name_send(struct resolve_context *ctx,
    225237                                            TALLOC_CTX *mem_ctx,
     
    227239                                            struct tevent_context *event_ctx)
    228240{
    229         return resolve_name_all_send(ctx, mem_ctx, 0, 0, name, event_ctx);
     241        return resolve_name_ex_send(ctx, mem_ctx, 0, 0, name, event_ctx);
    230242}
    231243
     
    240252
    241253        if (NT_STATUS_IS_OK(status)) {
    242                 *reply_addr = talloc_steal(mem_ctx, addrs[0]->addr);
     254                struct tsocket_address *t_addr = socket_address_to_tsocket_address(addrs, addrs[0]);
     255                if (!t_addr) {
     256                        return NT_STATUS_NO_MEMORY;
     257                }
     258
     259                *reply_addr = tsocket_address_inet_addr_string(t_addr, mem_ctx);
    243260                talloc_free(addrs);
     261                if (!*reply_addr) {
     262                        return NT_STATUS_NO_MEMORY;
     263                }
    244264        }
    245265
     
    248268
    249269/*
     270  receive multiple responses from resolve_name_send()
     271 */
     272NTSTATUS resolve_name_multiple_recv(struct composite_context *c,
     273                                    TALLOC_CTX *mem_ctx,
     274                                    const char ***reply_addrs)
     275{
     276        NTSTATUS status;
     277        struct socket_address **addrs = NULL;
     278        int i;
     279
     280        status = resolve_name_all_recv(c, mem_ctx, &addrs, NULL);
     281        NT_STATUS_NOT_OK_RETURN(status);
     282
     283        /* count the addresses */
     284        for (i=0; addrs[i]; i++) ;
     285
     286        *reply_addrs = talloc_array(mem_ctx, const char *, i+1);
     287        NT_STATUS_HAVE_NO_MEMORY(*reply_addrs);
     288
     289        for (i=0; addrs[i]; i++) {
     290                struct tsocket_address *t_addr = socket_address_to_tsocket_address(addrs, addrs[i]);
     291                NT_STATUS_HAVE_NO_MEMORY(t_addr);
     292
     293                (*reply_addrs)[i] = tsocket_address_inet_addr_string(t_addr, *reply_addrs);
     294                NT_STATUS_HAVE_NO_MEMORY((*reply_addrs)[i]);
     295        }
     296        (*reply_addrs)[i] = NULL;
     297
     298        talloc_free(addrs);
     299
     300        return status;
     301}
     302
     303/*
    250304  general name resolution - sync call
    251305 */
     306NTSTATUS resolve_name_ex(struct resolve_context *ctx,
     307                         uint32_t flags, /* RESOLVE_NAME_FLAG_* */
     308                         uint16_t port,
     309                         struct nbt_name *name,
     310                         TALLOC_CTX *mem_ctx,
     311                         const char **reply_addr,
     312                         struct tevent_context *ev)
     313{
     314        struct composite_context *c = resolve_name_ex_send(ctx, mem_ctx, flags, port, name, ev);
     315        return resolve_name_recv(c, mem_ctx, reply_addr);
     316}
     317
     318
     319/*
     320  general name resolution - sync call
     321 */
    252322NTSTATUS resolve_name(struct resolve_context *ctx,
    253                           struct nbt_name *name,
    254                           TALLOC_CTX *mem_ctx,
    255                           const char **reply_addr,
    256                           struct tevent_context *ev)
    257 {
    258         struct composite_context *c = resolve_name_send(ctx, mem_ctx, name, ev);
    259         return resolve_name_recv(c, mem_ctx, reply_addr);
     323                      struct nbt_name *name,
     324                      TALLOC_CTX *mem_ctx,
     325                      const char **reply_addr,
     326                      struct tevent_context *ev)
     327{
     328        return resolve_name_ex(ctx, 0, 0, name, mem_ctx, reply_addr, ev);
    260329}
    261330
  • vendor/current/source4/libcli/resolve/resolve_lp.c

    r414 r740  
    2222#include "param/param.h"
    2323
    24 struct resolve_context *lp_resolve_context(struct loadparm_context *lp_ctx)
     24struct resolve_context *lpcfg_resolve_context(struct loadparm_context *lp_ctx)
    2525{
    26         const char **methods = lp_name_resolve_order(lp_ctx);
     26        const char **methods = lpcfg_name_resolve_order(lp_ctx);
    2727        int i;
    2828        struct resolve_context *ret = resolve_context_init(lp_ctx);
     
    3636                } else if (!strcmp(methods[i], "bcast")) {
    3737                        resolve_context_add_bcast_method_lp(ret, lp_ctx);
     38                } else if (!strcmp(methods[i], "file")) {
     39                        resolve_context_add_file_method_lp(ret, lp_ctx);
    3840                } else if (!strcmp(methods[i], "host")) {
    3941                        resolve_context_add_host_method(ret);
  • vendor/current/source4/libcli/resolve/testsuite.c

    r414 r740  
    2525#include "torture/torture.h"
    2626#include "system/network.h"
     27#include "lib/util/util_net.h"
    2728
    2829static bool test_async_resolve(struct torture_context *tctx)
     
    8283struct torture_suite *torture_local_resolve(TALLOC_CTX *mem_ctx)
    8384{
    84         struct torture_suite *suite = torture_suite_create(mem_ctx, "RESOLVE");
     85        struct torture_suite *suite = torture_suite_create(mem_ctx, "resolve");
    8586
    8687        torture_suite_add_simple_test(suite, "async", test_async_resolve);
  • vendor/current/source4/libcli/resolve/wins.c

    r414 r740  
    7878{
    7979        struct interface *ifaces;
    80         load_interfaces(ctx, lp_interfaces(lp_ctx), &ifaces);
    81         return resolve_context_add_wins_method(ctx, lp_wins_server_list(lp_ctx), ifaces, lp_nbt_port(lp_ctx), lp_parm_int(lp_ctx, NULL, "nbt", "timeout", 1));
     80        load_interfaces(ctx, lpcfg_interfaces(lp_ctx), &ifaces);
     81        return resolve_context_add_wins_method(ctx, lpcfg_wins_server_list(lp_ctx), ifaces, lpcfg_nbt_port(lp_ctx), lpcfg_parm_int(lp_ctx, NULL, "nbt", "timeout", 1));
    8282}
Note: See TracChangeset for help on using the changeset viewer.