Changeset 740 for vendor/current/source4/libcli/resolve
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- Location:
- vendor/current/source4/libcli/resolve
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source4/libcli/resolve/bcast.c
r414 r740 102 102 { 103 103 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)); 106 106 } -
vendor/current/source4/libcli/resolve/dns_ex.c
r414 r740 68 68 69 69 kill(state->child, SIGTERM); 70 close(state->child_fd);71 70 if (waitpid(state->child, &status, WNOHANG) == 0) { 72 71 kill(state->child, SIGKILL); … … 94 93 bool do_srv = (state->flags & RESOLVE_NAME_FLAG_DNS_SRV); 95 94 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 96 104 /* this is the blocking call we are going to lots of trouble 97 105 to avoid in the parent */ … … 169 177 if (do_srv) { 170 178 /* we are only interested in SRV records */ 171 if (rr->type != rk_ns_ c_in) {179 if (rr->type != rk_ns_t_srv) { 172 180 continue; 173 181 } … … 209 217 } 210 218 211 /* we are only interested in SRVrecords */219 /* we are only interested in A records */ 212 220 if (rr->type != rk_ns_t_a) { 213 221 continue; … … 370 378 ret = -1; 371 379 } 372 close(state->child_fd);373 380 if (waitpid(state->child, &status, WNOHANG) == 0) { 374 381 kill(state->child, SIGKILL); … … 499 506 return c; 500 507 } 508 tevent_fd_set_auto_close(state->fde); 501 509 502 510 state->child = fork(); -
vendor/current/source4/libcli/resolve/nbtlist.c
r414 r740 164 164 } 165 165 166 state->nbtsock = nbt_name_socket_init(state, event_ctx, 167 global_iconv_convenience); 166 state->nbtsock = nbt_name_socket_init(state, event_ctx); 168 167 if (composite_nomem(state->nbtsock, c)) return c; 169 168 -
vendor/current/source4/libcli/resolve/resolve.c
r414 r740 28 28 #include "lib/socket/socket.h" 29 29 #include "../lib/util/dlinklist.h" 30 #include "lib/tsocket/tsocket.h" 31 #include "lib/util/util_net.h" 30 32 31 33 struct resolve_state { … … 138 140 struct composite_context *resolve_name_all_send(struct resolve_context *ctx, 139 141 TALLOC_CTX *mem_ctx, 140 uint32_t flags, 142 uint32_t flags, /* RESOLVE_NAME_FLAG_* */ 141 143 uint16_t port, 142 144 struct nbt_name *name, … … 146 148 struct resolve_state *state; 147 149 148 if ( ctx == NULL ||event_ctx == NULL) {150 if (event_ctx == NULL) { 149 151 return NULL; 150 152 } … … 222 224 } 223 225 226 struct 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 224 236 struct composite_context *resolve_name_send(struct resolve_context *ctx, 225 237 TALLOC_CTX *mem_ctx, … … 227 239 struct tevent_context *event_ctx) 228 240 { 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); 230 242 } 231 243 … … 240 252 241 253 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); 243 260 talloc_free(addrs); 261 if (!*reply_addr) { 262 return NT_STATUS_NO_MEMORY; 263 } 244 264 } 245 265 … … 248 268 249 269 /* 270 receive multiple responses from resolve_name_send() 271 */ 272 NTSTATUS 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 /* 250 304 general name resolution - sync call 251 305 */ 306 NTSTATUS 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 */ 252 322 NTSTATUS 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); 260 329 } 261 330 -
vendor/current/source4/libcli/resolve/resolve_lp.c
r414 r740 22 22 #include "param/param.h" 23 23 24 struct resolve_context *lp _resolve_context(struct loadparm_context *lp_ctx)24 struct resolve_context *lpcfg_resolve_context(struct loadparm_context *lp_ctx) 25 25 { 26 const char **methods = lp _name_resolve_order(lp_ctx);26 const char **methods = lpcfg_name_resolve_order(lp_ctx); 27 27 int i; 28 28 struct resolve_context *ret = resolve_context_init(lp_ctx); … … 36 36 } else if (!strcmp(methods[i], "bcast")) { 37 37 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); 38 40 } else if (!strcmp(methods[i], "host")) { 39 41 resolve_context_add_host_method(ret); -
vendor/current/source4/libcli/resolve/testsuite.c
r414 r740 25 25 #include "torture/torture.h" 26 26 #include "system/network.h" 27 #include "lib/util/util_net.h" 27 28 28 29 static bool test_async_resolve(struct torture_context *tctx) … … 82 83 struct torture_suite *torture_local_resolve(TALLOC_CTX *mem_ctx) 83 84 { 84 struct torture_suite *suite = torture_suite_create(mem_ctx, " RESOLVE");85 struct torture_suite *suite = torture_suite_create(mem_ctx, "resolve"); 85 86 86 87 torture_suite_add_simple_test(suite, "async", test_async_resolve); -
vendor/current/source4/libcli/resolve/wins.c
r414 r740 78 78 { 79 79 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)); 82 82 }
Note:
See TracChangeset
for help on using the changeset viewer.