2 * Unix SMB/CIFS implementation.
3 * Virtual Windows Registry Layer
4 * Copyright (C) Gerald Carter 2002-2005
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 /* Implementation of registry frontend view functions. */
26 #define DBGC_CLASS DBGC_RPC_SRV
28 struct reg_dyn_values {
30 int (*fetch_values) ( REGVAL_CTR *val );
33 /***********************************************************************
34 ***********************************************************************/
36 static int netlogon_params( REGVAL_CTR *regvals )
40 if ( !account_policy_get(AP_REFUSE_MACHINE_PW_CHANGE, &dwValue) )
43 regval_ctr_addvalue( regvals, "RefusePasswordChange", REG_DWORD,
44 (char*)&dwValue, sizeof(dwValue) );
46 return regval_ctr_numvals( regvals );
49 /***********************************************************************
50 ***********************************************************************/
52 static int prod_options( REGVAL_CTR *regvals )
54 const char *value_ascii = "";
58 switch (lp_server_role()) {
61 value_ascii = "LanmanNT";
64 value_ascii = "ServerNT";
66 case ROLE_DOMAIN_MEMBER:
67 value_ascii = "WinNT";
71 value_length = push_ucs2( value, value, value_ascii, sizeof(value),
72 STR_TERMINATE|STR_NOALIGN );
73 regval_ctr_addvalue( regvals, "ProductType", REG_SZ, value,
76 return regval_ctr_numvals( regvals );
79 /***********************************************************************
80 ***********************************************************************/
82 static int tcpip_params( REGVAL_CTR *regvals )
91 value_length = push_ucs2( value, value, hname, sizeof(value), STR_TERMINATE|STR_NOALIGN);
92 regval_ctr_addvalue( regvals, "Hostname",REG_SZ, value, value_length );
94 get_mydnsdomname( mydomainname );
95 value_length = push_ucs2( value, value, mydomainname, sizeof(value), STR_TERMINATE|STR_NOALIGN);
96 regval_ctr_addvalue( regvals, "Domain", REG_SZ, value, value_length );
98 return regval_ctr_numvals( regvals );
102 /***********************************************************************
103 Structure holding the registry paths and pointers to the value
104 enumeration functions
105 ***********************************************************************/
107 static struct reg_dyn_values dynamic_values[] = {
108 { "HKLM/SYSTEM/CURRENTCONTROLSET/SERVICES/NETLOGON/PARAMETERS", &netlogon_params },
109 { "HKLM/SYSTEM/CURRENTCONTROLSET/CONTROL/PRODUCTOPTIONS", &prod_options },
110 { "HKLM/SYSTEM/CURRENTCONTROLSET/SERVICES/TCPIP/PARAMETERS", &tcpip_params },
114 /***********************************************************************
115 ***********************************************************************/
117 int fetch_dynamic_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val )
122 pstrcpy( path, key->name );
123 normalize_reg_path( path );
125 for ( i=0; dynamic_values[i].path; i++ ) {
126 if ( strcmp( path, dynamic_values[i].path ) == 0 )
127 return dynamic_values[i].fetch_values( val );
133 /***********************************************************************
134 ***********************************************************************/
136 BOOL check_dynamic_reg_values( REGISTRY_KEY *key )
141 pstrcpy( path, key->name );
142 normalize_reg_path( path );
144 for ( i=0; dynamic_values[i].path; i++ ) {
145 /* can't write to dynamic keys */
146 if ( strcmp( path, dynamic_values[i].path ) == 0 )