diff -r -u source~/libsmb/libsmbclient.c source/libsmb/libsmbclient.c --- source~/libsmb/libsmbclient.c 2006-01-24 18:46:35.000000000 -0500 +++ source/libsmb/libsmbclient.c 2006-03-03 15:35:34.000000000 -0500 @@ -917,7 +917,7 @@ PI_LSARPC, &nt_status); if (!pipe_hnd) { - DEBUG(1, ("cli_nt_session_open fail!\n")); + DEBUG(1, ("cli_rpc_pipe_open_noauth fail!\n")); errno = ENOTSUP; cli_shutdown(&ipc_srv->cli); free(ipc_srv); diff -r -u source~/python/py_common.c source/python/py_common.c --- source~/python/py_common.c 2005-02-25 12:59:23.000000000 -0500 +++ source/python/py_common.c 2006-03-03 15:34:11.000000000 -0500 @@ -202,15 +202,16 @@ return True; } -/* Return a cli_state to a RPC pipe on the given server. Use the +/* Return an RPC pipe client on the given server. Use the credentials passed if not NULL. If an error occurs errstr is set to a string describing the error and NULL is returned. If set, errstr must be freed by calling free(). */ -struct cli_state *open_pipe_creds(char *server, PyObject *creds, +struct rpc_pipe_client *open_pipe_creds(char *server, PyObject *creds, int pipe_idx, char **errstr) { char *username, *password, *domain; + struct rpc_pipe_client *rpcp_cli; struct cli_state *cli; NTSTATUS result; @@ -230,7 +231,7 @@ return NULL; } - if (!cli_nt_session_open(cli, pipe_idx)) { + if (!(rpcp_cli = cli_rpc_pipe_open_noauth(cli, pipe_idx, &result))) { cli_shutdown(cli); asprintf(errstr, "error opening pipe index %d", pipe_idx); return NULL; @@ -238,7 +239,7 @@ *errstr = NULL; - return cli; + return rpcp_cli; } /* Return true if a dictionary contains a "level" key with an integer diff -r -u source~/python/py_common.h source/python/py_common.h --- source~/python/py_common.h 2005-10-17 22:44:54.000000000 -0400 +++ source/python/py_common.h 2006-03-03 15:34:13.000000000 -0500 @@ -42,7 +42,7 @@ PyObject *py_setup_logging(PyObject *self, PyObject *args, PyObject *kw); BOOL py_parse_creds(PyObject *creds, char **username, char **domain, char **password, char **errstr); -struct cli_state *open_pipe_creds(char *server, PyObject *creds, +struct rpc_pipe_client *open_pipe_creds(char *server, PyObject *creds, int pipe_idx, char **errstr); BOOL get_level_value(PyObject *dict, uint32 *level); diff -r -u source~/python/py_lsa.c source/python/py_lsa.c --- source~/python/py_lsa.c 2005-10-17 22:44:54.000000000 -0400 +++ source/python/py_lsa.c 2006-03-03 15:34:11.000000000 -0500 @@ -20,14 +20,14 @@ #include "python/py_lsa.h" -PyObject *new_lsa_policy_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx, +PyObject *new_lsa_policy_hnd_object(struct rpc_pipe_client *rpcp_cli, TALLOC_CTX *mem_ctx, POLICY_HND *pol) { lsa_policy_hnd_object *o; o = PyObject_New(lsa_policy_hnd_object, &lsa_policy_hnd_type); - o->cli = cli; + o->rpcp_cli = rpcp_cli; o->mem_ctx = mem_ctx; memcpy(&o->pol, pol, sizeof(POLICY_HND)); @@ -56,7 +56,7 @@ char *server, *errstr; PyObject *creds = NULL, *result = NULL; uint32 desired_access = GENERIC_EXECUTE_ACCESS; - struct cli_state *cli = NULL; + struct rpc_pipe_client *rpcp_cli = NULL; NTSTATUS ntstatus; TALLOC_CTX *mem_ctx = NULL; POLICY_HND hnd; @@ -78,7 +78,7 @@ server += 2; - if (!(cli = open_pipe_creds(server, creds, PI_LSARPC, &errstr))) { + if (!(rpcp_cli = open_pipe_creds(server, creds, PI_LSARPC, &errstr))) { PyErr_SetString(lsa_error, errstr); free(errstr); return NULL; @@ -90,19 +90,19 @@ } ntstatus = rpccli_lsa_open_policy( - cli, mem_ctx, True, desired_access, &hnd); + rpcp_cli, mem_ctx, True, desired_access, &hnd); if (!NT_STATUS_IS_OK(ntstatus)) { PyErr_SetObject(lsa_ntstatus, py_ntstatus_tuple(ntstatus)); goto done; } - result = new_lsa_policy_hnd_object(cli, mem_ctx, &hnd); + result = new_lsa_policy_hnd_object(rpcp_cli, mem_ctx, &hnd); done: if (!result) { - if (cli) - cli_shutdown(cli); + if (rpcp_cli) + cli_shutdown(rpcp_cli->cli); talloc_destroy(mem_ctx); } @@ -125,11 +125,11 @@ /* Call rpc function */ - result = rpccli_lsa_close(hnd->cli, hnd->mem_ctx, &hnd->pol); + result = rpccli_lsa_close(hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol); /* Cleanup samba stuff */ - cli_shutdown(hnd->cli); + cli_shutdown(hnd->rpcp_cli->cli); talloc_destroy(hnd->mem_ctx); /* Return value */ @@ -186,7 +186,7 @@ } ntstatus = rpccli_lsa_lookup_names( - hnd->cli, mem_ctx, &hnd->pol, num_names, names, &sids, + hnd->rpcp_cli, mem_ctx, &hnd->pol, num_names, names, &sids, &name_types); if (!NT_STATUS_IS_OK(ntstatus) && NT_STATUS_V(ntstatus) != 0x107) { @@ -269,7 +269,7 @@ } ntstatus = rpccli_lsa_lookup_sids( - hnd->cli, mem_ctx, &hnd->pol, num_sids, sids, &domains, + hnd->rpcp_cli, mem_ctx, &hnd->pol, num_sids, sids, &domains, &names, &types); if (!NT_STATUS_IS_OK(ntstatus)) { @@ -308,7 +308,7 @@ return NULL; ntstatus = rpccli_lsa_enum_trust_dom( - hnd->cli, hnd->mem_ctx, &hnd->pol, &enum_ctx, + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, &enum_ctx, &num_domains, &domain_names, &domain_sids); if (!NT_STATUS_IS_OK(ntstatus)) { diff -r -u source~/python/py_lsa.h source/python/py_lsa.h --- source~/python/py_lsa.h 2005-02-25 12:59:23.000000000 -0500 +++ source/python/py_lsa.h 2006-03-03 15:34:13.000000000 -0500 @@ -27,7 +27,7 @@ typedef struct { PyObject_HEAD - struct cli_state *cli; + struct rpc_pipe_client *rpcp_cli; TALLOC_CTX *mem_ctx; POLICY_HND pol; } lsa_policy_hnd_object; diff -r -u source~/python/py_spoolss.c source/python/py_spoolss.c --- source~/python/py_spoolss.c 2005-02-25 12:59:23.000000000 -0500 +++ source/python/py_spoolss.c 2006-03-03 15:34:11.000000000 -0500 @@ -304,7 +304,7 @@ hnd = (spoolss_policy_hnd_object*)self; - cli_shutdown(hnd->cli); + cli_shutdown(hnd->rpcp_cli->cli); talloc_destroy(hnd->mem_ctx); PyObject_Del(self); diff -r -u source~/python/py_spoolss_common.c source/python/py_spoolss_common.c --- source~/python/py_spoolss_common.c 2005-02-25 12:59:23.000000000 -0500 +++ source/python/py_spoolss_common.c 2006-03-03 15:34:11.000000000 -0500 @@ -20,14 +20,14 @@ #include "python/py_spoolss.h" -PyObject *new_spoolss_policy_hnd_object(struct cli_state *cli, +PyObject *new_spoolss_policy_hnd_object(struct rpc_pipe_client *rpcp_cli, TALLOC_CTX *mem_ctx, POLICY_HND *pol) { spoolss_policy_hnd_object *o; o = PyObject_New(spoolss_policy_hnd_object, &spoolss_policy_hnd_type); - o->cli = cli; + o->rpcp_cli = rpcp_cli; o->mem_ctx = mem_ctx; memcpy(&o->pol, pol, sizeof(POLICY_HND)); diff -r -u source~/python/py_spoolss_drivers.c source/python/py_spoolss_drivers.c --- source~/python/py_spoolss_drivers.c 2005-10-17 22:44:54.000000000 -0400 +++ source/python/py_spoolss_drivers.c 2006-03-03 15:34:11.000000000 -0500 @@ -32,7 +32,7 @@ uint32 num_drivers; char *arch = "Windows NT x86", *server, *errstr; static char *kwlist[] = {"server", "level", "creds", "arch", NULL}; - struct cli_state *cli = NULL; + struct rpc_pipe_client *rpcp_cli = NULL; TALLOC_CTX *mem_ctx = NULL; /* Parse parameters */ @@ -57,7 +57,7 @@ /* Call rpc function */ - if (!(cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { + if (!(rpcp_cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { PyErr_SetString(spoolss_error, errstr); free(errstr); goto done; @@ -70,7 +70,7 @@ } werror = rpccli_spoolss_enumprinterdrivers( - cli, mem_ctx, level, arch, + rpcp_cli, mem_ctx, level, arch, &num_drivers, &ctr); if (!W_ERROR_IS_OK(werror)) { @@ -151,8 +151,8 @@ } done: - if (cli) - cli_shutdown(cli); + if (rpcp_cli) + cli_shutdown(rpcp_cli->cli); if (mem_ctx) talloc_destroy(mem_ctx); @@ -183,7 +183,7 @@ /* Call rpc function */ werror = rpccli_spoolss_getprinterdriver( - hnd->cli, hnd->mem_ctx, &hnd->pol, level, arch, version, &ctr); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, level, arch, version, &ctr); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -225,7 +225,7 @@ uint32 level = 1; char *arch = "Windows NT x86", *server, *errstr; static char *kwlist[] = {"server", "level", "arch", "creds", NULL}; - struct cli_state *cli = NULL; + struct rpc_pipe_client *rpcp_cli = NULL; TALLOC_CTX *mem_ctx = NULL; /* Parse parameters */ @@ -250,7 +250,7 @@ /* Call rpc function */ - if (!(cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { + if (!(rpcp_cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { PyErr_SetString(spoolss_error, errstr); free(errstr); goto done; @@ -263,7 +263,7 @@ } werror = rpccli_spoolss_getprinterdriverdir( - cli, mem_ctx, level, arch, &ctr); + rpcp_cli, mem_ctx, level, arch, &ctr); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -282,8 +282,8 @@ } done: - if (cli) - cli_shutdown(cli); + if (rpcp_cli) + cli_shutdown(rpcp_cli->cli); if (mem_ctx) talloc_destroy(mem_ctx); @@ -300,7 +300,7 @@ PyObject *info, *result = NULL, *creds = NULL; WERROR werror; TALLOC_CTX *mem_ctx = NULL; - struct cli_state *cli = NULL; + struct rpc_pipe_client *rpcp_cli = NULL; PRINTER_DRIVER_CTR ctr; union { DRIVER_INFO_3 driver_3; @@ -326,7 +326,7 @@ return NULL; } - if (!(cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { + if (!(rpcp_cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { PyErr_SetString(spoolss_error, errstr); free(errstr); goto done; @@ -361,7 +361,7 @@ goto done; } - werror = rpccli_spoolss_addprinterdriver(cli, mem_ctx, level, &ctr); + werror = rpccli_spoolss_addprinterdriver(rpcp_cli, mem_ctx, level, &ctr); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -372,8 +372,8 @@ result = Py_None; done: - if (cli) - cli_shutdown(cli); + if (rpcp_cli) + cli_shutdown(rpcp_cli->cli); if (mem_ctx) talloc_destroy(mem_ctx); diff -r -u source~/python/py_spoolss_forms.c source/python/py_spoolss_forms.c --- source~/python/py_spoolss_forms.c 2005-10-17 22:44:54.000000000 -0400 +++ source/python/py_spoolss_forms.c 2006-03-03 15:34:11.000000000 -0500 @@ -67,7 +67,7 @@ return NULL; } - werror = rpccli_spoolss_addform(hnd->cli, hnd->mem_ctx, &hnd->pol, + werror = rpccli_spoolss_addform(hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, level, &form); @@ -101,7 +101,7 @@ /* Call rpc function */ werror = rpccli_spoolss_getform( - hnd->cli, hnd->mem_ctx, &hnd->pol, form_name, level, &form); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, form_name, level, &form); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -157,7 +157,7 @@ form_name = PyDict_GetItemString(info, "name"); werror = rpccli_spoolss_setform( - hnd->cli, hnd->mem_ctx, &hnd->pol, level, + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, level, PyString_AsString(form_name), &form); if (!W_ERROR_IS_OK(werror)) { @@ -187,7 +187,7 @@ /* Call rpc function */ werror = rpccli_spoolss_deleteform( - hnd->cli, hnd->mem_ctx, &hnd->pol, form_name); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, form_name); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -218,7 +218,7 @@ /* Call rpc function */ werror = rpccli_spoolss_enumforms( - hnd->cli, hnd->mem_ctx, &hnd->pol, level, &num_forms, &forms); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, level, &num_forms, &forms); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); diff -r -u source~/python/py_spoolss.h source/python/py_spoolss.h --- source~/python/py_spoolss.h 2005-10-17 22:44:54.000000000 -0400 +++ source/python/py_spoolss.h 2006-03-03 15:34:13.000000000 -0500 @@ -27,7 +27,7 @@ typedef struct { PyObject_HEAD - struct rpc_pipe_client *cli; + struct rpc_pipe_client *rpcp_cli; TALLOC_CTX *mem_ctx; POLICY_HND pol; } spoolss_policy_hnd_object; @@ -40,7 +40,7 @@ /* The following definitions come from python/py_spoolss_common.c */ -PyObject *new_spoolss_policy_hnd_object(struct cli_state *cli, +PyObject *new_spoolss_policy_hnd_object(struct rpc_pipe_client *rpcp_cli, TALLOC_CTX *mem_ctx, POLICY_HND *pol); /* The following definitions come from python/py_spoolss_drivers.c */ diff -r -u source~/python/py_spoolss_jobs.c source/python/py_spoolss_jobs.c --- source~/python/py_spoolss_jobs.c 2005-10-17 22:44:54.000000000 -0400 +++ source/python/py_spoolss_jobs.c 2006-03-03 15:34:11.000000000 -0500 @@ -40,7 +40,7 @@ /* Call rpc function */ werror = rpccli_spoolss_enumjobs( - hnd->cli, hnd->mem_ctx, &hnd->pol, level, 0, 1000, + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, level, 0, 1000, &num_jobs, &ctr); /* Return value */ @@ -100,7 +100,7 @@ /* Call rpc function */ werror = rpccli_spoolss_setjob( - hnd->cli, hnd->mem_ctx, &hnd->pol, jobid, level, command); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, jobid, level, command); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -131,7 +131,7 @@ /* Call rpc function */ werror = rpccli_spoolss_getjob( - hnd->cli, hnd->mem_ctx, &hnd->pol, jobid, level, &ctr); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, jobid, level, &ctr); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -167,7 +167,7 @@ /* Call rpc function */ werror = rpccli_spoolss_startpageprinter( - hnd->cli, hnd->mem_ctx, &hnd->pol); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -195,7 +195,7 @@ /* Call rpc function */ werror = rpccli_spoolss_endpageprinter( - hnd->cli, hnd->mem_ctx, &hnd->pol); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -287,7 +287,7 @@ /* Call rpc function */ werror = rpccli_spoolss_startdocprinter( - hnd->cli, hnd->mem_ctx, &hnd->pol, document_name, + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, document_name, output_file, data_type, &jobid); if (!W_ERROR_IS_OK(werror)) { @@ -319,7 +319,7 @@ /* Call rpc function */ werror = rpccli_spoolss_enddocprinter( - hnd->cli, hnd->mem_ctx, &hnd->pol); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -349,7 +349,7 @@ /* Call rpc function */ werror = rpccli_spoolss_writeprinter( - hnd->cli, hnd->mem_ctx, &hnd->pol, PyString_Size(data), + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, PyString_Size(data), PyString_AsString(data), &num_written); if (!W_ERROR_IS_OK(werror)) { diff -r -u source~/python/py_spoolss_ports.c source/python/py_spoolss_ports.c --- source~/python/py_spoolss_ports.c 2005-10-17 22:44:54.000000000 -0400 +++ source/python/py_spoolss_ports.c 2006-03-03 15:34:11.000000000 -0500 @@ -30,7 +30,7 @@ uint32 i, needed, num_ports; static char *kwlist[] = {"server", "level", "creds", NULL}; TALLOC_CTX *mem_ctx = NULL; - struct cli_state *cli = NULL; + struct rpc_pipe_client *rpcp_cli = NULL; char *server, *errstr; PORT_INFO_CTR ctr; @@ -53,7 +53,7 @@ return NULL; } - if (!(cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { + if (!(rpcp_cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { PyErr_SetString(spoolss_error, errstr); free(errstr); goto done; @@ -68,7 +68,7 @@ /* Call rpc function */ werror = rpccli_spoolss_enum_ports( - cli, mem_ctx, level, &num_ports, &ctr); + rpcp_cli, mem_ctx, level, &num_ports, &ctr); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -122,8 +122,8 @@ } done: - if (cli) - cli_shutdown(cli); + if (rpcp_cli) + cli_shutdown(rpcp_cli->cli); if (mem_ctx) talloc_destroy(mem_ctx); diff -r -u source~/python/py_spoolss_printerdata.c source/python/py_spoolss_printerdata.c --- source~/python/py_spoolss_printerdata.c 2005-10-17 22:44:54.000000000 -0400 +++ source/python/py_spoolss_printerdata.c 2006-03-03 15:34:11.000000000 -0500 @@ -123,7 +123,7 @@ /* Call rpc function */ werror = rpccli_spoolss_getprinterdata( - hnd->cli, hnd->mem_ctx, &hnd->pol, valuename, + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, valuename, &value); if (!W_ERROR_IS_OK(werror)) { @@ -161,7 +161,7 @@ /* Call rpc function */ werror = rpccli_spoolss_setprinterdata( - hnd->cli, hnd->mem_ctx, &hnd->pol, &value); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, &value); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -187,7 +187,7 @@ /* Get max buffer sizes for value and data */ werror = rpccli_spoolss_enumprinterdata( - hnd->cli, hnd->mem_ctx, &hnd->pol, ndx, 0, 0, + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, ndx, 0, 0, &value_needed, &data_needed, NULL); if (!W_ERROR_IS_OK(werror)) { @@ -203,7 +203,7 @@ PyObject *obj; werror = rpccli_spoolss_enumprinterdata( - hnd->cli, hnd->mem_ctx, &hnd->pol, ndx, + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, ndx, value_needed, data_needed, NULL, NULL, &value); if (py_from_printerdata( @@ -232,7 +232,7 @@ /* Call rpc function */ werror = rpccli_spoolss_deleteprinterdata( - hnd->cli, hnd->mem_ctx, &hnd->pol, value); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, value); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -260,7 +260,7 @@ /* Call rpc function */ werror = rpccli_spoolss_getprinterdataex( - hnd->cli, hnd->mem_ctx, &hnd->pol, key, + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, key, valuename, &value); if (!W_ERROR_IS_OK(werror)) { @@ -296,7 +296,7 @@ /* Call rpc function */ werror = rpccli_spoolss_setprinterdataex( - hnd->cli, hnd->mem_ctx, &hnd->pol, keyname, &value); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, keyname, &value); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -315,15 +315,20 @@ char *key; WERROR werror; PyObject *result; - REGVAL_CTR ctr; + REGVAL_CTR *ctr; if (!PyArg_ParseTupleAndKeywords(args, kw, "s", kwlist, &key)) return NULL; + if (!(ctr = TALLOC_ZERO_P( hnd->mem_ctx, REGVAL_CTR))) { + PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); + return NULL; + } + /* Get max buffer sizes for value and data */ werror = rpccli_spoolss_enumprinterdataex( - hnd->cli, hnd->mem_ctx, &hnd->pol, key, &ctr); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, key, ctr); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -334,12 +339,12 @@ result = PyDict_New(); - for (i = 0; i < regval_ctr_numvals(&ctr); i++) { + for (i = 0; i < regval_ctr_numvals(ctr); i++) { REGISTRY_VALUE *value; PyObject *item; item = PyDict_New(); - value = regval_ctr_specific_value(&ctr, i); + value = regval_ctr_specific_value(ctr, i); if (py_from_printerdata( &item, key, value->valuename, value->type, @@ -365,7 +370,7 @@ /* Call rpc function */ werror = rpccli_spoolss_deleteprinterdataex( - hnd->cli, hnd->mem_ctx, &hnd->pol, key, value); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, key, value); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -395,7 +400,7 @@ /* Call rpc function */ werror = rpccli_spoolss_enumprinterkey( - hnd->cli, hnd->mem_ctx, &hnd->pol, keyname, &keylist, + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, keyname, &keylist, &keylist_len); if (!W_ERROR_IS_OK(werror)) { diff -r -u source~/python/py_spoolss_printers.c source/python/py_spoolss_printers.c --- source~/python/py_spoolss_printers.c 2005-10-17 22:44:54.000000000 -0400 +++ source/python/py_spoolss_printers.c 2006-03-03 15:34:11.000000000 -0500 @@ -31,7 +31,7 @@ PyObject *result = NULL, *creds = NULL; static char *kwlist[] = { "printername", "creds", "access", NULL }; uint32 desired_access = MAXIMUM_ALLOWED_ACCESS; - struct cli_state *cli; + struct rpc_pipe_client *rpcp_cli; if (!PyArg_ParseTupleAndKeywords( args, kw, "s|Oi", kwlist, &unc_name, &creds, @@ -56,7 +56,7 @@ return NULL; } - if (!(cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { + if (!(rpcp_cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { PyErr_SetString(spoolss_error, errstr); free(errstr); goto done; @@ -69,7 +69,7 @@ } werror = rpccli_spoolss_open_printer_ex( - cli, mem_ctx, unc_name, "", desired_access, server, + rpcp_cli, mem_ctx, unc_name, "", desired_access, server, "", &hnd); if (!W_ERROR_IS_OK(werror)) { @@ -77,12 +77,12 @@ goto done; } - result = new_spoolss_policy_hnd_object(cli, mem_ctx, &hnd); + result = new_spoolss_policy_hnd_object(rpcp_cli, mem_ctx, &hnd); done: if (!result) { - if (cli) - cli_shutdown(cli); + if (rpcp_cli) + cli_shutdown(rpcp_cli->cli); if (mem_ctx) talloc_destroy(mem_ctx); @@ -111,7 +111,7 @@ /* Call rpc function */ result = rpccli_spoolss_close_printer( - hnd->cli, hnd->mem_ctx, &hnd->pol); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol); /* Return value */ @@ -140,7 +140,7 @@ /* Call rpc function */ werror = rpccli_spoolss_getprinter( - hnd->cli, hnd->mem_ctx, &hnd->pol, level, &ctr); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, level, &ctr); /* Return value */ @@ -251,7 +251,7 @@ /* Call rpc function */ werror = rpccli_spoolss_setprinter( - hnd->cli, hnd->mem_ctx, &hnd->pol, level, &ctr, 0); + hnd->rpcp_cli, hnd->mem_ctx, &hnd->pol, level, &ctr, 0); /* Return value */ @@ -276,7 +276,7 @@ static char *kwlist[] = {"server", "name", "level", "flags", "creds", NULL}; TALLOC_CTX *mem_ctx = NULL; - struct cli_state *cli = NULL; + struct rpc_pipe_client *rpcp_cli = NULL; char *server, *errstr, *name = NULL; /* Parse parameters */ @@ -299,7 +299,7 @@ return NULL; } - if (!(cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { + if (!(rpcp_cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { PyErr_SetString(spoolss_error, errstr); free(errstr); goto done; @@ -327,7 +327,7 @@ /* Call rpc function */ werror = rpccli_spoolss_enum_printers( - cli, mem_ctx, name, flags, level, &num_printers, &ctr); + rpcp_cli, mem_ctx, name, flags, level, &num_printers, &ctr); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -400,8 +400,8 @@ } done: - if (cli) - cli_shutdown(cli); + if (rpcp_cli) + cli_shutdown(rpcp_cli->cli); if (mem_ctx) talloc_destroy(mem_ctx); @@ -417,7 +417,7 @@ NULL}; char *printername, *server, *errstr; PyObject *info, *result = NULL, *creds = NULL; - struct cli_state *cli = NULL; + struct rpc_pipe_client *rpcp_cli = NULL; TALLOC_CTX *mem_ctx = NULL; PRINTER_INFO_CTR ctr; PRINTER_INFO_2 info2; @@ -428,7 +428,7 @@ &PyDict_Type, &info, &PyDict_Type, &creds)) return NULL; - if (!(cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { + if (!(rpcp_cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) { PyErr_SetString(spoolss_error, errstr); free(errstr); goto done; @@ -448,14 +448,14 @@ ctr.printers_2 = &info2; - werror = rpccli_spoolss_addprinterex(cli, mem_ctx, 2, &ctr); + werror = rpccli_spoolss_addprinterex(rpcp_cli, mem_ctx, 2, &ctr); Py_INCREF(Py_None); result = Py_None; done: - if (cli) - cli_shutdown(cli); + if (rpcp_cli) + cli_shutdown(rpcp_cli->cli); if (mem_ctx) talloc_destroy(mem_ctx); diff -r -u source~/python/py_srvsvc.c source/python/py_srvsvc.c --- source~/python/py_srvsvc.c 2005-10-17 22:44:54.000000000 -0400 +++ source/python/py_srvsvc.c 2006-03-03 15:34:11.000000000 -0500 @@ -78,7 +78,7 @@ static char *kwlist[] = { "server", "level", "creds", NULL }; char *unc_name, *server, *errstr; PyObject *creds = NULL, *result = NULL; - struct cli_state *cli; + struct rpc_pipe_client *rpcp_cli; TALLOC_CTX *mem_ctx = NULL; uint32 level; SRV_INFO_CTR ctr; @@ -106,7 +106,7 @@ return NULL; } - if (!(cli = open_pipe_creds(server, creds, PI_SRVSVC, &errstr))) { + if (!(rpcp_cli = open_pipe_creds(server, creds, PI_SRVSVC, &errstr))) { PyErr_SetString(srvsvc_error, errstr); free(errstr); goto done; @@ -120,7 +120,7 @@ ZERO_STRUCT(ctr); - status = rpccli_srvsvc_net_srv_get_info(cli, mem_ctx, level, &ctr); + status = rpccli_srvsvc_net_srv_get_info(rpcp_cli, mem_ctx, level, &ctr); if (!NT_STATUS_IS_OK(status)) { PyErr_SetObject(srvsvc_error, py_werror_tuple(status)); diff -r -u source~/rpcclient/cmd_reg.c source/rpcclient/cmd_reg.c --- source~/rpcclient/cmd_reg.c 2005-04-18 12:38:14.000000000 -0400 +++ source/rpcclient/cmd_reg.c 2006-03-03 15:59:07.000000000 -0500 @@ -225,6 +225,8 @@ BOOL res = True; BOOL res1 = True; + struct rpc_pipe_client *rpcp_cli = NULL; + NTSTATUS perr; POLICY_HND key_pol; fstring full_keyname; fstring key_name; @@ -252,8 +254,8 @@ return; } - /* open WINREG session. */ - res = res ? cli_nt_session_open(smb_cli, PI_WINREG) : False; + /* open WINREG rpc pipe */ + res = res ? ((rpcp_cli=cli_rpc_pipe_open_noauth(smb_cli, PI_WINREG, &perr))!=NULL) : False; /* open registry receive a policy handle */ res = res ? do_reg_connect(smb_cli, full_keyname, key_name, @@ -304,8 +306,8 @@ } res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False; - /* close the session */ - cli_nt_session_close(smb_cli); + /* close the open named pipe */ + cli_rpc_pipe_close(rpcp_cli); if (res && res1) { @@ -326,6 +328,8 @@ BOOL res3 = True; BOOL res4 = True; + struct rpc_pipe_client *rpcp_cli = NULL; + NTSTATUS perr; POLICY_HND parent_pol; fstring full_keyname; fstring keyname; @@ -415,8 +419,8 @@ DEBUG(10,("key data:\n")); dump_data(10, (char *)value.buffer, value.buf_len); - /* open WINREG session. */ - res = res ? cli_nt_session_open(smb_cli, PI_WINREG) : False; + /* open WINREG rpc client pipe */ + res = res ? ((rpcp_cli=cli_rpc_pipe_open_noauth(smb_cli, PI_WINREG, &perr))!=NULL) : False; /* open registry receive a policy handle */ res = res ? do_reg_connect(smb_cli, keyname, parent_name, @@ -449,8 +453,8 @@ /* close the registry handles */ res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False; - /* close the session */ - cli_nt_session_close(smb_cli); + /* close the open named pipe */ + cli_rpc_pipe_close(rpcp_cli); if (res && res3 && res4) { @@ -472,6 +476,8 @@ BOOL res3 = True; BOOL res4 = True; + struct rpc_pipe_client *rpcp_cli = NULL; + NTSTATUS perr; POLICY_HND parent_pol; fstring full_keyname; fstring keyname; @@ -494,8 +500,8 @@ return; } - /* open WINREG session. */ - res = res ? cli_nt_session_open(smb_cli, PI_WINREG) : False; + /* open WINREG rpc client pipe */ + res = res ? ((rpcp_cli=cli_rpc_pipe_open_noauth(smb_cli, PI_WINREG, &perr))!=NULL) : False; /* open registry receive a policy handle */ res = res ? do_reg_connect(smb_cli, keyname, parent_name, @@ -524,8 +530,8 @@ /* close the registry handles */ res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False; - /* close the session */ - cli_nt_session_close(smb_cli); + /* close the open named pipe */ + cli_rpc_pipe_close(rpcp_cli); if (res && res3 && res4) { @@ -547,6 +553,8 @@ BOOL res3 = True; BOOL res4 = True; + struct rpc_pipe_client *rpcp_cli = NULL; + NTSTATUS perr; POLICY_HND parent_pol; fstring full_keyname; fstring parent_name; @@ -569,8 +577,8 @@ return; } - /* open WINREG session. */ - res = res ? cli_nt_session_open(smb_cli, PI_WINREG) : False; + /* open WINREG rpc client pipe */ + res = res ? ((rpcp_cli=cli_rpc_pipe_open_noauth(smb_cli, PI_WINREG, &perr))!=NULL) : False; /* open registry receive a policy handle */ res = res ? do_reg_connect(smb_cli, parent_name, key_name, @@ -602,8 +610,8 @@ /* close the registry handles */ res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False; - /* close the session */ - cli_nt_session_close(smb_cli); + /* close the open named pipe */ + cli_rpc_pipe_close(rpcp_cli); if (res && res3 && res4) { @@ -625,6 +633,8 @@ BOOL res3 = True; BOOL res4 = True; + struct rpc_pipe_client *rpcp_cli = NULL; + NTSTATUS perr; POLICY_HND parent_pol; POLICY_HND key_pol; fstring full_keyname; @@ -658,8 +668,8 @@ /* set access permissions */ sam_access.mask = SEC_RIGHTS_READ; - /* open WINREG session. */ - res = res ? cli_nt_session_open(smb_cli, PI_WINREG) : False; + /* open WINREG rpc client pipe */ + res = res ? ((rpcp_cli=cli_rpc_pipe_open_noauth(smb_cli, PI_WINREG, &perr))!=NULL) : False; /* open registry receive a policy handle */ res = res ? do_reg_connect(smb_cli, parent_key, parent_name, @@ -695,8 +705,8 @@ /* close the registry handles */ res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False; - /* close the session */ - cli_nt_session_close(smb_cli); + /* close the open named pipe */ + cli_rpc_pipe_close(rpcp_cli); if (res && res3 && res4) { @@ -718,6 +728,8 @@ BOOL res3 = True; BOOL res4 = True; + struct rpc_pipe_client *rpcp_cli = NULL; + NTSTATUS perr; POLICY_HND key_pol; fstring full_keyname; fstring key_name; @@ -737,8 +749,8 @@ return; } - /* open WINREG session. */ - res = res ? cli_nt_session_open(smb_cli, PI_WINREG) : False; + /* open WINREG rpc client pipe */ + res = res ? ((rpcp_cli=cli_rpc_pipe_open_noauth(smb_cli, PI_WINREG, &perr))!=NULL) : False; /* open registry receive a policy handle */ res = res ? do_reg_connect(smb_cli, full_keyname, key_name, @@ -790,8 +802,8 @@ /* close the registry handles */ res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False; - /* close the session */ - cli_nt_session_close(smb_cli); + /* close the open named pipe */ + cli_rpc_pipe_close(rpcp_cli); if (res && res3 && res4) { @@ -813,6 +825,8 @@ BOOL res3 = True; BOOL res4 = True; + struct rpc_pipe_client *rpcp_cli = NULL; + NTSTATUS perr; POLICY_HND key_pol; fstring full_keyname; fstring key_name; @@ -832,8 +846,8 @@ return; } - /* open WINREG session. */ - res = res ? cli_nt_session_open(smb_cli, PI_WINREG) : False; + /* open WINREG rpc client pipe */ + res = res ? ((rpcp_cli=cli_rpc_pipe_open_noauth(smb_cli, PI_WINREG, &perr))!=NULL) : False; /* open registry receive a policy handle */ res = res ? do_reg_connect(smb_cli, full_keyname, key_name, @@ -882,8 +896,8 @@ /* close the registry handles */ res = res ? do_reg_close(smb_cli, &info->dom.reg_pol_connect) : False; - /* close the session */ - cli_nt_session_close(smb_cli); + /* close the open named pipe */ + cli_rpc_pipe_close(rpcp_cli); if (res && res3 && res4) {