Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
1 deleted
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source4/librpc/ndr/py_misc.c

    r414 r745  
    6262static int py_GUID_init(PyObject *self, PyObject *args, PyObject *kwargs)
    6363{
    64         char *str = NULL;
     64        PyObject *str = NULL;
    6565        NTSTATUS status;
    6666        struct GUID *guid = py_talloc_get_ptr(self);
    6767        const char *kwnames[] = { "str", NULL };
    6868
    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))
    7070                return -1;
    7171
    7272        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);
    7482                if (!NT_STATUS_IS_OK(status)) {
    7583                        PyErr_SetNTSTATUS(status);
  • trunk/server/source4/librpc/ndr/py_security.c

    r414 r745  
    4242}
    4343
     44static 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
    4471static int py_dom_sid_cmp(PyObject *py_self, PyObject *py_other)
    4572{
     
    87114}
    88115
     116static 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
    89124static void py_dom_sid_patch(PyTypeObject *type)
    90125{
     
    93128        type->tp_repr = py_dom_sid_repr;
    94129        type->tp_compare = py_dom_sid_cmp;
     130        PyType_AddMethods(type, py_dom_sid_extra_methods);
    95131}
    96132
Note: See TracChangeset for help on using the changeset viewer.