summaryrefslogtreecommitdiffstats
path: root/source3
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2002-07-26 22:40:06 +0000
committerGerald Carter <jerry@samba.org>2002-07-26 22:40:06 +0000
commita23e96316ebf5086a27365d4a9fb63b0e4533f6f (patch)
tree551cc677dcedd058402fab2c8eab77980edc6cb9 /source3
parentdbedccc75a0b651c803cb3e4ced375e02377112c (diff)
downloadsamba-a23e96316ebf5086a27365d4a9fb63b0e4533f6f.tar.gz
samba-a23e96316ebf5086a27365d4a9fb63b0e4533f6f.tar.xz
samba-a23e96316ebf5086a27365d4a9fb63b0e4533f6f.zip
3 things:
* normalize all registry key strings before storing or looking up paths in the registry tdb * return the current buffer size for REG_INFO even when not returning actual data * fix a segfault report by metze on #samba-technical so that the user/group object picker works again (was the "ProductType" key lookup that was failing). (This used to be commit 5640e6cdb213502d95fff33e06eaeed5ce3aeb76)
Diffstat (limited to 'source3')
-rw-r--r--source3/registry/reg_db.c6
-rw-r--r--source3/rpc_parse/parse_reg.c8
-rw-r--r--source3/rpc_server/srv_reg_nt.c15
3 files changed, 22 insertions, 7 deletions
diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c
index 74012263e5..b4c8f60ccf 100644
--- a/source3/registry/reg_db.c
+++ b/source3/registry/reg_db.c
@@ -163,7 +163,8 @@ BOOL init_registry_db( void )
fstrings
The full path to the registry key is used as database after the
- \'s are converted to /'s.
+ \'s are converted to /'s. Key string is also normalized to UPPER
+ case.
***********************************************************************/
BOOL regdb_store_reg_keys( char *keyname, REGSUBKEY_CTR *ctr )
@@ -178,6 +179,8 @@ BOOL regdb_store_reg_keys( char *keyname, REGSUBKEY_CTR *ctr )
if ( !keyname )
return False;
+ strupper_m( keyname );
+
/* allocate some initial memory */
buffer = malloc(sizeof(pstring));
@@ -245,6 +248,7 @@ int regdb_fetch_reg_keys( char* key, REGSUBKEY_CTR *ctr )
/* convert to key format */
pstring_sub( path, "\\", "/" );
+ strupper_m( path );
dbuf = tdb_fetch_by_string( tdb_reg, path );
diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c
index 83b55863eb..925d8b856e 100644
--- a/source3/rpc_parse/parse_reg.c
+++ b/source3/rpc_parse/parse_reg.c
@@ -1118,7 +1118,8 @@ BOOL new_init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r,
REGISTRY_VALUE *val, NTSTATUS status)
{
uint32 buf_len = 0;
-
+ BUFFER2 buf2;
+
if(r_r == NULL)
return False;
@@ -1136,6 +1137,11 @@ BOOL new_init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r,
buf_len = reg_init_buffer2( &r_r->uni_val, val );
}
+ else {
+ /* dummy buffer used so we can get the size */
+ r_r->ptr_uni_val = 0;
+ buf_len = reg_init_buffer2( &buf2, val );
+ }
r_r->ptr_max_len = 1;
r_r->buf_max_len = buf_len;
diff --git a/source3/rpc_server/srv_reg_nt.c b/source3/rpc_server/srv_reg_nt.c
index 2154b5a38a..7ebf940588 100644
--- a/source3/rpc_server/srv_reg_nt.c
+++ b/source3/rpc_server/srv_reg_nt.c
@@ -29,6 +29,11 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
+#define REGSTR_PRODUCTTYPE "ProductType"
+#define REG_PT_WINNT "WinNT"
+#define REG_PT_LANMANNT "LanmanNT"
+#define REG_PT_SERVERNT "ServerNT"
+
#define OUR_HANDLE(hnd) (((hnd)==NULL)?"NULL":(IVAL((hnd)->data5,4)==(uint32)sys_getpid()?"OURS":"OTHER")), \
((unsigned int)IVAL((hnd)->data5,4)),((unsigned int)sys_getpid())
@@ -367,7 +372,7 @@ NTSTATUS _reg_info(pipes_struct *p, REG_Q_INFO *q_u, REG_R_INFO *r_u)
goto out;
}
- if ( strequal(name, "ProductType") ) {
+ if ( strequal(name, REGSTR_PRODUCTTYPE) ) {
/* This makes the server look like a member server to clients */
/* which tells clients that we have our own local user and */
/* group databases and helps with ACL support. */
@@ -375,17 +380,17 @@ NTSTATUS _reg_info(pipes_struct *p, REG_Q_INFO *q_u, REG_R_INFO *r_u)
switch (lp_server_role()) {
case ROLE_DOMAIN_PDC:
case ROLE_DOMAIN_BDC:
- regval_ctr_addvalue( &regvals, "ProductType", REG_SZ, "LanmanNT", strlen("LanmanNT")+1 );
+ regval_ctr_addvalue( &regvals, REGSTR_PRODUCTTYPE, REG_SZ, REG_PT_LANMANNT, strlen(REG_PT_LANMANNT)+1 );
break;
case ROLE_STANDALONE:
- regval_ctr_addvalue( &regvals, "ProductType", REG_SZ, "ServerNT", strlen("ServerNT")+1 );
+ regval_ctr_addvalue( &regvals, REGSTR_PRODUCTTYPE, REG_SZ, REG_PT_SERVERNT, strlen(REG_PT_SERVERNT)+1 );
break;
case ROLE_DOMAIN_MEMBER:
- regval_ctr_addvalue( &regvals, "ProductType", REG_SZ, "WinNT", strlen("WinNT")+1 );
+ regval_ctr_addvalue( &regvals, REGSTR_PRODUCTTYPE, REG_SZ, REG_PT_WINNT, strlen(REG_PT_WINNT)+1 );
break;
}
- val = regval_ctr_specific_value( &regvals, 0 );
+ val = dup_registry_value( regval_ctr_specific_value( &regvals, 0 ) );
status = NT_STATUS_OK;