Changeset 745 for trunk/server/source4/librpc/ndr
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 1 deleted
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source4/librpc/ndr/py_misc.c
r414 r745 62 62 static int py_GUID_init(PyObject *self, PyObject *args, PyObject *kwargs) 63 63 { 64 char*str = NULL;64 PyObject *str = NULL; 65 65 NTSTATUS status; 66 66 struct GUID *guid = py_talloc_get_ptr(self); 67 67 const char *kwnames[] = { "str", NULL }; 68 68 69 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "| s", discard_const_p(char *, kwnames), &str))69 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O", discard_const_p(char *, kwnames), &str)) 70 70 return -1; 71 71 72 72 if (str != NULL) { 73 status = GUID_from_string(str, guid); 73 DATA_BLOB guid_val; 74 75 if (!PyString_Check(str)) { 76 PyErr_SetString(PyExc_TypeError, "Expected a string argument to GUID()"); 77 return -1; 78 } 79 guid_val.data = (uint8_t *)PyString_AsString(str); 80 guid_val.length = PyString_Size(str); 81 status = GUID_from_data_blob(&guid_val, guid); 74 82 if (!NT_STATUS_IS_OK(status)) { 75 83 PyErr_SetNTSTATUS(status); -
trunk/server/source4/librpc/ndr/py_security.c
r414 r745 42 42 } 43 43 44 static PyObject *py_dom_sid_split(PyObject *py_self, PyObject *args) 45 { 46 struct dom_sid *self = py_talloc_get_ptr(py_self); 47 struct dom_sid *domain_sid; 48 TALLOC_CTX *mem_ctx; 49 uint32_t rid; 50 NTSTATUS status; 51 PyObject *py_domain_sid; 52 53 mem_ctx = talloc_new(NULL); 54 if (mem_ctx == NULL) { 55 PyErr_NoMemory(); 56 return NULL; 57 } 58 59 status = dom_sid_split_rid(mem_ctx, self, &domain_sid, &rid); 60 if (!NT_STATUS_IS_OK(status)) { 61 PyErr_SetString(PyExc_RuntimeError, "dom_sid_split_rid failed"); 62 talloc_free(mem_ctx); 63 return NULL; 64 } 65 66 py_domain_sid = py_talloc_steal(&dom_sid_Type, domain_sid); 67 talloc_free(mem_ctx); 68 return Py_BuildValue("(OI)", py_domain_sid, rid); 69 } 70 44 71 static int py_dom_sid_cmp(PyObject *py_self, PyObject *py_other) 45 72 { … … 87 114 } 88 115 116 static PyMethodDef py_dom_sid_extra_methods[] = { 117 { "split", (PyCFunction)py_dom_sid_split, METH_NOARGS, 118 "S.split() -> (domain_sid, rid)\n" 119 "Split a domain sid" }, 120 { NULL } 121 }; 122 123 89 124 static void py_dom_sid_patch(PyTypeObject *type) 90 125 { … … 93 128 type->tp_repr = py_dom_sid_repr; 94 129 type->tp_compare = py_dom_sid_cmp; 130 PyType_AddMethods(type, py_dom_sid_extra_methods); 95 131 } 96 132
Note:
See TracChangeset
for help on using the changeset viewer.