svn commit: samba r9147 - in
branches/SOC/SAMBA_3_0/source/libmsrpc: . test
skel at samba.org
skel at samba.org
Fri Aug 5 23:08:13 GMT 2005
Author: skel
Date: 2005-08-05 23:08:13 +0000 (Fri, 05 Aug 2005)
New Revision: 9147
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9147
Log:
changed cac_RegOpenKey() to call cac_RegConnect() instead of cli_reg_connect(). This is needed since cac_RegConnect() handles the housekeeping for the pipe session
Modified:
branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c
branches/SOC/SAMBA_3_0/source/libmsrpc/test/regopenkey.c
Changeset:
Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c
===================================================================
--- branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c 2005-08-05 23:01:57 UTC (rev 9146)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c 2005-08-05 23:08:13 UTC (rev 9147)
@@ -116,10 +116,12 @@
char *key_name = NULL;
uint32 reg_type = 0;
+ struct RegConnect rc;
+
if(!hnd)
return CAC_FAILURE;
- if(!hnd->_internal.ctx || !hnd->_internal.pipes[PI_WINREG]) {
+ if(!hnd->_internal.ctx) {
hnd->status = NT_STATUS_INVALID_HANDLE;
return CAC_FAILURE;
}
@@ -135,7 +137,6 @@
return CAC_FAILURE;
}
- srv->cli.pipe_idx = PI_WINREG;
key_out = talloc(mem_ctx, POLICY_HND);
if(!key_out) {
@@ -150,30 +151,31 @@
return CAC_FAILURE;
}
- parent_key = talloc(mem_ctx, POLICY_HND);
- if(!parent_key) {
- hnd->status = NT_STATUS_NO_MEMORY;
- return CAC_FAILURE;
- }
+ /*use cac_RegConnect because it handles the session setup*/
+ ZERO_STRUCT(rc);
- err = cli_reg_connect( &(srv->cli), mem_ctx, reg_type, op->in.access, parent_key);
- hnd->status = werror_to_ntstatus(err);
+ rc.in.access = op->in.access;
+ rc.in.root = reg_type;
- if(!NT_STATUS_IS_OK(hnd->status)) {
+ if(!cac_RegConnect(hnd, mem_ctx, &rc)) {
return CAC_FAILURE;
}
/**if they only specified the root key, return the key we just opened*/
if(key_name == NULL) {
- op->out.key = parent_key;
+ op->out.key = rc.out.key;
return CAC_SUCCESS;
}
+
+ parent_key = rc.out.key;
}
else {
parent_key = op->in.parent_key;
key_name = op->in.key_name;
}
+ srv->cli.pipe_idx = PI_WINREG;
+
err = cli_reg_open_entry( &(srv->cli), mem_ctx, parent_key, key_name, op->in.access, key_out);
hnd->status = werror_to_ntstatus(err);
Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/test/regopenkey.c
===================================================================
--- branches/SOC/SAMBA_3_0/source/libmsrpc/test/regopenkey.c 2005-08-05 23:01:57 UTC (rev 9146)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/test/regopenkey.c 2005-08-05 23:08:13 UTC (rev 9147)
@@ -56,19 +56,6 @@
exit(-1);
}
- struct RegConnect rc;
- ZERO_STRUCT(rc);
-
- rc.in.access = REG_KEY_ALL;
- rc.in.root = HKEY_LOCAL_MACHINE;
-
- if(!cac_RegConnect(hnd, mem_ctx, &rc)) {
- fprintf(stderr, " Could not connect to registry. %s\n", nt_errstr(hnd->status));
- goto done;
- }
-
-
-
for(i = 0; i < num_keys; i++) {
printf("trying to open key %s...\n", key_names[i]);
@@ -91,10 +78,6 @@
}
}
- if(!cac_RegClose(hnd, mem_ctx, rc.out.key)) {
- fprintf(stderr, " Could not close handle. %s\n", nt_errstr(hnd->status));
- }
-
done:
cac_FreeHandle(hnd);
More information about the samba-cvs
mailing list