summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-01-17 01:47:00 +0100
committerMichael Adam <obnox@samba.org>2008-01-17 16:25:11 +0100
commit00f3df3c131ac6054e1a8d0565cd87ab8a49265b (patch)
treed7ab57973329ad7c4281f8be5dd073da98b011e5 /source3/rpc_server
parentb6eaf05479fb757da5e8a717c02a6f6c44c42ab5 (diff)
downloadsamba-00f3df3c131ac6054e1a8d0565cd87ab8a49265b.tar.gz
samba-00f3df3c131ac6054e1a8d0565cd87ab8a49265b.tar.bz2
samba-00f3df3c131ac6054e1a8d0565cd87ab8a49265b.zip
Convert sync_eventlog_params() to use reg_api instead of reg_frontend.
This is a step towards untangling the registry. All places should use reg_api.c, reg_frontend should actually more appropriately be named reg_backend_dispatcher and hidden from callers. :-) Michael (This used to be commit 92e95fe58500dc8bf89bb43c1d65559702363767)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_eventlog_nt.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/source3/rpc_server/srv_eventlog_nt.c b/source3/rpc_server/srv_eventlog_nt.c
index 3c9c835bad..0ea34e54ad 100644
--- a/source3/rpc_server/srv_eventlog_nt.c
+++ b/source3/rpc_server/srv_eventlog_nt.c
@@ -423,12 +423,12 @@ static bool sync_eventlog_params( EVENTLOG_INFO *info )
char *path = NULL;
uint32 uiMaxSize;
uint32 uiRetention;
- REGISTRY_KEY *keyinfo;
- REGISTRY_VALUE *val;
- REGVAL_CTR *values;
+ struct registry_key *key;
+ struct registry_value *value;
WERROR wresult;
char *elogname = info->logname;
TALLOC_CTX *ctx = talloc_tos();
+ bool ret = false;
DEBUG( 4, ( "sync_eventlog_params with %s\n", elogname ) );
@@ -451,36 +451,42 @@ static bool sync_eventlog_params( EVENTLOG_INFO *info )
return false;
}
- wresult = regkey_open_internal( NULL, &keyinfo, path,
- get_root_nt_token( ), REG_KEY_READ );
+ wresult = reg_open_path(ctx, path, REG_KEY_READ, get_root_nt_token(),
+ &key);
if ( !W_ERROR_IS_OK( wresult ) ) {
DEBUG( 4,
( "sync_eventlog_params: Failed to open key [%s] (%s)\n",
path, dos_errstr( wresult ) ) );
- return False;
+ return false;
}
- if ( !( values = TALLOC_ZERO_P( keyinfo, REGVAL_CTR ) ) ) {
- TALLOC_FREE( keyinfo );
- DEBUG( 0, ( "control_eventlog_hook: talloc() failed!\n" ) );
-
- return False;
+ wresult = reg_queryvalue(key, key, "Retention", &value);
+ if (!W_ERROR_IS_OK(wresult)) {
+ DEBUG(4, ("Failed to query value \"Retention\": %s\n",
+ dos_errstr(wresult)));
+ ret = false;
+ goto done;
}
- fetch_reg_values( keyinfo, values );
-
- if ( ( val = regval_ctr_getvalue( values, "Retention" ) ) != NULL )
- uiRetention = IVAL( regval_data_p( val ), 0 );
+ uiRetention = value->v.dword;
- if ( ( val = regval_ctr_getvalue( values, "MaxSize" ) ) != NULL )
- uiMaxSize = IVAL( regval_data_p( val ), 0 );
-
- TALLOC_FREE( keyinfo );
+ wresult = reg_queryvalue(key, key, "MaxSize", &value);
+ if (!W_ERROR_IS_OK(wresult)) {
+ DEBUG(4, ("Failed to query value \"MaxSize\": %s\n",
+ dos_errstr(wresult)));
+ ret = false;
+ goto done;
+ }
+ uiMaxSize = value->v.dword;
tdb_store_int32( ELOG_TDB_CTX(info->etdb), EVT_MAXSIZE, uiMaxSize );
tdb_store_int32( ELOG_TDB_CTX(info->etdb), EVT_RETENTION, uiRetention );
- return True;
+ ret = true;
+
+done:
+ TALLOC_FREE(ctx);
+ return true;
}
/********************************************************************