mirror of
https://github.com/samba-team/samba.git
synced 2025-02-28 01:58:17 +03:00
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)
This commit is contained in:
parent
dbedccc75a
commit
a23e96316e
@ -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 );
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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( ®vals, "ProductType", REG_SZ, "LanmanNT", strlen("LanmanNT")+1 );
|
||||
regval_ctr_addvalue( ®vals, REGSTR_PRODUCTTYPE, REG_SZ, REG_PT_LANMANNT, strlen(REG_PT_LANMANNT)+1 );
|
||||
break;
|
||||
case ROLE_STANDALONE:
|
||||
regval_ctr_addvalue( ®vals, "ProductType", REG_SZ, "ServerNT", strlen("ServerNT")+1 );
|
||||
regval_ctr_addvalue( ®vals, REGSTR_PRODUCTTYPE, REG_SZ, REG_PT_SERVERNT, strlen(REG_PT_SERVERNT)+1 );
|
||||
break;
|
||||
case ROLE_DOMAIN_MEMBER:
|
||||
regval_ctr_addvalue( ®vals, "ProductType", REG_SZ, "WinNT", strlen("WinNT")+1 );
|
||||
regval_ctr_addvalue( ®vals, REGSTR_PRODUCTTYPE, REG_SZ, REG_PT_WINNT, strlen(REG_PT_WINNT)+1 );
|
||||
break;
|
||||
}
|
||||
|
||||
val = regval_ctr_specific_value( ®vals, 0 );
|
||||
val = dup_registry_value( regval_ctr_specific_value( ®vals, 0 ) );
|
||||
|
||||
status = NT_STATUS_OK;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user