Changeset 988 for vendor/current/libcli/ldap
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- Location:
- vendor/current/libcli/ldap
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/libcli/ldap/ldap_message.c
r740 r988 230 230 case LDB_OP_AND: 231 231 case LDB_OP_OR: 232 asn1_push_tag(data, ASN1_CONTEXT(tree->operation==LDB_OP_AND?0:1));232 if (!asn1_push_tag(data, ASN1_CONTEXT(tree->operation==LDB_OP_AND?0:1))) return false; 233 233 for (i=0; i<tree->u.list.num_elements; i++) { 234 234 if (!ldap_push_filter(data, tree->u.list.elements[i])) { … … 236 236 } 237 237 } 238 asn1_pop_tag(data);238 if (!asn1_pop_tag(data)) return false; 239 239 break; 240 240 241 241 case LDB_OP_NOT: 242 asn1_push_tag(data, ASN1_CONTEXT(2));242 if (!asn1_push_tag(data, ASN1_CONTEXT(2))) return false; 243 243 if (!ldap_push_filter(data, tree->u.isnot.child)) { 244 244 return false; 245 245 } 246 asn1_pop_tag(data);246 if (!asn1_pop_tag(data)) return false; 247 247 break; 248 248 249 249 case LDB_OP_EQUALITY: 250 250 /* equality test */ 251 asn1_push_tag(data, ASN1_CONTEXT(3));252 asn1_write_OctetString(data, tree->u.equality.attr,253 strlen(tree->u.equality.attr)) ;254 asn1_write_OctetString(data, tree->u.equality.value.data,255 tree->u.equality.value.length) ;256 asn1_pop_tag(data);251 if (!asn1_push_tag(data, ASN1_CONTEXT(3))) return false; 252 if (!asn1_write_OctetString(data, tree->u.equality.attr, 253 strlen(tree->u.equality.attr))) return false; 254 if (!asn1_write_OctetString(data, tree->u.equality.value.data, 255 tree->u.equality.value.length)) return false; 256 if (!asn1_pop_tag(data)) return false; 257 257 break; 258 258 … … 267 267 final [2] LDAPString } } 268 268 */ 269 asn1_push_tag(data, ASN1_CONTEXT(4)); 270 asn1_write_OctetString(data, tree->u.substring.attr, strlen(tree->u.substring.attr)); 271 asn1_push_tag(data, ASN1_SEQUENCE(0)); 272 i = 0; 273 if ( ! tree->u.substring.start_with_wildcard) { 274 asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(0)); 275 asn1_write_DATA_BLOB_LDAPString(data, tree->u.substring.chunks[i]); 276 asn1_pop_tag(data); 277 i++; 278 } 279 while (tree->u.substring.chunks[i]) { 280 int ctx; 281 282 if (( ! tree->u.substring.chunks[i + 1]) && 283 (tree->u.substring.end_with_wildcard == 0)) { 284 ctx = 2; 285 } else { 286 ctx = 1; 287 } 288 asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(ctx)); 289 asn1_write_DATA_BLOB_LDAPString(data, tree->u.substring.chunks[i]); 290 asn1_pop_tag(data); 291 i++; 292 } 293 asn1_pop_tag(data); 294 asn1_pop_tag(data); 269 if (!asn1_push_tag(data, ASN1_CONTEXT(4))) return false; 270 if (!asn1_write_OctetString(data, tree->u.substring.attr, strlen(tree->u.substring.attr))) return false; 271 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) return false; 272 273 if (tree->u.substring.chunks && tree->u.substring.chunks[0]) { 274 i = 0; 275 if (!tree->u.substring.start_with_wildcard) { 276 if (!asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(0))) return false; 277 if (!asn1_write_DATA_BLOB_LDAPString(data, tree->u.substring.chunks[i])) return false; 278 if (!asn1_pop_tag(data)) return false; 279 i++; 280 } 281 while (tree->u.substring.chunks[i]) { 282 int ctx; 283 284 if (( ! tree->u.substring.chunks[i + 1]) && 285 (tree->u.substring.end_with_wildcard == 0)) { 286 ctx = 2; 287 } else { 288 ctx = 1; 289 } 290 if (!asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(ctx))) return false; 291 if (!asn1_write_DATA_BLOB_LDAPString(data, tree->u.substring.chunks[i])) return false; 292 if (!asn1_pop_tag(data)) return false; 293 i++; 294 } 295 } 296 if (!asn1_pop_tag(data)) return false; 297 if (!asn1_pop_tag(data)) return false; 295 298 break; 296 299 297 300 case LDB_OP_GREATER: 298 301 /* greaterOrEqual test */ 299 asn1_push_tag(data, ASN1_CONTEXT(5));300 asn1_write_OctetString(data, tree->u.comparison.attr,301 strlen(tree->u.comparison.attr)) ;302 asn1_write_OctetString(data, tree->u.comparison.value.data,303 tree->u.comparison.value.length) ;304 asn1_pop_tag(data);302 if (!asn1_push_tag(data, ASN1_CONTEXT(5))) return false; 303 if (!asn1_write_OctetString(data, tree->u.comparison.attr, 304 strlen(tree->u.comparison.attr))) return false; 305 if (!asn1_write_OctetString(data, tree->u.comparison.value.data, 306 tree->u.comparison.value.length)) return false; 307 if (!asn1_pop_tag(data)) return false; 305 308 break; 306 309 307 310 case LDB_OP_LESS: 308 311 /* lessOrEqual test */ 309 asn1_push_tag(data, ASN1_CONTEXT(6));310 asn1_write_OctetString(data, tree->u.comparison.attr,311 strlen(tree->u.comparison.attr)) ;312 asn1_write_OctetString(data, tree->u.comparison.value.data,313 tree->u.comparison.value.length) ;314 asn1_pop_tag(data);312 if (!asn1_push_tag(data, ASN1_CONTEXT(6))) return false; 313 if (!asn1_write_OctetString(data, tree->u.comparison.attr, 314 strlen(tree->u.comparison.attr))) return false; 315 if (!asn1_write_OctetString(data, tree->u.comparison.value.data, 316 tree->u.comparison.value.length)) return false; 317 if (!asn1_pop_tag(data)) return false; 315 318 break; 316 319 317 320 case LDB_OP_PRESENT: 318 321 /* present test */ 319 asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(7));320 asn1_write_LDAPString(data, tree->u.present.attr);321 asn1_pop_tag(data);322 return ! data->has_error;322 if (!asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(7))) return false; 323 if (!asn1_write_LDAPString(data, tree->u.present.attr)) return false; 324 if (!asn1_pop_tag(data)) return false; 325 return !asn1_has_error(data); 323 326 324 327 case LDB_OP_APPROX: 325 328 /* approx test */ 326 asn1_push_tag(data, ASN1_CONTEXT(8));327 asn1_write_OctetString(data, tree->u.comparison.attr,328 strlen(tree->u.comparison.attr)) ;329 asn1_write_OctetString(data, tree->u.comparison.value.data,330 tree->u.comparison.value.length) ;331 asn1_pop_tag(data);329 if (!asn1_push_tag(data, ASN1_CONTEXT(8))) return false; 330 if (!asn1_write_OctetString(data, tree->u.comparison.attr, 331 strlen(tree->u.comparison.attr))) return false; 332 if (!asn1_write_OctetString(data, tree->u.comparison.value.data, 333 tree->u.comparison.value.length)) return false; 334 if (!asn1_pop_tag(data)) return false; 332 335 break; 333 336 … … 341 344 } 342 345 */ 343 asn1_push_tag(data, ASN1_CONTEXT(9));346 if (!asn1_push_tag(data, ASN1_CONTEXT(9))) return false; 344 347 if (tree->u.extended.rule_id) { 345 asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(1));346 asn1_write_LDAPString(data, tree->u.extended.rule_id);347 asn1_pop_tag(data);348 if (!asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(1))) return false; 349 if (!asn1_write_LDAPString(data, tree->u.extended.rule_id)) return false; 350 if (!asn1_pop_tag(data)) return false; 348 351 } 349 352 if (tree->u.extended.attr) { 350 asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(2));351 asn1_write_LDAPString(data, tree->u.extended.attr);352 asn1_pop_tag(data);353 } 354 asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(3));355 asn1_write_DATA_BLOB_LDAPString(data, &tree->u.extended.value);356 asn1_pop_tag(data);357 asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(4));358 asn1_write_uint8(data, tree->u.extended.dnAttributes);359 asn1_pop_tag(data);360 asn1_pop_tag(data);353 if (!asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(2))) return false; 354 if (!asn1_write_LDAPString(data, tree->u.extended.attr)) return false; 355 if (!asn1_pop_tag(data)) return false; 356 } 357 if (!asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(3))) return false; 358 if (!asn1_write_DATA_BLOB_LDAPString(data, &tree->u.extended.value)) return false; 359 if (!asn1_pop_tag(data)) return false; 360 if (!asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(4))) return false; 361 if (!asn1_write_uint8(data, tree->u.extended.dnAttributes)) return false; 362 if (!asn1_pop_tag(data)) return false; 363 if (!asn1_pop_tag(data)) return false; 361 364 break; 362 365 … … 364 367 return false; 365 368 } 366 return ! data->has_error;367 } 368 369 static voidldap_encode_response(struct asn1_data *data, struct ldap_Result *result)370 { 371 asn1_write_enumerated(data, result->resultcode);372 asn1_write_OctetString(data, result->dn,373 (result->dn) ? strlen(result->dn) : 0) ;374 asn1_write_OctetString(data, result->errormessage,369 return !asn1_has_error(data); 370 } 371 372 static bool ldap_encode_response(struct asn1_data *data, struct ldap_Result *result) 373 { 374 if (!asn1_write_enumerated(data, result->resultcode)) return false; 375 if (!asn1_write_OctetString(data, result->dn, 376 (result->dn) ? strlen(result->dn) : 0)) return false; 377 if (!asn1_write_OctetString(data, result->errormessage, 375 378 (result->errormessage) ? 376 strlen(result->errormessage) : 0) ;379 strlen(result->errormessage) : 0)) return false; 377 380 if (result->referral) { 378 asn1_push_tag(data, ASN1_CONTEXT(3)); 379 asn1_write_OctetString(data, result->referral, 380 strlen(result->referral)); 381 asn1_pop_tag(data); 382 } 381 if (!asn1_push_tag(data, ASN1_CONTEXT(3))) return false; 382 if (!asn1_write_OctetString(data, result->referral, 383 strlen(result->referral))) return false; 384 if (!asn1_pop_tag(data)) return false; 385 } 386 return true; 383 387 } 384 388 … … 392 396 if (!data) return false; 393 397 394 asn1_push_tag(data, ASN1_SEQUENCE(0));395 asn1_write_Integer(data, msg->messageid);398 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) goto err; 399 if (!asn1_write_Integer(data, msg->messageid)) goto err; 396 400 397 401 switch (msg->type) { 398 402 case LDAP_TAG_BindRequest: { 399 403 struct ldap_BindRequest *r = &msg->r.BindRequest; 400 asn1_push_tag(data, ASN1_APPLICATION(msg->type));401 asn1_write_Integer(data, r->version);402 asn1_write_OctetString(data, r->dn,403 (r->dn != NULL) ? strlen(r->dn) : 0) ;404 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 405 if (!asn1_write_Integer(data, r->version)) goto err; 406 if (!asn1_write_OctetString(data, r->dn, 407 (r->dn != NULL) ? strlen(r->dn) : 0)) goto err; 404 408 405 409 switch (r->mechanism) { 406 410 case LDAP_AUTH_MECH_SIMPLE: 407 411 /* context, primitive */ 408 asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(0));409 asn1_write(data, r->creds.password,410 strlen(r->creds.password)) ;411 asn1_pop_tag(data);412 if (!asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(0))) goto err; 413 if (!asn1_write(data, r->creds.password, 414 strlen(r->creds.password))) goto err; 415 if (!asn1_pop_tag(data)) goto err; 412 416 break; 413 417 case LDAP_AUTH_MECH_SASL: 414 418 /* context, constructed */ 415 asn1_push_tag(data, ASN1_CONTEXT(3));416 asn1_write_OctetString(data, r->creds.SASL.mechanism,417 strlen(r->creds.SASL.mechanism)) ;419 if (!asn1_push_tag(data, ASN1_CONTEXT(3))) goto err; 420 if (!asn1_write_OctetString(data, r->creds.SASL.mechanism, 421 strlen(r->creds.SASL.mechanism))) goto err; 418 422 if (r->creds.SASL.secblob) { 419 asn1_write_OctetString(data, r->creds.SASL.secblob->data,420 r->creds.SASL.secblob->length) ;421 } 422 asn1_pop_tag(data);423 if (!asn1_write_OctetString(data, r->creds.SASL.secblob->data, 424 r->creds.SASL.secblob->length)) goto err; 425 } 426 if (!asn1_pop_tag(data)) goto err; 423 427 break; 424 428 default: 425 return false;426 } 427 428 asn1_pop_tag(data);429 goto err; 430 } 431 432 if (!asn1_pop_tag(data)) goto err; 429 433 break; 430 434 } 431 435 case LDAP_TAG_BindResponse: { 432 436 struct ldap_BindResponse *r = &msg->r.BindResponse; 433 asn1_push_tag(data, ASN1_APPLICATION(msg->type));434 ldap_encode_response(data, &r->response);437 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 438 if (!ldap_encode_response(data, &r->response)) goto err; 435 439 if (r->SASL.secblob) { 436 asn1_write_ContextSimple(data, 7, r->SASL.secblob);437 } 438 asn1_pop_tag(data);440 if (!asn1_write_ContextSimple(data, 7, r->SASL.secblob)) goto err; 441 } 442 if (!asn1_pop_tag(data)) goto err; 439 443 break; 440 444 } 441 445 case LDAP_TAG_UnbindRequest: { 442 446 /* struct ldap_UnbindRequest *r = &msg->r.UnbindRequest; */ 443 asn1_push_tag(data, ASN1_APPLICATION_SIMPLE(msg->type));444 asn1_pop_tag(data);447 if (!asn1_push_tag(data, ASN1_APPLICATION_SIMPLE(msg->type))) goto err; 448 if (!asn1_pop_tag(data)) goto err; 445 449 break; 446 450 } 447 451 case LDAP_TAG_SearchRequest: { 448 452 struct ldap_SearchRequest *r = &msg->r.SearchRequest; 449 asn1_push_tag(data, ASN1_APPLICATION(msg->type));450 asn1_write_OctetString(data, r->basedn, strlen(r->basedn));451 asn1_write_enumerated(data, r->scope);452 asn1_write_enumerated(data, r->deref);453 asn1_write_Integer(data, r->sizelimit);454 asn1_write_Integer(data, r->timelimit);455 asn1_write_BOOLEAN(data, r->attributesonly);453 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 454 if (!asn1_write_OctetString(data, r->basedn, strlen(r->basedn))) goto err; 455 if (!asn1_write_enumerated(data, r->scope)) goto err; 456 if (!asn1_write_enumerated(data, r->deref)) goto err; 457 if (!asn1_write_Integer(data, r->sizelimit)) goto err; 458 if (!asn1_write_Integer(data, r->timelimit)) goto err; 459 if (!asn1_write_BOOLEAN(data, r->attributesonly)) goto err; 456 460 457 461 if (!ldap_push_filter(data, r->tree)) { 458 return false;459 } 460 461 asn1_push_tag(data, ASN1_SEQUENCE(0));462 goto err; 463 } 464 465 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) goto err; 462 466 for (i=0; i<r->num_attributes; i++) { 463 asn1_write_OctetString(data, r->attributes[i],464 strlen(r->attributes[i])) ;465 } 466 asn1_pop_tag(data);467 asn1_pop_tag(data);467 if (!asn1_write_OctetString(data, r->attributes[i], 468 strlen(r->attributes[i]))) goto err; 469 } 470 if (!asn1_pop_tag(data)) goto err; 471 if (!asn1_pop_tag(data)) goto err; 468 472 break; 469 473 } 470 474 case LDAP_TAG_SearchResultEntry: { 471 475 struct ldap_SearchResEntry *r = &msg->r.SearchResultEntry; 472 asn1_push_tag(data, ASN1_APPLICATION(msg->type));473 asn1_write_OctetString(data, r->dn, strlen(r->dn));474 asn1_push_tag(data, ASN1_SEQUENCE(0));476 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 477 if (!asn1_write_OctetString(data, r->dn, strlen(r->dn))) goto err; 478 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) goto err; 475 479 for (i=0; i<r->num_attributes; i++) { 476 480 struct ldb_message_element *attr = &r->attributes[i]; 477 asn1_push_tag(data, ASN1_SEQUENCE(0));478 asn1_write_OctetString(data, attr->name,479 strlen(attr->name)) ;480 asn1_push_tag(data, ASN1_SEQUENCE(1));481 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) goto err; 482 if (!asn1_write_OctetString(data, attr->name, 483 strlen(attr->name))) goto err; 484 if (!asn1_push_tag(data, ASN1_SEQUENCE(1))) goto err; 481 485 for (j=0; j<attr->num_values; j++) { 482 asn1_write_OctetString(data,486 if (!asn1_write_OctetString(data, 483 487 attr->values[j].data, 484 attr->values[j].length) ;485 } 486 asn1_pop_tag(data);487 asn1_pop_tag(data);488 } 489 asn1_pop_tag(data);490 asn1_pop_tag(data);488 attr->values[j].length)) goto err; 489 } 490 if (!asn1_pop_tag(data)) goto err; 491 if (!asn1_pop_tag(data)) goto err; 492 } 493 if (!asn1_pop_tag(data)) goto err; 494 if (!asn1_pop_tag(data)) goto err; 491 495 break; 492 496 } 493 497 case LDAP_TAG_SearchResultDone: { 494 498 struct ldap_Result *r = &msg->r.SearchResultDone; 495 asn1_push_tag(data, ASN1_APPLICATION(msg->type));496 ldap_encode_response(data, r);497 asn1_pop_tag(data);499 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 500 if (!ldap_encode_response(data, r)) goto err; 501 if (!asn1_pop_tag(data)) goto err; 498 502 break; 499 503 } 500 504 case LDAP_TAG_ModifyRequest: { 501 505 struct ldap_ModifyRequest *r = &msg->r.ModifyRequest; 502 asn1_push_tag(data, ASN1_APPLICATION(msg->type));503 asn1_write_OctetString(data, r->dn, strlen(r->dn));504 asn1_push_tag(data, ASN1_SEQUENCE(0));506 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 507 if (!asn1_write_OctetString(data, r->dn, strlen(r->dn))) goto err; 508 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) goto err; 505 509 506 510 for (i=0; i<r->num_mods; i++) { 507 511 struct ldb_message_element *attrib = &r->mods[i].attrib; 508 asn1_push_tag(data, ASN1_SEQUENCE(0));509 asn1_write_enumerated(data, r->mods[i].type);510 asn1_push_tag(data, ASN1_SEQUENCE(0));511 asn1_write_OctetString(data, attrib->name,512 strlen(attrib->name)) ;513 asn1_push_tag(data, ASN1_SET);512 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) goto err; 513 if (!asn1_write_enumerated(data, r->mods[i].type)) goto err; 514 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) goto err; 515 if (!asn1_write_OctetString(data, attrib->name, 516 strlen(attrib->name))) goto err; 517 if (!asn1_push_tag(data, ASN1_SET)) goto err; 514 518 for (j=0; j<attrib->num_values; j++) { 515 asn1_write_OctetString(data,519 if (!asn1_write_OctetString(data, 516 520 attrib->values[j].data, 517 attrib->values[j].length) ;521 attrib->values[j].length)) goto err; 518 522 519 523 } 520 asn1_pop_tag(data);521 asn1_pop_tag(data);522 asn1_pop_tag(data);524 if (!asn1_pop_tag(data)) goto err; 525 if (!asn1_pop_tag(data)) goto err; 526 if (!asn1_pop_tag(data)) goto err; 523 527 } 524 528 525 asn1_pop_tag(data);526 asn1_pop_tag(data);529 if (!asn1_pop_tag(data)) goto err; 530 if (!asn1_pop_tag(data)) goto err; 527 531 break; 528 532 } 529 533 case LDAP_TAG_ModifyResponse: { 530 534 struct ldap_Result *r = &msg->r.ModifyResponse; 531 asn1_push_tag(data, ASN1_APPLICATION(msg->type));532 ldap_encode_response(data, r);533 asn1_pop_tag(data);535 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 536 if (!ldap_encode_response(data, r)) goto err; 537 if (!asn1_pop_tag(data)) goto err; 534 538 break; 535 539 } 536 540 case LDAP_TAG_AddRequest: { 537 541 struct ldap_AddRequest *r = &msg->r.AddRequest; 538 asn1_push_tag(data, ASN1_APPLICATION(msg->type));539 asn1_write_OctetString(data, r->dn, strlen(r->dn));540 asn1_push_tag(data, ASN1_SEQUENCE(0));542 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 543 if (!asn1_write_OctetString(data, r->dn, strlen(r->dn))) goto err; 544 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) goto err; 541 545 542 546 for (i=0; i<r->num_attributes; i++) { 543 547 struct ldb_message_element *attrib = &r->attributes[i]; 544 asn1_push_tag(data, ASN1_SEQUENCE(0));545 asn1_write_OctetString(data, attrib->name,546 strlen(attrib->name)) ;547 asn1_push_tag(data, ASN1_SET);548 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) goto err; 549 if (!asn1_write_OctetString(data, attrib->name, 550 strlen(attrib->name))) goto err; 551 if (!asn1_push_tag(data, ASN1_SET)) goto err; 548 552 for (j=0; j<r->attributes[i].num_values; j++) { 549 asn1_write_OctetString(data,553 if (!asn1_write_OctetString(data, 550 554 attrib->values[j].data, 551 attrib->values[j].length) ;552 } 553 asn1_pop_tag(data);554 asn1_pop_tag(data);555 } 556 asn1_pop_tag(data);557 asn1_pop_tag(data);555 attrib->values[j].length)) goto err; 556 } 557 if (!asn1_pop_tag(data)) goto err; 558 if (!asn1_pop_tag(data)) goto err; 559 } 560 if (!asn1_pop_tag(data)) goto err; 561 if (!asn1_pop_tag(data)) goto err; 558 562 break; 559 563 } 560 564 case LDAP_TAG_AddResponse: { 561 565 struct ldap_Result *r = &msg->r.AddResponse; 562 asn1_push_tag(data, ASN1_APPLICATION(msg->type));563 ldap_encode_response(data, r);564 asn1_pop_tag(data);566 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 567 if (!ldap_encode_response(data, r)) goto err; 568 if (!asn1_pop_tag(data)) goto err; 565 569 break; 566 570 } 567 571 case LDAP_TAG_DelRequest: { 568 572 struct ldap_DelRequest *r = &msg->r.DelRequest; 569 asn1_push_tag(data, ASN1_APPLICATION_SIMPLE(msg->type));570 asn1_write(data, r->dn, strlen(r->dn));571 asn1_pop_tag(data);573 if (!asn1_push_tag(data, ASN1_APPLICATION_SIMPLE(msg->type))) goto err; 574 if (!asn1_write(data, r->dn, strlen(r->dn))) goto err; 575 if (!asn1_pop_tag(data)) goto err; 572 576 break; 573 577 } 574 578 case LDAP_TAG_DelResponse: { 575 579 struct ldap_Result *r = &msg->r.DelResponse; 576 asn1_push_tag(data, ASN1_APPLICATION(msg->type));577 ldap_encode_response(data, r);578 asn1_pop_tag(data);580 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 581 if (!ldap_encode_response(data, r)) goto err; 582 if (!asn1_pop_tag(data)) goto err; 579 583 break; 580 584 } 581 585 case LDAP_TAG_ModifyDNRequest: { 582 586 struct ldap_ModifyDNRequest *r = &msg->r.ModifyDNRequest; 583 asn1_push_tag(data, ASN1_APPLICATION(msg->type));584 asn1_write_OctetString(data, r->dn, strlen(r->dn));585 asn1_write_OctetString(data, r->newrdn, strlen(r->newrdn));586 asn1_write_BOOLEAN(data, r->deleteolddn);587 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 588 if (!asn1_write_OctetString(data, r->dn, strlen(r->dn))) goto err; 589 if (!asn1_write_OctetString(data, r->newrdn, strlen(r->newrdn))) goto err; 590 if (!asn1_write_BOOLEAN(data, r->deleteolddn)) goto err; 587 591 if (r->newsuperior) { 588 asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(0));589 asn1_write(data, r->newsuperior,590 strlen(r->newsuperior)) ;591 asn1_pop_tag(data);592 } 593 asn1_pop_tag(data);592 if (!asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(0))) goto err; 593 if (!asn1_write(data, r->newsuperior, 594 strlen(r->newsuperior))) goto err; 595 if (!asn1_pop_tag(data)) goto err; 596 } 597 if (!asn1_pop_tag(data)) goto err; 594 598 break; 595 599 } 596 600 case LDAP_TAG_ModifyDNResponse: { 597 601 struct ldap_Result *r = &msg->r.ModifyDNResponse; 598 asn1_push_tag(data, ASN1_APPLICATION(msg->type));599 ldap_encode_response(data, r);600 asn1_pop_tag(data);602 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 603 if (!ldap_encode_response(data, r)) goto err; 604 if (!asn1_pop_tag(data)) goto err; 601 605 break; 602 606 } 603 607 case LDAP_TAG_CompareRequest: { 604 608 struct ldap_CompareRequest *r = &msg->r.CompareRequest; 605 asn1_push_tag(data, ASN1_APPLICATION(msg->type));606 asn1_write_OctetString(data, r->dn, strlen(r->dn));607 asn1_push_tag(data, ASN1_SEQUENCE(0));608 asn1_write_OctetString(data, r->attribute,609 strlen(r->attribute)) ;610 asn1_write_OctetString(data, r->value.data,611 r->value.length) ;612 asn1_pop_tag(data);613 asn1_pop_tag(data);609 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 610 if (!asn1_write_OctetString(data, r->dn, strlen(r->dn))) goto err; 611 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) goto err; 612 if (!asn1_write_OctetString(data, r->attribute, 613 strlen(r->attribute))) goto err; 614 if (!asn1_write_OctetString(data, r->value.data, 615 r->value.length)) goto err; 616 if (!asn1_pop_tag(data)) goto err; 617 if (!asn1_pop_tag(data)) goto err; 614 618 break; 615 619 } 616 620 case LDAP_TAG_CompareResponse: { 617 621 struct ldap_Result *r = &msg->r.ModifyDNResponse; 618 asn1_push_tag(data, ASN1_APPLICATION(msg->type));619 ldap_encode_response(data, r);620 asn1_pop_tag(data);622 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 623 if (!ldap_encode_response(data, r)) goto err; 624 if (!asn1_pop_tag(data)) goto err; 621 625 break; 622 626 } 623 627 case LDAP_TAG_AbandonRequest: { 624 628 struct ldap_AbandonRequest *r = &msg->r.AbandonRequest; 625 asn1_push_tag(data, ASN1_APPLICATION_SIMPLE(msg->type));626 asn1_write_implicit_Integer(data, r->messageid);627 asn1_pop_tag(data);629 if (!asn1_push_tag(data, ASN1_APPLICATION_SIMPLE(msg->type))) goto err; 630 if (!asn1_write_implicit_Integer(data, r->messageid)) goto err; 631 if (!asn1_pop_tag(data)) goto err; 628 632 break; 629 633 } 630 634 case LDAP_TAG_SearchResultReference: { 631 635 struct ldap_SearchResRef *r = &msg->r.SearchResultReference; 632 asn1_push_tag(data, ASN1_APPLICATION(msg->type));633 asn1_write_OctetString(data, r->referral, strlen(r->referral));634 asn1_pop_tag(data);636 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 637 if (!asn1_write_OctetString(data, r->referral, strlen(r->referral))) goto err; 638 if (!asn1_pop_tag(data)) goto err; 635 639 break; 636 640 } 637 641 case LDAP_TAG_ExtendedRequest: { 638 642 struct ldap_ExtendedRequest *r = &msg->r.ExtendedRequest; 639 asn1_push_tag(data, ASN1_APPLICATION(msg->type));640 asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(0));641 asn1_write(data, r->oid, strlen(r->oid));642 asn1_pop_tag(data);643 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 644 if (!asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(0))) goto err; 645 if (!asn1_write(data, r->oid, strlen(r->oid))) goto err; 646 if (!asn1_pop_tag(data)) goto err; 643 647 if (r->value) { 644 asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(1));645 asn1_write(data, r->value->data, r->value->length);646 asn1_pop_tag(data);647 } 648 asn1_pop_tag(data);648 if (!asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(1))) goto err; 649 if (!asn1_write(data, r->value->data, r->value->length)) goto err; 650 if (!asn1_pop_tag(data)) goto err; 651 } 652 if (!asn1_pop_tag(data)) goto err; 649 653 break; 650 654 } 651 655 case LDAP_TAG_ExtendedResponse: { 652 656 struct ldap_ExtendedResponse *r = &msg->r.ExtendedResponse; 653 asn1_push_tag(data, ASN1_APPLICATION(msg->type));654 ldap_encode_response(data, &r->response);657 if (!asn1_push_tag(data, ASN1_APPLICATION(msg->type))) goto err; 658 if (!ldap_encode_response(data, &r->response)) goto err; 655 659 if (r->oid) { 656 asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(10));657 asn1_write(data, r->oid, strlen(r->oid));658 asn1_pop_tag(data);660 if (!asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(10))) goto err; 661 if (!asn1_write(data, r->oid, strlen(r->oid))) goto err; 662 if (!asn1_pop_tag(data)) goto err; 659 663 } 660 664 if (r->value) { 661 asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(11));662 asn1_write(data, r->value->data, r->value->length);663 asn1_pop_tag(data);664 } 665 asn1_pop_tag(data);665 if (!asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(11))) goto err; 666 if (!asn1_write(data, r->value->data, r->value->length)) goto err; 667 if (!asn1_pop_tag(data)) goto err; 668 } 669 if (!asn1_pop_tag(data)) goto err; 666 670 break; 667 671 } 668 672 default: 669 return false;673 goto err; 670 674 } 671 675 672 676 if (msg->controls != NULL) { 673 asn1_push_tag(data, ASN1_CONTEXT(0));677 if (!asn1_push_tag(data, ASN1_CONTEXT(0))) goto err; 674 678 675 679 for (i = 0; msg->controls[i] != NULL; i++) { … … 677 681 control_handlers, 678 682 msg->controls[i])) { 679 DEBUG( 1,("Unable to encode control %s\n",683 DEBUG(0,("Unable to encode control %s\n", 680 684 msg->controls[i]->oid)); 681 return false; 682 } 683 } 684 685 asn1_pop_tag(data); 686 } 687 688 asn1_pop_tag(data); 689 690 if (data->has_error) { 691 asn1_free(data); 692 return false; 693 } 694 695 *result = data_blob_talloc(mem_ctx, data->data, data->length); 685 goto err; 686 } 687 } 688 689 if (!asn1_pop_tag(data)) goto err; 690 } 691 692 if (!asn1_pop_tag(data)) goto err; 693 694 if (!asn1_extract_blob(data, mem_ctx, result)) { 695 goto err; 696 } 697 696 698 asn1_free(data); 699 697 700 return true; 701 702 err: 703 704 asn1_free(data); 705 return false; 698 706 } 699 707 … … 702 710 { 703 711 char *result = talloc_array(mem_ctx, char, blob.length+1); 712 if (result == NULL) { 713 return NULL; 714 } 704 715 memcpy(result, blob.data, blob.length); 705 716 result[blob.length] = '\0'; … … 716 727 *result = blob2string_talloc(mem_ctx, string); 717 728 data_blob_free(&string); 718 return true;719 } 720 721 static voidldap_decode_response(TALLOC_CTX *mem_ctx,729 return *result ? true : false; 730 } 731 732 static bool ldap_decode_response(TALLOC_CTX *mem_ctx, 722 733 struct asn1_data *data, 723 734 struct ldap_Result *result) 724 735 { 725 asn1_read_enumerated(data, &result->resultcode);726 asn1_read_OctetString_talloc(mem_ctx, data, &result->dn);727 asn1_read_OctetString_talloc(mem_ctx, data, &result->errormessage);736 if (!asn1_read_enumerated(data, &result->resultcode)) return false; 737 if (!asn1_read_OctetString_talloc(mem_ctx, data, &result->dn)) return false; 738 if (!asn1_read_OctetString_talloc(mem_ctx, data, &result->errormessage)) return false; 728 739 if (asn1_peek_tag(data, ASN1_CONTEXT(3))) { 729 asn1_start_tag(data, ASN1_CONTEXT(3));730 asn1_read_OctetString_talloc(mem_ctx, data, &result->referral);731 asn1_end_tag(data);740 if (!asn1_start_tag(data, ASN1_CONTEXT(3))) return false; 741 if (!asn1_read_OctetString_talloc(mem_ctx, data, &result->referral)) return false; 742 if (!asn1_end_tag(data)) return false; 732 743 } else { 733 744 result->referral = NULL; 734 745 } 746 return true; 735 747 } 736 748 … … 754 766 chunks[chunk_num]->length = strlen(value); 755 767 756 chunks[chunk_num + 1] = '\0';768 chunks[chunk_num + 1] = NULL; 757 769 758 770 return chunks; … … 833 845 DATA_BLOB value; 834 846 835 asn1_start_tag(data, ASN1_CONTEXT(filter_tag)); 836 asn1_read_OctetString_talloc(mem_ctx, data, &attrib); 837 asn1_read_OctetString(data, mem_ctx, &value); 838 asn1_end_tag(data); 839 if ((data->has_error) || (attrib == NULL) || (value.data == NULL)) { 847 if (!asn1_start_tag(data, ASN1_CONTEXT(filter_tag))) goto failed; 848 if (!asn1_read_OctetString_talloc(mem_ctx, data, &attrib)) goto failed; 849 if (!asn1_read_OctetString(data, mem_ctx, &value)) goto failed; 850 if (!asn1_end_tag(data)) goto failed; 851 if (asn1_has_error(data) || (attrib == NULL) || 852 (value.data == NULL)) { 840 853 goto failed; 841 854 } … … 863 876 ret->operation = LDB_OP_SUBSTRING; 864 877 ret->u.substring.attr = talloc_strndup(ret, (char *)attr.data, attr.length); 878 if (ret->u.substring.attr == NULL) { 879 goto failed; 880 } 865 881 ret->u.substring.chunks = NULL; 866 882 ret->u.substring.start_with_wildcard = 1; … … 872 888 873 889 while (asn1_tag_remaining(data)) { 874 asn1_peek_uint8(data, &subs_tag);890 if (!asn1_peek_uint8(data, &subs_tag)) goto failed; 875 891 subs_tag &= 0x1f; /* strip off the asn1 stuff */ 876 892 if (subs_tag > 2) goto failed; 877 893 878 asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(subs_tag));879 asn1_read_LDAPString(data, mem_ctx, &value);880 asn1_end_tag(data);894 if (!asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(subs_tag))) goto failed; 895 if (!asn1_read_LDAPString(data, mem_ctx, &value)) goto failed; 896 if (!asn1_end_tag(data)) goto failed; 881 897 882 898 switch (subs_tag) { … … 945 961 DATA_BLOB value; 946 962 947 asn1_start_tag(data, ASN1_CONTEXT(filter_tag)); 948 asn1_read_OctetString_talloc(mem_ctx, data, &attrib); 949 asn1_read_OctetString(data, mem_ctx, &value); 950 asn1_end_tag(data); 951 if ((data->has_error) || (attrib == NULL) || (value.data == NULL)) { 963 if (!asn1_start_tag(data, ASN1_CONTEXT(filter_tag))) goto failed; 964 if (!asn1_read_OctetString_talloc(mem_ctx, data, &attrib)) goto failed; 965 if (!asn1_read_OctetString(data, mem_ctx, &value)) goto failed; 966 if (!asn1_end_tag(data)) goto failed; 967 if (asn1_has_error(data) || (attrib == NULL) || 968 (value.data == NULL)) { 952 969 goto failed; 953 970 } … … 964 981 DATA_BLOB value; 965 982 966 asn1_start_tag(data, ASN1_CONTEXT(filter_tag)); 967 asn1_read_OctetString_talloc(mem_ctx, data, &attrib); 968 asn1_read_OctetString(data, mem_ctx, &value); 969 asn1_end_tag(data); 970 if ((data->has_error) || (attrib == NULL) || (value.data == NULL)) { 983 if (!asn1_start_tag(data, ASN1_CONTEXT(filter_tag))) goto failed; 984 if (!asn1_read_OctetString_talloc(mem_ctx, data, &attrib)) goto failed; 985 if (!asn1_read_OctetString(data, mem_ctx, &value)) goto failed; 986 if (!asn1_end_tag(data)) goto failed; 987 if (asn1_has_error(data) || (attrib == NULL) || 988 (value.data == NULL)) { 971 989 goto failed; 972 990 } … … 1002 1020 DATA_BLOB value; 1003 1021 1004 asn1_start_tag(data, ASN1_CONTEXT(filter_tag)); 1005 asn1_read_OctetString_talloc(mem_ctx, data, &attrib); 1006 asn1_read_OctetString(data, mem_ctx, &value); 1007 asn1_end_tag(data); 1008 if ((data->has_error) || (attrib == NULL) || (value.data == NULL)) { 1022 if (!asn1_start_tag(data, ASN1_CONTEXT(filter_tag))) goto failed; 1023 if (!asn1_read_OctetString_talloc(mem_ctx, data, &attrib)) goto failed; 1024 if (!asn1_read_OctetString(data, mem_ctx, &value)) goto failed; 1025 if (!asn1_end_tag(data)) goto failed; 1026 if (asn1_has_error(data) || (attrib == NULL) || 1027 (value.data == NULL)) { 1009 1028 goto failed; 1010 1029 } … … 1028 1047 /* either oid or type must be defined */ 1029 1048 if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(1))) { /* optional */ 1030 asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(1));1031 asn1_read_LDAPString(data, ret, &oid);1032 asn1_end_tag(data);1049 if (!asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(1))) goto failed; 1050 if (!asn1_read_LDAPString(data, ret, &oid)) goto failed; 1051 if (!asn1_end_tag(data)) goto failed; 1033 1052 } 1034 1053 if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(2))) { /* optional */ 1035 asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(2));1036 asn1_read_LDAPString(data, ret, &attr);1037 asn1_end_tag(data);1038 } 1039 asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(3));1040 asn1_read_LDAPString(data, ret, &value);1041 asn1_end_tag(data);1054 if (!asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(2))) goto failed; 1055 if (!asn1_read_LDAPString(data, ret, &attr)) goto failed; 1056 if (!asn1_end_tag(data)) goto failed; 1057 } 1058 if (!asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(3))) goto failed; 1059 if (!asn1_read_LDAPString(data, ret, &value)) goto failed; 1060 if (!asn1_end_tag(data)) goto failed; 1042 1061 /* dnAttributes is marked as BOOLEAN DEFAULT FALSE 1043 1062 it is not marked as OPTIONAL but openldap tools … … 1047 1066 boolean value to be set */ 1048 1067 if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(4))) { 1049 asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(4));1050 asn1_read_uint8(data, &dnAttributes);1051 asn1_end_tag(data);1068 if (!asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(4))) goto failed; 1069 if (!asn1_read_uint8(data, &dnAttributes)) goto failed; 1070 if (!asn1_end_tag(data)) goto failed; 1052 1071 } else { 1053 1072 dnAttributes = 0; … … 1068 1087 } else { 1069 1088 ret->u.extended.attr = talloc_strdup(ret, "*"); 1089 if (ret->u.extended.attr == NULL) { 1090 goto failed; 1091 } 1070 1092 } 1071 1093 ret->u.extended.rule_id = talloc_steal(ret, oid); … … 1097 1119 1098 1120 /* Decode a single LDAP attribute, possibly containing multiple values */ 1099 static voidldap_decode_attrib(TALLOC_CTX *mem_ctx, struct asn1_data *data,1121 static bool ldap_decode_attrib(TALLOC_CTX *mem_ctx, struct asn1_data *data, 1100 1122 struct ldb_message_element *attrib) 1101 1123 { 1102 asn1_start_tag(data, ASN1_SEQUENCE(0));1103 asn1_read_OctetString_talloc(mem_ctx, data, &attrib->name);1104 asn1_start_tag(data, ASN1_SET);1124 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) return false; 1125 if (!asn1_read_OctetString_talloc(mem_ctx, data, &attrib->name)) return false; 1126 if (!asn1_start_tag(data, ASN1_SET)) return false; 1105 1127 while (asn1_peek_tag(data, ASN1_OCTET_STRING)) { 1106 1128 DATA_BLOB blob; 1107 asn1_read_OctetString(data, mem_ctx, &blob);1129 if (!asn1_read_OctetString(data, mem_ctx, &blob)) return false; 1108 1130 add_value_to_attrib(mem_ctx, &blob, attrib); 1109 1131 } 1110 asn1_end_tag(data); 1111 asn1_end_tag(data); 1112 1132 if (!asn1_end_tag(data)) return false; 1133 return asn1_end_tag(data); 1113 1134 } 1114 1135 1115 1136 /* Decode a set of LDAP attributes, as found in the dereference control */ 1116 voidldap_decode_attribs_bare(TALLOC_CTX *mem_ctx, struct asn1_data *data,1137 bool ldap_decode_attribs_bare(TALLOC_CTX *mem_ctx, struct asn1_data *data, 1117 1138 struct ldb_message_element **attributes, 1118 1139 int *num_attributes) … … 1121 1142 struct ldb_message_element attrib; 1122 1143 ZERO_STRUCT(attrib); 1123 ldap_decode_attrib(mem_ctx, data, &attrib);1144 if (!ldap_decode_attrib(mem_ctx, data, &attrib)) return false; 1124 1145 add_attrib_to_array_talloc(mem_ctx, &attrib, 1125 1146 attributes, num_attributes); 1126 1147 } 1148 return true; 1127 1149 } 1128 1150 1129 1151 /* Decode a set of LDAP attributes, as found in a search entry */ 1130 static voidldap_decode_attribs(TALLOC_CTX *mem_ctx, struct asn1_data *data,1152 static bool ldap_decode_attribs(TALLOC_CTX *mem_ctx, struct asn1_data *data, 1131 1153 struct ldb_message_element **attributes, 1132 1154 int *num_attributes) 1133 1155 { 1134 asn1_start_tag(data, ASN1_SEQUENCE(0));1135 ldap_decode_attribs_bare(mem_ctx, data,1136 attributes, num_attributes) ;1137 asn1_end_tag(data);1156 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) return false; 1157 if (!ldap_decode_attribs_bare(mem_ctx, data, 1158 attributes, num_attributes)) return false; 1159 return asn1_end_tag(data); 1138 1160 } 1139 1161 … … 1146 1168 uint8_t tag; 1147 1169 1148 asn1_start_tag(data, ASN1_SEQUENCE(0)); 1149 asn1_read_Integer(data, &msg->messageid); 1150 1151 if (!asn1_peek_uint8(data, &tag)) 1152 return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR); 1170 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) goto prot_err; 1171 if (!asn1_read_Integer(data, &msg->messageid)) goto prot_err; 1172 1173 if (!asn1_peek_uint8(data, &tag)) goto prot_err; 1153 1174 1154 1175 switch(tag) { … … 1157 1178 struct ldap_BindRequest *r = &msg->r.BindRequest; 1158 1179 msg->type = LDAP_TAG_BindRequest; 1159 asn1_start_tag(data, tag);1160 asn1_read_Integer(data, &r->version);1161 asn1_read_OctetString_talloc(msg, data, &r->dn);1180 if (!asn1_start_tag(data, tag)) goto prot_err; 1181 if (!asn1_read_Integer(data, &r->version)) goto prot_err; 1182 if (!asn1_read_OctetString_talloc(msg, data, &r->dn)) goto prot_err; 1162 1183 if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(0))) { 1163 1184 int pwlen; 1164 1185 r->creds.password = ""; 1165 1186 r->mechanism = LDAP_AUTH_MECH_SIMPLE; 1166 asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(0));1187 if (!asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(0))) goto prot_err; 1167 1188 pwlen = asn1_tag_remaining(data); 1168 1189 if (pwlen == -1) { 1169 return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);1190 goto prot_err; 1170 1191 } 1171 1192 if (pwlen != 0) { … … 1174 1195 return NT_STATUS_LDAP(LDAP_OPERATIONS_ERROR); 1175 1196 } 1176 asn1_read(data, pw, pwlen);1197 if (!asn1_read(data, pw, pwlen)) goto prot_err; 1177 1198 pw[pwlen] = '\0'; 1178 1199 r->creds.password = pw; 1179 1200 } 1180 asn1_end_tag(data);1201 if (!asn1_end_tag(data)) goto prot_err; 1181 1202 } else if (asn1_peek_tag(data, ASN1_CONTEXT(3))){ 1182 asn1_start_tag(data, ASN1_CONTEXT(3));1203 if (!asn1_start_tag(data, ASN1_CONTEXT(3))) goto prot_err; 1183 1204 r->mechanism = LDAP_AUTH_MECH_SASL; 1184 asn1_read_OctetString_talloc(msg, data, &r->creds.SASL.mechanism);1205 if (!asn1_read_OctetString_talloc(msg, data, &r->creds.SASL.mechanism)) goto prot_err; 1185 1206 if (asn1_peek_tag(data, ASN1_OCTET_STRING)) { /* optional */ 1186 1207 DATA_BLOB tmp_blob = data_blob(NULL, 0); 1187 asn1_read_OctetString(data, msg, &tmp_blob);1208 if (!asn1_read_OctetString(data, msg, &tmp_blob)) goto prot_err; 1188 1209 r->creds.SASL.secblob = talloc(msg, DATA_BLOB); 1189 1210 if (!r->creds.SASL.secblob) { … … 1196 1217 r->creds.SASL.secblob = NULL; 1197 1218 } 1198 asn1_end_tag(data);1219 if (!asn1_end_tag(data)) goto prot_err; 1199 1220 } else { 1200 1221 /* Neither Simple nor SASL bind */ 1201 return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);1202 } 1203 asn1_end_tag(data);1222 goto prot_err; 1223 } 1224 if (!asn1_end_tag(data)) goto prot_err; 1204 1225 break; 1205 1226 } … … 1208 1229 struct ldap_BindResponse *r = &msg->r.BindResponse; 1209 1230 msg->type = LDAP_TAG_BindResponse; 1210 asn1_start_tag(data, tag);1211 ldap_decode_response(msg, data, &r->response);1231 if (!asn1_start_tag(data, tag)) goto prot_err; 1232 if (!ldap_decode_response(msg, data, &r->response)) goto prot_err; 1212 1233 if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(7))) { 1213 1234 DATA_BLOB tmp_blob = data_blob(NULL, 0); 1214 asn1_read_ContextSimple(data, 7, &tmp_blob);1235 if (!asn1_read_ContextSimple(data, 7, &tmp_blob)) goto prot_err; 1215 1236 r->SASL.secblob = talloc(msg, DATA_BLOB); 1216 1237 if (!r->SASL.secblob) { … … 1223 1244 r->SASL.secblob = NULL; 1224 1245 } 1225 asn1_end_tag(data);1246 if (!asn1_end_tag(data)) goto prot_err; 1226 1247 break; 1227 1248 } … … 1229 1250 case ASN1_APPLICATION_SIMPLE(LDAP_TAG_UnbindRequest): { 1230 1251 msg->type = LDAP_TAG_UnbindRequest; 1231 asn1_start_tag(data, tag);1232 asn1_end_tag(data);1252 if (!asn1_start_tag(data, tag)) goto prot_err; 1253 if (!asn1_end_tag(data)) goto prot_err; 1233 1254 break; 1234 1255 } … … 1239 1260 const char **attrs = NULL; 1240 1261 msg->type = LDAP_TAG_SearchRequest; 1241 asn1_start_tag(data, tag);1242 asn1_read_OctetString_talloc(msg, data, &r->basedn);1243 asn1_read_enumerated(data, (int *)(void *)&(r->scope));1244 asn1_read_enumerated(data, (int *)(void *)&(r->deref));1245 asn1_read_Integer(data, &sizelimit);1262 if (!asn1_start_tag(data, tag)) goto prot_err; 1263 if (!asn1_read_OctetString_talloc(msg, data, &r->basedn)) goto prot_err; 1264 if (!asn1_read_enumerated(data, (int *)(void *)&(r->scope))) goto prot_err; 1265 if (!asn1_read_enumerated(data, (int *)(void *)&(r->deref))) goto prot_err; 1266 if (!asn1_read_Integer(data, &sizelimit)) goto prot_err; 1246 1267 r->sizelimit = sizelimit; 1247 asn1_read_Integer(data, &timelimit);1268 if (!asn1_read_Integer(data, &timelimit)) goto prot_err; 1248 1269 r->timelimit = timelimit; 1249 asn1_read_BOOLEAN(data, &r->attributesonly);1270 if (!asn1_read_BOOLEAN(data, &r->attributesonly)) goto prot_err; 1250 1271 1251 1272 r->tree = ldap_decode_filter_tree(msg, data); 1252 1273 if (r->tree == NULL) { 1253 return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);1254 } 1255 1256 asn1_start_tag(data, ASN1_SEQUENCE(0));1274 goto prot_err; 1275 } 1276 1277 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) goto prot_err; 1257 1278 1258 1279 r->num_attributes = 0; 1259 1280 r->attributes = NULL; 1260 1281 1261 while (asn1_tag_remaining(data) > 0) { 1282 while (asn1_tag_remaining(data) > 0) { 1262 1283 1263 1284 const char *attr; 1264 1285 if (!asn1_read_OctetString_talloc(msg, data, 1265 1286 &attr)) 1266 return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);1287 goto prot_err; 1267 1288 if (!add_string_to_array(msg, attr, 1268 1289 &attrs, 1269 1290 &r->num_attributes)) 1270 return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);1291 goto prot_err; 1271 1292 } 1272 1293 r->attributes = attrs; 1273 1294 1274 asn1_end_tag(data);1275 asn1_end_tag(data);1295 if (!asn1_end_tag(data)) goto prot_err; 1296 if (!asn1_end_tag(data)) goto prot_err; 1276 1297 break; 1277 1298 } … … 1282 1303 r->attributes = NULL; 1283 1304 r->num_attributes = 0; 1284 asn1_start_tag(data, tag);1285 asn1_read_OctetString_talloc(msg, data, &r->dn);1286 ldap_decode_attribs(msg, data, &r->attributes,1287 &r->num_attributes) ;1288 asn1_end_tag(data);1305 if (!asn1_start_tag(data, tag)) goto prot_err; 1306 if (!asn1_read_OctetString_talloc(msg, data, &r->dn)) goto prot_err; 1307 if (!ldap_decode_attribs(msg, data, &r->attributes, 1308 &r->num_attributes)) goto prot_err; 1309 if (!asn1_end_tag(data)) goto prot_err; 1289 1310 break; 1290 1311 } … … 1293 1314 struct ldap_Result *r = &msg->r.SearchResultDone; 1294 1315 msg->type = LDAP_TAG_SearchResultDone; 1295 asn1_start_tag(data, tag);1296 ldap_decode_response(msg, data, r);1297 asn1_end_tag(data);1316 if (!asn1_start_tag(data, tag)) goto prot_err; 1317 if (!ldap_decode_response(msg, data, r)) goto prot_err; 1318 if (!asn1_end_tag(data)) goto prot_err; 1298 1319 break; 1299 1320 } … … 1302 1323 struct ldap_SearchResRef *r = &msg->r.SearchResultReference; 1303 1324 msg->type = LDAP_TAG_SearchResultReference; 1304 asn1_start_tag(data, tag);1305 asn1_read_OctetString_talloc(msg, data, &r->referral);1306 asn1_end_tag(data);1325 if (!asn1_start_tag(data, tag)) goto prot_err; 1326 if (!asn1_read_OctetString_talloc(msg, data, &r->referral)) goto prot_err; 1327 if (!asn1_end_tag(data)) goto prot_err; 1307 1328 break; 1308 1329 } … … 1311 1332 struct ldap_ModifyRequest *r = &msg->r.ModifyRequest; 1312 1333 msg->type = LDAP_TAG_ModifyRequest; 1313 asn1_start_tag(data, ASN1_APPLICATION(LDAP_TAG_ModifyRequest));1314 asn1_read_OctetString_talloc(msg, data, &r->dn);1315 asn1_start_tag(data, ASN1_SEQUENCE(0));1334 if (!asn1_start_tag(data, ASN1_APPLICATION(LDAP_TAG_ModifyRequest))) goto prot_err; 1335 if (!asn1_read_OctetString_talloc(msg, data, &r->dn)) goto prot_err; 1336 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) goto prot_err; 1316 1337 1317 1338 r->num_mods = 0; … … 1322 1343 int v; 1323 1344 ZERO_STRUCT(mod); 1324 asn1_start_tag(data, ASN1_SEQUENCE(0));1325 asn1_read_enumerated(data, &v);1345 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) goto prot_err; 1346 if (!asn1_read_enumerated(data, &v)) goto prot_err; 1326 1347 mod.type = v; 1327 ldap_decode_attrib(msg, data, &mod.attrib);1328 asn1_end_tag(data);1348 if (!ldap_decode_attrib(msg, data, &mod.attrib)) goto prot_err; 1349 if (!asn1_end_tag(data)) goto prot_err; 1329 1350 if (!add_mod_to_array_talloc(msg, &mod, 1330 1351 &r->mods, &r->num_mods)) { … … 1333 1354 } 1334 1355 1335 asn1_end_tag(data);1336 asn1_end_tag(data);1356 if (!asn1_end_tag(data)) goto prot_err; 1357 if (!asn1_end_tag(data)) goto prot_err; 1337 1358 break; 1338 1359 } … … 1341 1362 struct ldap_Result *r = &msg->r.ModifyResponse; 1342 1363 msg->type = LDAP_TAG_ModifyResponse; 1343 asn1_start_tag(data, tag);1344 ldap_decode_response(msg, data, r);1345 asn1_end_tag(data);1364 if (!asn1_start_tag(data, tag)) goto prot_err; 1365 if (!ldap_decode_response(msg, data, r)) goto prot_err; 1366 if (!asn1_end_tag(data)) goto prot_err; 1346 1367 break; 1347 1368 } … … 1350 1371 struct ldap_AddRequest *r = &msg->r.AddRequest; 1351 1372 msg->type = LDAP_TAG_AddRequest; 1352 asn1_start_tag(data, tag);1353 asn1_read_OctetString_talloc(msg, data, &r->dn);1373 if (!asn1_start_tag(data, tag)) goto prot_err; 1374 if (!asn1_read_OctetString_talloc(msg, data, &r->dn)) goto prot_err; 1354 1375 1355 1376 r->attributes = NULL; 1356 1377 r->num_attributes = 0; 1357 ldap_decode_attribs(msg, data, &r->attributes,1358 &r->num_attributes) ;1359 1360 asn1_end_tag(data);1378 if (!ldap_decode_attribs(msg, data, &r->attributes, 1379 &r->num_attributes)) goto prot_err; 1380 1381 if (!asn1_end_tag(data)) goto prot_err; 1361 1382 break; 1362 1383 } … … 1365 1386 struct ldap_Result *r = &msg->r.AddResponse; 1366 1387 msg->type = LDAP_TAG_AddResponse; 1367 asn1_start_tag(data, tag);1368 ldap_decode_response(msg, data, r);1369 asn1_end_tag(data);1388 if (!asn1_start_tag(data, tag)) goto prot_err; 1389 if (!ldap_decode_response(msg, data, r)) goto prot_err; 1390 if (!asn1_end_tag(data)) goto prot_err; 1370 1391 break; 1371 1392 } … … 1376 1397 char *dn; 1377 1398 msg->type = LDAP_TAG_DelRequest; 1378 asn1_start_tag(data,1379 ASN1_APPLICATION_SIMPLE(LDAP_TAG_DelRequest)) ;1399 if (!asn1_start_tag(data, 1400 ASN1_APPLICATION_SIMPLE(LDAP_TAG_DelRequest))) goto prot_err; 1380 1401 len = asn1_tag_remaining(data); 1381 1402 if (len == -1) { 1382 return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);1403 goto prot_err; 1383 1404 } 1384 1405 dn = talloc_array(msg, char, len+1); 1385 1406 if (dn == NULL) 1386 1407 break; 1387 asn1_read(data, dn, len);1408 if (!asn1_read(data, dn, len)) goto prot_err; 1388 1409 dn[len] = '\0'; 1389 1410 r->dn = dn; 1390 asn1_end_tag(data);1411 if (!asn1_end_tag(data)) goto prot_err; 1391 1412 break; 1392 1413 } … … 1395 1416 struct ldap_Result *r = &msg->r.DelResponse; 1396 1417 msg->type = LDAP_TAG_DelResponse; 1397 asn1_start_tag(data, tag);1398 ldap_decode_response(msg, data, r);1399 asn1_end_tag(data);1418 if (!asn1_start_tag(data, tag)) goto prot_err; 1419 if (!ldap_decode_response(msg, data, r)) goto prot_err; 1420 if (!asn1_end_tag(data)) goto prot_err; 1400 1421 break; 1401 1422 } … … 1404 1425 struct ldap_ModifyDNRequest *r = &msg->r.ModifyDNRequest; 1405 1426 msg->type = LDAP_TAG_ModifyDNRequest; 1406 asn1_start_tag(data,1407 ASN1_APPLICATION(LDAP_TAG_ModifyDNRequest)) ;1408 asn1_read_OctetString_talloc(msg, data, &r->dn);1409 asn1_read_OctetString_talloc(msg, data, &r->newrdn);1410 asn1_read_BOOLEAN(data, &r->deleteolddn);1427 if (!asn1_start_tag(data, 1428 ASN1_APPLICATION(LDAP_TAG_ModifyDNRequest))) goto prot_err; 1429 if (!asn1_read_OctetString_talloc(msg, data, &r->dn)) goto prot_err; 1430 if (!asn1_read_OctetString_talloc(msg, data, &r->newrdn)) goto prot_err; 1431 if (!asn1_read_BOOLEAN(data, &r->deleteolddn)) goto prot_err; 1411 1432 r->newsuperior = NULL; 1412 1433 if (asn1_tag_remaining(data) > 0) { 1413 1434 int len; 1414 1435 char *newsup; 1415 asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(0));1436 if (!asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(0))) goto prot_err; 1416 1437 len = asn1_tag_remaining(data); 1417 1438 if (len == -1) { 1418 return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);1439 goto prot_err; 1419 1440 } 1420 1441 newsup = talloc_array(msg, char, len+1); … … 1422 1443 return NT_STATUS_LDAP(LDAP_OPERATIONS_ERROR); 1423 1444 } 1424 asn1_read(data, newsup, len);1445 if (!asn1_read(data, newsup, len)) goto prot_err; 1425 1446 newsup[len] = '\0'; 1426 1447 r->newsuperior = newsup; 1427 asn1_end_tag(data);1428 } 1429 asn1_end_tag(data);1448 if (!asn1_end_tag(data)) goto prot_err; 1449 } 1450 if (!asn1_end_tag(data)) goto prot_err; 1430 1451 break; 1431 1452 } … … 1434 1455 struct ldap_Result *r = &msg->r.ModifyDNResponse; 1435 1456 msg->type = LDAP_TAG_ModifyDNResponse; 1436 asn1_start_tag(data, tag);1437 ldap_decode_response(msg, data, r);1438 asn1_end_tag(data);1457 if (!asn1_start_tag(data, tag)) goto prot_err; 1458 if (!ldap_decode_response(msg, data, r)) goto prot_err; 1459 if (!asn1_end_tag(data)) goto prot_err; 1439 1460 break; 1440 1461 } … … 1443 1464 struct ldap_CompareRequest *r = &msg->r.CompareRequest; 1444 1465 msg->type = LDAP_TAG_CompareRequest; 1445 asn1_start_tag(data,1446 ASN1_APPLICATION(LDAP_TAG_CompareRequest)) ;1447 asn1_read_OctetString_talloc(msg, data, &r->dn);1448 asn1_start_tag(data, ASN1_SEQUENCE(0));1449 asn1_read_OctetString_talloc(msg, data, &r->attribute);1450 asn1_read_OctetString(data, msg, &r->value);1466 if (!asn1_start_tag(data, 1467 ASN1_APPLICATION(LDAP_TAG_CompareRequest))) goto prot_err; 1468 if (!asn1_read_OctetString_talloc(msg, data, &r->dn)) goto prot_err; 1469 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) goto prot_err; 1470 if (!asn1_read_OctetString_talloc(msg, data, &r->attribute)) goto prot_err; 1471 if (!asn1_read_OctetString(data, msg, &r->value)) goto prot_err; 1451 1472 if (r->value.data) { 1452 1473 talloc_steal(msg, r->value.data); 1453 1474 } 1454 asn1_end_tag(data);1455 asn1_end_tag(data);1475 if (!asn1_end_tag(data)) goto prot_err; 1476 if (!asn1_end_tag(data)) goto prot_err; 1456 1477 break; 1457 1478 } … … 1460 1481 struct ldap_Result *r = &msg->r.CompareResponse; 1461 1482 msg->type = LDAP_TAG_CompareResponse; 1462 asn1_start_tag(data, tag);1463 ldap_decode_response(msg, data, r);1464 asn1_end_tag(data);1483 if (!asn1_start_tag(data, tag)) goto prot_err; 1484 if (!ldap_decode_response(msg, data, r)) goto prot_err; 1485 if (!asn1_end_tag(data)) goto prot_err; 1465 1486 break; 1466 1487 } … … 1469 1490 struct ldap_AbandonRequest *r = &msg->r.AbandonRequest; 1470 1491 msg->type = LDAP_TAG_AbandonRequest; 1471 asn1_start_tag(data, tag);1472 asn1_read_implicit_Integer(data, &r->messageid);1473 asn1_end_tag(data);1492 if (!asn1_start_tag(data, tag)) goto prot_err; 1493 if (!asn1_read_implicit_Integer(data, &r->messageid)) goto prot_err; 1494 if (!asn1_end_tag(data)) goto prot_err; 1474 1495 break; 1475 1496 } … … 1480 1501 1481 1502 msg->type = LDAP_TAG_ExtendedRequest; 1482 asn1_start_tag(data,tag);1503 if (!asn1_start_tag(data,tag)) goto prot_err; 1483 1504 if (!asn1_read_ContextSimple(data, 0, &tmp_blob)) { 1484 return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);1505 goto prot_err; 1485 1506 } 1486 1507 r->oid = blob2string_talloc(msg, tmp_blob); … … 1491 1512 1492 1513 if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(1))) { 1493 asn1_read_ContextSimple(data, 1, &tmp_blob);1514 if (!asn1_read_ContextSimple(data, 1, &tmp_blob)) goto prot_err; 1494 1515 r->value = talloc(msg, DATA_BLOB); 1495 1516 if (!r->value) { … … 1502 1523 } 1503 1524 1504 asn1_end_tag(data);1525 if (!asn1_end_tag(data)) goto prot_err; 1505 1526 break; 1506 1527 } … … 1511 1532 1512 1533 msg->type = LDAP_TAG_ExtendedResponse; 1513 asn1_start_tag(data, tag);1514 ldap_decode_response(msg, data, &r->response);1534 if (!asn1_start_tag(data, tag)) goto prot_err; 1535 if (!ldap_decode_response(msg, data, &r->response)) goto prot_err; 1515 1536 1516 1537 if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(10))) { 1517 asn1_read_ContextSimple(data, 1, &tmp_blob);1538 if (!asn1_read_ContextSimple(data, 1, &tmp_blob)) goto prot_err; 1518 1539 r->oid = blob2string_talloc(msg, tmp_blob); 1519 1540 data_blob_free(&tmp_blob); … … 1526 1547 1527 1548 if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(11))) { 1528 asn1_read_ContextSimple(data, 1, &tmp_blob);1549 if (!asn1_read_ContextSimple(data, 1, &tmp_blob)) goto prot_err; 1529 1550 r->value = talloc(msg, DATA_BLOB); 1530 1551 if (!r->value) { … … 1537 1558 } 1538 1559 1539 asn1_end_tag(data);1540 break; 1541 } 1542 default: 1543 return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);1560 if (!asn1_end_tag(data)) goto prot_err; 1561 break; 1562 } 1563 default: 1564 goto prot_err; 1544 1565 } 1545 1566 … … 1552 1573 bool *decoded = NULL; 1553 1574 1554 asn1_start_tag(data, ASN1_CONTEXT(0));1575 if (!asn1_start_tag(data, ASN1_CONTEXT(0))) goto prot_err; 1555 1576 1556 1577 while (asn1_peek_tag(data, ASN1_SEQUENCE(0))) { … … 1573 1594 } 1574 1595 1575 if (!ldap_decode_control_wrapper(ctrl , data, ctrl[i], &value)) {1576 return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);1577 } 1578 1579 if (!ldap_decode_control_value(ctrl , value,1596 if (!ldap_decode_control_wrapper(ctrl[i], data, ctrl[i], &value)) { 1597 goto prot_err; 1598 } 1599 1600 if (!ldap_decode_control_value(ctrl[i], value, 1580 1601 control_handlers, 1581 1602 ctrl[i])) { … … 1601 1622 msg->controls_decoded = decoded; 1602 1623 1603 asn1_end_tag(data);1604 } 1605 1606 asn1_end_tag(data);1607 if ( (data->has_error) || (data->nesting != NULL)) {1624 if (!asn1_end_tag(data)) goto prot_err; 1625 } 1626 1627 if (!asn1_end_tag(data)) goto prot_err; 1628 if (asn1_has_error(data) || asn1_has_nesting(data)) { 1608 1629 return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR); 1609 1630 } 1610 1631 return NT_STATUS_OK; 1632 1633 prot_err: 1634 1635 return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR); 1611 1636 } 1612 1637 … … 1618 1643 NTSTATUS ldap_full_packet(void *private_data, DATA_BLOB blob, size_t *packet_size) 1619 1644 { 1645 int ret; 1646 1620 1647 if (blob.length < 6) { 1621 1648 /* … … 1625 1652 return STATUS_MORE_ENTRIES; 1626 1653 } 1627 return asn1_peek_full_tag(blob, ASN1_SEQUENCE(0), packet_size); 1628 } 1654 1655 ret = asn1_peek_full_tag(blob, ASN1_SEQUENCE(0), packet_size); 1656 if (ret != 0) { 1657 return map_nt_error_from_unix_common(ret); 1658 } 1659 return NT_STATUS_OK; 1660 } -
vendor/current/libcli/ldap/ldap_message.h
r740 r988 23 23 24 24 #include "../libcli/ldap/ldap_errors.h" 25 #if _SAMBA_BUILD_ == 326 #include "lib/ldb_compat.h"27 #else28 25 #include <ldb.h> 29 #endif30 26 31 27 enum ldap_request_tag { … … 109 105 bool attributesonly; 110 106 struct ldb_parse_tree *tree; 111 int num_attributes;107 size_t num_attributes; 112 108 const char * const *attributes; 113 109 }; … … 233 229 const char **result); 234 230 235 voidldap_decode_attribs_bare(TALLOC_CTX *mem_ctx, struct asn1_data *data,231 bool ldap_decode_attribs_bare(TALLOC_CTX *mem_ctx, struct asn1_data *data, 236 232 struct ldb_message_element **attributes, 237 233 int *num_attributes); -
vendor/current/libcli/ldap/ldap_ndr.c
r740 r988 22 22 23 23 #include "includes.h" 24 #if _SAMBA_BUILD_ == 325 #include "lib/ldb_compat.h"26 #else27 24 #include <ldb.h> 28 #endif29 25 #include "librpc/gen_ndr/ndr_security.h" 30 26 #include "librpc/gen_ndr/ndr_misc.h" -
vendor/current/libcli/ldap/wscript_build
r740 r988 1 1 #!/usr/bin/env python 2 2 3 bld.SAMBA_SUBSYSTEM('LIBCLI_LDAP_MESSAGE', 4 source='ldap_message.c', 5 public_deps='errors talloc ldb', 6 public_headers='ldap_message.h ldap_errors.h', 7 deps='samba-util ASN1_UTIL' 8 ) 9 10 11 bld.SAMBA_SUBSYSTEM('LIBCLI_LDAP_NDR', 12 source='ldap_ndr.c', 13 public_deps='errors talloc', 14 public_headers='ldap_ndr.h', 15 deps='samba-util ldb NDR_SECURITY tevent' 16 ) 17 3 bld.SAMBA_LIBRARY('cli-ldap-common', 4 source='ldap_message.c ldap_ndr.c', 5 public_deps='samba-errors talloc ldb', 6 private_headers='ldap_message.h ldap_errors.h ldap_ndr.h', 7 deps='samba-util asn1util NDR_SECURITY tevent', 8 private_library=True)
Note:
See TracChangeset
for help on using the changeset viewer.