| 1 |
|
|---|
| 2 | /* Python wrapper functions auto-generated by pidl */
|
|---|
| 3 | #include <Python.h>
|
|---|
| 4 | #include "includes.h"
|
|---|
| 5 | #include <pytalloc.h>
|
|---|
| 6 | #include "librpc/rpc/pyrpc.h"
|
|---|
| 7 | #include "librpc/rpc/pyrpc_util.h"
|
|---|
| 8 | #include "librpc/gen_ndr/ndr_backupkey.h"
|
|---|
| 9 | #include "librpc/gen_ndr/ndr_backupkey_c.h"
|
|---|
| 10 |
|
|---|
| 11 | #include "librpc/gen_ndr/misc.h"
|
|---|
| 12 | #include "librpc/gen_ndr/security.h"
|
|---|
| 13 | staticforward PyTypeObject bkrp_exported_RSA_key_pair_Type;
|
|---|
| 14 | staticforward PyTypeObject bkrp_dc_serverwrap_key_Type;
|
|---|
| 15 | staticforward PyTypeObject bkrp_client_side_wrapped_Type;
|
|---|
| 16 | staticforward PyTypeObject bkrp_client_side_unwrapped_Type;
|
|---|
| 17 | staticforward PyTypeObject bkrp_encrypted_secret_v2_Type;
|
|---|
| 18 | staticforward PyTypeObject bkrp_encrypted_secret_v3_Type;
|
|---|
| 19 | staticforward PyTypeObject bkrp_access_check_v2_Type;
|
|---|
| 20 | staticforward PyTypeObject bkrp_access_check_v3_Type;
|
|---|
| 21 | staticforward PyTypeObject backupkey_InterfaceType;
|
|---|
| 22 |
|
|---|
| 23 | void initbackupkey(void);static PyTypeObject *dom_sid_Type;
|
|---|
| 24 | static PyTypeObject *Object_Type;
|
|---|
| 25 | static PyTypeObject *GUID_Type;
|
|---|
| 26 | static PyTypeObject *ClientConnection_Type;
|
|---|
| 27 |
|
|---|
| 28 | static PyObject *py_bkrp_exported_RSA_key_pair_get_header1(PyObject *obj, void *closure)
|
|---|
| 29 | {
|
|---|
| 30 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(obj);
|
|---|
| 31 | PyObject *py_header1;
|
|---|
| 32 | py_header1 = PyInt_FromLong(object->header1);
|
|---|
| 33 | return py_header1;
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | static int py_bkrp_exported_RSA_key_pair_set_header1(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 37 | {
|
|---|
| 38 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(py_obj);
|
|---|
| 39 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 40 | object->header1 = PyInt_AsLong(value);
|
|---|
| 41 | return 0;
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | static PyObject *py_bkrp_exported_RSA_key_pair_get_header2(PyObject *obj, void *closure)
|
|---|
| 45 | {
|
|---|
| 46 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(obj);
|
|---|
| 47 | PyObject *py_header2;
|
|---|
| 48 | py_header2 = PyInt_FromLong(object->header2);
|
|---|
| 49 | return py_header2;
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | static int py_bkrp_exported_RSA_key_pair_set_header2(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 53 | {
|
|---|
| 54 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(py_obj);
|
|---|
| 55 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 56 | object->header2 = PyInt_AsLong(value);
|
|---|
| 57 | return 0;
|
|---|
| 58 | }
|
|---|
| 59 |
|
|---|
| 60 | static PyObject *py_bkrp_exported_RSA_key_pair_get_certificate_len(PyObject *obj, void *closure)
|
|---|
| 61 | {
|
|---|
| 62 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(obj);
|
|---|
| 63 | PyObject *py_certificate_len;
|
|---|
| 64 | py_certificate_len = PyInt_FromLong(object->certificate_len);
|
|---|
| 65 | return py_certificate_len;
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | static int py_bkrp_exported_RSA_key_pair_set_certificate_len(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 69 | {
|
|---|
| 70 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(py_obj);
|
|---|
| 71 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 72 | object->certificate_len = PyInt_AsLong(value);
|
|---|
| 73 | return 0;
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 | static PyObject *py_bkrp_exported_RSA_key_pair_get_magic1(PyObject *obj, void *closure)
|
|---|
| 77 | {
|
|---|
| 78 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(obj);
|
|---|
| 79 | PyObject *py_magic1;
|
|---|
| 80 | py_magic1 = PyInt_FromLong(object->magic1);
|
|---|
| 81 | return py_magic1;
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | static int py_bkrp_exported_RSA_key_pair_set_magic1(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 85 | {
|
|---|
| 86 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(py_obj);
|
|---|
| 87 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 88 | object->magic1 = PyInt_AsLong(value);
|
|---|
| 89 | return 0;
|
|---|
| 90 | }
|
|---|
| 91 |
|
|---|
| 92 | static PyObject *py_bkrp_exported_RSA_key_pair_get_magic2(PyObject *obj, void *closure)
|
|---|
| 93 | {
|
|---|
| 94 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(obj);
|
|---|
| 95 | PyObject *py_magic2;
|
|---|
| 96 | py_magic2 = PyInt_FromLong(object->magic2);
|
|---|
| 97 | return py_magic2;
|
|---|
| 98 | }
|
|---|
| 99 |
|
|---|
| 100 | static int py_bkrp_exported_RSA_key_pair_set_magic2(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 101 | {
|
|---|
| 102 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(py_obj);
|
|---|
| 103 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 104 | object->magic2 = PyInt_AsLong(value);
|
|---|
| 105 | return 0;
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 | static PyObject *py_bkrp_exported_RSA_key_pair_get_magic3(PyObject *obj, void *closure)
|
|---|
| 109 | {
|
|---|
| 110 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(obj);
|
|---|
| 111 | PyObject *py_magic3;
|
|---|
| 112 | py_magic3 = PyInt_FromLong(object->magic3);
|
|---|
| 113 | return py_magic3;
|
|---|
| 114 | }
|
|---|
| 115 |
|
|---|
| 116 | static int py_bkrp_exported_RSA_key_pair_set_magic3(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 117 | {
|
|---|
| 118 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(py_obj);
|
|---|
| 119 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 120 | object->magic3 = PyInt_AsLong(value);
|
|---|
| 121 | return 0;
|
|---|
| 122 | }
|
|---|
| 123 |
|
|---|
| 124 | static PyObject *py_bkrp_exported_RSA_key_pair_get_magic4(PyObject *obj, void *closure)
|
|---|
| 125 | {
|
|---|
| 126 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(obj);
|
|---|
| 127 | PyObject *py_magic4;
|
|---|
| 128 | py_magic4 = PyInt_FromLong(object->magic4);
|
|---|
| 129 | return py_magic4;
|
|---|
| 130 | }
|
|---|
| 131 |
|
|---|
| 132 | static int py_bkrp_exported_RSA_key_pair_set_magic4(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 133 | {
|
|---|
| 134 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(py_obj);
|
|---|
| 135 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 136 | object->magic4 = PyInt_AsLong(value);
|
|---|
| 137 | return 0;
|
|---|
| 138 | }
|
|---|
| 139 |
|
|---|
| 140 | static PyObject *py_bkrp_exported_RSA_key_pair_get_public_exponent(PyObject *obj, void *closure)
|
|---|
| 141 | {
|
|---|
| 142 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(obj);
|
|---|
| 143 | PyObject *py_public_exponent;
|
|---|
| 144 | py_public_exponent = PyString_FromStringAndSize((char *)(object->public_exponent).data, (object->public_exponent).length);
|
|---|
| 145 | return py_public_exponent;
|
|---|
| 146 | }
|
|---|
| 147 |
|
|---|
| 148 | static int py_bkrp_exported_RSA_key_pair_set_public_exponent(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 149 | {
|
|---|
| 150 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(py_obj);
|
|---|
| 151 | object->public_exponent = data_blob_talloc(py_talloc_get_mem_ctx(py_obj), PyString_AS_STRING(value), PyString_GET_SIZE(value));
|
|---|
| 152 | return 0;
|
|---|
| 153 | }
|
|---|
| 154 |
|
|---|
| 155 | static PyObject *py_bkrp_exported_RSA_key_pair_get_modulus(PyObject *obj, void *closure)
|
|---|
| 156 | {
|
|---|
| 157 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(obj);
|
|---|
| 158 | PyObject *py_modulus;
|
|---|
| 159 | py_modulus = PyString_FromStringAndSize((char *)(object->modulus).data, (object->modulus).length);
|
|---|
| 160 | return py_modulus;
|
|---|
| 161 | }
|
|---|
| 162 |
|
|---|
| 163 | static int py_bkrp_exported_RSA_key_pair_set_modulus(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 164 | {
|
|---|
| 165 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(py_obj);
|
|---|
| 166 | object->modulus = data_blob_talloc(py_talloc_get_mem_ctx(py_obj), PyString_AS_STRING(value), PyString_GET_SIZE(value));
|
|---|
| 167 | return 0;
|
|---|
| 168 | }
|
|---|
| 169 |
|
|---|
| 170 | static PyObject *py_bkrp_exported_RSA_key_pair_get_prime1(PyObject *obj, void *closure)
|
|---|
| 171 | {
|
|---|
| 172 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(obj);
|
|---|
| 173 | PyObject *py_prime1;
|
|---|
| 174 | py_prime1 = PyString_FromStringAndSize((char *)(object->prime1).data, (object->prime1).length);
|
|---|
| 175 | return py_prime1;
|
|---|
| 176 | }
|
|---|
| 177 |
|
|---|
| 178 | static int py_bkrp_exported_RSA_key_pair_set_prime1(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 179 | {
|
|---|
| 180 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(py_obj);
|
|---|
| 181 | object->prime1 = data_blob_talloc(py_talloc_get_mem_ctx(py_obj), PyString_AS_STRING(value), PyString_GET_SIZE(value));
|
|---|
| 182 | return 0;
|
|---|
| 183 | }
|
|---|
| 184 |
|
|---|
| 185 | static PyObject *py_bkrp_exported_RSA_key_pair_get_prime2(PyObject *obj, void *closure)
|
|---|
| 186 | {
|
|---|
| 187 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(obj);
|
|---|
| 188 | PyObject *py_prime2;
|
|---|
| 189 | py_prime2 = PyString_FromStringAndSize((char *)(object->prime2).data, (object->prime2).length);
|
|---|
| 190 | return py_prime2;
|
|---|
| 191 | }
|
|---|
| 192 |
|
|---|
| 193 | static int py_bkrp_exported_RSA_key_pair_set_prime2(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 194 | {
|
|---|
| 195 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(py_obj);
|
|---|
| 196 | object->prime2 = data_blob_talloc(py_talloc_get_mem_ctx(py_obj), PyString_AS_STRING(value), PyString_GET_SIZE(value));
|
|---|
| 197 | return 0;
|
|---|
| 198 | }
|
|---|
| 199 |
|
|---|
| 200 | static PyObject *py_bkrp_exported_RSA_key_pair_get_exponent1(PyObject *obj, void *closure)
|
|---|
| 201 | {
|
|---|
| 202 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(obj);
|
|---|
| 203 | PyObject *py_exponent1;
|
|---|
| 204 | py_exponent1 = PyString_FromStringAndSize((char *)(object->exponent1).data, (object->exponent1).length);
|
|---|
| 205 | return py_exponent1;
|
|---|
| 206 | }
|
|---|
| 207 |
|
|---|
| 208 | static int py_bkrp_exported_RSA_key_pair_set_exponent1(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 209 | {
|
|---|
| 210 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(py_obj);
|
|---|
| 211 | object->exponent1 = data_blob_talloc(py_talloc_get_mem_ctx(py_obj), PyString_AS_STRING(value), PyString_GET_SIZE(value));
|
|---|
| 212 | return 0;
|
|---|
| 213 | }
|
|---|
| 214 |
|
|---|
| 215 | static PyObject *py_bkrp_exported_RSA_key_pair_get_exponent2(PyObject *obj, void *closure)
|
|---|
| 216 | {
|
|---|
| 217 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(obj);
|
|---|
| 218 | PyObject *py_exponent2;
|
|---|
| 219 | py_exponent2 = PyString_FromStringAndSize((char *)(object->exponent2).data, (object->exponent2).length);
|
|---|
| 220 | return py_exponent2;
|
|---|
| 221 | }
|
|---|
| 222 |
|
|---|
| 223 | static int py_bkrp_exported_RSA_key_pair_set_exponent2(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 224 | {
|
|---|
| 225 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(py_obj);
|
|---|
| 226 | object->exponent2 = data_blob_talloc(py_talloc_get_mem_ctx(py_obj), PyString_AS_STRING(value), PyString_GET_SIZE(value));
|
|---|
| 227 | return 0;
|
|---|
| 228 | }
|
|---|
| 229 |
|
|---|
| 230 | static PyObject *py_bkrp_exported_RSA_key_pair_get_coefficient(PyObject *obj, void *closure)
|
|---|
| 231 | {
|
|---|
| 232 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(obj);
|
|---|
| 233 | PyObject *py_coefficient;
|
|---|
| 234 | py_coefficient = PyString_FromStringAndSize((char *)(object->coefficient).data, (object->coefficient).length);
|
|---|
| 235 | return py_coefficient;
|
|---|
| 236 | }
|
|---|
| 237 |
|
|---|
| 238 | static int py_bkrp_exported_RSA_key_pair_set_coefficient(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 239 | {
|
|---|
| 240 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(py_obj);
|
|---|
| 241 | object->coefficient = data_blob_talloc(py_talloc_get_mem_ctx(py_obj), PyString_AS_STRING(value), PyString_GET_SIZE(value));
|
|---|
| 242 | return 0;
|
|---|
| 243 | }
|
|---|
| 244 |
|
|---|
| 245 | static PyObject *py_bkrp_exported_RSA_key_pair_get_private_exponent(PyObject *obj, void *closure)
|
|---|
| 246 | {
|
|---|
| 247 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(obj);
|
|---|
| 248 | PyObject *py_private_exponent;
|
|---|
| 249 | py_private_exponent = PyString_FromStringAndSize((char *)(object->private_exponent).data, (object->private_exponent).length);
|
|---|
| 250 | return py_private_exponent;
|
|---|
| 251 | }
|
|---|
| 252 |
|
|---|
| 253 | static int py_bkrp_exported_RSA_key_pair_set_private_exponent(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 254 | {
|
|---|
| 255 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(py_obj);
|
|---|
| 256 | object->private_exponent = data_blob_talloc(py_talloc_get_mem_ctx(py_obj), PyString_AS_STRING(value), PyString_GET_SIZE(value));
|
|---|
| 257 | return 0;
|
|---|
| 258 | }
|
|---|
| 259 |
|
|---|
| 260 | static PyObject *py_bkrp_exported_RSA_key_pair_get_cert(PyObject *obj, void *closure)
|
|---|
| 261 | {
|
|---|
| 262 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(obj);
|
|---|
| 263 | PyObject *py_cert;
|
|---|
| 264 | py_cert = PyString_FromStringAndSize((char *)(object->cert).data, (object->cert).length);
|
|---|
| 265 | return py_cert;
|
|---|
| 266 | }
|
|---|
| 267 |
|
|---|
| 268 | static int py_bkrp_exported_RSA_key_pair_set_cert(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 269 | {
|
|---|
| 270 | struct bkrp_exported_RSA_key_pair *object = (struct bkrp_exported_RSA_key_pair *)py_talloc_get_ptr(py_obj);
|
|---|
| 271 | object->cert = data_blob_talloc(py_talloc_get_mem_ctx(py_obj), PyString_AS_STRING(value), PyString_GET_SIZE(value));
|
|---|
| 272 | return 0;
|
|---|
| 273 | }
|
|---|
| 274 |
|
|---|
| 275 | static PyGetSetDef py_bkrp_exported_RSA_key_pair_getsetters[] = {
|
|---|
| 276 | { discard_const_p(char, "header1"), py_bkrp_exported_RSA_key_pair_get_header1, py_bkrp_exported_RSA_key_pair_set_header1 },
|
|---|
| 277 | { discard_const_p(char, "header2"), py_bkrp_exported_RSA_key_pair_get_header2, py_bkrp_exported_RSA_key_pair_set_header2 },
|
|---|
| 278 | { discard_const_p(char, "certificate_len"), py_bkrp_exported_RSA_key_pair_get_certificate_len, py_bkrp_exported_RSA_key_pair_set_certificate_len },
|
|---|
| 279 | { discard_const_p(char, "magic1"), py_bkrp_exported_RSA_key_pair_get_magic1, py_bkrp_exported_RSA_key_pair_set_magic1 },
|
|---|
| 280 | { discard_const_p(char, "magic2"), py_bkrp_exported_RSA_key_pair_get_magic2, py_bkrp_exported_RSA_key_pair_set_magic2 },
|
|---|
| 281 | { discard_const_p(char, "magic3"), py_bkrp_exported_RSA_key_pair_get_magic3, py_bkrp_exported_RSA_key_pair_set_magic3 },
|
|---|
| 282 | { discard_const_p(char, "magic4"), py_bkrp_exported_RSA_key_pair_get_magic4, py_bkrp_exported_RSA_key_pair_set_magic4 },
|
|---|
| 283 | { discard_const_p(char, "public_exponent"), py_bkrp_exported_RSA_key_pair_get_public_exponent, py_bkrp_exported_RSA_key_pair_set_public_exponent },
|
|---|
| 284 | { discard_const_p(char, "modulus"), py_bkrp_exported_RSA_key_pair_get_modulus, py_bkrp_exported_RSA_key_pair_set_modulus },
|
|---|
| 285 | { discard_const_p(char, "prime1"), py_bkrp_exported_RSA_key_pair_get_prime1, py_bkrp_exported_RSA_key_pair_set_prime1 },
|
|---|
| 286 | { discard_const_p(char, "prime2"), py_bkrp_exported_RSA_key_pair_get_prime2, py_bkrp_exported_RSA_key_pair_set_prime2 },
|
|---|
| 287 | { discard_const_p(char, "exponent1"), py_bkrp_exported_RSA_key_pair_get_exponent1, py_bkrp_exported_RSA_key_pair_set_exponent1 },
|
|---|
| 288 | { discard_const_p(char, "exponent2"), py_bkrp_exported_RSA_key_pair_get_exponent2, py_bkrp_exported_RSA_key_pair_set_exponent2 },
|
|---|
| 289 | { discard_const_p(char, "coefficient"), py_bkrp_exported_RSA_key_pair_get_coefficient, py_bkrp_exported_RSA_key_pair_set_coefficient },
|
|---|
| 290 | { discard_const_p(char, "private_exponent"), py_bkrp_exported_RSA_key_pair_get_private_exponent, py_bkrp_exported_RSA_key_pair_set_private_exponent },
|
|---|
| 291 | { discard_const_p(char, "cert"), py_bkrp_exported_RSA_key_pair_get_cert, py_bkrp_exported_RSA_key_pair_set_cert },
|
|---|
| 292 | { NULL }
|
|---|
| 293 | };
|
|---|
| 294 |
|
|---|
| 295 | static PyObject *py_bkrp_exported_RSA_key_pair_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|---|
| 296 | {
|
|---|
| 297 | return py_talloc_new(struct bkrp_exported_RSA_key_pair, type);
|
|---|
| 298 | }
|
|---|
| 299 |
|
|---|
| 300 |
|
|---|
| 301 | static PyTypeObject bkrp_exported_RSA_key_pair_Type = {
|
|---|
| 302 | PyObject_HEAD_INIT(NULL) 0,
|
|---|
| 303 | .tp_name = "backupkey.bkrp_exported_RSA_key_pair",
|
|---|
| 304 | .tp_getset = py_bkrp_exported_RSA_key_pair_getsetters,
|
|---|
| 305 | .tp_methods = NULL,
|
|---|
| 306 | .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
|---|
| 307 | .tp_basicsize = sizeof(py_talloc_Object),
|
|---|
| 308 | .tp_new = py_bkrp_exported_RSA_key_pair_new,
|
|---|
| 309 | };
|
|---|
| 310 |
|
|---|
| 311 |
|
|---|
| 312 | static PyObject *py_bkrp_dc_serverwrap_key_get_magic(PyObject *obj, void *closure)
|
|---|
| 313 | {
|
|---|
| 314 | struct bkrp_dc_serverwrap_key *object = (struct bkrp_dc_serverwrap_key *)py_talloc_get_ptr(obj);
|
|---|
| 315 | PyObject *py_magic;
|
|---|
| 316 | py_magic = PyInt_FromLong(object->magic);
|
|---|
| 317 | return py_magic;
|
|---|
| 318 | }
|
|---|
| 319 |
|
|---|
| 320 | static int py_bkrp_dc_serverwrap_key_set_magic(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 321 | {
|
|---|
| 322 | struct bkrp_dc_serverwrap_key *object = (struct bkrp_dc_serverwrap_key *)py_talloc_get_ptr(py_obj);
|
|---|
| 323 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 324 | object->magic = PyInt_AsLong(value);
|
|---|
| 325 | return 0;
|
|---|
| 326 | }
|
|---|
| 327 |
|
|---|
| 328 | static PyObject *py_bkrp_dc_serverwrap_key_get_key(PyObject *obj, void *closure)
|
|---|
| 329 | {
|
|---|
| 330 | struct bkrp_dc_serverwrap_key *object = (struct bkrp_dc_serverwrap_key *)py_talloc_get_ptr(obj);
|
|---|
| 331 | PyObject *py_key;
|
|---|
| 332 | py_key = PyList_New(256);
|
|---|
| 333 | if (py_key == NULL) {
|
|---|
| 334 | return NULL;
|
|---|
| 335 | }
|
|---|
| 336 | {
|
|---|
| 337 | int key_cntr_0;
|
|---|
| 338 | for (key_cntr_0 = 0; key_cntr_0 < 256; key_cntr_0++) {
|
|---|
| 339 | PyObject *py_key_0;
|
|---|
| 340 | py_key_0 = PyInt_FromLong(object->key[key_cntr_0]);
|
|---|
| 341 | PyList_SetItem(py_key, key_cntr_0, py_key_0);
|
|---|
| 342 | }
|
|---|
| 343 | }
|
|---|
| 344 | return py_key;
|
|---|
| 345 | }
|
|---|
| 346 |
|
|---|
| 347 | static int py_bkrp_dc_serverwrap_key_set_key(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 348 | {
|
|---|
| 349 | struct bkrp_dc_serverwrap_key *object = (struct bkrp_dc_serverwrap_key *)py_talloc_get_ptr(py_obj);
|
|---|
| 350 | PY_CHECK_TYPE(&PyList_Type, value, return -1;);
|
|---|
| 351 | {
|
|---|
| 352 | int key_cntr_0;
|
|---|
| 353 | for (key_cntr_0 = 0; key_cntr_0 < PyList_GET_SIZE(value); key_cntr_0++) {
|
|---|
| 354 | PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, key_cntr_0), return -1;);
|
|---|
| 355 | object->key[key_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, key_cntr_0));
|
|---|
| 356 | }
|
|---|
| 357 | }
|
|---|
| 358 | return 0;
|
|---|
| 359 | }
|
|---|
| 360 |
|
|---|
| 361 | static PyGetSetDef py_bkrp_dc_serverwrap_key_getsetters[] = {
|
|---|
| 362 | { discard_const_p(char, "magic"), py_bkrp_dc_serverwrap_key_get_magic, py_bkrp_dc_serverwrap_key_set_magic },
|
|---|
| 363 | { discard_const_p(char, "key"), py_bkrp_dc_serverwrap_key_get_key, py_bkrp_dc_serverwrap_key_set_key },
|
|---|
| 364 | { NULL }
|
|---|
| 365 | };
|
|---|
| 366 |
|
|---|
| 367 | static PyObject *py_bkrp_dc_serverwrap_key_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|---|
| 368 | {
|
|---|
| 369 | return py_talloc_new(struct bkrp_dc_serverwrap_key, type);
|
|---|
| 370 | }
|
|---|
| 371 |
|
|---|
| 372 |
|
|---|
| 373 | static PyTypeObject bkrp_dc_serverwrap_key_Type = {
|
|---|
| 374 | PyObject_HEAD_INIT(NULL) 0,
|
|---|
| 375 | .tp_name = "backupkey.bkrp_dc_serverwrap_key",
|
|---|
| 376 | .tp_getset = py_bkrp_dc_serverwrap_key_getsetters,
|
|---|
| 377 | .tp_methods = NULL,
|
|---|
| 378 | .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
|---|
| 379 | .tp_basicsize = sizeof(py_talloc_Object),
|
|---|
| 380 | .tp_new = py_bkrp_dc_serverwrap_key_new,
|
|---|
| 381 | };
|
|---|
| 382 |
|
|---|
| 383 |
|
|---|
| 384 | static PyObject *py_bkrp_client_side_wrapped_get_version(PyObject *obj, void *closure)
|
|---|
| 385 | {
|
|---|
| 386 | struct bkrp_client_side_wrapped *object = (struct bkrp_client_side_wrapped *)py_talloc_get_ptr(obj);
|
|---|
| 387 | PyObject *py_version;
|
|---|
| 388 | py_version = PyInt_FromLong(object->version);
|
|---|
| 389 | return py_version;
|
|---|
| 390 | }
|
|---|
| 391 |
|
|---|
| 392 | static int py_bkrp_client_side_wrapped_set_version(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 393 | {
|
|---|
| 394 | struct bkrp_client_side_wrapped *object = (struct bkrp_client_side_wrapped *)py_talloc_get_ptr(py_obj);
|
|---|
| 395 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 396 | object->version = PyInt_AsLong(value);
|
|---|
| 397 | return 0;
|
|---|
| 398 | }
|
|---|
| 399 |
|
|---|
| 400 | static PyObject *py_bkrp_client_side_wrapped_get_encrypted_secret_len(PyObject *obj, void *closure)
|
|---|
| 401 | {
|
|---|
| 402 | struct bkrp_client_side_wrapped *object = (struct bkrp_client_side_wrapped *)py_talloc_get_ptr(obj);
|
|---|
| 403 | PyObject *py_encrypted_secret_len;
|
|---|
| 404 | py_encrypted_secret_len = PyInt_FromLong(object->encrypted_secret_len);
|
|---|
| 405 | return py_encrypted_secret_len;
|
|---|
| 406 | }
|
|---|
| 407 |
|
|---|
| 408 | static int py_bkrp_client_side_wrapped_set_encrypted_secret_len(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 409 | {
|
|---|
| 410 | struct bkrp_client_side_wrapped *object = (struct bkrp_client_side_wrapped *)py_talloc_get_ptr(py_obj);
|
|---|
| 411 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 412 | object->encrypted_secret_len = PyInt_AsLong(value);
|
|---|
| 413 | return 0;
|
|---|
| 414 | }
|
|---|
| 415 |
|
|---|
| 416 | static PyObject *py_bkrp_client_side_wrapped_get_access_check_len(PyObject *obj, void *closure)
|
|---|
| 417 | {
|
|---|
| 418 | struct bkrp_client_side_wrapped *object = (struct bkrp_client_side_wrapped *)py_talloc_get_ptr(obj);
|
|---|
| 419 | PyObject *py_access_check_len;
|
|---|
| 420 | py_access_check_len = PyInt_FromLong(object->access_check_len);
|
|---|
| 421 | return py_access_check_len;
|
|---|
| 422 | }
|
|---|
| 423 |
|
|---|
| 424 | static int py_bkrp_client_side_wrapped_set_access_check_len(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 425 | {
|
|---|
| 426 | struct bkrp_client_side_wrapped *object = (struct bkrp_client_side_wrapped *)py_talloc_get_ptr(py_obj);
|
|---|
| 427 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 428 | object->access_check_len = PyInt_AsLong(value);
|
|---|
| 429 | return 0;
|
|---|
| 430 | }
|
|---|
| 431 |
|
|---|
| 432 | static PyObject *py_bkrp_client_side_wrapped_get_guid(PyObject *obj, void *closure)
|
|---|
| 433 | {
|
|---|
| 434 | struct bkrp_client_side_wrapped *object = (struct bkrp_client_side_wrapped *)py_talloc_get_ptr(obj);
|
|---|
| 435 | PyObject *py_guid;
|
|---|
| 436 | py_guid = py_talloc_reference_ex(GUID_Type, py_talloc_get_mem_ctx(obj), &object->guid);
|
|---|
| 437 | return py_guid;
|
|---|
| 438 | }
|
|---|
| 439 |
|
|---|
| 440 | static int py_bkrp_client_side_wrapped_set_guid(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 441 | {
|
|---|
| 442 | struct bkrp_client_side_wrapped *object = (struct bkrp_client_side_wrapped *)py_talloc_get_ptr(py_obj);
|
|---|
| 443 | PY_CHECK_TYPE(GUID_Type, value, return -1;);
|
|---|
| 444 | if (talloc_reference(py_talloc_get_mem_ctx(py_obj), py_talloc_get_mem_ctx(value)) == NULL) {
|
|---|
| 445 | PyErr_NoMemory();
|
|---|
| 446 | return -1;
|
|---|
| 447 | }
|
|---|
| 448 | object->guid = *(struct GUID *)py_talloc_get_ptr(value);
|
|---|
| 449 | return 0;
|
|---|
| 450 | }
|
|---|
| 451 |
|
|---|
| 452 | static PyObject *py_bkrp_client_side_wrapped_get_encrypted_secret(PyObject *obj, void *closure)
|
|---|
| 453 | {
|
|---|
| 454 | struct bkrp_client_side_wrapped *object = (struct bkrp_client_side_wrapped *)py_talloc_get_ptr(obj);
|
|---|
| 455 | PyObject *py_encrypted_secret;
|
|---|
| 456 | py_encrypted_secret = PyList_New(object->encrypted_secret_len);
|
|---|
| 457 | if (py_encrypted_secret == NULL) {
|
|---|
| 458 | return NULL;
|
|---|
| 459 | }
|
|---|
| 460 | {
|
|---|
| 461 | int encrypted_secret_cntr_0;
|
|---|
| 462 | for (encrypted_secret_cntr_0 = 0; encrypted_secret_cntr_0 < object->encrypted_secret_len; encrypted_secret_cntr_0++) {
|
|---|
| 463 | PyObject *py_encrypted_secret_0;
|
|---|
| 464 | py_encrypted_secret_0 = PyInt_FromLong(object->encrypted_secret[encrypted_secret_cntr_0]);
|
|---|
| 465 | PyList_SetItem(py_encrypted_secret, encrypted_secret_cntr_0, py_encrypted_secret_0);
|
|---|
| 466 | }
|
|---|
| 467 | }
|
|---|
| 468 | return py_encrypted_secret;
|
|---|
| 469 | }
|
|---|
| 470 |
|
|---|
| 471 | static int py_bkrp_client_side_wrapped_set_encrypted_secret(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 472 | {
|
|---|
| 473 | struct bkrp_client_side_wrapped *object = (struct bkrp_client_side_wrapped *)py_talloc_get_ptr(py_obj);
|
|---|
| 474 | PY_CHECK_TYPE(&PyList_Type, value, return -1;);
|
|---|
| 475 | {
|
|---|
| 476 | int encrypted_secret_cntr_0;
|
|---|
| 477 | object->encrypted_secret = talloc_array_ptrtype(py_talloc_get_mem_ctx(py_obj), object->encrypted_secret, PyList_GET_SIZE(value));
|
|---|
| 478 | if (!object->encrypted_secret) { return -1;; }
|
|---|
| 479 | talloc_set_name_const(object->encrypted_secret, "ARRAY: object->encrypted_secret");
|
|---|
| 480 | for (encrypted_secret_cntr_0 = 0; encrypted_secret_cntr_0 < PyList_GET_SIZE(value); encrypted_secret_cntr_0++) {
|
|---|
| 481 | PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, encrypted_secret_cntr_0), return -1;);
|
|---|
| 482 | object->encrypted_secret[encrypted_secret_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, encrypted_secret_cntr_0));
|
|---|
| 483 | }
|
|---|
| 484 | }
|
|---|
| 485 | return 0;
|
|---|
| 486 | }
|
|---|
| 487 |
|
|---|
| 488 | static PyObject *py_bkrp_client_side_wrapped_get_access_check(PyObject *obj, void *closure)
|
|---|
| 489 | {
|
|---|
| 490 | struct bkrp_client_side_wrapped *object = (struct bkrp_client_side_wrapped *)py_talloc_get_ptr(obj);
|
|---|
| 491 | PyObject *py_access_check;
|
|---|
| 492 | py_access_check = PyList_New(object->access_check_len);
|
|---|
| 493 | if (py_access_check == NULL) {
|
|---|
| 494 | return NULL;
|
|---|
| 495 | }
|
|---|
| 496 | {
|
|---|
| 497 | int access_check_cntr_0;
|
|---|
| 498 | for (access_check_cntr_0 = 0; access_check_cntr_0 < object->access_check_len; access_check_cntr_0++) {
|
|---|
| 499 | PyObject *py_access_check_0;
|
|---|
| 500 | py_access_check_0 = PyInt_FromLong(object->access_check[access_check_cntr_0]);
|
|---|
| 501 | PyList_SetItem(py_access_check, access_check_cntr_0, py_access_check_0);
|
|---|
| 502 | }
|
|---|
| 503 | }
|
|---|
| 504 | return py_access_check;
|
|---|
| 505 | }
|
|---|
| 506 |
|
|---|
| 507 | static int py_bkrp_client_side_wrapped_set_access_check(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 508 | {
|
|---|
| 509 | struct bkrp_client_side_wrapped *object = (struct bkrp_client_side_wrapped *)py_talloc_get_ptr(py_obj);
|
|---|
| 510 | PY_CHECK_TYPE(&PyList_Type, value, return -1;);
|
|---|
| 511 | {
|
|---|
| 512 | int access_check_cntr_0;
|
|---|
| 513 | object->access_check = talloc_array_ptrtype(py_talloc_get_mem_ctx(py_obj), object->access_check, PyList_GET_SIZE(value));
|
|---|
| 514 | if (!object->access_check) { return -1;; }
|
|---|
| 515 | talloc_set_name_const(object->access_check, "ARRAY: object->access_check");
|
|---|
| 516 | for (access_check_cntr_0 = 0; access_check_cntr_0 < PyList_GET_SIZE(value); access_check_cntr_0++) {
|
|---|
| 517 | PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, access_check_cntr_0), return -1;);
|
|---|
| 518 | object->access_check[access_check_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, access_check_cntr_0));
|
|---|
| 519 | }
|
|---|
| 520 | }
|
|---|
| 521 | return 0;
|
|---|
| 522 | }
|
|---|
| 523 |
|
|---|
| 524 | static PyGetSetDef py_bkrp_client_side_wrapped_getsetters[] = {
|
|---|
| 525 | { discard_const_p(char, "version"), py_bkrp_client_side_wrapped_get_version, py_bkrp_client_side_wrapped_set_version },
|
|---|
| 526 | { discard_const_p(char, "encrypted_secret_len"), py_bkrp_client_side_wrapped_get_encrypted_secret_len, py_bkrp_client_side_wrapped_set_encrypted_secret_len },
|
|---|
| 527 | { discard_const_p(char, "access_check_len"), py_bkrp_client_side_wrapped_get_access_check_len, py_bkrp_client_side_wrapped_set_access_check_len },
|
|---|
| 528 | { discard_const_p(char, "guid"), py_bkrp_client_side_wrapped_get_guid, py_bkrp_client_side_wrapped_set_guid },
|
|---|
| 529 | { discard_const_p(char, "encrypted_secret"), py_bkrp_client_side_wrapped_get_encrypted_secret, py_bkrp_client_side_wrapped_set_encrypted_secret },
|
|---|
| 530 | { discard_const_p(char, "access_check"), py_bkrp_client_side_wrapped_get_access_check, py_bkrp_client_side_wrapped_set_access_check },
|
|---|
| 531 | { NULL }
|
|---|
| 532 | };
|
|---|
| 533 |
|
|---|
| 534 | static PyObject *py_bkrp_client_side_wrapped_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|---|
| 535 | {
|
|---|
| 536 | return py_talloc_new(struct bkrp_client_side_wrapped, type);
|
|---|
| 537 | }
|
|---|
| 538 |
|
|---|
| 539 |
|
|---|
| 540 | static PyTypeObject bkrp_client_side_wrapped_Type = {
|
|---|
| 541 | PyObject_HEAD_INIT(NULL) 0,
|
|---|
| 542 | .tp_name = "backupkey.bkrp_client_side_wrapped",
|
|---|
| 543 | .tp_getset = py_bkrp_client_side_wrapped_getsetters,
|
|---|
| 544 | .tp_methods = NULL,
|
|---|
| 545 | .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
|---|
| 546 | .tp_basicsize = sizeof(py_talloc_Object),
|
|---|
| 547 | .tp_new = py_bkrp_client_side_wrapped_new,
|
|---|
| 548 | };
|
|---|
| 549 |
|
|---|
| 550 |
|
|---|
| 551 | static PyObject *py_bkrp_client_side_unwrapped_get_magic(PyObject *obj, void *closure)
|
|---|
| 552 | {
|
|---|
| 553 | struct bkrp_client_side_unwrapped *object = (struct bkrp_client_side_unwrapped *)py_talloc_get_ptr(obj);
|
|---|
| 554 | PyObject *py_magic;
|
|---|
| 555 | py_magic = PyInt_FromLong(object->magic);
|
|---|
| 556 | return py_magic;
|
|---|
| 557 | }
|
|---|
| 558 |
|
|---|
| 559 | static int py_bkrp_client_side_unwrapped_set_magic(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 560 | {
|
|---|
| 561 | struct bkrp_client_side_unwrapped *object = (struct bkrp_client_side_unwrapped *)py_talloc_get_ptr(py_obj);
|
|---|
| 562 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 563 | object->magic = PyInt_AsLong(value);
|
|---|
| 564 | return 0;
|
|---|
| 565 | }
|
|---|
| 566 |
|
|---|
| 567 | static PyObject *py_bkrp_client_side_unwrapped_get_secret(PyObject *obj, void *closure)
|
|---|
| 568 | {
|
|---|
| 569 | struct bkrp_client_side_unwrapped *object = (struct bkrp_client_side_unwrapped *)py_talloc_get_ptr(obj);
|
|---|
| 570 | PyObject *py_secret;
|
|---|
| 571 | py_secret = PyString_FromStringAndSize((char *)(object->secret).data, (object->secret).length);
|
|---|
| 572 | return py_secret;
|
|---|
| 573 | }
|
|---|
| 574 |
|
|---|
| 575 | static int py_bkrp_client_side_unwrapped_set_secret(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 576 | {
|
|---|
| 577 | struct bkrp_client_side_unwrapped *object = (struct bkrp_client_side_unwrapped *)py_talloc_get_ptr(py_obj);
|
|---|
| 578 | object->secret = data_blob_talloc(py_talloc_get_mem_ctx(py_obj), PyString_AS_STRING(value), PyString_GET_SIZE(value));
|
|---|
| 579 | return 0;
|
|---|
| 580 | }
|
|---|
| 581 |
|
|---|
| 582 | static PyGetSetDef py_bkrp_client_side_unwrapped_getsetters[] = {
|
|---|
| 583 | { discard_const_p(char, "magic"), py_bkrp_client_side_unwrapped_get_magic, py_bkrp_client_side_unwrapped_set_magic },
|
|---|
| 584 | { discard_const_p(char, "secret"), py_bkrp_client_side_unwrapped_get_secret, py_bkrp_client_side_unwrapped_set_secret },
|
|---|
| 585 | { NULL }
|
|---|
| 586 | };
|
|---|
| 587 |
|
|---|
| 588 | static PyObject *py_bkrp_client_side_unwrapped_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|---|
| 589 | {
|
|---|
| 590 | return py_talloc_new(struct bkrp_client_side_unwrapped, type);
|
|---|
| 591 | }
|
|---|
| 592 |
|
|---|
| 593 |
|
|---|
| 594 | static PyTypeObject bkrp_client_side_unwrapped_Type = {
|
|---|
| 595 | PyObject_HEAD_INIT(NULL) 0,
|
|---|
| 596 | .tp_name = "backupkey.bkrp_client_side_unwrapped",
|
|---|
| 597 | .tp_getset = py_bkrp_client_side_unwrapped_getsetters,
|
|---|
| 598 | .tp_methods = NULL,
|
|---|
| 599 | .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
|---|
| 600 | .tp_basicsize = sizeof(py_talloc_Object),
|
|---|
| 601 | .tp_new = py_bkrp_client_side_unwrapped_new,
|
|---|
| 602 | };
|
|---|
| 603 |
|
|---|
| 604 |
|
|---|
| 605 | static PyObject *py_bkrp_encrypted_secret_v2_get_secret_len(PyObject *obj, void *closure)
|
|---|
| 606 | {
|
|---|
| 607 | struct bkrp_encrypted_secret_v2 *object = (struct bkrp_encrypted_secret_v2 *)py_talloc_get_ptr(obj);
|
|---|
| 608 | PyObject *py_secret_len;
|
|---|
| 609 | py_secret_len = PyInt_FromLong(object->secret_len);
|
|---|
| 610 | return py_secret_len;
|
|---|
| 611 | }
|
|---|
| 612 |
|
|---|
| 613 | static int py_bkrp_encrypted_secret_v2_set_secret_len(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 614 | {
|
|---|
| 615 | struct bkrp_encrypted_secret_v2 *object = (struct bkrp_encrypted_secret_v2 *)py_talloc_get_ptr(py_obj);
|
|---|
| 616 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 617 | object->secret_len = PyInt_AsLong(value);
|
|---|
| 618 | return 0;
|
|---|
| 619 | }
|
|---|
| 620 |
|
|---|
| 621 | static PyObject *py_bkrp_encrypted_secret_v2_get_magic(PyObject *obj, void *closure)
|
|---|
| 622 | {
|
|---|
| 623 | struct bkrp_encrypted_secret_v2 *object = (struct bkrp_encrypted_secret_v2 *)py_talloc_get_ptr(obj);
|
|---|
| 624 | PyObject *py_magic;
|
|---|
| 625 | py_magic = PyInt_FromLong(object->magic);
|
|---|
| 626 | return py_magic;
|
|---|
| 627 | }
|
|---|
| 628 |
|
|---|
| 629 | static int py_bkrp_encrypted_secret_v2_set_magic(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 630 | {
|
|---|
| 631 | struct bkrp_encrypted_secret_v2 *object = (struct bkrp_encrypted_secret_v2 *)py_talloc_get_ptr(py_obj);
|
|---|
| 632 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 633 | object->magic = PyInt_AsLong(value);
|
|---|
| 634 | return 0;
|
|---|
| 635 | }
|
|---|
| 636 |
|
|---|
| 637 | static PyObject *py_bkrp_encrypted_secret_v2_get_secret(PyObject *obj, void *closure)
|
|---|
| 638 | {
|
|---|
| 639 | struct bkrp_encrypted_secret_v2 *object = (struct bkrp_encrypted_secret_v2 *)py_talloc_get_ptr(obj);
|
|---|
| 640 | PyObject *py_secret;
|
|---|
| 641 | py_secret = PyList_New(object->secret_len);
|
|---|
| 642 | if (py_secret == NULL) {
|
|---|
| 643 | return NULL;
|
|---|
| 644 | }
|
|---|
| 645 | {
|
|---|
| 646 | int secret_cntr_0;
|
|---|
| 647 | for (secret_cntr_0 = 0; secret_cntr_0 < object->secret_len; secret_cntr_0++) {
|
|---|
| 648 | PyObject *py_secret_0;
|
|---|
| 649 | py_secret_0 = PyInt_FromLong(object->secret[secret_cntr_0]);
|
|---|
| 650 | PyList_SetItem(py_secret, secret_cntr_0, py_secret_0);
|
|---|
| 651 | }
|
|---|
| 652 | }
|
|---|
| 653 | return py_secret;
|
|---|
| 654 | }
|
|---|
| 655 |
|
|---|
| 656 | static int py_bkrp_encrypted_secret_v2_set_secret(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 657 | {
|
|---|
| 658 | struct bkrp_encrypted_secret_v2 *object = (struct bkrp_encrypted_secret_v2 *)py_talloc_get_ptr(py_obj);
|
|---|
| 659 | PY_CHECK_TYPE(&PyList_Type, value, return -1;);
|
|---|
| 660 | {
|
|---|
| 661 | int secret_cntr_0;
|
|---|
| 662 | object->secret = talloc_array_ptrtype(py_talloc_get_mem_ctx(py_obj), object->secret, PyList_GET_SIZE(value));
|
|---|
| 663 | if (!object->secret) { return -1;; }
|
|---|
| 664 | talloc_set_name_const(object->secret, "ARRAY: object->secret");
|
|---|
| 665 | for (secret_cntr_0 = 0; secret_cntr_0 < PyList_GET_SIZE(value); secret_cntr_0++) {
|
|---|
| 666 | PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, secret_cntr_0), return -1;);
|
|---|
| 667 | object->secret[secret_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, secret_cntr_0));
|
|---|
| 668 | }
|
|---|
| 669 | }
|
|---|
| 670 | return 0;
|
|---|
| 671 | }
|
|---|
| 672 |
|
|---|
| 673 | static PyObject *py_bkrp_encrypted_secret_v2_get_payload_key(PyObject *obj, void *closure)
|
|---|
| 674 | {
|
|---|
| 675 | struct bkrp_encrypted_secret_v2 *object = (struct bkrp_encrypted_secret_v2 *)py_talloc_get_ptr(obj);
|
|---|
| 676 | PyObject *py_payload_key;
|
|---|
| 677 | py_payload_key = PyList_New(32);
|
|---|
| 678 | if (py_payload_key == NULL) {
|
|---|
| 679 | return NULL;
|
|---|
| 680 | }
|
|---|
| 681 | {
|
|---|
| 682 | int payload_key_cntr_0;
|
|---|
| 683 | for (payload_key_cntr_0 = 0; payload_key_cntr_0 < 32; payload_key_cntr_0++) {
|
|---|
| 684 | PyObject *py_payload_key_0;
|
|---|
| 685 | py_payload_key_0 = PyInt_FromLong(object->payload_key[payload_key_cntr_0]);
|
|---|
| 686 | PyList_SetItem(py_payload_key, payload_key_cntr_0, py_payload_key_0);
|
|---|
| 687 | }
|
|---|
| 688 | }
|
|---|
| 689 | return py_payload_key;
|
|---|
| 690 | }
|
|---|
| 691 |
|
|---|
| 692 | static int py_bkrp_encrypted_secret_v2_set_payload_key(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 693 | {
|
|---|
| 694 | struct bkrp_encrypted_secret_v2 *object = (struct bkrp_encrypted_secret_v2 *)py_talloc_get_ptr(py_obj);
|
|---|
| 695 | PY_CHECK_TYPE(&PyList_Type, value, return -1;);
|
|---|
| 696 | {
|
|---|
| 697 | int payload_key_cntr_0;
|
|---|
| 698 | for (payload_key_cntr_0 = 0; payload_key_cntr_0 < PyList_GET_SIZE(value); payload_key_cntr_0++) {
|
|---|
| 699 | PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, payload_key_cntr_0), return -1;);
|
|---|
| 700 | object->payload_key[payload_key_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, payload_key_cntr_0));
|
|---|
| 701 | }
|
|---|
| 702 | }
|
|---|
| 703 | return 0;
|
|---|
| 704 | }
|
|---|
| 705 |
|
|---|
| 706 | static PyGetSetDef py_bkrp_encrypted_secret_v2_getsetters[] = {
|
|---|
| 707 | { discard_const_p(char, "secret_len"), py_bkrp_encrypted_secret_v2_get_secret_len, py_bkrp_encrypted_secret_v2_set_secret_len },
|
|---|
| 708 | { discard_const_p(char, "magic"), py_bkrp_encrypted_secret_v2_get_magic, py_bkrp_encrypted_secret_v2_set_magic },
|
|---|
| 709 | { discard_const_p(char, "secret"), py_bkrp_encrypted_secret_v2_get_secret, py_bkrp_encrypted_secret_v2_set_secret },
|
|---|
| 710 | { discard_const_p(char, "payload_key"), py_bkrp_encrypted_secret_v2_get_payload_key, py_bkrp_encrypted_secret_v2_set_payload_key },
|
|---|
| 711 | { NULL }
|
|---|
| 712 | };
|
|---|
| 713 |
|
|---|
| 714 | static PyObject *py_bkrp_encrypted_secret_v2_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|---|
| 715 | {
|
|---|
| 716 | return py_talloc_new(struct bkrp_encrypted_secret_v2, type);
|
|---|
| 717 | }
|
|---|
| 718 |
|
|---|
| 719 |
|
|---|
| 720 | static PyTypeObject bkrp_encrypted_secret_v2_Type = {
|
|---|
| 721 | PyObject_HEAD_INIT(NULL) 0,
|
|---|
| 722 | .tp_name = "backupkey.bkrp_encrypted_secret_v2",
|
|---|
| 723 | .tp_getset = py_bkrp_encrypted_secret_v2_getsetters,
|
|---|
| 724 | .tp_methods = NULL,
|
|---|
| 725 | .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
|---|
| 726 | .tp_basicsize = sizeof(py_talloc_Object),
|
|---|
| 727 | .tp_new = py_bkrp_encrypted_secret_v2_new,
|
|---|
| 728 | };
|
|---|
| 729 |
|
|---|
| 730 |
|
|---|
| 731 | static PyObject *py_bkrp_encrypted_secret_v3_get_secret_len(PyObject *obj, void *closure)
|
|---|
| 732 | {
|
|---|
| 733 | struct bkrp_encrypted_secret_v3 *object = (struct bkrp_encrypted_secret_v3 *)py_talloc_get_ptr(obj);
|
|---|
| 734 | PyObject *py_secret_len;
|
|---|
| 735 | py_secret_len = PyInt_FromLong(object->secret_len);
|
|---|
| 736 | return py_secret_len;
|
|---|
| 737 | }
|
|---|
| 738 |
|
|---|
| 739 | static int py_bkrp_encrypted_secret_v3_set_secret_len(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 740 | {
|
|---|
| 741 | struct bkrp_encrypted_secret_v3 *object = (struct bkrp_encrypted_secret_v3 *)py_talloc_get_ptr(py_obj);
|
|---|
| 742 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 743 | object->secret_len = PyInt_AsLong(value);
|
|---|
| 744 | return 0;
|
|---|
| 745 | }
|
|---|
| 746 |
|
|---|
| 747 | static PyObject *py_bkrp_encrypted_secret_v3_get_magic1(PyObject *obj, void *closure)
|
|---|
| 748 | {
|
|---|
| 749 | struct bkrp_encrypted_secret_v3 *object = (struct bkrp_encrypted_secret_v3 *)py_talloc_get_ptr(obj);
|
|---|
| 750 | PyObject *py_magic1;
|
|---|
| 751 | py_magic1 = PyInt_FromLong(object->magic1);
|
|---|
| 752 | return py_magic1;
|
|---|
| 753 | }
|
|---|
| 754 |
|
|---|
| 755 | static int py_bkrp_encrypted_secret_v3_set_magic1(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 756 | {
|
|---|
| 757 | struct bkrp_encrypted_secret_v3 *object = (struct bkrp_encrypted_secret_v3 *)py_talloc_get_ptr(py_obj);
|
|---|
| 758 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 759 | object->magic1 = PyInt_AsLong(value);
|
|---|
| 760 | return 0;
|
|---|
| 761 | }
|
|---|
| 762 |
|
|---|
| 763 | static PyObject *py_bkrp_encrypted_secret_v3_get_magic2(PyObject *obj, void *closure)
|
|---|
| 764 | {
|
|---|
| 765 | struct bkrp_encrypted_secret_v3 *object = (struct bkrp_encrypted_secret_v3 *)py_talloc_get_ptr(obj);
|
|---|
| 766 | PyObject *py_magic2;
|
|---|
| 767 | py_magic2 = PyInt_FromLong(object->magic2);
|
|---|
| 768 | return py_magic2;
|
|---|
| 769 | }
|
|---|
| 770 |
|
|---|
| 771 | static int py_bkrp_encrypted_secret_v3_set_magic2(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 772 | {
|
|---|
| 773 | struct bkrp_encrypted_secret_v3 *object = (struct bkrp_encrypted_secret_v3 *)py_talloc_get_ptr(py_obj);
|
|---|
| 774 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 775 | object->magic2 = PyInt_AsLong(value);
|
|---|
| 776 | return 0;
|
|---|
| 777 | }
|
|---|
| 778 |
|
|---|
| 779 | static PyObject *py_bkrp_encrypted_secret_v3_get_magic3(PyObject *obj, void *closure)
|
|---|
| 780 | {
|
|---|
| 781 | struct bkrp_encrypted_secret_v3 *object = (struct bkrp_encrypted_secret_v3 *)py_talloc_get_ptr(obj);
|
|---|
| 782 | PyObject *py_magic3;
|
|---|
| 783 | py_magic3 = PyInt_FromLong(object->magic3);
|
|---|
| 784 | return py_magic3;
|
|---|
| 785 | }
|
|---|
| 786 |
|
|---|
| 787 | static int py_bkrp_encrypted_secret_v3_set_magic3(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 788 | {
|
|---|
| 789 | struct bkrp_encrypted_secret_v3 *object = (struct bkrp_encrypted_secret_v3 *)py_talloc_get_ptr(py_obj);
|
|---|
| 790 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 791 | object->magic3 = PyInt_AsLong(value);
|
|---|
| 792 | return 0;
|
|---|
| 793 | }
|
|---|
| 794 |
|
|---|
| 795 | static PyObject *py_bkrp_encrypted_secret_v3_get_secret(PyObject *obj, void *closure)
|
|---|
| 796 | {
|
|---|
| 797 | struct bkrp_encrypted_secret_v3 *object = (struct bkrp_encrypted_secret_v3 *)py_talloc_get_ptr(obj);
|
|---|
| 798 | PyObject *py_secret;
|
|---|
| 799 | py_secret = PyList_New(object->secret_len);
|
|---|
| 800 | if (py_secret == NULL) {
|
|---|
| 801 | return NULL;
|
|---|
| 802 | }
|
|---|
| 803 | {
|
|---|
| 804 | int secret_cntr_0;
|
|---|
| 805 | for (secret_cntr_0 = 0; secret_cntr_0 < object->secret_len; secret_cntr_0++) {
|
|---|
| 806 | PyObject *py_secret_0;
|
|---|
| 807 | py_secret_0 = PyInt_FromLong(object->secret[secret_cntr_0]);
|
|---|
| 808 | PyList_SetItem(py_secret, secret_cntr_0, py_secret_0);
|
|---|
| 809 | }
|
|---|
| 810 | }
|
|---|
| 811 | return py_secret;
|
|---|
| 812 | }
|
|---|
| 813 |
|
|---|
| 814 | static int py_bkrp_encrypted_secret_v3_set_secret(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 815 | {
|
|---|
| 816 | struct bkrp_encrypted_secret_v3 *object = (struct bkrp_encrypted_secret_v3 *)py_talloc_get_ptr(py_obj);
|
|---|
| 817 | PY_CHECK_TYPE(&PyList_Type, value, return -1;);
|
|---|
| 818 | {
|
|---|
| 819 | int secret_cntr_0;
|
|---|
| 820 | object->secret = talloc_array_ptrtype(py_talloc_get_mem_ctx(py_obj), object->secret, PyList_GET_SIZE(value));
|
|---|
| 821 | if (!object->secret) { return -1;; }
|
|---|
| 822 | talloc_set_name_const(object->secret, "ARRAY: object->secret");
|
|---|
| 823 | for (secret_cntr_0 = 0; secret_cntr_0 < PyList_GET_SIZE(value); secret_cntr_0++) {
|
|---|
| 824 | PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, secret_cntr_0), return -1;);
|
|---|
| 825 | object->secret[secret_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, secret_cntr_0));
|
|---|
| 826 | }
|
|---|
| 827 | }
|
|---|
| 828 | return 0;
|
|---|
| 829 | }
|
|---|
| 830 |
|
|---|
| 831 | static PyObject *py_bkrp_encrypted_secret_v3_get_payload_key(PyObject *obj, void *closure)
|
|---|
| 832 | {
|
|---|
| 833 | struct bkrp_encrypted_secret_v3 *object = (struct bkrp_encrypted_secret_v3 *)py_talloc_get_ptr(obj);
|
|---|
| 834 | PyObject *py_payload_key;
|
|---|
| 835 | py_payload_key = PyList_New(48);
|
|---|
| 836 | if (py_payload_key == NULL) {
|
|---|
| 837 | return NULL;
|
|---|
| 838 | }
|
|---|
| 839 | {
|
|---|
| 840 | int payload_key_cntr_0;
|
|---|
| 841 | for (payload_key_cntr_0 = 0; payload_key_cntr_0 < 48; payload_key_cntr_0++) {
|
|---|
| 842 | PyObject *py_payload_key_0;
|
|---|
| 843 | py_payload_key_0 = PyInt_FromLong(object->payload_key[payload_key_cntr_0]);
|
|---|
| 844 | PyList_SetItem(py_payload_key, payload_key_cntr_0, py_payload_key_0);
|
|---|
| 845 | }
|
|---|
| 846 | }
|
|---|
| 847 | return py_payload_key;
|
|---|
| 848 | }
|
|---|
| 849 |
|
|---|
| 850 | static int py_bkrp_encrypted_secret_v3_set_payload_key(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 851 | {
|
|---|
| 852 | struct bkrp_encrypted_secret_v3 *object = (struct bkrp_encrypted_secret_v3 *)py_talloc_get_ptr(py_obj);
|
|---|
| 853 | PY_CHECK_TYPE(&PyList_Type, value, return -1;);
|
|---|
| 854 | {
|
|---|
| 855 | int payload_key_cntr_0;
|
|---|
| 856 | for (payload_key_cntr_0 = 0; payload_key_cntr_0 < PyList_GET_SIZE(value); payload_key_cntr_0++) {
|
|---|
| 857 | PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, payload_key_cntr_0), return -1;);
|
|---|
| 858 | object->payload_key[payload_key_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, payload_key_cntr_0));
|
|---|
| 859 | }
|
|---|
| 860 | }
|
|---|
| 861 | return 0;
|
|---|
| 862 | }
|
|---|
| 863 |
|
|---|
| 864 | static PyGetSetDef py_bkrp_encrypted_secret_v3_getsetters[] = {
|
|---|
| 865 | { discard_const_p(char, "secret_len"), py_bkrp_encrypted_secret_v3_get_secret_len, py_bkrp_encrypted_secret_v3_set_secret_len },
|
|---|
| 866 | { discard_const_p(char, "magic1"), py_bkrp_encrypted_secret_v3_get_magic1, py_bkrp_encrypted_secret_v3_set_magic1 },
|
|---|
| 867 | { discard_const_p(char, "magic2"), py_bkrp_encrypted_secret_v3_get_magic2, py_bkrp_encrypted_secret_v3_set_magic2 },
|
|---|
| 868 | { discard_const_p(char, "magic3"), py_bkrp_encrypted_secret_v3_get_magic3, py_bkrp_encrypted_secret_v3_set_magic3 },
|
|---|
| 869 | { discard_const_p(char, "secret"), py_bkrp_encrypted_secret_v3_get_secret, py_bkrp_encrypted_secret_v3_set_secret },
|
|---|
| 870 | { discard_const_p(char, "payload_key"), py_bkrp_encrypted_secret_v3_get_payload_key, py_bkrp_encrypted_secret_v3_set_payload_key },
|
|---|
| 871 | { NULL }
|
|---|
| 872 | };
|
|---|
| 873 |
|
|---|
| 874 | static PyObject *py_bkrp_encrypted_secret_v3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|---|
| 875 | {
|
|---|
| 876 | return py_talloc_new(struct bkrp_encrypted_secret_v3, type);
|
|---|
| 877 | }
|
|---|
| 878 |
|
|---|
| 879 |
|
|---|
| 880 | static PyTypeObject bkrp_encrypted_secret_v3_Type = {
|
|---|
| 881 | PyObject_HEAD_INIT(NULL) 0,
|
|---|
| 882 | .tp_name = "backupkey.bkrp_encrypted_secret_v3",
|
|---|
| 883 | .tp_getset = py_bkrp_encrypted_secret_v3_getsetters,
|
|---|
| 884 | .tp_methods = NULL,
|
|---|
| 885 | .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
|---|
| 886 | .tp_basicsize = sizeof(py_talloc_Object),
|
|---|
| 887 | .tp_new = py_bkrp_encrypted_secret_v3_new,
|
|---|
| 888 | };
|
|---|
| 889 |
|
|---|
| 890 |
|
|---|
| 891 | static PyObject *py_bkrp_access_check_v2_get_magic(PyObject *obj, void *closure)
|
|---|
| 892 | {
|
|---|
| 893 | struct bkrp_access_check_v2 *object = (struct bkrp_access_check_v2 *)py_talloc_get_ptr(obj);
|
|---|
| 894 | PyObject *py_magic;
|
|---|
| 895 | py_magic = PyInt_FromLong(object->magic);
|
|---|
| 896 | return py_magic;
|
|---|
| 897 | }
|
|---|
| 898 |
|
|---|
| 899 | static int py_bkrp_access_check_v2_set_magic(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 900 | {
|
|---|
| 901 | struct bkrp_access_check_v2 *object = (struct bkrp_access_check_v2 *)py_talloc_get_ptr(py_obj);
|
|---|
| 902 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 903 | object->magic = PyInt_AsLong(value);
|
|---|
| 904 | return 0;
|
|---|
| 905 | }
|
|---|
| 906 |
|
|---|
| 907 | static PyObject *py_bkrp_access_check_v2_get_nonce_len(PyObject *obj, void *closure)
|
|---|
| 908 | {
|
|---|
| 909 | struct bkrp_access_check_v2 *object = (struct bkrp_access_check_v2 *)py_talloc_get_ptr(obj);
|
|---|
| 910 | PyObject *py_nonce_len;
|
|---|
| 911 | py_nonce_len = PyInt_FromLong(object->nonce_len);
|
|---|
| 912 | return py_nonce_len;
|
|---|
| 913 | }
|
|---|
| 914 |
|
|---|
| 915 | static int py_bkrp_access_check_v2_set_nonce_len(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 916 | {
|
|---|
| 917 | struct bkrp_access_check_v2 *object = (struct bkrp_access_check_v2 *)py_talloc_get_ptr(py_obj);
|
|---|
| 918 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 919 | object->nonce_len = PyInt_AsLong(value);
|
|---|
| 920 | return 0;
|
|---|
| 921 | }
|
|---|
| 922 |
|
|---|
| 923 | static PyObject *py_bkrp_access_check_v2_get_nonce(PyObject *obj, void *closure)
|
|---|
| 924 | {
|
|---|
| 925 | struct bkrp_access_check_v2 *object = (struct bkrp_access_check_v2 *)py_talloc_get_ptr(obj);
|
|---|
| 926 | PyObject *py_nonce;
|
|---|
| 927 | py_nonce = PyList_New(object->nonce_len);
|
|---|
| 928 | if (py_nonce == NULL) {
|
|---|
| 929 | return NULL;
|
|---|
| 930 | }
|
|---|
| 931 | {
|
|---|
| 932 | int nonce_cntr_0;
|
|---|
| 933 | for (nonce_cntr_0 = 0; nonce_cntr_0 < object->nonce_len; nonce_cntr_0++) {
|
|---|
| 934 | PyObject *py_nonce_0;
|
|---|
| 935 | py_nonce_0 = PyInt_FromLong(object->nonce[nonce_cntr_0]);
|
|---|
| 936 | PyList_SetItem(py_nonce, nonce_cntr_0, py_nonce_0);
|
|---|
| 937 | }
|
|---|
| 938 | }
|
|---|
| 939 | return py_nonce;
|
|---|
| 940 | }
|
|---|
| 941 |
|
|---|
| 942 | static int py_bkrp_access_check_v2_set_nonce(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 943 | {
|
|---|
| 944 | struct bkrp_access_check_v2 *object = (struct bkrp_access_check_v2 *)py_talloc_get_ptr(py_obj);
|
|---|
| 945 | PY_CHECK_TYPE(&PyList_Type, value, return -1;);
|
|---|
| 946 | {
|
|---|
| 947 | int nonce_cntr_0;
|
|---|
| 948 | object->nonce = talloc_array_ptrtype(py_talloc_get_mem_ctx(py_obj), object->nonce, PyList_GET_SIZE(value));
|
|---|
| 949 | if (!object->nonce) { return -1;; }
|
|---|
| 950 | talloc_set_name_const(object->nonce, "ARRAY: object->nonce");
|
|---|
| 951 | for (nonce_cntr_0 = 0; nonce_cntr_0 < PyList_GET_SIZE(value); nonce_cntr_0++) {
|
|---|
| 952 | PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, nonce_cntr_0), return -1;);
|
|---|
| 953 | object->nonce[nonce_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, nonce_cntr_0));
|
|---|
| 954 | }
|
|---|
| 955 | }
|
|---|
| 956 | return 0;
|
|---|
| 957 | }
|
|---|
| 958 |
|
|---|
| 959 | static PyObject *py_bkrp_access_check_v2_get_sid(PyObject *obj, void *closure)
|
|---|
| 960 | {
|
|---|
| 961 | struct bkrp_access_check_v2 *object = (struct bkrp_access_check_v2 *)py_talloc_get_ptr(obj);
|
|---|
| 962 | PyObject *py_sid;
|
|---|
| 963 | py_sid = py_talloc_reference_ex(dom_sid_Type, py_talloc_get_mem_ctx(obj), &object->sid);
|
|---|
| 964 | return py_sid;
|
|---|
| 965 | }
|
|---|
| 966 |
|
|---|
| 967 | static int py_bkrp_access_check_v2_set_sid(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 968 | {
|
|---|
| 969 | struct bkrp_access_check_v2 *object = (struct bkrp_access_check_v2 *)py_talloc_get_ptr(py_obj);
|
|---|
| 970 | PY_CHECK_TYPE(dom_sid_Type, value, return -1;);
|
|---|
| 971 | if (talloc_reference(py_talloc_get_mem_ctx(py_obj), py_talloc_get_mem_ctx(value)) == NULL) {
|
|---|
| 972 | PyErr_NoMemory();
|
|---|
| 973 | return -1;
|
|---|
| 974 | }
|
|---|
| 975 | object->sid = *(struct dom_sid *)py_talloc_get_ptr(value);
|
|---|
| 976 | return 0;
|
|---|
| 977 | }
|
|---|
| 978 |
|
|---|
| 979 | static PyObject *py_bkrp_access_check_v2_get_hash(PyObject *obj, void *closure)
|
|---|
| 980 | {
|
|---|
| 981 | struct bkrp_access_check_v2 *object = (struct bkrp_access_check_v2 *)py_talloc_get_ptr(obj);
|
|---|
| 982 | PyObject *py_hash;
|
|---|
| 983 | py_hash = PyList_New(20);
|
|---|
| 984 | if (py_hash == NULL) {
|
|---|
| 985 | return NULL;
|
|---|
| 986 | }
|
|---|
| 987 | {
|
|---|
| 988 | int hash_cntr_0;
|
|---|
| 989 | for (hash_cntr_0 = 0; hash_cntr_0 < 20; hash_cntr_0++) {
|
|---|
| 990 | PyObject *py_hash_0;
|
|---|
| 991 | py_hash_0 = PyInt_FromLong(object->hash[hash_cntr_0]);
|
|---|
| 992 | PyList_SetItem(py_hash, hash_cntr_0, py_hash_0);
|
|---|
| 993 | }
|
|---|
| 994 | }
|
|---|
| 995 | return py_hash;
|
|---|
| 996 | }
|
|---|
| 997 |
|
|---|
| 998 | static int py_bkrp_access_check_v2_set_hash(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 999 | {
|
|---|
| 1000 | struct bkrp_access_check_v2 *object = (struct bkrp_access_check_v2 *)py_talloc_get_ptr(py_obj);
|
|---|
| 1001 | PY_CHECK_TYPE(&PyList_Type, value, return -1;);
|
|---|
| 1002 | {
|
|---|
| 1003 | int hash_cntr_0;
|
|---|
| 1004 | for (hash_cntr_0 = 0; hash_cntr_0 < PyList_GET_SIZE(value); hash_cntr_0++) {
|
|---|
| 1005 | PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, hash_cntr_0), return -1;);
|
|---|
| 1006 | object->hash[hash_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, hash_cntr_0));
|
|---|
| 1007 | }
|
|---|
| 1008 | }
|
|---|
| 1009 | return 0;
|
|---|
| 1010 | }
|
|---|
| 1011 |
|
|---|
| 1012 | static PyGetSetDef py_bkrp_access_check_v2_getsetters[] = {
|
|---|
| 1013 | { discard_const_p(char, "magic"), py_bkrp_access_check_v2_get_magic, py_bkrp_access_check_v2_set_magic },
|
|---|
| 1014 | { discard_const_p(char, "nonce_len"), py_bkrp_access_check_v2_get_nonce_len, py_bkrp_access_check_v2_set_nonce_len },
|
|---|
| 1015 | { discard_const_p(char, "nonce"), py_bkrp_access_check_v2_get_nonce, py_bkrp_access_check_v2_set_nonce },
|
|---|
| 1016 | { discard_const_p(char, "sid"), py_bkrp_access_check_v2_get_sid, py_bkrp_access_check_v2_set_sid },
|
|---|
| 1017 | { discard_const_p(char, "hash"), py_bkrp_access_check_v2_get_hash, py_bkrp_access_check_v2_set_hash },
|
|---|
| 1018 | { NULL }
|
|---|
| 1019 | };
|
|---|
| 1020 |
|
|---|
| 1021 | static PyObject *py_bkrp_access_check_v2_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|---|
| 1022 | {
|
|---|
| 1023 | return py_talloc_new(struct bkrp_access_check_v2, type);
|
|---|
| 1024 | }
|
|---|
| 1025 |
|
|---|
| 1026 |
|
|---|
| 1027 | static PyTypeObject bkrp_access_check_v2_Type = {
|
|---|
| 1028 | PyObject_HEAD_INIT(NULL) 0,
|
|---|
| 1029 | .tp_name = "backupkey.bkrp_access_check_v2",
|
|---|
| 1030 | .tp_getset = py_bkrp_access_check_v2_getsetters,
|
|---|
| 1031 | .tp_methods = NULL,
|
|---|
| 1032 | .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
|---|
| 1033 | .tp_basicsize = sizeof(py_talloc_Object),
|
|---|
| 1034 | .tp_new = py_bkrp_access_check_v2_new,
|
|---|
| 1035 | };
|
|---|
| 1036 |
|
|---|
| 1037 |
|
|---|
| 1038 | static PyObject *py_bkrp_access_check_v3_get_magic(PyObject *obj, void *closure)
|
|---|
| 1039 | {
|
|---|
| 1040 | struct bkrp_access_check_v3 *object = (struct bkrp_access_check_v3 *)py_talloc_get_ptr(obj);
|
|---|
| 1041 | PyObject *py_magic;
|
|---|
| 1042 | py_magic = PyInt_FromLong(object->magic);
|
|---|
| 1043 | return py_magic;
|
|---|
| 1044 | }
|
|---|
| 1045 |
|
|---|
| 1046 | static int py_bkrp_access_check_v3_set_magic(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 1047 | {
|
|---|
| 1048 | struct bkrp_access_check_v3 *object = (struct bkrp_access_check_v3 *)py_talloc_get_ptr(py_obj);
|
|---|
| 1049 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 1050 | object->magic = PyInt_AsLong(value);
|
|---|
| 1051 | return 0;
|
|---|
| 1052 | }
|
|---|
| 1053 |
|
|---|
| 1054 | static PyObject *py_bkrp_access_check_v3_get_nonce_len(PyObject *obj, void *closure)
|
|---|
| 1055 | {
|
|---|
| 1056 | struct bkrp_access_check_v3 *object = (struct bkrp_access_check_v3 *)py_talloc_get_ptr(obj);
|
|---|
| 1057 | PyObject *py_nonce_len;
|
|---|
| 1058 | py_nonce_len = PyInt_FromLong(object->nonce_len);
|
|---|
| 1059 | return py_nonce_len;
|
|---|
| 1060 | }
|
|---|
| 1061 |
|
|---|
| 1062 | static int py_bkrp_access_check_v3_set_nonce_len(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 1063 | {
|
|---|
| 1064 | struct bkrp_access_check_v3 *object = (struct bkrp_access_check_v3 *)py_talloc_get_ptr(py_obj);
|
|---|
| 1065 | PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
|
|---|
| 1066 | object->nonce_len = PyInt_AsLong(value);
|
|---|
| 1067 | return 0;
|
|---|
| 1068 | }
|
|---|
| 1069 |
|
|---|
| 1070 | static PyObject *py_bkrp_access_check_v3_get_nonce(PyObject *obj, void *closure)
|
|---|
| 1071 | {
|
|---|
| 1072 | struct bkrp_access_check_v3 *object = (struct bkrp_access_check_v3 *)py_talloc_get_ptr(obj);
|
|---|
| 1073 | PyObject *py_nonce;
|
|---|
| 1074 | py_nonce = PyList_New(object->nonce_len);
|
|---|
| 1075 | if (py_nonce == NULL) {
|
|---|
| 1076 | return NULL;
|
|---|
| 1077 | }
|
|---|
| 1078 | {
|
|---|
| 1079 | int nonce_cntr_0;
|
|---|
| 1080 | for (nonce_cntr_0 = 0; nonce_cntr_0 < object->nonce_len; nonce_cntr_0++) {
|
|---|
| 1081 | PyObject *py_nonce_0;
|
|---|
| 1082 | py_nonce_0 = PyInt_FromLong(object->nonce[nonce_cntr_0]);
|
|---|
| 1083 | PyList_SetItem(py_nonce, nonce_cntr_0, py_nonce_0);
|
|---|
| 1084 | }
|
|---|
| 1085 | }
|
|---|
| 1086 | return py_nonce;
|
|---|
| 1087 | }
|
|---|
| 1088 |
|
|---|
| 1089 | static int py_bkrp_access_check_v3_set_nonce(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 1090 | {
|
|---|
| 1091 | struct bkrp_access_check_v3 *object = (struct bkrp_access_check_v3 *)py_talloc_get_ptr(py_obj);
|
|---|
| 1092 | PY_CHECK_TYPE(&PyList_Type, value, return -1;);
|
|---|
| 1093 | {
|
|---|
| 1094 | int nonce_cntr_0;
|
|---|
| 1095 | object->nonce = talloc_array_ptrtype(py_talloc_get_mem_ctx(py_obj), object->nonce, PyList_GET_SIZE(value));
|
|---|
| 1096 | if (!object->nonce) { return -1;; }
|
|---|
| 1097 | talloc_set_name_const(object->nonce, "ARRAY: object->nonce");
|
|---|
| 1098 | for (nonce_cntr_0 = 0; nonce_cntr_0 < PyList_GET_SIZE(value); nonce_cntr_0++) {
|
|---|
| 1099 | PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, nonce_cntr_0), return -1;);
|
|---|
| 1100 | object->nonce[nonce_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, nonce_cntr_0));
|
|---|
| 1101 | }
|
|---|
| 1102 | }
|
|---|
| 1103 | return 0;
|
|---|
| 1104 | }
|
|---|
| 1105 |
|
|---|
| 1106 | static PyObject *py_bkrp_access_check_v3_get_sid(PyObject *obj, void *closure)
|
|---|
| 1107 | {
|
|---|
| 1108 | struct bkrp_access_check_v3 *object = (struct bkrp_access_check_v3 *)py_talloc_get_ptr(obj);
|
|---|
| 1109 | PyObject *py_sid;
|
|---|
| 1110 | py_sid = py_talloc_reference_ex(dom_sid_Type, py_talloc_get_mem_ctx(obj), &object->sid);
|
|---|
| 1111 | return py_sid;
|
|---|
| 1112 | }
|
|---|
| 1113 |
|
|---|
| 1114 | static int py_bkrp_access_check_v3_set_sid(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 1115 | {
|
|---|
| 1116 | struct bkrp_access_check_v3 *object = (struct bkrp_access_check_v3 *)py_talloc_get_ptr(py_obj);
|
|---|
| 1117 | PY_CHECK_TYPE(dom_sid_Type, value, return -1;);
|
|---|
| 1118 | if (talloc_reference(py_talloc_get_mem_ctx(py_obj), py_talloc_get_mem_ctx(value)) == NULL) {
|
|---|
| 1119 | PyErr_NoMemory();
|
|---|
| 1120 | return -1;
|
|---|
| 1121 | }
|
|---|
| 1122 | object->sid = *(struct dom_sid *)py_talloc_get_ptr(value);
|
|---|
| 1123 | return 0;
|
|---|
| 1124 | }
|
|---|
| 1125 |
|
|---|
| 1126 | static PyObject *py_bkrp_access_check_v3_get_hash(PyObject *obj, void *closure)
|
|---|
| 1127 | {
|
|---|
| 1128 | struct bkrp_access_check_v3 *object = (struct bkrp_access_check_v3 *)py_talloc_get_ptr(obj);
|
|---|
| 1129 | PyObject *py_hash;
|
|---|
| 1130 | py_hash = PyList_New(64);
|
|---|
| 1131 | if (py_hash == NULL) {
|
|---|
| 1132 | return NULL;
|
|---|
| 1133 | }
|
|---|
| 1134 | {
|
|---|
| 1135 | int hash_cntr_0;
|
|---|
| 1136 | for (hash_cntr_0 = 0; hash_cntr_0 < 64; hash_cntr_0++) {
|
|---|
| 1137 | PyObject *py_hash_0;
|
|---|
| 1138 | py_hash_0 = PyInt_FromLong(object->hash[hash_cntr_0]);
|
|---|
| 1139 | PyList_SetItem(py_hash, hash_cntr_0, py_hash_0);
|
|---|
| 1140 | }
|
|---|
| 1141 | }
|
|---|
| 1142 | return py_hash;
|
|---|
| 1143 | }
|
|---|
| 1144 |
|
|---|
| 1145 | static int py_bkrp_access_check_v3_set_hash(PyObject *py_obj, PyObject *value, void *closure)
|
|---|
| 1146 | {
|
|---|
| 1147 | struct bkrp_access_check_v3 *object = (struct bkrp_access_check_v3 *)py_talloc_get_ptr(py_obj);
|
|---|
| 1148 | PY_CHECK_TYPE(&PyList_Type, value, return -1;);
|
|---|
| 1149 | {
|
|---|
| 1150 | int hash_cntr_0;
|
|---|
| 1151 | for (hash_cntr_0 = 0; hash_cntr_0 < PyList_GET_SIZE(value); hash_cntr_0++) {
|
|---|
| 1152 | PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, hash_cntr_0), return -1;);
|
|---|
| 1153 | object->hash[hash_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, hash_cntr_0));
|
|---|
| 1154 | }
|
|---|
| 1155 | }
|
|---|
| 1156 | return 0;
|
|---|
| 1157 | }
|
|---|
| 1158 |
|
|---|
| 1159 | static PyGetSetDef py_bkrp_access_check_v3_getsetters[] = {
|
|---|
| 1160 | { discard_const_p(char, "magic"), py_bkrp_access_check_v3_get_magic, py_bkrp_access_check_v3_set_magic },
|
|---|
| 1161 | { discard_const_p(char, "nonce_len"), py_bkrp_access_check_v3_get_nonce_len, py_bkrp_access_check_v3_set_nonce_len },
|
|---|
| 1162 | { discard_const_p(char, "nonce"), py_bkrp_access_check_v3_get_nonce, py_bkrp_access_check_v3_set_nonce },
|
|---|
| 1163 | { discard_const_p(char, "sid"), py_bkrp_access_check_v3_get_sid, py_bkrp_access_check_v3_set_sid },
|
|---|
| 1164 | { discard_const_p(char, "hash"), py_bkrp_access_check_v3_get_hash, py_bkrp_access_check_v3_set_hash },
|
|---|
| 1165 | { NULL }
|
|---|
| 1166 | };
|
|---|
| 1167 |
|
|---|
| 1168 | static PyObject *py_bkrp_access_check_v3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|---|
| 1169 | {
|
|---|
| 1170 | return py_talloc_new(struct bkrp_access_check_v3, type);
|
|---|
| 1171 | }
|
|---|
| 1172 |
|
|---|
| 1173 |
|
|---|
| 1174 | static PyTypeObject bkrp_access_check_v3_Type = {
|
|---|
| 1175 | PyObject_HEAD_INIT(NULL) 0,
|
|---|
| 1176 | .tp_name = "backupkey.bkrp_access_check_v3",
|
|---|
| 1177 | .tp_getset = py_bkrp_access_check_v3_getsetters,
|
|---|
| 1178 | .tp_methods = NULL,
|
|---|
| 1179 | .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
|---|
| 1180 | .tp_basicsize = sizeof(py_talloc_Object),
|
|---|
| 1181 | .tp_new = py_bkrp_access_check_v3_new,
|
|---|
| 1182 | };
|
|---|
| 1183 |
|
|---|
| 1184 | PyObject *py_import_bkrp_data_in_blob(TALLOC_CTX *mem_ctx, int level, union bkrp_data_in_blob *in)
|
|---|
| 1185 | {
|
|---|
| 1186 | PyObject *ret;
|
|---|
| 1187 |
|
|---|
| 1188 | switch (level) {
|
|---|
| 1189 | case BACKUPKEY_RESTORE_GUID_INTEGER:
|
|---|
| 1190 | ret = py_talloc_reference_ex(&bkrp_client_side_wrapped_Type, mem_ctx, &in->restore_req);
|
|---|
| 1191 | return ret;
|
|---|
| 1192 |
|
|---|
| 1193 | case BACKUPKEY_RETRIEVE_BACKUP_KEY_GUID_INTEGER:
|
|---|
| 1194 | ret = py_talloc_reference_ex(&bkrp_client_side_wrapped_Type, mem_ctx, &in->cert_req);
|
|---|
| 1195 | return ret;
|
|---|
| 1196 |
|
|---|
| 1197 | }
|
|---|
| 1198 | PyErr_SetString(PyExc_TypeError, "unknown union level");
|
|---|
| 1199 | return NULL;
|
|---|
| 1200 | }
|
|---|
| 1201 |
|
|---|
| 1202 | union bkrp_data_in_blob *py_export_bkrp_data_in_blob(TALLOC_CTX *mem_ctx, int level, PyObject *in)
|
|---|
| 1203 | {
|
|---|
| 1204 | union bkrp_data_in_blob *ret = talloc_zero(mem_ctx, union bkrp_data_in_blob);
|
|---|
| 1205 | switch (level) {
|
|---|
| 1206 | case BACKUPKEY_RESTORE_GUID_INTEGER:
|
|---|
| 1207 | PY_CHECK_TYPE(&bkrp_client_side_wrapped_Type, in, talloc_free(ret); return NULL;);
|
|---|
| 1208 | if (talloc_reference(mem_ctx, py_talloc_get_mem_ctx(in)) == NULL) {
|
|---|
| 1209 | PyErr_NoMemory();
|
|---|
| 1210 | talloc_free(ret); return NULL;
|
|---|
| 1211 | }
|
|---|
| 1212 | ret->restore_req = *(struct bkrp_client_side_wrapped *)py_talloc_get_ptr(in);
|
|---|
| 1213 | break;
|
|---|
| 1214 |
|
|---|
| 1215 | case BACKUPKEY_RETRIEVE_BACKUP_KEY_GUID_INTEGER:
|
|---|
| 1216 | PY_CHECK_TYPE(&bkrp_client_side_wrapped_Type, in, talloc_free(ret); return NULL;);
|
|---|
| 1217 | if (talloc_reference(mem_ctx, py_talloc_get_mem_ctx(in)) == NULL) {
|
|---|
| 1218 | PyErr_NoMemory();
|
|---|
| 1219 | talloc_free(ret); return NULL;
|
|---|
| 1220 | }
|
|---|
| 1221 | ret->cert_req = *(struct bkrp_client_side_wrapped *)py_talloc_get_ptr(in);
|
|---|
| 1222 | break;
|
|---|
| 1223 |
|
|---|
| 1224 | default:
|
|---|
| 1225 | PyErr_SetString(PyExc_TypeError, "invalid union level value");
|
|---|
| 1226 | talloc_free(ret);
|
|---|
| 1227 | ret = NULL;
|
|---|
| 1228 | }
|
|---|
| 1229 |
|
|---|
| 1230 | return ret;
|
|---|
| 1231 | }
|
|---|
| 1232 |
|
|---|
| 1233 |
|
|---|
| 1234 | static bool pack_py_bkrp_BackupKey_args_in(PyObject *args, PyObject *kwargs, struct bkrp_BackupKey *r)
|
|---|
| 1235 | {
|
|---|
| 1236 | PyObject *py_guidActionAgent;
|
|---|
| 1237 | PyObject *py_data_in;
|
|---|
| 1238 | PyObject *py_param;
|
|---|
| 1239 | const char *kwnames[] = {
|
|---|
| 1240 | "guidActionAgent", "data_in", "param", NULL
|
|---|
| 1241 | };
|
|---|
| 1242 |
|
|---|
| 1243 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:bkrp_BackupKey", discard_const_p(char *, kwnames), &py_guidActionAgent, &py_data_in, &py_param)) {
|
|---|
| 1244 | return false;
|
|---|
| 1245 | }
|
|---|
| 1246 |
|
|---|
| 1247 | r->in.guidActionAgent = talloc_ptrtype(r, r->in.guidActionAgent);
|
|---|
| 1248 | PY_CHECK_TYPE(GUID_Type, py_guidActionAgent, return false;);
|
|---|
| 1249 | if (talloc_reference(r, py_talloc_get_mem_ctx(py_guidActionAgent)) == NULL) {
|
|---|
| 1250 | PyErr_NoMemory();
|
|---|
| 1251 | return false;
|
|---|
| 1252 | }
|
|---|
| 1253 | r->in.guidActionAgent = (struct GUID *)py_talloc_get_ptr(py_guidActionAgent);
|
|---|
| 1254 | r->in.data_in = talloc_ptrtype(r, r->in.data_in);
|
|---|
| 1255 | PY_CHECK_TYPE(&PyList_Type, py_data_in, return false;);
|
|---|
| 1256 | {
|
|---|
| 1257 | int data_in_cntr_1;
|
|---|
| 1258 | r->in.data_in = talloc_array_ptrtype(r, r->in.data_in, PyList_GET_SIZE(py_data_in));
|
|---|
| 1259 | if (!r->in.data_in) { return false;; }
|
|---|
| 1260 | talloc_set_name_const(r->in.data_in, "ARRAY: r->in.data_in");
|
|---|
| 1261 | for (data_in_cntr_1 = 0; data_in_cntr_1 < PyList_GET_SIZE(py_data_in); data_in_cntr_1++) {
|
|---|
| 1262 | PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(py_data_in, data_in_cntr_1), return false;);
|
|---|
| 1263 | r->in.data_in[data_in_cntr_1] = PyInt_AsLong(PyList_GET_ITEM(py_data_in, data_in_cntr_1));
|
|---|
| 1264 | }
|
|---|
| 1265 | }
|
|---|
| 1266 | PY_CHECK_TYPE(&PyList_Type, py_data_in, return false;);
|
|---|
| 1267 | r->in.data_in_len = PyList_GET_SIZE(py_data_in);
|
|---|
| 1268 | PY_CHECK_TYPE(&PyInt_Type, py_param, return false;);
|
|---|
| 1269 | r->in.param = PyInt_AsLong(py_param);
|
|---|
| 1270 | return true;
|
|---|
| 1271 | }
|
|---|
| 1272 |
|
|---|
| 1273 | static PyObject *unpack_py_bkrp_BackupKey_args_out(struct bkrp_BackupKey *r)
|
|---|
| 1274 | {
|
|---|
| 1275 | PyObject *result;
|
|---|
| 1276 | PyObject *py_data_out;
|
|---|
| 1277 | PyObject *py_data_out_len;
|
|---|
| 1278 | result = PyTuple_New(2);
|
|---|
| 1279 | if (*r->out.data_out == NULL) {
|
|---|
| 1280 | py_data_out = Py_None;
|
|---|
| 1281 | Py_INCREF(py_data_out);
|
|---|
| 1282 | } else {
|
|---|
| 1283 | py_data_out = PyList_New(*r->out.data_out_len);
|
|---|
| 1284 | if (py_data_out == NULL) {
|
|---|
| 1285 | return NULL;
|
|---|
| 1286 | }
|
|---|
| 1287 | {
|
|---|
| 1288 | int data_out_cntr_2;
|
|---|
| 1289 | for (data_out_cntr_2 = 0; data_out_cntr_2 < *r->out.data_out_len; data_out_cntr_2++) {
|
|---|
| 1290 | PyObject *py_data_out_2;
|
|---|
| 1291 | py_data_out_2 = PyInt_FromLong(*r->out.data_out[data_out_cntr_2]);
|
|---|
| 1292 | PyList_SetItem(py_data_out, data_out_cntr_2, py_data_out_2);
|
|---|
| 1293 | }
|
|---|
| 1294 | }
|
|---|
| 1295 | }
|
|---|
| 1296 | PyTuple_SetItem(result, 0, py_data_out);
|
|---|
| 1297 | py_data_out_len = PyInt_FromLong(*r->out.data_out_len);
|
|---|
| 1298 | PyTuple_SetItem(result, 1, py_data_out_len);
|
|---|
| 1299 | if (!W_ERROR_IS_OK(r->out.result)) {
|
|---|
| 1300 | PyErr_SetWERROR(r->out.result);
|
|---|
| 1301 | return NULL;
|
|---|
| 1302 | }
|
|---|
| 1303 |
|
|---|
| 1304 | return result;
|
|---|
| 1305 | }
|
|---|
| 1306 |
|
|---|
| 1307 | const struct PyNdrRpcMethodDef py_ndr_backupkey_methods[] = {
|
|---|
| 1308 | { "bkrp_BackupKey", "S.bkrp_BackupKey(guidActionAgent, data_in, param) -> (data_out, data_out_len)", (py_dcerpc_call_fn)dcerpc_bkrp_BackupKey_r, (py_data_pack_fn)pack_py_bkrp_BackupKey_args_in, (py_data_unpack_fn)unpack_py_bkrp_BackupKey_args_out, 0, &ndr_table_backupkey },
|
|---|
| 1309 | { NULL }
|
|---|
| 1310 | };
|
|---|
| 1311 |
|
|---|
| 1312 | static PyObject *interface_backupkey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|---|
| 1313 | {
|
|---|
| 1314 | return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_backupkey);
|
|---|
| 1315 | }
|
|---|
| 1316 |
|
|---|
| 1317 | #define PY_DOC_BACKUPKEY "Remote Backup Key Storage"
|
|---|
| 1318 | static PyTypeObject backupkey_InterfaceType = {
|
|---|
| 1319 | PyObject_HEAD_INIT(NULL) 0,
|
|---|
| 1320 | .tp_name = "backupkey.backupkey",
|
|---|
| 1321 | .tp_basicsize = sizeof(dcerpc_InterfaceObject),
|
|---|
| 1322 | .tp_doc = "backupkey(binding, lp_ctx=None, credentials=None) -> connection\n"
|
|---|
| 1323 | "\n"
|
|---|
| 1324 | "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
|
|---|
| 1325 | "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
|
|---|
| 1326 | "credentials should be a credentials.Credentials object.\n\n"PY_DOC_BACKUPKEY,
|
|---|
| 1327 | .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
|---|
| 1328 | .tp_new = interface_backupkey_new,
|
|---|
| 1329 | };
|
|---|
| 1330 |
|
|---|
| 1331 | static PyMethodDef backupkey_methods[] = {
|
|---|
| 1332 | { NULL, NULL, 0, NULL }
|
|---|
| 1333 | };
|
|---|
| 1334 |
|
|---|
| 1335 | void initbackupkey(void)
|
|---|
| 1336 | {
|
|---|
| 1337 | PyObject *m;
|
|---|
| 1338 | PyObject *dep_samba_dcerpc_security;
|
|---|
| 1339 | PyObject *dep_talloc;
|
|---|
| 1340 | PyObject *dep_samba_dcerpc_misc;
|
|---|
| 1341 | PyObject *dep_samba_dcerpc_base;
|
|---|
| 1342 |
|
|---|
| 1343 | dep_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security");
|
|---|
| 1344 | if (dep_samba_dcerpc_security == NULL)
|
|---|
| 1345 | return;
|
|---|
| 1346 |
|
|---|
| 1347 | dep_talloc = PyImport_ImportModule("talloc");
|
|---|
| 1348 | if (dep_talloc == NULL)
|
|---|
| 1349 | return;
|
|---|
| 1350 |
|
|---|
| 1351 | dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
|
|---|
| 1352 | if (dep_samba_dcerpc_misc == NULL)
|
|---|
| 1353 | return;
|
|---|
| 1354 |
|
|---|
| 1355 | dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
|
|---|
| 1356 | if (dep_samba_dcerpc_base == NULL)
|
|---|
| 1357 | return;
|
|---|
| 1358 |
|
|---|
| 1359 | dom_sid_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "dom_sid");
|
|---|
| 1360 | if (dom_sid_Type == NULL)
|
|---|
| 1361 | return;
|
|---|
| 1362 |
|
|---|
| 1363 | Object_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "Object");
|
|---|
| 1364 | if (Object_Type == NULL)
|
|---|
| 1365 | return;
|
|---|
| 1366 |
|
|---|
| 1367 | GUID_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "GUID");
|
|---|
| 1368 | if (GUID_Type == NULL)
|
|---|
| 1369 | return;
|
|---|
| 1370 |
|
|---|
| 1371 | ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
|
|---|
| 1372 | if (ClientConnection_Type == NULL)
|
|---|
| 1373 | return;
|
|---|
| 1374 |
|
|---|
| 1375 | bkrp_exported_RSA_key_pair_Type.tp_base = Object_Type;
|
|---|
| 1376 |
|
|---|
| 1377 | bkrp_dc_serverwrap_key_Type.tp_base = Object_Type;
|
|---|
| 1378 |
|
|---|
| 1379 | bkrp_client_side_wrapped_Type.tp_base = Object_Type;
|
|---|
| 1380 |
|
|---|
| 1381 | bkrp_client_side_unwrapped_Type.tp_base = Object_Type;
|
|---|
| 1382 |
|
|---|
| 1383 | bkrp_encrypted_secret_v2_Type.tp_base = Object_Type;
|
|---|
| 1384 |
|
|---|
| 1385 | bkrp_encrypted_secret_v3_Type.tp_base = Object_Type;
|
|---|
| 1386 |
|
|---|
| 1387 | bkrp_access_check_v2_Type.tp_base = Object_Type;
|
|---|
| 1388 |
|
|---|
| 1389 | bkrp_access_check_v3_Type.tp_base = Object_Type;
|
|---|
| 1390 |
|
|---|
| 1391 | backupkey_InterfaceType.tp_base = ClientConnection_Type;
|
|---|
| 1392 |
|
|---|
| 1393 | if (PyType_Ready(&bkrp_exported_RSA_key_pair_Type) < 0)
|
|---|
| 1394 | return;
|
|---|
| 1395 | if (PyType_Ready(&bkrp_dc_serverwrap_key_Type) < 0)
|
|---|
| 1396 | return;
|
|---|
| 1397 | if (PyType_Ready(&bkrp_client_side_wrapped_Type) < 0)
|
|---|
| 1398 | return;
|
|---|
| 1399 | if (PyType_Ready(&bkrp_client_side_unwrapped_Type) < 0)
|
|---|
| 1400 | return;
|
|---|
| 1401 | if (PyType_Ready(&bkrp_encrypted_secret_v2_Type) < 0)
|
|---|
| 1402 | return;
|
|---|
| 1403 | if (PyType_Ready(&bkrp_encrypted_secret_v3_Type) < 0)
|
|---|
| 1404 | return;
|
|---|
| 1405 | if (PyType_Ready(&bkrp_access_check_v2_Type) < 0)
|
|---|
| 1406 | return;
|
|---|
| 1407 | if (PyType_Ready(&bkrp_access_check_v3_Type) < 0)
|
|---|
| 1408 | return;
|
|---|
| 1409 | if (PyType_Ready(&backupkey_InterfaceType) < 0)
|
|---|
| 1410 | return;
|
|---|
| 1411 | if (!PyInterface_AddNdrRpcMethods(&backupkey_InterfaceType, py_ndr_backupkey_methods))
|
|---|
| 1412 | return;
|
|---|
| 1413 |
|
|---|
| 1414 | #ifdef PY_BKRP_EXPORTED_RSA_KEY_PAIR_PATCH
|
|---|
| 1415 | PY_BKRP_EXPORTED_RSA_KEY_PAIR_PATCH(&bkrp_exported_RSA_key_pair_Type);
|
|---|
| 1416 | #endif
|
|---|
| 1417 | #ifdef PY_BKRP_DC_SERVERWRAP_KEY_PATCH
|
|---|
| 1418 | PY_BKRP_DC_SERVERWRAP_KEY_PATCH(&bkrp_dc_serverwrap_key_Type);
|
|---|
| 1419 | #endif
|
|---|
| 1420 | #ifdef PY_BKRP_CLIENT_SIDE_WRAPPED_PATCH
|
|---|
| 1421 | PY_BKRP_CLIENT_SIDE_WRAPPED_PATCH(&bkrp_client_side_wrapped_Type);
|
|---|
| 1422 | #endif
|
|---|
| 1423 | #ifdef PY_BKRP_CLIENT_SIDE_UNWRAPPED_PATCH
|
|---|
| 1424 | PY_BKRP_CLIENT_SIDE_UNWRAPPED_PATCH(&bkrp_client_side_unwrapped_Type);
|
|---|
| 1425 | #endif
|
|---|
| 1426 | #ifdef PY_BKRP_ENCRYPTED_SECRET_V2_PATCH
|
|---|
| 1427 | PY_BKRP_ENCRYPTED_SECRET_V2_PATCH(&bkrp_encrypted_secret_v2_Type);
|
|---|
| 1428 | #endif
|
|---|
| 1429 | #ifdef PY_BKRP_ENCRYPTED_SECRET_V3_PATCH
|
|---|
| 1430 | PY_BKRP_ENCRYPTED_SECRET_V3_PATCH(&bkrp_encrypted_secret_v3_Type);
|
|---|
| 1431 | #endif
|
|---|
| 1432 | #ifdef PY_BKRP_ACCESS_CHECK_V2_PATCH
|
|---|
| 1433 | PY_BKRP_ACCESS_CHECK_V2_PATCH(&bkrp_access_check_v2_Type);
|
|---|
| 1434 | #endif
|
|---|
| 1435 | #ifdef PY_BKRP_ACCESS_CHECK_V3_PATCH
|
|---|
| 1436 | PY_BKRP_ACCESS_CHECK_V3_PATCH(&bkrp_access_check_v3_Type);
|
|---|
| 1437 | #endif
|
|---|
| 1438 | #ifdef PY_BACKUPKEY_PATCH
|
|---|
| 1439 | PY_BACKUPKEY_PATCH(&backupkey_InterfaceType);
|
|---|
| 1440 | #endif
|
|---|
| 1441 |
|
|---|
| 1442 | m = Py_InitModule3("backupkey", backupkey_methods, "backupkey DCE/RPC");
|
|---|
| 1443 | if (m == NULL)
|
|---|
| 1444 | return;
|
|---|
| 1445 |
|
|---|
| 1446 | PyModule_AddObject(m, "BACKUPKEY_RETRIEVE_BACKUP_KEY_GUID_INTEGER", PyInt_FromLong(BACKUPKEY_RETRIEVE_BACKUP_KEY_GUID_INTEGER));
|
|---|
| 1447 | PyModule_AddObject(m, "BACKUPKEY_RETRIEVE_BACKUP_KEY_GUID", PyString_FromString("018FF48A-EABA-40C6-8F6D-72370240E967"));
|
|---|
| 1448 | PyModule_AddObject(m, "BACKUPKEY_RESTORE_GUID", PyString_FromString("47270C64-2FC7-499B-AC5B-0E37CDCE899A"));
|
|---|
| 1449 | PyModule_AddObject(m, "BACKUPKEY_BACKUP_GUID", PyString_FromString("7F752B10-178E-11D1-AB8F-00805F14DB40"));
|
|---|
| 1450 | PyModule_AddObject(m, "BACKUPKEY_RESTORE_GUID_INTEGER", PyInt_FromLong(BACKUPKEY_RESTORE_GUID_INTEGER));
|
|---|
| 1451 | PyModule_AddObject(m, "BACKUPKEY_INVALID_GUID_INTEGER", PyInt_FromLong(BACKUPKEY_INVALID_GUID_INTEGER));
|
|---|
| 1452 | PyModule_AddObject(m, "BACKUPKEY_RESTORE_GUID_WIN2K", PyString_FromString("7FE94D50-178E-11D1-AB8F-00805F14DB40"));
|
|---|
| 1453 | Py_INCREF((PyObject *)(void *)&bkrp_exported_RSA_key_pair_Type);
|
|---|
| 1454 | PyModule_AddObject(m, "bkrp_exported_RSA_key_pair", (PyObject *)(void *)&bkrp_exported_RSA_key_pair_Type);
|
|---|
| 1455 | Py_INCREF((PyObject *)(void *)&bkrp_dc_serverwrap_key_Type);
|
|---|
| 1456 | PyModule_AddObject(m, "bkrp_dc_serverwrap_key", (PyObject *)(void *)&bkrp_dc_serverwrap_key_Type);
|
|---|
| 1457 | Py_INCREF((PyObject *)(void *)&bkrp_client_side_wrapped_Type);
|
|---|
| 1458 | PyModule_AddObject(m, "bkrp_client_side_wrapped", (PyObject *)(void *)&bkrp_client_side_wrapped_Type);
|
|---|
| 1459 | Py_INCREF((PyObject *)(void *)&bkrp_client_side_unwrapped_Type);
|
|---|
| 1460 | PyModule_AddObject(m, "bkrp_client_side_unwrapped", (PyObject *)(void *)&bkrp_client_side_unwrapped_Type);
|
|---|
| 1461 | Py_INCREF((PyObject *)(void *)&bkrp_encrypted_secret_v2_Type);
|
|---|
| 1462 | PyModule_AddObject(m, "bkrp_encrypted_secret_v2", (PyObject *)(void *)&bkrp_encrypted_secret_v2_Type);
|
|---|
| 1463 | Py_INCREF((PyObject *)(void *)&bkrp_encrypted_secret_v3_Type);
|
|---|
| 1464 | PyModule_AddObject(m, "bkrp_encrypted_secret_v3", (PyObject *)(void *)&bkrp_encrypted_secret_v3_Type);
|
|---|
| 1465 | Py_INCREF((PyObject *)(void *)&bkrp_access_check_v2_Type);
|
|---|
| 1466 | PyModule_AddObject(m, "bkrp_access_check_v2", (PyObject *)(void *)&bkrp_access_check_v2_Type);
|
|---|
| 1467 | Py_INCREF((PyObject *)(void *)&bkrp_access_check_v3_Type);
|
|---|
| 1468 | PyModule_AddObject(m, "bkrp_access_check_v3", (PyObject *)(void *)&bkrp_access_check_v3_Type);
|
|---|
| 1469 | Py_INCREF((PyObject *)(void *)&backupkey_InterfaceType);
|
|---|
| 1470 | PyModule_AddObject(m, "backupkey", (PyObject *)(void *)&backupkey_InterfaceType);
|
|---|
| 1471 | #ifdef PY_MOD_BACKUPKEY_PATCH
|
|---|
| 1472 | PY_MOD_BACKUPKEY_PATCH(m);
|
|---|
| 1473 | #endif
|
|---|
| 1474 |
|
|---|
| 1475 | }
|
|---|