データ構造 | |
struct | const_vals |
関数 | |
static void | const_init (PyObject *dict) |
PyObject * | srvsvc_netservergetinfo (PyObject *self, PyObject *args, PyObject *kw) |
void | initsrvsvc (void) |
変数 | |
PyObject * | srvsvc_error |
PyObject * | srvsvc_werror |
static struct const_vals | module_const_vals [] |
static PyMethodDef | srvsvc_methods [] |
static void const_init | ( | PyObject * | dict | ) | [static] |
py_srvsvc.c の 61 行で定義されています。
参照先 module_const_vals・const_vals::name・const_vals::value.
00062 { 00063 struct const_vals *tmp; 00064 PyObject *obj; 00065 00066 for (tmp = module_const_vals; tmp->name; tmp++) { 00067 obj = PyInt_FromLong(tmp->value); 00068 PyDict_SetItemString(dict, tmp->name, obj); 00069 Py_DECREF(obj); 00070 } 00071 }
PyObject* srvsvc_netservergetinfo | ( | PyObject * | self, | |
PyObject * | args, | |||
PyObject * | kw | |||
) |
py_srvsvc.c の 75 行で定義されています。
参照先 c・cli・level・cli_state::mem_ctx・open_pipe_creds()・cli_state::pipe_list・py_from_SRV_INFO_101()・py_werror_tuple()・result・rpccli_srvsvc_net_srv_get_info()・server・srv_info_ctr_info::srv・srvsvc_error・status・srv_info_ctr_info::sv101・srv_info_ctr_info::switch_value・talloc_init().
00077 { 00078 static char *kwlist[] = { "server", "level", "creds", NULL }; 00079 char *unc_name, *server, *errstr; 00080 PyObject *creds = NULL, *result = NULL; 00081 struct cli_state *cli; 00082 TALLOC_CTX *mem_ctx = NULL; 00083 uint32 level; 00084 SRV_INFO_CTR ctr; 00085 WERROR status; 00086 00087 if (!PyArg_ParseTupleAndKeywords( 00088 args, kw, "si|O", kwlist, &unc_name, &level, &creds)) 00089 return NULL; 00090 00091 if (unc_name[0] != '\\' || unc_name[1] != '\\') { 00092 PyErr_SetString(PyExc_ValueError, "UNC name required"); 00093 return NULL; 00094 } 00095 00096 server = SMB_STRDUP(unc_name + 2); 00097 00098 if (strchr(server, '\\')) { 00099 char *c = strchr(server, '\\'); 00100 *c = 0; 00101 } 00102 00103 if (creds && creds != Py_None && !PyDict_Check(creds)) { 00104 PyErr_SetString(PyExc_TypeError, 00105 "credentials must be dictionary or None"); 00106 return NULL; 00107 } 00108 00109 if (!(cli = open_pipe_creds(server, creds, PI_SRVSVC, &errstr))) { 00110 PyErr_SetString(srvsvc_error, errstr); 00111 free(errstr); 00112 goto done; 00113 } 00114 00115 if (!(mem_ctx = talloc_init("srvsvc_netservergetinfo"))) { 00116 PyErr_SetString(srvsvc_error, 00117 "unable to init talloc context\n"); 00118 goto done; 00119 } 00120 00121 ZERO_STRUCT(ctr); 00122 00123 status = rpccli_srvsvc_net_srv_get_info(cli->pipe_list, mem_ctx, level, &ctr); 00124 00125 if (!W_ERROR_IS_OK(status)) { 00126 PyErr_SetObject(srvsvc_error, py_werror_tuple(status)); 00127 goto done; 00128 } 00129 00130 if (level != ctr.switch_value) { 00131 PyErr_SetString(srvsvc_error, "container level value wrong"); 00132 goto done; 00133 } 00134 00135 switch(level) { 00136 case 101: 00137 py_from_SRV_INFO_101(&result, &ctr.srv.sv101); 00138 break; 00139 } 00140 00141 Py_INCREF(result); 00142 00143 done: 00144 if (mem_ctx) 00145 talloc_destroy(mem_ctx); 00146 00147 return result; 00148 }
void initsrvsvc | ( | void | ) |
py_srvsvc.c の 191 行で定義されています。
参照先 const_init()・py_samba_init()・srvsvc_error・srvsvc_methods・srvsvc_werror.
00192 { 00193 PyObject *module, *dict; 00194 00195 /* Initialise module */ 00196 00197 module = Py_InitModule("srvsvc", srvsvc_methods); 00198 dict = PyModule_GetDict(module); 00199 00200 /* Exceptions we can raise */ 00201 00202 srvsvc_error = PyErr_NewException("srvsvc.error", NULL, NULL); 00203 PyDict_SetItemString(dict, "error", srvsvc_error); 00204 00205 srvsvc_werror = PyErr_NewException("srvsvc.werror", NULL, NULL); 00206 PyDict_SetItemString(dict, "werror", srvsvc_werror); 00207 00208 /* Initialise constants */ 00209 00210 const_init(dict); 00211 00212 /* Do samba initialisation */ 00213 00214 py_samba_init(); 00215 }
PyObject* srvsvc_error |
PyObject * srvsvc_werror |
struct const_vals module_const_vals[] [static] |
PyMethodDef srvsvc_methods[] [static] |