The branch, master has been updated via 1bc83b9... s3-winreg: fill in some inline comments. via 5d46530... s3-winreg: remove trailing whitespace. from 71018eb... s3:auth: Fix typo in debug message.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 1bc83b984d6f074a5a7c7d3e7f6de4a2278fee4c Author: Günther Deschner <g...@samba.org> Date: Fri Dec 4 13:33:49 2009 +0100 s3-winreg: fill in some inline comments. Guenther commit 5d46530053fa7728d1d4903a3d92f238202ab0d8 Author: Günther Deschner <g...@samba.org> Date: Fri Dec 4 13:29:08 2009 +0100 s3-winreg: remove trailing whitespace. Guenther ----------------------------------------------------------------------- Summary of changes: source3/rpc_server/srv_winreg_nt.c | 128 ++++++++++++++++++++++-------------- 1 files changed, 78 insertions(+), 50 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/rpc_server/srv_winreg_nt.c b/source3/rpc_server/srv_winreg_nt.c index cf30436..dcfe2b9 100644 --- a/source3/rpc_server/srv_winreg_nt.c +++ b/source3/rpc_server/srv_winreg_nt.c @@ -1,19 +1,19 @@ -/* +/* * Unix SMB/CIFS implementation. * RPC Pipe client / server routines - * + * * Copyright (C) Gerald Carter 2002-2006. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ @@ -44,13 +44,13 @@ static struct registry_key *find_regkey_by_hnd(pipes_struct *p, } /******************************************************************* - Function for open a new registry handle and creating a handle + Function for open a new registry handle and creating a handle Note that P should be valid & hnd should already have space - - When we open a key, we store the full path to the key as + + When we open a key, we store the full path to the key as HK[LM|U]\<key>\<key>\... *******************************************************************/ - + static WERROR open_registry_key( pipes_struct *p, struct policy_handle *hnd, struct registry_key *parent, const char *subkeyname, @@ -71,36 +71,36 @@ static WERROR open_registry_key( pipes_struct *p, struct policy_handle *hnd, if ( !W_ERROR_IS_OK(result) ) { return result; } - + if ( !create_policy_hnd( p, hnd, key ) ) { - return WERR_BADFILE; + return WERR_BADFILE; } - + return WERR_OK; } /******************************************************************* - Function for open a new registry handle and creating a handle + Function for open a new registry handle and creating a handle Note that P should be valid & hnd should already have space *******************************************************************/ static bool close_registry_key(pipes_struct *p, struct policy_handle *hnd) { struct registry_key *regkey = find_regkey_by_hnd(p, hnd); - + if ( !regkey ) { DEBUG(2,("close_registry_key: Invalid handle (%s:%u:%u)\n", OUR_HANDLE(hnd))); return False; } - + close_policy_hnd(p, hnd); - + return True; } /******************************************************************** - reg_close + _winreg_CloseKey ********************************************************************/ WERROR _winreg_CloseKey(pipes_struct *p, struct winreg_CloseKey *r) @@ -108,7 +108,7 @@ WERROR _winreg_CloseKey(pipes_struct *p, struct winreg_CloseKey *r) /* close the policy handle */ if (!close_registry_key(p, r->in.handle)) - return WERR_BADFID; + return WERR_BADFID; ZERO_STRUCTP(r->out.handle); @@ -116,6 +116,7 @@ WERROR _winreg_CloseKey(pipes_struct *p, struct winreg_CloseKey *r) } /******************************************************************* + _winreg_OpenHKLM ********************************************************************/ WERROR _winreg_OpenHKLM(pipes_struct *p, struct winreg_OpenHKLM *r) @@ -124,6 +125,7 @@ WERROR _winreg_OpenHKLM(pipes_struct *p, struct winreg_OpenHKLM *r) } /******************************************************************* + _winreg_OpenHKPD ********************************************************************/ WERROR _winreg_OpenHKPD(pipes_struct *p, struct winreg_OpenHKPD *r) @@ -132,6 +134,7 @@ WERROR _winreg_OpenHKPD(pipes_struct *p, struct winreg_OpenHKPD *r) } /******************************************************************* + _winreg_OpenHKPT ********************************************************************/ WERROR _winreg_OpenHKPT(pipes_struct *p, struct winreg_OpenHKPT *r) @@ -140,6 +143,7 @@ WERROR _winreg_OpenHKPT(pipes_struct *p, struct winreg_OpenHKPT *r) } /******************************************************************* + _winreg_OpenHKCR ********************************************************************/ WERROR _winreg_OpenHKCR(pipes_struct *p, struct winreg_OpenHKCR *r) @@ -148,6 +152,7 @@ WERROR _winreg_OpenHKCR(pipes_struct *p, struct winreg_OpenHKCR *r) } /******************************************************************* + _winreg_OpenHKU ********************************************************************/ WERROR _winreg_OpenHKU(pipes_struct *p, struct winreg_OpenHKU *r) @@ -156,6 +161,7 @@ WERROR _winreg_OpenHKU(pipes_struct *p, struct winreg_OpenHKU *r) } /******************************************************************* + _winreg_OpenHKCU ********************************************************************/ WERROR _winreg_OpenHKCU(pipes_struct *p, struct winreg_OpenHKCU *r) @@ -164,6 +170,7 @@ WERROR _winreg_OpenHKCU(pipes_struct *p, struct winreg_OpenHKCU *r) } /******************************************************************* + _winreg_OpenHKCC ********************************************************************/ WERROR _winreg_OpenHKCC(pipes_struct *p, struct winreg_OpenHKCC *r) @@ -172,6 +179,7 @@ WERROR _winreg_OpenHKCC(pipes_struct *p, struct winreg_OpenHKCC *r) } /******************************************************************* + _winreg_OpenHKDD ********************************************************************/ WERROR _winreg_OpenHKDD(pipes_struct *p, struct winreg_OpenHKDD *r) @@ -180,6 +188,7 @@ WERROR _winreg_OpenHKDD(pipes_struct *p, struct winreg_OpenHKDD *r) } /******************************************************************* + _winreg_OpenHKPN ********************************************************************/ WERROR _winreg_OpenHKPN(pipes_struct *p, struct winreg_OpenHKPN *r) @@ -188,7 +197,7 @@ WERROR _winreg_OpenHKPN(pipes_struct *p, struct winreg_OpenHKPN *r) } /******************************************************************* - reg_reply_open_entry + _winreg_OpenKey ********************************************************************/ WERROR _winreg_OpenKey(pipes_struct *p, struct winreg_OpenKey *r) @@ -202,7 +211,7 @@ WERROR _winreg_OpenKey(pipes_struct *p, struct winreg_OpenKey *r) } /******************************************************************* - reg_reply_info + _winreg_QueryValue ********************************************************************/ WERROR _winreg_QueryValue(pipes_struct *p, struct winreg_QueryValue *r) @@ -226,12 +235,12 @@ WERROR _winreg_QueryValue(pipes_struct *p, struct winreg_QueryValue *r) } *r->out.data_length = *r->out.type = REG_NONE; - + DEBUG(7,("_reg_info: policy key name = [%s]\n", regkey->key->name)); DEBUG(7,("_reg_info: policy key type = [%08x]\n", regkey->key->type)); - + /* Handle QueryValue calls on HKEY_PERFORMANCE_DATA */ - if(regkey->key->type == REG_KEY_HKPD) + if(regkey->key->type == REG_KEY_HKPD) { if (strequal(r->in.value_name->name, "Global")) { if (!prs_init(&prs_hkpd, *r->in.data_size, p->mem_ctx, MARSHALL)) @@ -317,14 +326,14 @@ WERROR _winreg_QueryValue(pipes_struct *p, struct winreg_QueryValue *r) } /***************************************************************************** - Implementation of REG_QUERY_KEY + _winreg_QueryInfoKey ****************************************************************************/ WERROR _winreg_QueryInfoKey(pipes_struct *p, struct winreg_QueryInfoKey *r) { WERROR status = WERR_OK; struct registry_key *regkey = find_regkey_by_hnd( p, r->in.handle ); - + if ( !regkey ) return WERR_BADFID; @@ -347,37 +356,37 @@ WERROR _winreg_QueryInfoKey(pipes_struct *p, struct winreg_QueryInfoKey *r) *r->out.max_valnamelen += 1; *r->out.max_valnamelen *= 2; - + return WERR_OK; } /***************************************************************************** - Implementation of REG_GETVERSION + _winreg_GetVersion ****************************************************************************/ - + WERROR _winreg_GetVersion(pipes_struct *p, struct winreg_GetVersion *r) { struct registry_key *regkey = find_regkey_by_hnd( p, r->in.handle ); - + if ( !regkey ) return WERR_BADFID; - + return reg_getversion(r->out.version); } /***************************************************************************** - Implementation of REG_ENUM_KEY + _winreg_EnumKey ****************************************************************************/ - + WERROR _winreg_EnumKey(pipes_struct *p, struct winreg_EnumKey *r) { WERROR err; struct registry_key *key = find_regkey_by_hnd( p, r->in.handle ); - + if ( !key ) - return WERR_BADFID; + return WERR_BADFID; if ( !r->in.name || !r->in.keyclass ) return WERR_INVALID_PARAM; @@ -394,7 +403,7 @@ WERROR _winreg_EnumKey(pipes_struct *p, struct winreg_EnumKey *r) } /***************************************************************************** - Implementation of REG_ENUM_VALUE + _winreg_EnumValue ****************************************************************************/ WERROR _winreg_EnumValue(pipes_struct *p, struct winreg_EnumValue *r) @@ -404,7 +413,7 @@ WERROR _winreg_EnumValue(pipes_struct *p, struct winreg_EnumValue *r) char *valname; struct registry_value *val; DATA_BLOB value_blob; - + if ( !key ) return WERR_BADFID; @@ -455,7 +464,7 @@ WERROR _winreg_EnumValue(pipes_struct *p, struct winreg_EnumValue *r) } /******************************************************************* - reg_shutdwon + _winreg_InitiateSystemShutdown ********************************************************************/ WERROR _winreg_InitiateSystemShutdown(pipes_struct *p, struct winreg_InitiateSystemShutdown *r) @@ -469,14 +478,14 @@ WERROR _winreg_InitiateSystemShutdown(pipes_struct *p, struct winreg_InitiateSys s.in.do_reboot = r->in.do_reboot; s.in.reason = 0; - /* thunk down to _winreg_InitiateSystemShutdownEx() + /* thunk down to _winreg_InitiateSystemShutdownEx() (just returns a status) */ - + return _winreg_InitiateSystemShutdownEx( p, &s ); } /******************************************************************* - reg_shutdown_ex + _winreg_InitiateSystemShutdownEx ********************************************************************/ #define SHUTDOWN_R_STRING "-r" @@ -572,7 +581,7 @@ WERROR _winreg_InitiateSystemShutdownEx(pipes_struct *p, struct winreg_InitiateS } /******************************************************************* - reg_abort_shutdwon + _winreg_AbortSystemShutdown ********************************************************************/ WERROR _winreg_AbortSystemShutdown(pipes_struct *p, struct winreg_AbortSystemShutdown *r) @@ -648,6 +657,7 @@ static int validate_reg_filename(TALLOC_CTX *ctx, char **pp_fname ) } /******************************************************************* + _winreg_RestoreKey ********************************************************************/ WERROR _winreg_RestoreKey(pipes_struct *p, struct winreg_RestoreKey *r) @@ -684,6 +694,10 @@ WERROR _winreg_RestoreKey(pipes_struct *p, struct winreg_RestoreKey *r) return reg_restorekey(regkey, fname); } +/******************************************************************* + _winreg_SaveKey + ********************************************************************/ + WERROR _winreg_SaveKey(pipes_struct *p, struct winreg_SaveKey *r) { struct registry_key *regkey = find_regkey_by_hnd( p, r->in.handle ); @@ -714,6 +728,7 @@ WERROR _winreg_SaveKey(pipes_struct *p, struct winreg_SaveKey *r) } /******************************************************************* + _winreg_SaveKeyEx ********************************************************************/ WERROR _winreg_SaveKeyEx(pipes_struct *p, struct winreg_SaveKeyEx *r) @@ -726,6 +741,7 @@ WERROR _winreg_SaveKeyEx(pipes_struct *p, struct winreg_SaveKeyEx *r) } /******************************************************************* + _winreg_CreateKey ********************************************************************/ WERROR _winreg_CreateKey( pipes_struct *p, struct winreg_CreateKey *r) @@ -755,6 +771,7 @@ WERROR _winreg_CreateKey( pipes_struct *p, struct winreg_CreateKey *r) } /******************************************************************* + _winreg_SetValue ********************************************************************/ WERROR _winreg_SetValue(pipes_struct *p, struct winreg_SetValue *r) @@ -766,10 +783,10 @@ WERROR _winreg_SetValue(pipes_struct *p, struct winreg_SetValue *r) if ( !key ) return WERR_BADFID; - DEBUG(8,("_reg_set_value: Setting value for [%s:%s]\n", + DEBUG(8,("_reg_set_value: Setting value for [%s:%s]\n", key->key->name, r->in.name.name)); - status = registry_pull_value(p->mem_ctx, &val, r->in.type, r->in.data, + status = registry_pull_value(p->mem_ctx, &val, r->in.type, r->in.data, r->in.size, r->in.size); if (!W_ERROR_IS_OK(status)) { return status; @@ -779,6 +796,7 @@ WERROR _winreg_SetValue(pipes_struct *p, struct winreg_SetValue *r) } /******************************************************************* + _winreg_DeleteKey ********************************************************************/ WERROR _winreg_DeleteKey(pipes_struct *p, struct winreg_DeleteKey *r) @@ -793,12 +811,13 @@ WERROR _winreg_DeleteKey(pipes_struct *p, struct winreg_DeleteKey *r) /******************************************************************* + _winreg_DeleteValue ********************************************************************/ WERROR _winreg_DeleteValue(pipes_struct *p, struct winreg_DeleteValue *r) { struct registry_key *key = find_regkey_by_hnd(p, r->in.handle); - + if ( !key ) return WERR_BADFID; @@ -806,6 +825,7 @@ WERROR _winreg_DeleteValue(pipes_struct *p, struct winreg_DeleteValue *r) } /******************************************************************* + _winreg_GetKeySecurity ********************************************************************/ WERROR _winreg_GetKeySecurity(pipes_struct *p, struct winreg_GetKeySecurity *r) @@ -818,9 +838,9 @@ WERROR _winreg_GetKeySecurity(pipes_struct *p, struct winreg_GetKeySecurity *r) if ( !key ) return WERR_BADFID; - + /* access checks first */ - + if ( !(key->key->access_granted & STD_RIGHT_READ_CONTROL_ACCESS) ) return WERR_ACCESS_DENIED; @@ -843,11 +863,12 @@ WERROR _winreg_GetKeySecurity(pipes_struct *p, struct winreg_GetKeySecurity *r) r->out.sd->size = len; r->out.sd->len = len; r->out.sd->data = data; - + return WERR_OK; } /******************************************************************* + _winreg_SetKeySecurity ********************************************************************/ WERROR _winreg_SetKeySecurity(pipes_struct *p, struct winreg_SetKeySecurity *r) @@ -858,9 +879,9 @@ WERROR _winreg_SetKeySecurity(pipes_struct *p, struct winreg_SetKeySecurity *r) if ( !key ) return WERR_BADFID; - + /* access checks first */ - + if ( !(key->key->access_granted & STD_RIGHT_WRITE_DAC_ACCESS) ) return WERR_ACCESS_DENIED; @@ -874,17 +895,19 @@ WERROR _winreg_SetKeySecurity(pipes_struct *p, struct winreg_SetKeySecurity *r) } /******************************************************************* + _winreg_FlushKey ********************************************************************/ WERROR _winreg_FlushKey(pipes_struct *p, struct winreg_FlushKey *r) { - /* I'm just replying OK because there's not a lot + /* I'm just replying OK because there's not a lot here I see to do i --jerry */ - + return WERR_OK; } /******************************************************************* + _winreg_UnLoadKey ********************************************************************/ WERROR _winreg_UnLoadKey(pipes_struct *p, struct winreg_UnLoadKey *r) @@ -897,6 +920,7 @@ WERROR _winreg_UnLoadKey(pipes_struct *p, struct winreg_UnLoadKey *r) } /******************************************************************* + _winreg_ReplaceKey ********************************************************************/ WERROR _winreg_ReplaceKey(pipes_struct *p, struct winreg_ReplaceKey *r) @@ -909,6 +933,7 @@ WERROR _winreg_ReplaceKey(pipes_struct *p, struct winreg_ReplaceKey *r) } /******************************************************************* + _winreg_LoadKey ********************************************************************/ WERROR _winreg_LoadKey(pipes_struct *p, struct winreg_LoadKey *r) @@ -921,6 +946,7 @@ WERROR _winreg_LoadKey(pipes_struct *p, struct winreg_LoadKey *r) } /******************************************************************* + _winreg_NotifyChangeKeyValue ********************************************************************/ WERROR _winreg_NotifyChangeKeyValue(pipes_struct *p, struct winreg_NotifyChangeKeyValue *r) @@ -933,6 +959,7 @@ WERROR _winreg_NotifyChangeKeyValue(pipes_struct *p, struct winreg_NotifyChangeK } /******************************************************************* + _winreg_QueryMultipleValues -- Samba Shared Repository