Changeset 740 for vendor/current/source4/libcli/ldap
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- Location:
- vendor/current/source4/libcli/ldap
- Files:
-
- 2 added
- 2 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source4/libcli/ldap/ldap_bind.c
r414 r740 23 23 24 24 #include "includes.h" 25 #include "libcli/ldap/l dap.h"25 #include "libcli/ldap/libcli_ldap.h" 26 26 #include "libcli/ldap/ldap_proto.h" 27 27 #include "libcli/ldap/ldap_client.h" … … 226 226 status = gensec_client_start(conn, &conn->gensec, 227 227 conn->event.event_ctx, 228 lp _gensec_settings(conn, lp_ctx));228 lpcfg_gensec_settings(conn, lp_ctx)); 229 229 if (!NT_STATUS_IS_OK(status)) { 230 230 DEBUG(0, ("Failed to start GENSEC engine (%s)\n", nt_errstr(status))); … … 353 353 goto failed; 354 354 } 355 talloc_ steal(tmp_ctx, req);355 talloc_reparent(conn, tmp_ctx, req); 356 356 357 357 status = ldap_result_n(req, 0, &response); -
vendor/current/source4/libcli/ldap/ldap_client.c
r414 r740 28 28 #include "../lib/util/asn1.h" 29 29 #include "../lib/util/dlinklist.h" 30 #include "libcli/ldap/l dap.h"30 #include "libcli/ldap/libcli_ldap.h" 31 31 #include "libcli/ldap/ldap_proto.h" 32 32 #include "libcli/ldap/ldap_client.h" … … 339 339 * local host name as the target for gensec's 340 340 * DIGEST-MD5 mechanism */ 341 conn->host = talloc_asprintf(conn, "%s.%s", lp_netbios_name(conn->lp_ctx), lp_realm(conn->lp_ctx)); 341 conn->host = talloc_asprintf(conn, "%s.%s", 342 lpcfg_netbios_name(conn->lp_ctx), 343 lpcfg_dnsdomain(conn->lp_ctx)); 342 344 if (composite_nomem(conn->host, state->ctx)) { 343 345 return result; … … 374 376 375 377 ctx = socket_connect_multi_send(state, conn->host, 1, &conn->port, 376 lp _resolve_context(conn->lp_ctx), conn->event.event_ctx);378 lpcfg_resolve_context(conn->lp_ctx), conn->event.event_ctx); 377 379 if (ctx == NULL) goto failed; 378 380 … … 404 406 if (conn->ldaps) { 405 407 struct socket_context *tls_socket; 406 struct socket_context *tmp_socket; 407 char *cafile = lp_tls_cafile(conn->sock, conn->lp_ctx); 408 char *cafile = lpcfg_tls_cafile(conn->sock, conn->lp_ctx); 408 409 409 410 if (!cafile || !*cafile) { … … 499 500 conn->reconnect.max_retries = max_retries; 500 501 conn->reconnect.retries = 0; 501 conn->reconnect.previous = time (NULL);502 conn->reconnect.previous = time_mono(NULL); 502 503 } 503 504 } … … 507 508 { 508 509 NTSTATUS status; 509 time_t now = time (NULL);510 time_t now = time_mono(NULL); 510 511 511 512 /* do we have set up reconnect ? */ … … 565 566 566 567 /* 567 called on completion of a one-wayldap request568 */ 569 static void ldap_request_ complete(struct tevent_context *ev, struct tevent_timer *te,570 struct timeval t, void *private_data)568 called on completion of a failed ldap request 569 */ 570 static void ldap_request_failed_complete(struct tevent_context *ev, struct tevent_timer *te, 571 struct timeval t, void *private_data) 571 572 { 572 573 struct ldap_request *req = talloc_get_type(private_data, struct ldap_request); … … 577 578 578 579 /* 580 called on completion of a one-way ldap request 581 */ 582 static void ldap_request_oneway_complete(void *private_data) 583 { 584 struct ldap_request *req = talloc_get_type(private_data, struct ldap_request); 585 if (req->state == LDAP_REQUEST_PENDING) { 586 DLIST_REMOVE(req->conn->pending, req); 587 } 588 req->state = LDAP_REQUEST_DONE; 589 if (req->async.fn) { 590 req->async.fn(req); 591 } 592 } 593 /* 579 594 send a ldap message - async interface 580 595 */ … … 584 599 struct ldap_request *req; 585 600 NTSTATUS status = NT_STATUS_UNSUCCESSFUL; 601 packet_send_callback_fn_t send_callback = NULL; 586 602 587 603 req = talloc_zero(conn, struct ldap_request); … … 613 629 } 614 630 615 status = packet_send(conn->packet, req->data); 631 if (req->type == LDAP_TAG_AbandonRequest || 632 req->type == LDAP_TAG_UnbindRequest) { 633 send_callback = ldap_request_oneway_complete; 634 } 635 636 status = packet_send_callback(conn->packet, req->data, 637 send_callback, req); 616 638 if (!NT_STATUS_IS_OK(status)) { 617 639 goto failed; 618 }619 620 /* some requests don't expect a reply, so don't add those to the621 pending queue */622 if (req->type == LDAP_TAG_AbandonRequest ||623 req->type == LDAP_TAG_UnbindRequest) {624 req->status = NT_STATUS_OK;625 req->state = LDAP_REQUEST_DONE;626 /* we can't call the async callback now, as it isn't setup, so627 call it as next event */628 tevent_add_timer(conn->event.event_ctx, req, timeval_zero(),629 ldap_request_complete, req);630 return req;631 640 } 632 641 … … 645 654 req->state = LDAP_REQUEST_ERROR; 646 655 tevent_add_timer(conn->event.event_ctx, req, timeval_zero(), 647 ldap_request_ complete, req);656 ldap_request_failed_complete, req); 648 657 649 658 return req; -
vendor/current/source4/libcli/ldap/ldap_client.h
r414 r740 21 21 22 22 23 #include "libcli/ldap/l dap.h"23 #include "libcli/ldap/libcli_ldap.h" 24 24 25 25 enum ldap_request_state { LDAP_REQUEST_SEND=1, LDAP_REQUEST_PENDING=2, LDAP_REQUEST_DONE=3, LDAP_REQUEST_ERROR=4 }; -
vendor/current/source4/libcli/ldap/ldap_controls.c
r414 r740 22 22 #include "includes.h" 23 23 #include "../lib/util/asn1.h" 24 #include "libcli/ldap/ldap.h" 25 #include "lib/ldb/include/ldb.h" 24 #include "libcli/ldap/libcli_ldap.h" 26 25 #include "libcli/ldap/ldap_proto.h" 27 26 #include "dsdb/samdb/samdb.h" … … 215 214 } 216 215 217 if (!asn1_read_Integer(data, &(lsdfc->secinfo_flags))) {216 if (!asn1_read_Integer(data, (int *) &(lsdfc->secinfo_flags))) { 218 217 return false; 219 218 } … … 249 248 } 250 249 251 if (!asn1_read_Integer(data, &(lsoc->search_options))) {250 if (!asn1_read_Integer(data, (int *) &(lsoc->search_options))) { 252 251 return false; 253 252 } … … 424 423 425 424 *out = lac; 426 427 return true;428 }429 430 static bool decode_domain_scope_request(void *mem_ctx, DATA_BLOB in, void *_out)431 {432 if (in.length != 0) {433 return false;434 }435 436 return true;437 }438 439 static bool decode_notification_request(void *mem_ctx, DATA_BLOB in, void *_out)440 {441 if (in.length != 0) {442 return false;443 }444 445 return true;446 }447 448 static bool decode_show_deleted_request(void *mem_ctx, DATA_BLOB in, void *_out)449 {450 if (in.length != 0) {451 return false;452 }453 454 return true;455 }456 457 static bool decode_show_recycled_request(void *mem_ctx, DATA_BLOB in, void *_out)458 {459 if (in.length != 0) {460 return false;461 }462 463 return true;464 }465 466 static bool decode_show_deactivated_link_request(void *mem_ctx, DATA_BLOB in, void *_out)467 {468 if (in.length != 0) {469 return false;470 }471 472 return true;473 }474 475 static bool decode_permissive_modify_request(void *mem_ctx, DATA_BLOB in, void *_out)476 {477 if (in.length != 0) {478 return false;479 }480 481 return true;482 }483 484 static bool decode_manageDSAIT_request(void *mem_ctx, DATA_BLOB in, void *_out)485 {486 if (in.length != 0) {487 return false;488 }489 425 490 426 return true; … … 947 883 talloc_free(data); 948 884 949 return true;950 }951 952 static bool encode_domain_scope_request(void *mem_ctx, void *in, DATA_BLOB *out)953 {954 if (in) {955 return false;956 }957 958 *out = data_blob(NULL, 0);959 return true;960 }961 962 static bool encode_notification_request(void *mem_ctx, void *in, DATA_BLOB *out)963 {964 if (in) {965 return false;966 }967 968 *out = data_blob(NULL, 0);969 return true;970 }971 972 static bool encode_show_deleted_request(void *mem_ctx, void *in, DATA_BLOB *out)973 {974 if (in) {975 return false;976 }977 978 *out = data_blob(NULL, 0);979 return true;980 }981 982 static bool encode_show_recycled_request(void *mem_ctx, void *in, DATA_BLOB *out)983 {984 if (in) {985 return false;986 }987 988 *out = data_blob(NULL, 0);989 return true;990 }991 992 static bool encode_show_deactivated_link_request(void *mem_ctx, void *in, DATA_BLOB *out)993 {994 if (in) {995 return false;996 }997 998 *out = data_blob(NULL, 0);999 return true;1000 }1001 1002 static bool encode_permissive_modify_request(void *mem_ctx, void *in, DATA_BLOB *out)1003 {1004 if (in) {1005 return false;1006 }1007 1008 *out = data_blob(NULL, 0);1009 return true;1010 }1011 1012 static bool encode_manageDSAIT_request(void *mem_ctx, void *in, DATA_BLOB *out)1013 {1014 if (in) {1015 return false;1016 }1017 1018 *out = data_blob(NULL, 0);1019 885 return true; 1020 886 } … … 1252 1118 } 1253 1119 1120 static bool encode_flag_request(void *mem_ctx, void *in, DATA_BLOB *out) 1121 { 1122 if (in) { 1123 return false; 1124 } 1125 1126 *out = data_blob(NULL, 0); 1127 return true; 1128 } 1129 1130 static bool decode_flag_request(void *mem_ctx, DATA_BLOB in, void *_out) 1131 { 1132 if (in.length != 0) { 1133 return false; 1134 } 1135 1136 return true; 1137 } 1138 1254 1139 static const struct ldap_control_handler ldap_known_controls[] = { 1255 { "1.2.840.113556.1.4.319", decode_paged_results_request, encode_paged_results_request }, 1256 { "1.2.840.113556.1.4.529", decode_extended_dn_request, encode_extended_dn_request }, 1257 { "1.2.840.113556.1.4.473", decode_server_sort_request, encode_server_sort_request }, 1258 { "1.2.840.113556.1.4.474", decode_server_sort_response, encode_server_sort_response }, 1259 { "1.2.840.113556.1.4.1504", decode_asq_control, encode_asq_control }, 1260 { "1.2.840.113556.1.4.841", decode_dirsync_request, encode_dirsync_request }, 1261 { "1.2.840.113556.1.4.528", decode_notification_request, encode_notification_request }, 1262 { "1.2.840.113556.1.4.417", decode_show_deleted_request, encode_show_deleted_request }, 1263 { "1.2.840.113556.1.4.2064", decode_show_recycled_request, encode_show_recycled_request }, 1264 { "1.2.840.113556.1.4.2065", decode_show_deactivated_link_request, encode_show_deactivated_link_request }, 1265 { "1.2.840.113556.1.4.1413", decode_permissive_modify_request, encode_permissive_modify_request }, 1266 { "1.2.840.113556.1.4.801", decode_sd_flags_request, encode_sd_flags_request }, 1267 { "1.2.840.113556.1.4.1339", decode_domain_scope_request, encode_domain_scope_request }, 1268 { "1.2.840.113556.1.4.1340", decode_search_options_request, encode_search_options_request }, 1269 { "2.16.840.1.113730.3.4.2", decode_manageDSAIT_request, encode_manageDSAIT_request }, 1270 { "2.16.840.1.113730.3.4.9", decode_vlv_request, encode_vlv_request }, 1271 { "2.16.840.1.113730.3.4.10", decode_vlv_response, encode_vlv_response }, 1140 { LDB_CONTROL_PAGED_RESULTS_OID, decode_paged_results_request, encode_paged_results_request }, 1141 { LDB_CONTROL_SD_FLAGS_OID, decode_sd_flags_request, encode_sd_flags_request }, 1142 { LDB_CONTROL_DOMAIN_SCOPE_OID, decode_flag_request, encode_flag_request }, 1143 { LDB_CONTROL_SEARCH_OPTIONS_OID, decode_search_options_request, encode_search_options_request }, 1144 { LDB_CONTROL_NOTIFICATION_OID, decode_flag_request, encode_flag_request }, 1145 { LDB_CONTROL_TREE_DELETE_OID, decode_flag_request, encode_flag_request }, 1146 { LDB_CONTROL_SHOW_DELETED_OID, decode_flag_request, encode_flag_request }, 1147 { LDB_CONTROL_SHOW_RECYCLED_OID, decode_flag_request, encode_flag_request }, 1148 { LDB_CONTROL_SHOW_DEACTIVATED_LINK_OID, decode_flag_request, encode_flag_request }, 1149 { LDB_CONTROL_EXTENDED_DN_OID, decode_extended_dn_request, encode_extended_dn_request }, 1150 { LDB_CONTROL_SERVER_SORT_OID, decode_server_sort_request, encode_server_sort_request }, 1151 { LDB_CONTROL_SORT_RESP_OID, decode_server_sort_response, encode_server_sort_response }, 1152 { LDB_CONTROL_ASQ_OID, decode_asq_control, encode_asq_control }, 1153 { LDB_CONTROL_DIRSYNC_OID, decode_dirsync_request, encode_dirsync_request }, 1154 { LDB_CONTROL_VLV_REQ_OID, decode_vlv_request, encode_vlv_request }, 1155 { LDB_CONTROL_VLV_RESP_OID, decode_vlv_response, encode_vlv_response }, 1156 { LDB_CONTROL_PERMISSIVE_MODIFY_OID, decode_flag_request, encode_flag_request }, 1157 { LDB_CONTROL_SERVER_LAZY_COMMIT, decode_flag_request, encode_flag_request }, 1158 { LDB_CONTROL_RODC_DCPROMO_OID, decode_flag_request, encode_flag_request }, 1159 { LDB_CONTROL_RELAX_OID, decode_flag_request, encode_flag_request }, 1160 { DSDB_OPENLDAP_DEREFERENCE_CONTROL, decode_openldap_dereference, encode_openldap_dereference }, 1161 1272 1162 /* DSDB_CONTROL_CURRENT_PARTITION_OID is internal only, and has no network representation */ 1273 { "1.3.6.1.4.1.7165.4.3.2", NULL, NULL }, 1163 { DSDB_CONTROL_CURRENT_PARTITION_OID, NULL, NULL }, 1164 /* DSDB_CONTROL_REPLICATED_UPDATE_OID is internal only, and has no network representation */ 1165 { DSDB_CONTROL_REPLICATED_UPDATE_OID, NULL, NULL }, 1166 /* DSDB_CONTROL_DN_STORAGE_FORMAT_OID is internal only, and has no network representation */ 1167 { DSDB_CONTROL_DN_STORAGE_FORMAT_OID, NULL, NULL }, 1168 /* LDB_CONTROL_RECALCULATE_SD_OID is internal only, and has no network representation */ 1169 { LDB_CONTROL_RECALCULATE_SD_OID, NULL, NULL }, 1170 /* LDB_CONTROL_REVEAL_INTERNALS is internal only, and has no network representation */ 1171 { LDB_CONTROL_REVEAL_INTERNALS, NULL, NULL }, 1172 /* LDB_CONTROL_AS_SYSTEM_OID is internal only, and has no network representation */ 1173 { LDB_CONTROL_AS_SYSTEM_OID, NULL, NULL }, 1174 /* DSDB_CONTROL_PASSWORD_CHANGE_STATUS_OID is internal only, and has no network representation */ 1175 { DSDB_CONTROL_PASSWORD_CHANGE_STATUS_OID, NULL, NULL }, 1176 /* DSDB_CONTROL_PASSWORD_HASH_VALUES_OID is internal only, and has no network representation */ 1177 { DSDB_CONTROL_PASSWORD_HASH_VALUES_OID, NULL, NULL }, 1178 /* DSDB_CONTROL_PASSWORD_CHANGE_OID is internal only, and has no network representation */ 1179 { DSDB_CONTROL_PASSWORD_CHANGE_OID, NULL, NULL }, 1180 /* DSDB_CONTROL_APPLY_LINKS is internal only, and has no network representation */ 1181 { DSDB_CONTROL_APPLY_LINKS, NULL, NULL }, 1182 /* DSDB_CONTROL_BYPASS_PASSWORD_HASH_OID is internal only, and has an empty network representation */ 1183 { DSDB_CONTROL_BYPASS_PASSWORD_HASH_OID, decode_flag_request, encode_flag_request }, 1184 /* LDB_CONTROL_BYPASS_OPERATIONAL_OID is internal only, and has no network representation */ 1185 { LDB_CONTROL_BYPASS_OPERATIONAL_OID, NULL, NULL }, 1186 /* DSDB_CONTROL_CHANGEREPLMETADATA_OID is internal only, and has no network representation */ 1187 { DSDB_CONTROL_CHANGEREPLMETADATA_OID, NULL, NULL }, 1188 /* LDB_CONTROL_PROVISION_OID is internal only, and has no network representation */ 1189 { LDB_CONTROL_PROVISION_OID, NULL, NULL }, 1274 1190 /* DSDB_EXTENDED_REPLICATED_OBJECTS_OID is internal only, and has no network representation */ 1275 { "1.3.6.1.4.1.7165.4.4.1", NULL, NULL }, 1276 { DSDB_OPENLDAP_DEREFERENCE_CONTROL, decode_openldap_dereference, encode_openldap_dereference}, 1191 { DSDB_EXTENDED_REPLICATED_OBJECTS_OID, NULL, NULL }, 1192 /* DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID is internal only, and has no network representation */ 1193 { DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID, NULL, NULL }, 1194 /* DSDB_EXTENDED_ALLOCATE_RID_POOL is internal only, and has no network representation */ 1195 { DSDB_EXTENDED_ALLOCATE_RID_POOL, NULL, NULL }, 1277 1196 { NULL, NULL, NULL } 1278 1197 }; -
vendor/current/source4/libcli/ldap/ldap_ildap.c
r414 r740 22 22 23 23 #include "includes.h" 24 #include "libcli/ldap/l dap.h"24 #include "libcli/ldap/libcli_ldap.h" 25 25 #include "libcli/ldap/ldap_client.h" 26 26 … … 74 74 75 75 req = ldap_request_send(conn, msg); 76 talloc_ steal(msg, req);76 talloc_reparent(conn, msg, req); 77 77 78 78 for (i=n=0;true;i++) {
Note:
See TracChangeset
for help on using the changeset viewer.