diff options
author | Gerald Carter <jerry@samba.org> | 2005-09-01 14:00:53 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:03:27 -0500 |
commit | 790a29253c950711c8f822b43c3112fe8045e952 (patch) | |
tree | a4098c0cbea14cc6573f9712f895457d31a5efbe | |
parent | be36d74ec2bbceb4bae848917ec90e8133a905c8 (diff) | |
download | samba-790a29253c950711c8f822b43c3112fe8045e952.tar.gz samba-790a29253c950711c8f822b43c3112fe8045e952.tar.bz2 samba-790a29253c950711c8f822b43c3112fe8045e952.zip |
r9894: Add new registry key expected by Windows XP clients.
HKLM\\SYSTEM\\CurrentControlSet\\Control\\Termininal Server\\DefaultUserConfiguration
Apparently this started showing up after the winreg-write support
was added in 3.0.20rc1 or so.
Also modifed init_registry_data() to always run and add the
required keys. Initial values however are only written if
they don't already exist.
This makes it easier to add new keys without having to rev the
tdb version number (which is really unnecessary in this case).
Portions of patch reviewed by Thomas Bork on the general samba ml.
(This used to be commit b12a05b23782cfcb93fb4811807ef388de97c95c)
-rw-r--r-- | source3/registry/reg_db.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c index 19f9abd80d..c67d18c19d 100644 --- a/source3/registry/reg_db.c +++ b/source3/registry/reg_db.c @@ -49,6 +49,7 @@ static const char *builtin_registry_paths[] = { "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009", "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors", "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions", + "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Termininal Server\\DefaultUserConfiguration", "HKLM\\SYSTEM\\CurrentControlSet\\Services\\TcpIp\\Parameters", "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters", "HKU", @@ -163,7 +164,12 @@ static BOOL init_registry_data( void ) } regdb_fetch_values( builtin_registry_values[i].path, values ); - switch( builtin_registry_values[i].type ) { + + /* preserve existing values across restarts. Only add new ones */ + + if ( !regval_ctr_key_exists( values, builtin_registry_values[i].valuename ) ) + { + switch( builtin_registry_values[i].type ) { case REG_DWORD: regval_ctr_addvalue( values, builtin_registry_values[i].valuename, @@ -184,8 +190,9 @@ static BOOL init_registry_data( void ) default: DEBUG(0,("init_registry_data: invalid value type in builtin_registry_values [%d]\n", builtin_registry_values[i].type)); + } + regdb_store_values( builtin_registry_values[i].path, values ); } - regdb_store_values( builtin_registry_values[i].path, values ); TALLOC_FREE( values ); } @@ -205,8 +212,6 @@ BOOL init_registry_db( void ) if ( tdb_reg ) return True; - /* placeholder tdb; reinit upon startup */ - if ( !(tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) ) { tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); @@ -223,13 +228,14 @@ BOOL init_registry_db( void ) vers_id = tdb_fetch_int32(tdb_reg, vstring); if ( vers_id != REGVER_V1 ) { + /* any upgrade code here if needed */ + } - /* create the registry here */ + /* always setup the necessary keys and values */ - if ( !init_registry_data() ) { - DEBUG(0,("init_registry: Failed to initiailize data in registry!\n")); - return False; - } + if ( !init_registry_data() ) { + DEBUG(0,("init_registry: Failed to initiailize data in registry!\n")); + return False; } return True; |