Changeset 988 for vendor/current/source4/dsdb/pydsdb.c
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source4/dsdb/pydsdb.c
r740 r988 32 32 void initdsdb(void); 33 33 34 /* There's no Py_ssize_t in 2.4, apparently */ 35 #if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5 36 typedef int Py_ssize_t; 37 typedef inquiry lenfunc; 38 typedef intargfunc ssizeargfunc; 39 #endif 40 41 /* FIXME: These should be in a header file somewhere, once we finish moving 42 * away from SWIG .. */ 34 /* FIXME: These should be in a header file somewhere */ 43 35 #define PyErr_LDB_OR_RAISE(py_ldb, ldb) \ 44 /* if (!PyLdb_Check(py_ldb)) { \36 if (!py_check_dcerpc_type(py_ldb, "ldb", "Ldb")) { \ 45 37 PyErr_SetString(py_ldb_get_exception(), "Ldb connection object required"); \ 46 38 return NULL; \ 47 } */\ 48 ldb = PyLdb_AsLdbContext(py_ldb); 39 } \ 40 ldb = pyldb_Ldb_AsLdbContext(py_ldb); 41 42 #define PyErr_LDB_DN_OR_RAISE(py_ldb_dn, dn) \ 43 if (!py_check_dcerpc_type(py_ldb_dn, "ldb", "Dn")) { \ 44 PyErr_SetString(py_ldb_get_exception(), "ldb Dn object required"); \ 45 return NULL; \ 46 } \ 47 dn = pyldb_Dn_AsDn(py_ldb_dn); 49 48 50 49 static PyObject *py_ldb_get_exception(void) … … 98 97 99 98 static PyObject *py_dsdb_convert_schema_to_openldap(PyObject *self, 100 99 PyObject *args) 101 100 { 102 101 char *target_str, *mapping; … … 169 168 } 170 169 171 if (! PyObject_AsDn(tmp_ctx, py_ntds_settings_dn, ldb, &ntds_settings_dn)) {172 /* exception thrown by " PyObject_AsDn" */170 if (!pyldb_Object_AsDn(tmp_ctx, py_ntds_settings_dn, ldb, &ntds_settings_dn)) { 171 /* exception thrown by "pyldb_Object_AsDn" */ 173 172 talloc_free(tmp_ctx); 174 173 return NULL; … … 254 253 TALLOC_CTX *mem_ctx; 255 254 256 if (!PyArg_ParseTuple(args, "O i", &py_ldb, &attid))255 if (!PyArg_ParseTuple(args, "OI", &py_ldb, &attid)) 257 256 return NULL; 258 257 … … 322 321 a = dsdb_attribute_by_lDAPDisplayName(schema, ldap_display_name); 323 322 if (a == NULL) { 324 PyErr_Format(PyExc_ RuntimeError, "Failed to find attribute '%s'", ldap_display_name);323 PyErr_Format(PyExc_KeyError, "Failed to find attribute '%s'", ldap_display_name); 325 324 return NULL; 326 325 } … … 329 328 330 329 return PyLong_FromUnsignedLong(attid); 330 } 331 332 /* 333 return the systemFlags as int from the attribute name 334 */ 335 static PyObject *py_dsdb_get_systemFlags_from_lDAPDisplayName(PyObject *self, PyObject *args) 336 { 337 PyObject *py_ldb; 338 struct ldb_context *ldb; 339 struct dsdb_schema *schema; 340 const char *ldap_display_name; 341 const struct dsdb_attribute *attribute; 342 343 if (!PyArg_ParseTuple(args, "Os", &py_ldb, &ldap_display_name)) 344 return NULL; 345 346 PyErr_LDB_OR_RAISE(py_ldb, ldb); 347 348 schema = dsdb_get_schema(ldb, NULL); 349 350 if (!schema) { 351 PyErr_SetString(PyExc_RuntimeError, "Failed to find a schema from ldb"); 352 return NULL; 353 } 354 355 attribute = dsdb_attribute_by_lDAPDisplayName(schema, ldap_display_name); 356 if (attribute == NULL) { 357 PyErr_Format(PyExc_KeyError, "Failed to find attribute '%s'", ldap_display_name); 358 return NULL; 359 } 360 361 return PyInt_FromLong(attribute->systemFlags); 362 } 363 364 /* 365 return the linkID from the attribute name 366 */ 367 static PyObject *py_dsdb_get_linkId_from_lDAPDisplayName(PyObject *self, PyObject *args) 368 { 369 PyObject *py_ldb; 370 struct ldb_context *ldb; 371 struct dsdb_schema *schema; 372 const char *ldap_display_name; 373 const struct dsdb_attribute *attribute; 374 375 if (!PyArg_ParseTuple(args, "Os", &py_ldb, &ldap_display_name)) 376 return NULL; 377 378 PyErr_LDB_OR_RAISE(py_ldb, ldb); 379 380 schema = dsdb_get_schema(ldb, NULL); 381 382 if (!schema) { 383 PyErr_SetString(PyExc_RuntimeError, "Failed to find a schema from ldb"); 384 return NULL; 385 } 386 387 attribute = dsdb_attribute_by_lDAPDisplayName(schema, ldap_display_name); 388 if (attribute == NULL) { 389 PyErr_Format(PyExc_KeyError, "Failed to find attribute '%s'", ldap_display_name); 390 return NULL; 391 } 392 393 return PyInt_FromLong(attribute->linkID); 394 } 395 396 /* 397 return the backlink attribute name (if any) for an attribute 398 */ 399 static PyObject *py_dsdb_get_backlink_from_lDAPDisplayName(PyObject *self, PyObject *args) 400 { 401 PyObject *py_ldb; 402 struct ldb_context *ldb; 403 struct dsdb_schema *schema; 404 const char *ldap_display_name; 405 const struct dsdb_attribute *attribute, *target_attr; 406 407 if (!PyArg_ParseTuple(args, "Os", &py_ldb, &ldap_display_name)) 408 return NULL; 409 410 PyErr_LDB_OR_RAISE(py_ldb, ldb); 411 412 schema = dsdb_get_schema(ldb, NULL); 413 414 if (!schema) { 415 PyErr_SetString(PyExc_RuntimeError, "Failed to find a schema from ldb"); 416 return NULL; 417 } 418 419 attribute = dsdb_attribute_by_lDAPDisplayName(schema, ldap_display_name); 420 if (attribute == NULL) { 421 PyErr_Format(PyExc_KeyError, "Failed to find attribute '%s'", ldap_display_name); 422 return NULL; 423 } 424 425 if (attribute->linkID == 0) { 426 Py_RETURN_NONE; 427 } 428 429 target_attr = dsdb_attribute_by_linkID(schema, attribute->linkID ^ 1); 430 if (target_attr == NULL) { 431 /* when we add pseudo-backlinks we'll need to handle 432 them here */ 433 Py_RETURN_NONE; 434 } 435 436 return PyString_FromString(target_attr->lDAPDisplayName); 437 } 438 439 440 static PyObject *py_dsdb_get_lDAPDisplayName_by_attid(PyObject *self, PyObject *args) 441 { 442 PyObject *py_ldb; 443 struct ldb_context *ldb; 444 struct dsdb_schema *schema; 445 const struct dsdb_attribute *a; 446 uint32_t attid; 447 448 if (!PyArg_ParseTuple(args, "OI", &py_ldb, &attid)) 449 return NULL; 450 451 PyErr_LDB_OR_RAISE(py_ldb, ldb); 452 453 schema = dsdb_get_schema(ldb, NULL); 454 455 if (!schema) { 456 PyErr_SetString(PyExc_RuntimeError, "Failed to find a schema from ldb"); 457 return NULL; 458 } 459 460 a = dsdb_attribute_by_attributeID_id(schema, attid); 461 if (a == NULL) { 462 PyErr_Format(PyExc_KeyError, "Failed to find attribute '0x%08x'", attid); 463 return NULL; 464 } 465 466 return PyString_FromString(a->lDAPDisplayName); 467 } 468 469 470 /* 471 return the attribute syntax oid as a string from the attribute name 472 */ 473 static PyObject *py_dsdb_get_syntax_oid_from_lDAPDisplayName(PyObject *self, PyObject *args) 474 { 475 PyObject *py_ldb; 476 struct ldb_context *ldb; 477 struct dsdb_schema *schema; 478 const char *ldap_display_name; 479 const struct dsdb_attribute *attribute; 480 481 if (!PyArg_ParseTuple(args, "Os", &py_ldb, &ldap_display_name)) 482 return NULL; 483 484 PyErr_LDB_OR_RAISE(py_ldb, ldb); 485 486 schema = dsdb_get_schema(ldb, NULL); 487 488 if (!schema) { 489 PyErr_SetString(PyExc_RuntimeError, "Failed to find a schema from ldb"); 490 return NULL; 491 } 492 493 attribute = dsdb_attribute_by_lDAPDisplayName(schema, ldap_display_name); 494 if (attribute == NULL) { 495 PyErr_Format(PyExc_KeyError, "Failed to find attribute '%s'", ldap_display_name); 496 return NULL; 497 } 498 499 return PyString_FromString(attribute->syntax->ldap_oid); 331 500 } 332 501 … … 354 523 PyErr_LDB_OR_RAISE(py_ldb, ldb); 355 524 356 if (!PyList_Check(el_list)) {357 PyErr_Format(PyExc_TypeError, "ldif_elements must be a list");358 return NULL;359 }360 361 525 schema = dsdb_get_schema(ldb, NULL); 362 526 if (!schema) { … … 367 531 a = dsdb_attribute_by_lDAPDisplayName(schema, ldap_display_name); 368 532 if (a == NULL) { 369 PyErr_Format(PyExc_ RuntimeError, "Failed to find attribute '%s'", ldap_display_name);533 PyErr_Format(PyExc_KeyError, "Failed to find attribute '%s'", ldap_display_name); 370 534 return NULL; 371 535 } … … 380 544 } 381 545 382 el = talloc_zero(tmp_ctx, struct ldb_message_element); 383 if (el == NULL) { 384 PyErr_NoMemory(); 385 talloc_free(tmp_ctx); 386 return NULL; 387 } 388 389 el->name = ldap_display_name; 390 el->num_values = PyList_Size(el_list); 391 392 el->values = talloc_array(el, struct ldb_val, el->num_values); 393 if (el->values == NULL) { 394 PyErr_NoMemory(); 395 talloc_free(tmp_ctx); 396 return NULL; 397 } 398 399 for (i = 0; i < el->num_values; i++) { 400 PyObject *item = PyList_GetItem(el_list, i); 401 if (!PyString_Check(item)) { 402 PyErr_Format(PyExc_TypeError, "ldif_elements should be strings"); 546 /* If we were not given an LdbMessageElement */ 547 if (!PyList_Check(el_list)) { 548 if (!py_check_dcerpc_type(el_list, "ldb", "MessageElement")) { 549 PyErr_SetString(py_ldb_get_exception(), 550 "list of strings or ldb MessageElement object required"); 403 551 return NULL; 404 552 } 405 el->values[i].data = (uint8_t *)PyString_AsString(item); 406 el->values[i].length = PyString_Size(item); 553 /* 554 * NOTE: 555 * el may not be a valid talloc context, it 556 * could be part of an array 557 */ 558 el = pyldb_MessageElement_AsMessageElement(el_list); 559 } else { 560 el = talloc_zero(tmp_ctx, struct ldb_message_element); 561 if (el == NULL) { 562 PyErr_NoMemory(); 563 talloc_free(tmp_ctx); 564 return NULL; 565 } 566 567 el->name = ldap_display_name; 568 el->num_values = PyList_Size(el_list); 569 570 el->values = talloc_array(el, struct ldb_val, el->num_values); 571 if (el->values == NULL) { 572 PyErr_NoMemory(); 573 talloc_free(tmp_ctx); 574 return NULL; 575 } 576 577 for (i = 0; i < el->num_values; i++) { 578 PyObject *item = PyList_GetItem(el_list, i); 579 if (!PyString_Check(item)) { 580 PyErr_Format(PyExc_TypeError, "ldif_elements should be strings"); 581 talloc_free(tmp_ctx); 582 return NULL; 583 } 584 el->values[i].data = (uint8_t *)PyString_AsString(item); 585 el->values[i].length = PyString_Size(item); 586 } 407 587 } 408 588 … … 415 595 416 596 werr = a->syntax->ldb_to_drsuapi(&syntax_ctx, a, el, attr, attr); 417 PyErr_WERROR_ IS_ERR_RAISE(werr);597 PyErr_WERROR_NOT_OK_RAISE(werr); 418 598 419 599 ret = py_return_ndr_struct("samba.dcerpc.drsuapi", "DsReplicaAttribute", attr, attr); … … 423 603 return ret; 424 604 } 605 606 607 /* 608 normalise a ldb attribute list 609 */ 610 static PyObject *py_dsdb_normalise_attributes(PyObject *self, PyObject *args) 611 { 612 PyObject *py_ldb, *el_list, *py_ret; 613 struct ldb_context *ldb; 614 char *ldap_display_name; 615 const struct dsdb_attribute *a; 616 struct dsdb_schema *schema; 617 struct dsdb_syntax_ctx syntax_ctx; 618 struct ldb_message_element *el, *new_el; 619 struct drsuapi_DsReplicaAttribute *attr; 620 PyLdbMessageElementObject *ret; 621 TALLOC_CTX *tmp_ctx; 622 WERROR werr; 623 Py_ssize_t i; 624 PyTypeObject *py_type = NULL; 625 PyObject *module = NULL; 626 627 if (!PyArg_ParseTuple(args, "OsO", &py_ldb, &ldap_display_name, &el_list)) { 628 return NULL; 629 } 630 631 PyErr_LDB_OR_RAISE(py_ldb, ldb); 632 633 schema = dsdb_get_schema(ldb, NULL); 634 if (!schema) { 635 PyErr_SetString(PyExc_RuntimeError, "Failed to find a schema from ldb"); 636 return NULL; 637 } 638 639 a = dsdb_attribute_by_lDAPDisplayName(schema, ldap_display_name); 640 if (a == NULL) { 641 PyErr_Format(PyExc_KeyError, "Failed to find attribute '%s'", ldap_display_name); 642 return NULL; 643 } 644 645 dsdb_syntax_ctx_init(&syntax_ctx, ldb, schema); 646 syntax_ctx.is_schema_nc = false; 647 648 tmp_ctx = talloc_new(ldb); 649 if (tmp_ctx == NULL) { 650 PyErr_NoMemory(); 651 return NULL; 652 } 653 654 if (!PyList_Check(el_list)) { 655 if (!py_check_dcerpc_type(el_list, "ldb", "MessageElement")) { 656 PyErr_SetString(py_ldb_get_exception(), 657 "list of strings or ldb MessageElement object required"); 658 return NULL; 659 } 660 /* 661 * NOTE: 662 * el may not be a valid talloc context, it 663 * could be part of an array 664 */ 665 el = pyldb_MessageElement_AsMessageElement(el_list); 666 } else { 667 el = talloc_zero(tmp_ctx, struct ldb_message_element); 668 if (el == NULL) { 669 PyErr_NoMemory(); 670 talloc_free(tmp_ctx); 671 return NULL; 672 } 673 674 el->name = ldap_display_name; 675 el->num_values = PyList_Size(el_list); 676 677 el->values = talloc_array(el, struct ldb_val, el->num_values); 678 if (el->values == NULL) { 679 PyErr_NoMemory(); 680 talloc_free(tmp_ctx); 681 return NULL; 682 } 683 684 for (i = 0; i < el->num_values; i++) { 685 PyObject *item = PyList_GetItem(el_list, i); 686 if (!PyString_Check(item)) { 687 PyErr_Format(PyExc_TypeError, "ldif_elements should be strings"); 688 talloc_free(tmp_ctx); 689 return NULL; 690 } 691 el->values[i].data = (uint8_t *)PyString_AsString(item); 692 el->values[i].length = PyString_Size(item); 693 } 694 } 695 696 new_el = talloc_zero(tmp_ctx, struct ldb_message_element); 697 if (new_el == NULL) { 698 PyErr_NoMemory(); 699 talloc_free(tmp_ctx); 700 return NULL; 701 } 702 703 /* Normalise "objectClass" attribute if needed */ 704 if (ldb_attr_cmp(a->lDAPDisplayName, "objectClass") == 0) { 705 int iret; 706 iret = dsdb_sort_objectClass_attr(ldb, schema, el, new_el, new_el); 707 if (iret != LDB_SUCCESS) { 708 PyErr_SetString(PyExc_RuntimeError, ldb_errstring(ldb)); 709 talloc_free(tmp_ctx); 710 return NULL; 711 } 712 } 713 714 /* first run ldb_to_drsuapi, then convert back again. This has 715 * the effect of normalising the attributes 716 */ 717 718 attr = talloc_zero(tmp_ctx, struct drsuapi_DsReplicaAttribute); 719 if (attr == NULL) { 720 PyErr_NoMemory(); 721 talloc_free(tmp_ctx); 722 return NULL; 723 } 724 725 werr = a->syntax->ldb_to_drsuapi(&syntax_ctx, a, el, attr, attr); 726 PyErr_WERROR_NOT_OK_RAISE(werr); 727 728 /* now convert back again */ 729 werr = a->syntax->drsuapi_to_ldb(&syntax_ctx, a, attr, new_el, new_el); 730 PyErr_WERROR_NOT_OK_RAISE(werr); 731 732 module = PyImport_ImportModule("ldb"); 733 if (module == NULL) { 734 return NULL; 735 } 736 737 py_type = (PyTypeObject *)PyObject_GetAttrString(module, "MessageElement"); 738 if (py_type == NULL) { 739 return NULL; 740 } 741 py_ret = py_type->tp_alloc(py_type, 0); 742 ret = (PyLdbMessageElementObject *)py_ret; 743 744 ret->mem_ctx = talloc_new(NULL); 745 if (talloc_reference(ret->mem_ctx, new_el) == NULL) { 746 PyErr_NoMemory(); 747 return NULL; 748 } 749 ret->el = new_el; 750 751 talloc_free(tmp_ctx); 752 753 return py_ret; 754 } 755 425 756 426 757 static PyObject *py_dsdb_set_ntds_invocation_id(PyObject *self, PyObject *args) … … 436 767 GUID_from_string(PyString_AsString(py_guid), &guid); 437 768 769 if (GUID_all_zero(&guid)) { 770 PyErr_SetString(PyExc_RuntimeError, "set_ntds_invocation_id rejected due to all-zero invocation ID"); 771 return NULL; 772 } 773 438 774 ret = samdb_set_ntds_invocation_id(ldb, &guid); 439 775 if (!ret) { … … 506 842 mem_ctx = talloc_new(NULL); 507 843 if (mem_ctx == NULL) { 508 509 510 } 511 512 if (! PyObject_AsDn(mem_ctx, py_dn, ldb, &dn)) {513 514 844 PyErr_NoMemory(); 845 return NULL; 846 } 847 848 if (!pyldb_Object_AsDn(mem_ctx, py_dn, ldb, &dn)) { 849 talloc_free(mem_ctx); 850 return NULL; 515 851 } 516 852 … … 558 894 { 559 895 WERROR result; 560 char *pf, *df ;561 PyObject *py_ldb; 562 struct ldb_context *ldb; 563 564 if (!PyArg_ParseTuple(args, "Oss ", &py_ldb, &pf, &df))565 return NULL; 566 567 PyErr_LDB_OR_RAISE(py_ldb, ldb); 568 569 result = dsdb_set_schema_from_ldif(ldb, pf, df );570 PyErr_WERROR_ IS_ERR_RAISE(result);896 char *pf, *df, *dn; 897 PyObject *py_ldb; 898 struct ldb_context *ldb; 899 900 if (!PyArg_ParseTuple(args, "Osss", &py_ldb, &pf, &df, &dn)) 901 return NULL; 902 903 PyErr_LDB_OR_RAISE(py_ldb, ldb); 904 905 result = dsdb_set_schema_from_ldif(ldb, pf, df, dn); 906 PyErr_WERROR_NOT_OK_RAISE(result); 571 907 572 908 Py_RETURN_NONE; … … 581 917 struct dsdb_schema *schema; 582 918 int ret; 583 if (!PyArg_ParseTuple(args, "OO", &py_ldb, &py_from_ldb)) 919 char write_indices_and_attributes = true; 920 if (!PyArg_ParseTuple(args, "OO|b", 921 &py_ldb, &py_from_ldb, &write_indices_and_attributes)) 584 922 return NULL; 585 923 … … 594 932 } 595 933 596 ret = dsdb_reference_schema(ldb, schema, true);934 ret = dsdb_reference_schema(ldb, schema, write_indices_and_attributes); 597 935 PyErr_LDB_ERROR_IS_ERR_RAISE(py_ldb_get_exception(), ret, ldb); 598 936 … … 619 957 620 958 result = dsdb_write_prefixes_from_schema_to_ldb(NULL, ldb, schema); 621 PyErr_WERROR_ IS_ERR_RAISE(result);959 PyErr_WERROR_NOT_OK_RAISE(result); 622 960 623 961 Py_RETURN_NONE; … … 630 968 struct ldb_dn *dn; 631 969 PyObject *py_ldb, *ret; 632 PyObject *mod;633 634 mod = PyImport_ImportModule("ldb");635 970 636 971 if (!PyArg_ParseTuple(args, "O", &py_ldb)) … … 644 979 return NULL; 645 980 } 646 ret = PyLdbDn_FromDn(dn);981 ret = pyldb_Dn_FromDn(dn); 647 982 talloc_free(dn); 648 983 return ret; 984 } 985 986 987 static PyObject *py_dsdb_get_nc_root(PyObject *self, PyObject *args) 988 { 989 struct ldb_context *ldb; 990 struct ldb_dn *dn, *nc_root; 991 PyObject *py_ldb, *py_ldb_dn, *py_nc_root; 992 int ret; 993 994 if (!PyArg_ParseTuple(args, "OO", &py_ldb, &py_ldb_dn)) 995 return NULL; 996 997 PyErr_LDB_OR_RAISE(py_ldb, ldb); 998 PyErr_LDB_DN_OR_RAISE(py_ldb_dn, dn); 999 1000 ret = dsdb_find_nc_root(ldb, ldb, dn, &nc_root); 1001 PyErr_LDB_ERROR_IS_ERR_RAISE(py_ldb_get_exception(), ret, ldb); 1002 1003 py_nc_root = pyldb_Dn_FromDn(nc_root); 1004 talloc_unlink(ldb, nc_root); 1005 return py_nc_root; 1006 } 1007 1008 static PyObject *py_dsdb_get_wellknown_dn(PyObject *self, PyObject *args) 1009 { 1010 struct ldb_context *ldb; 1011 struct ldb_dn *nc_dn, *wk_dn; 1012 char *wkguid; 1013 PyObject *py_ldb, *py_nc_dn, *py_wk_dn; 1014 int ret; 1015 1016 if (!PyArg_ParseTuple(args, "OOs", &py_ldb, &py_nc_dn, &wkguid)) 1017 return NULL; 1018 1019 PyErr_LDB_OR_RAISE(py_ldb, ldb); 1020 PyErr_LDB_DN_OR_RAISE(py_nc_dn, nc_dn); 1021 1022 ret = dsdb_wellknown_dn(ldb, ldb, nc_dn, wkguid, &wk_dn); 1023 if (ret == LDB_ERR_NO_SUCH_OBJECT) { 1024 PyErr_Format(PyExc_KeyError, "Failed to find well known DN for GUID %s", wkguid); 1025 return NULL; 1026 } 1027 1028 PyErr_LDB_ERROR_IS_ERR_RAISE(py_ldb_get_exception(), ret, ldb); 1029 1030 py_wk_dn = pyldb_Dn_FromDn(wk_dn); 1031 talloc_unlink(ldb, wk_dn); 1032 return py_wk_dn; 649 1033 } 650 1034 … … 672 1056 673 1057 return PyBool_FromLong(am_rodc); 1058 } 1059 1060 /* 1061 call into samdb_is_pdc() 1062 */ 1063 static PyObject *py_dsdb_am_pdc(PyObject *self, PyObject *args) 1064 { 1065 PyObject *py_ldb; 1066 struct ldb_context *ldb; 1067 bool am_pdc; 1068 1069 if (!PyArg_ParseTuple(args, "O", &py_ldb)) 1070 return NULL; 1071 1072 PyErr_LDB_OR_RAISE(py_ldb, ldb); 1073 1074 am_pdc = samdb_is_pdc(ldb); 1075 return PyBool_FromLong(am_pdc); 674 1076 } 675 1077 … … 700 1102 { "_dsdb_get_attid_from_lDAPDisplayName", (PyCFunction)py_dsdb_get_attid_from_lDAPDisplayName, 701 1103 METH_VARARGS, NULL }, 1104 { "_dsdb_get_syntax_oid_from_lDAPDisplayName", (PyCFunction)py_dsdb_get_syntax_oid_from_lDAPDisplayName, 1105 METH_VARARGS, NULL }, 1106 { "_dsdb_get_systemFlags_from_lDAPDisplayName", (PyCFunction)py_dsdb_get_systemFlags_from_lDAPDisplayName, 1107 METH_VARARGS, NULL }, 1108 { "_dsdb_get_linkId_from_lDAPDisplayName", (PyCFunction)py_dsdb_get_linkId_from_lDAPDisplayName, 1109 METH_VARARGS, NULL }, 1110 { "_dsdb_get_lDAPDisplayName_by_attid", (PyCFunction)py_dsdb_get_lDAPDisplayName_by_attid, 1111 METH_VARARGS, NULL }, 1112 { "_dsdb_get_backlink_from_lDAPDisplayName", (PyCFunction)py_dsdb_get_backlink_from_lDAPDisplayName, 1113 METH_VARARGS, NULL }, 702 1114 { "_dsdb_set_ntds_invocation_id", 703 1115 (PyCFunction)py_dsdb_set_ntds_invocation_id, METH_VARARGS, … … 716 1128 (PyCFunction)py_dsdb_am_rodc, METH_VARARGS, 717 1129 NULL }, 1130 { "_am_pdc", 1131 (PyCFunction)py_dsdb_am_pdc, METH_VARARGS, 1132 NULL }, 718 1133 { "_dsdb_set_schema_from_ldif", (PyCFunction)py_dsdb_set_schema_from_ldif, METH_VARARGS, 719 1134 NULL }, … … 723 1138 NULL }, 724 1139 { "_dsdb_get_partitions_dn", (PyCFunction)py_dsdb_get_partitions_dn, METH_VARARGS, NULL }, 1140 { "_dsdb_get_nc_root", (PyCFunction)py_dsdb_get_nc_root, METH_VARARGS, NULL }, 1141 { "_dsdb_get_wellknown_dn", (PyCFunction)py_dsdb_get_wellknown_dn, METH_VARARGS, NULL }, 725 1142 { "_dsdb_DsReplicaAttribute", (PyCFunction)py_dsdb_DsReplicaAttribute, METH_VARARGS, NULL }, 1143 { "_dsdb_normalise_attributes", (PyCFunction)py_dsdb_normalise_attributes, METH_VARARGS, NULL }, 726 1144 { NULL } 727 1145 }; … … 774 1192 ADD_DSDB_FLAG(UF_NO_AUTH_DATA_REQUIRED); 775 1193 ADD_DSDB_FLAG(UF_PARTIAL_SECRETS_ACCOUNT); 1194 ADD_DSDB_FLAG(UF_USE_AES_KEYS); 776 1195 777 1196 /* groupType flags */ … … 801 1220 ADD_DSDB_FLAG(DS_DOMAIN_FUNCTION_2008); 802 1221 ADD_DSDB_FLAG(DS_DOMAIN_FUNCTION_2008_R2); 1222 ADD_DSDB_FLAG(DS_DOMAIN_FUNCTION_2012); 1223 ADD_DSDB_FLAG(DS_DOMAIN_FUNCTION_2012_R2); 1224 1225 /* nc replica flags */ 1226 ADD_DSDB_FLAG(INSTANCE_TYPE_IS_NC_HEAD); 1227 ADD_DSDB_FLAG(INSTANCE_TYPE_UNINSTANT); 1228 ADD_DSDB_FLAG(INSTANCE_TYPE_WRITE); 1229 ADD_DSDB_FLAG(INSTANCE_TYPE_NC_ABOVE); 1230 ADD_DSDB_FLAG(INSTANCE_TYPE_NC_COMING); 1231 ADD_DSDB_FLAG(INSTANCE_TYPE_NC_GOING); 803 1232 804 1233 /* "systemFlags" */ … … 839 1268 ADD_DSDB_FLAG(DS_FLAG_ATTR_IS_CONSTRUCTED); 840 1269 1270 ADD_DSDB_FLAG(DS_NTDSSETTINGS_OPT_IS_AUTO_TOPOLOGY_DISABLED); 1271 ADD_DSDB_FLAG(DS_NTDSSETTINGS_OPT_IS_TOPL_CLEANUP_DISABLED); 1272 ADD_DSDB_FLAG(DS_NTDSSETTINGS_OPT_IS_TOPL_MIN_HOPS_DISABLED); 1273 ADD_DSDB_FLAG(DS_NTDSSETTINGS_OPT_IS_TOPL_DETECT_STALE_DISABLED); 1274 ADD_DSDB_FLAG(DS_NTDSSETTINGS_OPT_IS_INTER_SITE_AUTO_TOPOLOGY_DISABLED); 1275 ADD_DSDB_FLAG(DS_NTDSSETTINGS_OPT_IS_GROUP_CACHING_ENABLED); 1276 ADD_DSDB_FLAG(DS_NTDSSETTINGS_OPT_FORCE_KCC_WHISTLER_BEHAVIOR); 1277 ADD_DSDB_FLAG(DS_NTDSSETTINGS_OPT_IS_RAND_BH_SELECTION_DISABLED); 1278 ADD_DSDB_FLAG(DS_NTDSSETTINGS_OPT_IS_SCHEDULE_HASHING_ENABLED); 1279 ADD_DSDB_FLAG(DS_NTDSSETTINGS_OPT_IS_REDUNDANT_SERVER_TOPOLOGY_ENABLED); 1280 841 1281 ADD_DSDB_FLAG(DS_NTDSDSA_OPT_IS_GC); 842 1282 ADD_DSDB_FLAG(DS_NTDSDSA_OPT_DISABLE_INBOUND_REPL); … … 856 1296 ADD_DSDB_FLAG(NTDSCONN_KCC_REDUNDANT_SERVER_TOPOLOGY); 857 1297 1298 ADD_DSDB_FLAG(NTDSCONN_OPT_IS_GENERATED); 1299 ADD_DSDB_FLAG(NTDSCONN_OPT_TWOWAY_SYNC); 1300 ADD_DSDB_FLAG(NTDSCONN_OPT_OVERRIDE_NOTIFY_DEFAULT); 1301 ADD_DSDB_FLAG(NTDSCONN_OPT_USE_NOTIFY); 1302 ADD_DSDB_FLAG(NTDSCONN_OPT_DISABLE_INTERSITE_COMPRESSION); 1303 ADD_DSDB_FLAG(NTDSCONN_OPT_USER_OWNED_SCHEDULE); 1304 ADD_DSDB_FLAG(NTDSCONN_OPT_RODC_TOPOLOGY); 1305 1306 /* Site Link Object options */ 1307 ADD_DSDB_FLAG(NTDSSITELINK_OPT_USE_NOTIFY); 1308 ADD_DSDB_FLAG(NTDSSITELINK_OPT_TWOWAY_SYNC); 1309 ADD_DSDB_FLAG(NTDSSITELINK_OPT_DISABLE_COMPRESSION); 1310 858 1311 /* GPO policy flags */ 859 1312 ADD_DSDB_FLAG(GPLINK_OPT_DISABLE); … … 863 1316 ADD_DSDB_FLAG(GPO_INHERIT); 864 1317 ADD_DSDB_FLAG(GPO_BLOCK_INHERITANCE); 865 } 1318 1319 #define ADD_DSDB_STRING(val) PyModule_AddObject(m, #val, PyString_FromString(val)) 1320 1321 ADD_DSDB_STRING(DSDB_SYNTAX_BINARY_DN); 1322 ADD_DSDB_STRING(DSDB_SYNTAX_STRING_DN); 1323 ADD_DSDB_STRING(DSDB_SYNTAX_OR_NAME); 1324 ADD_DSDB_STRING(DSDB_CONTROL_DBCHECK); 1325 ADD_DSDB_STRING(DSDB_CONTROL_DBCHECK_MODIFY_RO_REPLICA); 1326 ADD_DSDB_STRING(DSDB_CONTROL_PERMIT_INTERDOMAIN_TRUST_UAC_OID); 1327 1328 ADD_DSDB_STRING(DS_GUID_COMPUTERS_CONTAINER); 1329 ADD_DSDB_STRING(DS_GUID_DELETED_OBJECTS_CONTAINER); 1330 ADD_DSDB_STRING(DS_GUID_DOMAIN_CONTROLLERS_CONTAINER); 1331 ADD_DSDB_STRING(DS_GUID_FOREIGNSECURITYPRINCIPALS_CONTAINER); 1332 ADD_DSDB_STRING(DS_GUID_INFRASTRUCTURE_CONTAINER); 1333 ADD_DSDB_STRING(DS_GUID_LOSTANDFOUND_CONTAINER); 1334 ADD_DSDB_STRING(DS_GUID_MICROSOFT_PROGRAM_DATA_CONTAINER); 1335 ADD_DSDB_STRING(DS_GUID_NTDS_QUOTAS_CONTAINER); 1336 ADD_DSDB_STRING(DS_GUID_PROGRAM_DATA_CONTAINER); 1337 ADD_DSDB_STRING(DS_GUID_SYSTEMS_CONTAINER); 1338 ADD_DSDB_STRING(DS_GUID_USERS_CONTAINER); 1339 }
Note:
See TracChangeset
for help on using the changeset viewer.